esimsSendSms method

Future<EsimSmsResult?> esimsSendSms(
  1. String iccid, {
  2. EsimSmsRequest? esimSmsRequest,
  3. Future<void>? abortTrigger,
})

Send an SMS to an eSIM

Sends a text message to one of your eSIMs. Takes { message }, which must not be empty, and returns { iccid, success, isSupported }. isSupported is false when the eSIM's plan cannot receive messages this way, and success is false when the message was not sent. 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.

  • EsimSmsRequest esimSmsRequest: The message to send.

Implementation

Future<EsimSmsResult?> esimsSendSms(String iccid, { EsimSmsRequest? esimSmsRequest, Future<void>? abortTrigger, }) async {
  final response = await esimsSendSmsWithHttpInfo(iccid, esimSmsRequest: esimSmsRequest, 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), 'EsimSmsResult',) as EsimSmsResult;

  }
  return null;
}