VERSION 1
TOKEN "endpoint__get_daily_verifications__v1_endpoint_read_0343" READ

NODE endpoint
SQL >

    %
        SELECT time,
        countIfMerge(success) as success,
        countIfMerge(rateLimited) as rateLimited,
        countIfMerge(usageExceeded) as usageExceeded
        FROM mv__daily_verifications


        where
            workspaceId = {{ String(workspaceId, required=True )}}
            {% if defined(apiId) %}
            and apiId ={{ String(apiId) }}
            {%end if %}
            {% if defined(keyId) %}
            and keyId ={{ String(keyId) }}
            {%end if %}
            and time > now() - INTERVAL 30 day
        GROUP BY time
