Skip to content

put_channel_membership_preferences async

put_channel_membership_preferences(
    channel_arn: ChimeArn,
    member_arn: ChimeArn,
    chime_bearer: ChimeArn,
    preferences: ChannelMembershipPreferences,
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
) -> PutChannelMembershipPreferencesResponse

Sets the membership preferences of an AppInstanceUser or AppInstanceBot for the specified channel. The user or bot must be a member of the channel. Only the user or bot who owns the membership can set preferences. Users or bots in the AppInstanceAdmin and channel moderator roles can't set preferences for other users. Banned users or bots can't set membership preferences for the channel from which they are banned.

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

Parameters:

  • channel_arn (ChimeArn) –

    The ARN of the channel.

  • member_arn (ChimeArn) –

    The ARN of the member setting the preferences.

  • chime_bearer (ChimeArn) –

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

  • preferences (ChannelMembershipPreferences) –

    The channel membership preferences of an AppInstanceUser .

Raises:

Source code in docs_src/capo_chime_sdk_messaging/_services/async_chime_sdk_messaging.py
async def put_channel_membership_preferences(
    self,
    channel_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    member_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    chime_bearer: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    preferences: "capo_chime_sdk_messaging.types.channel_membership_preferences.ChannelMembershipPreferences",
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
) -> "capo_chime_sdk_messaging.types.put_channel_membership_preferences_response.PutChannelMembershipPreferencesResponse":
    """<p>Sets the membership preferences of an <code>AppInstanceUser</code> or <code>AppInstanceBot</code> for the specified channel. The user or bot must be a member of the channel. Only the user or bot who owns the membership can set preferences. Users or bots in the <code>AppInstanceAdmin</code> and channel moderator roles can't set preferences for other users. Banned users or bots can't set membership preferences for the channel from which they are banned.</p> <note> <p>The x-amz-chime-bearer request header is mandatory. Use the ARN of an <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call as the value in the header.</p> </note>

    Args:
        channel_arn: <p>The ARN of the channel.</p>
        member_arn: <p>The ARN of the member setting the preferences.</p>
        chime_bearer: <p>The ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call.</p>
        preferences: <p>The channel membership preferences of an <code>AppInstanceUser</code> .</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.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</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.put_channel_membership_preferences_request.PutChannelMembershipPreferencesRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime_sdk_messaging.types.put_channel_membership_preferences_response.PutChannelMembershipPreferencesResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.put_channel_membership_preferences

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

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

        return capo_chime_sdk_messaging.types.put_channel_membership_preferences_request.redact_sensitive(
            input_
        )

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

        return capo_chime_sdk_messaging.types.put_channel_membership_preferences_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "PutChannelMembershipPreferences",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chime_sdk_messaging.types.put_channel_membership_preferences_request.PutChannelMembershipPreferencesRequest = {
        "channel_arn": channel_arn,
        "member_arn": member_arn,
        "chime_bearer": chime_bearer,
        "preferences": preferences,
    }

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