declineChatCall method
- ChatId chatId
Declines the ongoing ChatCall in the specified Chat by the authenticated MyUser.
Use this mutation when an EventChatCallStarted is received via
Subscription.chatEvents
and MyUser doesn't want to accept the
ChatCall.
Authentication
Mandatory.
Result
One of the following ChatEvents may be produced on success:
- EventChatCallDeclined (for Chat-groups);
- EventChatCallFinished (for Chat-dialogs).
Idempotent
Succeeds as no-op (and returns no ChatEvent) if there is no current ChatCall, or it is declined by the authenticated MyUser already.
Implementation
Future<ChatEventsVersionedMixin?> declineChatCall(ChatId chatId) async {
Log.debug('declineChatCall($chatId)', '$runtimeType');
final variables = DeclineCallArguments(chatId: chatId);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'DeclineCall',
document: DeclineCallMutation(variables: variables).document,
variables: variables.toJson(),
),
onException:
(data) => DeclineChatCallException(
(DeclineCall$Mutation.fromJson(data).declineChatCall
as DeclineCall$Mutation$DeclineChatCall$DeclineChatCallError)
.code,
),
);
return (DeclineCall$Mutation.fromJson(result.data!).declineChatCall
as ChatEventsVersionedMixin?);
}