updateTemplateActiveVersion method

Future<UpdateTemplateActiveVersionResponse> updateTemplateActiveVersion({
  1. required TemplateActiveVersionRequest templateActiveVersionRequest,
  2. required String templateName,
  3. required String templateType,
})

Changes the status of a specific version of a message template to active.

May throw BadRequestException. May throw InternalServerErrorException. May throw PayloadTooLargeException. May throw ForbiddenException. May throw NotFoundException. May throw MethodNotAllowedException. May throw TooManyRequestsException.

Parameter templateName : The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.

Parameter templateType : The type of channel that the message template is designed for. Valid values are: EMAIL, PUSH, SMS, and VOICE.

Implementation

Future<UpdateTemplateActiveVersionResponse> updateTemplateActiveVersion({
  required TemplateActiveVersionRequest templateActiveVersionRequest,
  required String templateName,
  required String templateType,
}) async {
  ArgumentError.checkNotNull(
      templateActiveVersionRequest, 'templateActiveVersionRequest');
  ArgumentError.checkNotNull(templateName, 'templateName');
  ArgumentError.checkNotNull(templateType, 'templateType');
  final response = await _protocol.sendRaw(
    payload: templateActiveVersionRequest,
    method: 'PUT',
    requestUri:
        '/v1/templates/${Uri.encodeComponent(templateName)}/${Uri.encodeComponent(templateType)}/active-version',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return UpdateTemplateActiveVersionResponse(
    messageBody: MessageBody.fromJson($json),
  );
}