Skip to content

search_channels

search_channels(
    fields: SearchFields,
    *,
    config_overrides: Optional[ChimeSDKMessagingClientConfig] = None,
    chime_bearer: Optional[ChimeArn] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> SearchChannelsResponse

Allows the ChimeBearer to search channels by channel members. Users or bots can search across the channels that they belong to. Users in the AppInstanceAdmin role can search across all channels.

The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header.

This operation isn't supported for AppInstanceUsers with a large number of memberships.

Parameters:

  • chime_bearer (Optional[ChimeArn], default: None ) –

    The AppInstanceUserArn of the user making the API call.

  • fields (SearchFields) –

    A list of the Field objects in the channel being searched.

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

    The maximum number of channels that you want returned.

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

    The token returned from previous API requests until the number of channels is reached.

Raises:

Source code in docs_src/capo_chime_sdk_messaging/_services/chime_sdk_messaging.py
def search_channels(
    self,
    fields: "capo_chime_sdk_messaging.types.search_fields.SearchFields",
    *,
    config_overrides: Optional[ChimeSDKMessagingClientConfig] = None,
    chime_bearer: Optional[
        "capo_chime_sdk_messaging.types.chime_arn.ChimeArn"
    ] = None,
    max_results: Optional[
        "capo_chime_sdk_messaging.types.max_results.MaxResults"
    ] = None,
    next_token: Optional[
        "capo_chime_sdk_messaging.types.next_token.NextToken"
    ] = None,
) -> (
    "capo_chime_sdk_messaging.types.search_channels_response.SearchChannelsResponse"
):
    """<p>Allows the <code>ChimeBearer</code> to search channels by channel members. Users or bots can search across the channels that they belong to. Users in the <code>AppInstanceAdmin</code> role can search across all channels.</p> <p>The <code>x-amz-chime-bearer</code> request header is mandatory. Use the ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call as the value in the header.</p> <note> <p>This operation isn't supported for <code>AppInstanceUsers</code> with a large number of memberships.</p> </note>

    Args:
        chime_bearer: <p>The <code>AppInstanceUserArn</code> of the user making the API call.</p>
        fields: <p>A list of the <code>Field</code> objects in the channel being searched.</p>
        max_results: <p>The maximum number of channels that you want returned.</p>
        next_token: <p>The token returned from previous API requests until the number of channels is reached.</p>

    Raises:
        capo_chime_sdk_messaging.errors.bad_request_exception.BadRequestException: <p>The input parameters don't match the service's restrictions.</p>
        capo_chime_sdk_messaging.errors.forbidden_exception.ForbiddenException: <p>The client is permanently forbidden from making the request.</p>
        capo_chime_sdk_messaging.errors.service_failure_exception.ServiceFailureException: <p>The service encountered an unexpected error.</p>
        capo_chime_sdk_messaging.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_chime_sdk_messaging.errors.throttled_client_exception.ThrottledClientException: <p>The client exceeded its request rate limit.</p>
        capo_chime_sdk_messaging.errors.unauthorized_client_exception.UnauthorizedClientException: <p>The client is not currently authorized to make the request.</p>
        capo_chime_sdk_messaging.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_chime_sdk_messaging.types.search_channels_request.SearchChannelsRequest]",
    ) -> OperationResponse[
        "capo_chime_sdk_messaging.types.search_channels_response.SearchChannelsResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.search_channels

        output, http_response = (
            capo_chime_sdk_messaging._operations.chime_messaging_service.search_channels.search_channels(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_chime_sdk_messaging.types.search_channels_request.SearchChannelsRequest",
    ) -> dict[str, Any]:
        import capo_chime_sdk_messaging.types.search_channels_request

        return (
            capo_chime_sdk_messaging.types.search_channels_request.redact_sensitive(
                input_
            )
        )

    def _redact_output(
        output: "capo_chime_sdk_messaging.types.search_channels_response.SearchChannelsResponse",
    ) -> dict[str, Any]:
        import capo_chime_sdk_messaging.types.search_channels_response

        return capo_chime_sdk_messaging.types.search_channels_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "SearchChannels",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chime_sdk_messaging.types.search_channels_request.SearchChannelsRequest = {
        "fields": fields
    }
    if chime_bearer is not None:
        input_["chime_bearer"] = chime_bearer
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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