forwardChatItems method
- ChatId from,
- ChatId to,
- List<
ChatItemQuoteInput> items, { - ChatMessageText? text,
- List<
AttachmentId> ? attachments,
Forwards ChatItems to the specified Chat by the authenticated MyUser.
Supported ChatItems are ChatMessage and ChatForward.
If text
or attachments
argument is specified, then the forwarded
ChatItems will be followed with a posted ChatMessage containing that
text
and/or attachments
.
The maximum number of forwarded ChatItems at once is 100.
Authentication
Mandatory.
Result
Only the following ChatEvents may be produced on success:
- EventChatItemPosted (ChatForward and optionally ChatMessage).
Non-idempotent
Each time posts a new ChatForward.
Implementation
Future<ChatEventsVersionedMixin?> forwardChatItems(
ChatId from,
ChatId to,
List<ChatItemQuoteInput> items, {
ChatMessageText? text,
List<AttachmentId>? attachments,
}) async {
Log.debug(
'forwardChatItems($from, $to, $items, $text, $attachments)',
'$runtimeType',
);
final variables = ForwardChatItemsArguments(
from: from,
to: to,
items: items,
text: text,
attachments: attachments,
);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'ForwardChatItems',
document: ForwardChatItemsMutation(variables: variables).document,
variables: variables.toJson(),
),
onException:
(data) => ForwardChatItemsException(
(ForwardChatItems$Mutation.fromJson(data).forwardChatItems
as ForwardChatItems$Mutation$ForwardChatItems$ForwardChatItemsError)
.code,
),
);
return ForwardChatItems$Mutation.fromJson(result.data!).forwardChatItems
as ForwardChatItems$Mutation$ForwardChatItems$ChatEventsVersioned;
}