esimsProvision method
- String id,
- String idempotencyKey, {
- EsimProvisioningRequest? esimProvisioningRequest,
- Future<
void> ? abortTrigger,
Provision a deferred eSIM
Provisions a deferred eSIM bought with inputs.isInstant: false and returns it. Creates the eSIM for an order item that delivered an entitlement, and returns it as GET /esims/{iccid} does. The item's result moves to provisioning.status processing and then ready, and each change sends an order.fulfillment.updated webhook. An Idempotency-Key header with a UUID is required; a key already used for a completed call gives 409 / 12000. The optional body { travelStartDate } is needed when the plan requires the first day of travel and the order did not send it (400 / 10001 without it); a date other than the one recorded, or a new date once provisioning has started, gives 409 / 10005. An instant eSIM gives 400 / 10001, and an ID that names no eSIM purchase of yours, such as a top-up item, gives 404 / 10004.
Parameters:
-
String id (required): The order item ID of the deferred eSIM purchase.
-
String idempotencyKey (required): UUID idempotency key for safe retries of this operation.
-
EsimProvisioningRequest esimProvisioningRequest: Optional:
{ travelStartDate }, the first day of travel.
Implementation
Future<EsimProfile?> esimsProvision(String id, String idempotencyKey, { EsimProvisioningRequest? esimProvisioningRequest, Future<void>? abortTrigger, }) async {
final response = await esimsProvisionWithHttpInfo(id, idempotencyKey, esimProvisioningRequest: esimProvisioningRequest, 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), 'EsimProfile',) as EsimProfile;
}
return null;
}