getRevenueStatisticsSummary method

Future<GetRevenueStatisticsSummaryResponse> getRevenueStatisticsSummary({
  1. required Currency currency,
  2. required Scope scope,
  3. required TimeWindow timeWindow,
  4. List<MonetizationFilter>? filters,
})

Retrieves a summary of monetization revenue for the specified time window. Returns total revenue, revenue by verification tier, total settlements, and total HTTP 402 responses served. This operation is only available for CLOUDFRONT scope. The maximum supported time window is 90 days. When no CurrencyMode filter is provided, results default to REAL. To retrieve test data, include a CurrencyMode filter with the value TEST.

May throw WAFInternalErrorException. May throw WAFInvalidOperationException. May throw WAFInvalidParameterException. May throw WAFNonexistentItemException.

Parameter currency : The currency for the revenue amounts in the response. Currently only USDC is supported.

Parameter scope : Specifies whether this is for a Amazon CloudFront distribution (CLOUDFRONT) or for a regional application (REGIONAL). AI bot monetization is only available for CLOUDFRONT scope.

Parameter timeWindow : The time range for the revenue summary query. Specify start and end timestamps.

Parameter filters : Optional filters to narrow the results. You can filter by source name, category, organization, intent, verified status, content path, web ACL ARN, or currency mode.

Implementation

Future<GetRevenueStatisticsSummaryResponse> getRevenueStatisticsSummary({
  required Currency currency,
  required Scope scope,
  required TimeWindow timeWindow,
  List<MonetizationFilter>? filters,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSWAF_20190729.GetRevenueStatisticsSummary'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Currency': currency.value,
      'Scope': scope.value,
      'TimeWindow': timeWindow,
      if (filters != null) 'Filters': filters,
    },
  );

  return GetRevenueStatisticsSummaryResponse.fromJson(jsonResponse.body);
}