affiliateAnalytics method

Future<AffiliateAnalytics> affiliateAnalytics({
  1. required Date from,
  2. required Date to,
  3. int? limit,
  4. int? offset,
})

Fetches affiliate analytics for the period from from to to, inclusive.

Requires a secret API key. limit is capped at 100 by the API; page through larger result sets with offset.

Implementation

Future<AffiliateAnalytics> affiliateAnalytics({
  required Date from,
  required Date to,
  int? limit,
  int? offset,
}) async {
  final response = await _analytics.getAffiliateAnalytics(
    from: from,
    to: to,
    xApiKey: apiKey,
    limit: limit,
    offset: offset,
  );
  final body = response.data ??
      (throw StateError('affiliateAnalytics: response body was empty.'));
  return body.data;
}