getLinkUsageWithHttpInfo method

Future<Response> getLinkUsageWithHttpInfo({
  1. String? provider,
  2. String? account,
  3. String? window,
  4. String? range,
})

Shows one provider account's own usage dashboard.

Shows one provider account's own usage dashboard. It answers the time series for a SINGLE provider account — the windows in range plus the currently-open ones — as that provider's own meter reported it: "my plan is 47% through its 6h window, resets at 14:20". current is the newest instance of each lane (the headline); windows is the history behind it, both computed from ONE deduped read. provider is required; an unknown window class or range is 400, never a quiet fallback to a different one. When no series is available the response is a 200 with available:false and empty lists — an honest "we have no data", which is a different claim from zero usage.

Note: This method returns the HTTP Response.

Parameters:

  • String provider: Provider is the provider whose meter to read. Required.

  • String account: Account narrows to one account when a user has several with the provider.

  • String window: Window selects a window class: 6h, day, week or month. Empty reads all.

  • String range: Range is the period, one of 1h, 24h, 7d or 30d; empty means 24h, and an unknown label is 400, never a quiet fallback.

Implementation

Future<Response> getLinkUsageWithHttpInfo({ String? provider, String? account, String? window, String? range, }) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/link/usage';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (provider != null) {
    queryParams.addAll(_queryParams('', 'provider', provider));
  }
  if (account != null) {
    queryParams.addAll(_queryParams('', 'account', account));
  }
  if (window != null) {
    queryParams.addAll(_queryParams('', 'window', window));
  }
  if (range != null) {
    queryParams.addAll(_queryParams('', 'range', range));
  }

  const contentTypes = <String>[];


  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}