editChatMessage method
- ChatItemId id, {
- ChatMessageTextInput? text,
- ChatMessageAttachmentsInput? attachments,
- ChatMessageRepliesInput? repliesTo,
Edits a ChatMessage by the authenticated MyUser with the provided
text
/attachments
/repliesTo
(at least one of three must be
specified).
ChatMessage is allowed to be edited within 5 minutes since its creation or if it hasn't been read by any other Chat member yet.
Authentication
Mandatory.
Result
Only the following ChatEvent may be produced on success:
Idempotent
Succeeds as no-op (and returns no ChatEvents) if the specified
ChatMessage already has the specified text
, attachments
and
repliesTo
in the same order.
Implementation
Future<ChatEventsVersionedMixin?> editChatMessage(
ChatItemId id, {
ChatMessageTextInput? text,
ChatMessageAttachmentsInput? attachments,
ChatMessageRepliesInput? repliesTo,
}) async {
Log.debug(
'editChatMessage($id, $text, $attachments, $repliesTo)',
'$runtimeType',
);
final variables = EditChatMessageArguments(
id: id,
text: text,
attachments: attachments,
repliesTo: repliesTo,
);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'EditChatMessage',
document: EditChatMessageMutation(variables: variables).document,
variables: variables.toJson(),
),
onException:
(data) => EditChatMessageException(
(EditChatMessage$Mutation.fromJson(data).editChatMessage
as EditChatMessage$Mutation$EditChatMessage$EditChatMessageError)
.code,
),
);
return (EditChatMessage$Mutation.fromJson(result.data!).editChatMessage
as ChatEventsVersionedMixin?);
}