esimsSearch method

Future<EsimSearchResult?> esimsSearch({
  1. String? countryCode,
  2. String? category,
  3. String? region,
  4. int? validityDays,
  5. bool? isUnlimited,
  6. String? iccid,
  7. String? currency,
  8. int? page,
  9. int? limit,
  10. Future<void>? abortTrigger,
})

Search eSIM plans

Searches eSIM destinations and returns them with their plans, one page at a time. Returns { items, pagination }. countryCode keeps the destinations whose coverage includes that country, so local, regional and global destinations can match; category and region select destinations, and validityDays and isUnlimited select plans within them. Pages count destinations with an orderable plan. With iccid it returns the plans that can top up that eSIM instead, under its destination, and takes no filter other than currency (400 / 10001, NOT_ALLOWED); an unknown or foreign ICCID gives 404 / 10004. Prices are indicative, in currency.

Parameters:

  • String countryCode: Optional ISO 3166-1 alpha-2 country, in either case: keeps the destinations whose coverage includes it, regional and global ones too. A blank value is rejected.

  • String category: Keep local, regional or global destinations.

  • String region: Keep the destinations of this region, in display or slug form, for example North America or north-america.

  • int validityDays: Keep the plans valid for exactly this many days; at least 1.

  • bool isUnlimited: Keep the unlimited (true) or the limited (false) plans.

  • String iccid: Top-up search: the ICCID (18 to 22 digits) of your eSIM to list the plans that can top it up. No other filter than currency is allowed with it.

  • String currency: Price currency, three letters in either case; the API key's currency when omitted. An unsupported code gives 404 / 10004.

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

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

Implementation

Future<EsimSearchResult?> esimsSearch({ String? countryCode, String? category, String? region, int? validityDays, bool? isUnlimited, String? iccid, String? currency, int? page, int? limit, Future<void>? abortTrigger, }) async {
  final response = await esimsSearchWithHttpInfo(countryCode: countryCode, category: category, region: region, validityDays: validityDays, isUnlimited: isUnlimited, iccid: iccid, currency: currency, page: page, limit: limit, 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), 'EsimSearchResult',) as EsimSearchResult;

  }
  return null;
}