deleteChatMessage method
- ChatItemId id
Deletes the specified ChatMessage posted by the authenticated MyUser.
ChatMessage is allowed to be deleted only when it's not read by any other Chat member and neither forwarded, nor replied. Once deleted, ChatMessage is not visible for anyone in the Chat.
If this mutation returns READ
(or QUOTED
) error, use hideChatItem to
"remove" the ChatMessage for the authenticated MyUser.
Authentication
Mandatory.
Result
Only the following ChatEvent may be produced on success:
Idempotent
Succeeds as no-op (and returns no ChatEvent) if the specified ChatMessage is deleted already.
Implementation
Future<ChatEventsVersionedMixin?> deleteChatMessage(ChatItemId id) async {
Log.debug('deleteChatMessage($id)', '$runtimeType');
DeleteChatMessageArguments variables = DeleteChatMessageArguments(id: id);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'DeleteChatMessage',
document: DeleteChatMessageMutation(variables: variables).document,
variables: variables.toJson(),
),
onException:
(data) => DeleteChatMessageException(
(DeleteChatMessage$Mutation.fromJson(data).deleteChatMessage
as DeleteChatMessage$Mutation$DeleteChatMessage$DeleteChatMessageError)
.code,
),
);
return (DeleteChatMessage$Mutation.fromJson(result.data!).deleteChatMessage
as ChatEventsVersionedMixin?);
}