Skip to content

list_channel_memberships_for_app_instance_user async

list_channel_memberships_for_app_instance_user(
    chime_bearer: ChimeArn,
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    app_instance_user_arn: Optional[ChimeArn] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListChannelMembershipsForAppInstanceUserResponse

Lists all channels that an AppInstanceUser or AppInstanceBot is a part of. Only an AppInstanceAdmin can call the API with a user ARN that is not their own.

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_user_arn (Optional[ChimeArn], default: None ) –

    The ARN of the user or bot.

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

    The maximum number of users that you want returned.

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

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

  • 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_channel_memberships_for_app_instance_user(
    self,
    chime_bearer: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    app_instance_user_arn: 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.list_channel_memberships_for_app_instance_user_response.ListChannelMembershipsForAppInstanceUserResponse":
    """<p> Lists all channels that an <code>AppInstanceUser</code> or <code>AppInstanceBot</code> is a part of. Only an <code>AppInstanceAdmin</code> can call the API with a user ARN that is not their own. </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>

    Args:
        app_instance_user_arn: <p>The ARN of the user or bot.</p>
        max_results: <p>The maximum number of users that you want returned.</p>
        next_token: <p>The token returned from previous API requests until the number of channel memberships is reached.</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_channel_memberships_for_app_instance_user_request.ListChannelMembershipsForAppInstanceUserRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime_sdk_messaging.types.list_channel_memberships_for_app_instance_user_response.ListChannelMembershipsForAppInstanceUserResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.list_channel_memberships_for_app_instance_user

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

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

        return capo_chime_sdk_messaging.types.list_channel_memberships_for_app_instance_user_request.redact_sensitive(
            input_
        )

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

        return capo_chime_sdk_messaging.types.list_channel_memberships_for_app_instance_user_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ListChannelMembershipsForAppInstanceUser",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chime_sdk_messaging.types.list_channel_memberships_for_app_instance_user_request.ListChannelMembershipsForAppInstanceUserRequest = {
        "chime_bearer": chime_bearer
    }
    if app_instance_user_arn is not None:
        input_["app_instance_user_arn"] = app_instance_user_arn
    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