Skip to content

get_intents

get_intents(
    *,
    config_overrides: Optional[LexModelBuildingServiceClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    name_contains: Optional[IntentName] = None,
) -> GetIntentsResponse

Returns intent information as follows:

  • If you specify the nameContains field, returns the $LATEST version of all intents that contain the specified string.

  • If you don't specify the nameContains field, returns information about the $LATEST version of all intents.

The operation requires permission for the lex:GetIntents action.

Parameters:

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

    A pagination token that fetches the next page of intents. If the response to this API call is truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of intents, specify the pagination token in the next request.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of intents to return in the response. The default is 10.

  • name_contains (Optional[IntentName], default: None ) –

    Substring to match in intent names. An intent will be returned if any part of its name matches the substring. For example, "xyz" matches both "xyzabc" and "abcxyz."

Raises:

  • BadRequestException –

    The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again.

  • InternalFailureException –

    An internal Amazon Lex error occurred. Try your request again.

  • LimitExceededException –

    The request exceeded a limit. Try your request again.

  • NotFoundException –

    The resource specified in the request was not found. Check the resource and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To get a list of intents This example shows how to get a list of all of the intents in your account.

>>> client.get_intents(next_token='', max_results=10)
Source code in docs_src/capo_lex_model_building_service/_services/lex_model_building_service.py
def get_intents(
    self,
    *,
    config_overrides: Optional[LexModelBuildingServiceClientConfig] = None,
    next_token: Optional[
        "capo_lex_model_building_service.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_lex_model_building_service.types.max_results.MaxResults"
    ] = None,
    name_contains: Optional[
        "capo_lex_model_building_service.types.intent_name.IntentName"
    ] = None,
) -> (
    "capo_lex_model_building_service.types.get_intents_response.GetIntentsResponse"
):
    """<p>Returns intent information as follows: </p> <ul> <li> <p>If you specify the <code>nameContains</code> field, returns the <code>$LATEST</code> version of all intents that contain the specified string.</p> </li> <li> <p> If you don't specify the <code>nameContains</code> field, returns information about the <code>$LATEST</code> version of all intents. </p> </li> </ul> <p> The operation requires permission for the <code>lex:GetIntents</code> action. </p>

    Args:
        next_token: <p>A pagination token that fetches the next page of intents. If the response to this API call is truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of intents, specify the pagination token in the next request. </p>
        max_results: <p>The maximum number of intents to return in the response. The default is 10.</p>
        name_contains: <p>Substring to match in intent names. An intent will be returned if any part of its name matches the substring. For example, "xyz" matches both "xyzabc" and "abcxyz."</p>

    Raises:
        capo_lex_model_building_service.errors.bad_request_exception.BadRequestException: <p>The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again.</p>
        capo_lex_model_building_service.errors.internal_failure_exception.InternalFailureException: <p>An internal Amazon Lex error occurred. Try your request again.</p>
        capo_lex_model_building_service.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeded a limit. Try your request again.</p>
        capo_lex_model_building_service.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. Check the resource and try again.</p>
        capo_lex_model_building_service.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get a list of intents
        This example shows how to get a list of all of the intents in your account.

        >>> client.get_intents(next_token='', max_results=10)
    """

    def _handler(
        req: "OperationRequest[capo_lex_model_building_service.types.get_intents_request.GetIntentsRequest]",
    ) -> OperationResponse[
        "capo_lex_model_building_service.types.get_intents_response.GetIntentsResponse"
    ]:
        import capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.get_intents

        output, http_response = (
            capo_lex_model_building_service._operations.aws_deep_sense_model_building_service.get_intents.get_intents(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetIntents")
    )
    input_: capo_lex_model_building_service.types.get_intents_request.GetIntentsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if name_contains is not None:
        input_["name_contains"] = name_contains

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output