listTemplates method

Future<ListTemplatesResponse> listTemplates({
  1. String? nextToken,
  2. String? pageSize,
  3. String? prefix,
  4. String? templateType,
})

Retrieves information about all the message templates that are associated with your Amazon Pinpoint account.

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

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.

Parameter prefix : The substring to match in the names of the message templates to include in the results. If you specify this value, Amazon Pinpoint returns only those templates whose names begin with the value that you specify.

Parameter templateType : The type of message template to include in the results. Valid values are: EMAIL, PUSH, SMS, and VOICE. To include all types of templates in the results, don't include this parameter in your request.

Implementation

Future<ListTemplatesResponse> listTemplates({
  String? nextToken,
  String? pageSize,
  String? prefix,
  String? templateType,
}) async {
  final $query = <String, List<String>>{
    if (nextToken != null) 'next-token': [nextToken],
    if (pageSize != null) 'page-size': [pageSize],
    if (prefix != null) 'prefix': [prefix],
    if (templateType != null) 'template-type': [templateType],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri: '/v1/templates',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return ListTemplatesResponse(
    templatesResponse: TemplatesResponse.fromJson($json),
  );
}