Skip to content

list_channels async

list_channels(
    app_instance_arn: ChimeArn,
    chime_bearer: ChimeArn,
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    privacy: Optional[ChannelPrivacy] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListChannelsResponse

Lists all Channels created under a single Chime App as a paginated list. You can specify filters to narrow results.

Functionality & restrictions

  • Use privacy = PUBLIC to retrieve all public channels in the account.

  • Only an AppInstanceAdmin can set privacy = PRIVATE to list the private channels in an account.

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.

Parameters:

  • app_instance_arn (ChimeArn) –

    The ARN of the AppInstance.

  • privacy (Optional[ChannelPrivacy], default: None ) –

    The privacy setting. PUBLIC retrieves all the public channels. PRIVATE retrieves private channels. Only an AppInstanceAdmin can retrieve private channels.

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

    The maximum number of channels that you want to return.

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

    The token passed by previous API calls until all requested channels are returned.

  • chime_bearer (ChimeArn) –

    The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.

Raises:

Source code in docs_src/capo_chime_sdk_messaging/_services/async_chime_sdk_messaging.py
async def list_channels(
    self,
    app_instance_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    chime_bearer: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    privacy: Optional[
        "capo_chime_sdk_messaging.types.channel_privacy.ChannelPrivacy"
    ] = 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.list_channels_response.ListChannelsResponse":
    """<p>Lists all Channels created under a single Chime App as a paginated list. You can specify filters to narrow results.</p> <p class="title"> <b>Functionality & restrictions</b> </p> <ul> <li> <p>Use privacy = <code>PUBLIC</code> to retrieve all public channels in the account.</p> </li> <li> <p>Only an <code>AppInstanceAdmin</code> can set privacy = <code>PRIVATE</code> to list the private channels in an account.</p> </li> </ul> <note> <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>

    Args:
        app_instance_arn: <p>The ARN of the <code>AppInstance</code>.</p>
        privacy: <p>The privacy setting. <code>PUBLIC</code> retrieves all the public channels. <code>PRIVATE</code> retrieves private channels. Only an <code>AppInstanceAdmin</code> can retrieve private channels. </p>
        max_results: <p>The maximum number of channels that you want to return.</p>
        next_token: <p>The token passed by previous API calls until all requested channels are returned.</p>
        chime_bearer: <p>The ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_chime_sdk_messaging.types.list_channels_request.ListChannelsRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime_sdk_messaging.types.list_channels_response.ListChannelsResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.list_channels

        (
            output,
            http_response,
        ) = await capo_chime_sdk_messaging._operations.chime_messaging_service.list_channels.async_list_channels(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

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

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

        return (
            capo_chime_sdk_messaging.types.list_channels_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ListChannels", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_chime_sdk_messaging.types.list_channels_request.ListChannelsRequest = {
        "app_instance_arn": app_instance_arn,
        "chime_bearer": chime_bearer,
    }
    if privacy is not None:
        input_["privacy"] = privacy
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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