listTemplateVersions method

Future<ListTemplateVersionsResponse> listTemplateVersions({
  1. required String templateName,
  2. required String templateType,
  3. String? nextToken,
  4. String? pageSize,
})

Retrieves information about all the versions of a specific message template.

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.

Parameter nextToken : The string that specifies which page of results to return in a paginated response. This parameter is not supported for application, campaign, and journey metrics.

Parameter pageSize : The maximum number of items to include in each page of a paginated response. This parameter is not supported for application, campaign, and journey metrics.

Implementation

Future<ListTemplateVersionsResponse> listTemplateVersions({
  required String templateName,
  required String templateType,
  String? nextToken,
  String? pageSize,
}) async {
  ArgumentError.checkNotNull(templateName, 'templateName');
  ArgumentError.checkNotNull(templateType, 'templateType');
  final $query = <String, List<String>>{
    if (nextToken != null) 'next-token': [nextToken],
    if (pageSize != null) 'page-size': [pageSize],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri:
        '/v1/templates/${Uri.encodeComponent(templateName)}/${Uri.encodeComponent(templateType)}/versions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return ListTemplateVersionsResponse(
    templateVersionsResponse: TemplateVersionsResponse.fromJson($json),
  );
}