createDialogChat method
- UserId responderId
Creates a Chat-dialog with the provided responderId
for the
authenticated MyUser.
There can be only one Chat-dialog between two Users.
Authentication
Mandatory.
Idempotent
Succeeds as no-op if a Chat with the given responder User exists already, and returns this Chat.
Implementation
Future<ChatMixin> createDialogChat(UserId responderId) async {
Log.debug('createDialogChat($responderId)', '$runtimeType');
final variables = CreateDialogArguments(responderId: responderId);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'CreateDialog',
document: CreateDialogMutation(variables: variables).document,
variables: variables.toJson(),
),
onException:
(data) => CreateDialogException(
(CreateDialog$Mutation.fromJson(data).createDialogChat
as CreateDialog$Mutation$CreateDialogChat$CreateDialogChatError)
.code,
),
);
return (CreateDialog$Mutation.fromJson(result.data!).createDialogChat
as ChatMixin);
}