startChatCall method
- ChatId chatId,
- ChatCallCredentials creds, [
- bool? withVideo
Starts a new ChatCall in the specified Chat by the authenticated MyUser.
Once this mutation succeeds the EventChatCallStarted is fired to all
Chat members via Subscription.chatEvents
, and it's required to use
callEvents for the authenticated MyUser to be able to react on all
ChatCallEvents happening during the started ChatCall.
Authentication
Mandatory.
Result
Only of the following ChatEvents may be produced on success:
- EventChatItemPosted (if no ChatCall exists);
- EventChatCallStarted (if no ChatCall exists);
- EventChatCallMemberJoined (if ChatCall exists already).
Idempotent
Succeeds as no-op (and returns no ChatEvents) if there is a ChatCall in this Chat already and the authenticated MyUser is a member of it. Joins it if the authenticated MyUser is not a member yet.
Implementation
Future<StartCall$Mutation$StartChatCall$StartChatCallOk> startChatCall(
ChatId chatId,
ChatCallCredentials creds, [
bool? withVideo,
]) async {
Log.debug('startChatCall($chatId, $creds)', '$runtimeType');
final variables = StartCallArguments(
chatId: chatId,
creds: creds,
withVideo: withVideo,
);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'StartCall',
document: StartCallMutation(variables: variables).document,
variables: variables.toJson(),
),
onException:
(data) => StartChatCallException(
(StartCall$Mutation.fromJson(data).startChatCall
as StartCall$Mutation$StartChatCall$StartChatCallError)
.code,
),
);
return (StartCall$Mutation.fromJson(result.data!).startChatCall
as StartCall$Mutation$StartChatCall$StartChatCallOk);
}