esimsGetUsageHistory method

Future<EsimUsageReadingList?> esimsGetUsageHistory(
  1. String iccid, {
  2. int? page,
  3. int? limit,
  4. DateTime? from,
  5. DateTime? to,
  6. Future<void>? abortTrigger,
})

List eSIM usage history

Lists the recorded usage readings of an eSIM, newest first. Returns { items, pagination }, one item per usage reading, with its allowances, remaining amounts and usage and expiry bands. from and to limit the readings by capturedAt, both inclusive. An ICCID that is not one of your eSIMs gives 404 / 10004.

Parameters:

  • String iccid (required): The eSIM's ICCID, from the order item's fulfillment.result.details.iccid.

  • int page: Page number, from 1; default 1.

  • int limit: Page size, 1 to 100; default 10.

  • DateTime from: Only readings captured at or after this UTC time.

  • DateTime to: Only readings captured at or before this UTC time.

Implementation

Future<EsimUsageReadingList?> esimsGetUsageHistory(String iccid, { int? page, int? limit, DateTime? from, DateTime? to, Future<void>? abortTrigger, }) async {
  final response = await esimsGetUsageHistoryWithHttpInfo(iccid, page: page, limit: limit, from: from, to: to, abortTrigger: abortTrigger,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'EsimUsageReadingList',) as EsimUsageReadingList;

  }
  return null;
}