Skip to content

list_channel_memberships async

list_channel_memberships(
    channel_arn: ChimeArn,
    chime_bearer: ChimeArn,
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    type: Optional[ChannelMembershipType] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
    sub_channel_id: Optional[SubChannelId] = None,
) -> ListChannelMembershipsResponse

Lists all channel memberships in a channel.

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.

If you want to list the channels to which a specific app instance user belongs, see the ListChannelMembershipsForAppInstanceUser API.

Parameters:

  • channel_arn (ChimeArn) –

    The maximum number of channel memberships that you want returned.

  • type (Optional[ChannelMembershipType], default: None ) –

    The membership type of a user, DEFAULT or HIDDEN. Default members are returned as part of ListChannelMemberships if no type is specified. Hidden members are only returned if the type filter in ListChannelMemberships equals HIDDEN.

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

    The maximum number of channel memberships that you want returned.

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

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

  • chime_bearer (ChimeArn) –

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

  • sub_channel_id (Optional[SubChannelId], default: None ) –

    The ID of the SubChannel in the request.

    Only required when listing a user's memberships in a particular sub-channel of an elastic channel.

Raises:

Source code in docs_src/capo_chime_sdk_messaging/_services/async_chime_sdk_messaging.py
async def list_channel_memberships(
    self,
    channel_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    chime_bearer: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    type: Optional[
        "capo_chime_sdk_messaging.types.channel_membership_type.ChannelMembershipType"
    ] = 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,
    sub_channel_id: Optional[
        "capo_chime_sdk_messaging.types.sub_channel_id.SubChannelId"
    ] = None,
) -> "capo_chime_sdk_messaging.types.list_channel_memberships_response.ListChannelMembershipsResponse":
    """<p>Lists all channel memberships in a channel.</p> <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> <p>If you want to list the channels to which a specific app instance user belongs, see the <a href="https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_messaging-chime_ListChannelMembershipsForAppInstanceUser.html">ListChannelMembershipsForAppInstanceUser</a> API.</p>

    Args:
        channel_arn: <p>The maximum number of channel memberships that you want returned.</p>
        type: <p>The membership type of a user, <code>DEFAULT</code> or <code>HIDDEN</code>. Default members are returned as part of <code>ListChannelMemberships</code> if no type is specified. Hidden members are only returned if the type filter in <code>ListChannelMemberships</code> equals <code>HIDDEN</code>.</p>
        max_results: <p>The maximum number of channel memberships that you want returned.</p>
        next_token: <p>The token passed by previous API calls until all requested channel memberships are returned.</p>
        chime_bearer: <p>The ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call.</p>
        sub_channel_id: <p>The ID of the SubChannel in the request.</p> <note> <p>Only required when listing a user's memberships in a particular sub-channel of an elastic channel.</p> </note>

    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_channel_memberships_request.ListChannelMembershipsRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime_sdk_messaging.types.list_channel_memberships_response.ListChannelMembershipsResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.list_channel_memberships

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

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

        return capo_chime_sdk_messaging.types.list_channel_memberships_request.redact_sensitive(
            input_
        )

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

        return capo_chime_sdk_messaging.types.list_channel_memberships_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ListChannelMemberships",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chime_sdk_messaging.types.list_channel_memberships_request.ListChannelMembershipsRequest = {
        "channel_arn": channel_arn,
        "chime_bearer": chime_bearer,
    }
    if type is not None:
        input_["type"] = type
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if sub_channel_id is not None:
        input_["sub_channel_id"] = sub_channel_id

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