Skip to content

delete_message

delete_message(
    room_identifier: RoomIdentifier,
    id: MessageID,
    *,
    config_overrides: Optional[ivschatClientConfig] = None,
    reason: Optional[Reason] = None,
) -> DeleteMessageResponse

Sends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s EventName is aws:DELETE_MESSAGE. This replicates the DeleteMessage WebSocket operation in the Amazon IVS Chat Messaging API.

Parameters:

  • room_identifier (RoomIdentifier) –

    Identifier of the room where the message should be deleted. Currently this must be an ARN.

  • id (MessageID) –

    ID of the message to be deleted. This is the Id field in the received message (see Message (Subscribe) in the Chat Messaging API).

  • reason (Optional[Reason], default: None ) –

    Reason for deleting the message.

Raises:

Source code in docs_src/capo_ivschat/_services/ivschat.py
def delete_message(
    self,
    room_identifier: "capo_ivschat.types.room_identifier.RoomIdentifier",
    id: "capo_ivschat.types.message_id.MessageID",
    *,
    config_overrides: Optional[ivschatClientConfig] = None,
    reason: Optional["capo_ivschat.types.reason.Reason"] = None,
) -> "capo_ivschat.types.delete_message_response.DeleteMessageResponse":
    """<p>Sends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s <code>EventName</code> is <code>aws:DELETE_MESSAGE</code>. This replicates the <a href="https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-deletemessage-publish.html"> DeleteMessage</a> WebSocket operation in the Amazon IVS Chat Messaging API.</p>

    Args:
        room_identifier: <p>Identifier of the room where the message should be deleted. Currently this must be an ARN. </p>
        id: <p>ID of the message to be deleted. This is the <code>Id</code> field in the received message (see <a href="https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-message-subscribe.html"> Message (Subscribe)</a> in the Chat Messaging API).</p>
        reason: <p>Reason for deleting the message.</p>

    Raises:
        capo_ivschat.errors.access_denied_exception.AccessDeniedException: <p/>
        capo_ivschat.errors.pending_verification.PendingVerification: <p/>
        capo_ivschat.errors.resource_not_found_exception.ResourceNotFoundException: <p/>
        capo_ivschat.errors.throttling_exception.ThrottlingException: <p/>
        capo_ivschat.errors.validation_exception.ValidationException: <p/>
        capo_ivschat.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ivschat.types.delete_message_request.DeleteMessageRequest]",
    ) -> OperationResponse[
        "capo_ivschat.types.delete_message_response.DeleteMessageResponse"
    ]:
        import capo_ivschat._operations.amazon_interactive_video_service_chat.delete_message

        output, http_response = (
            capo_ivschat._operations.amazon_interactive_video_service_chat.delete_message.delete_message(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteMessage")
    )
    input_: capo_ivschat.types.delete_message_request.DeleteMessageRequest = {
        "room_identifier": room_identifier,
        "id": id,
    }
    if reason is not None:
        input_["reason"] = reason

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