Skip to content

list_templates async

list_templates(
    *,
    config_overrides: Optional[AsyncPinpointClientConfig] = None,
    next_token: Optional[__string] = None,
    page_size: Optional[__string] = None,
    prefix: Optional[__string] = None,
    template_type: Optional[__string] = None,
) -> ListTemplatesResponse

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

Parameters:

  • next_token (Optional[__string], default: None ) –

    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.

  • page_size (Optional[__string], default: None ) –

    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.

  • prefix (Optional[__string], default: None ) –

    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.

  • template_type (Optional[__string], default: None ) –

    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.

Raises:

Source code in docs_src/capo_pinpoint/_services/async_pinpoint.py
async def list_templates(
    self,
    *,
    config_overrides: Optional[AsyncPinpointClientConfig] = None,
    next_token: Optional["capo_pinpoint.types.__string.__string"] = None,
    page_size: Optional["capo_pinpoint.types.__string.__string"] = None,
    prefix: Optional["capo_pinpoint.types.__string.__string"] = None,
    template_type: Optional["capo_pinpoint.types.__string.__string"] = None,
) -> "capo_pinpoint.types.list_templates_response.ListTemplatesResponse":
    """<p>Retrieves information about all the message templates that are associated with your Amazon Pinpoint account.</p>

    Args:
        next_token: <p>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.</p>
        page_size: <p>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.</p>
        prefix: <p>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.</p>
        template_type: <p>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.</p>

    Raises:
        capo_pinpoint.errors.bad_request_exception.BadRequestException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.forbidden_exception.ForbiddenException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.internal_server_error_exception.InternalServerErrorException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.method_not_allowed_exception.MethodNotAllowedException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.too_many_requests_exception.TooManyRequestsException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint.types.list_templates_request.ListTemplatesRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint.types.list_templates_response.ListTemplatesResponse"
    ]:
        import capo_pinpoint._operations.pinpoint.list_templates

        (
            output,
            http_response,
        ) = await capo_pinpoint._operations.pinpoint.list_templates.async_list_templates(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListTemplates")
    )
    input_: capo_pinpoint.types.list_templates_request.ListTemplatesRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if page_size is not None:
        input_["page_size"] = page_size
    if prefix is not None:
        input_["prefix"] = prefix
    if template_type is not None:
        input_["template_type"] = template_type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output