useChatDirectLink method

Future<UseChatDirectLink$Mutation$UseChatDirectLink$UseChatDirectLinkOk> useChatDirectLink(
  1. ChatDirectLinkSlug slug
)

Uses the specified ChatDirectLink by the authenticated MyUser creating a new Chat-dialog or joining an existing Chat-group.

Authentication

Mandatory.

Result

Always returns the created or modified Chat.

Only the following ChatEvent may be produced on success for the Chat-group:

Idempotent

Succeeds as no-op (and returns no ChatEvent) if the authenticated MyUser is already a member of the Chat-group or has already created the Chat-dialog by the specified ChatDirectLink.

Implementation

Future<UseChatDirectLink$Mutation$UseChatDirectLink$UseChatDirectLinkOk>
useChatDirectLink(ChatDirectLinkSlug slug) async {
  Log.debug('useChatDirectLink($slug)', '$runtimeType');

  final variables = UseChatDirectLinkArguments(slug: slug);
  final QueryResult result = await client.mutate(
    MutationOptions(
      operationName: 'UseChatDirectLink',
      document: UseChatDirectLinkMutation(variables: variables).document,
      variables: variables.toJson(),
    ),
    onException:
        (data) => UseChatDirectLinkException(
          (UseChatDirectLink$Mutation.fromJson(data).useChatDirectLink
                  as UseChatDirectLink$Mutation$UseChatDirectLink$UseChatDirectLinkError)
              .code,
        ),
  );
  return (UseChatDirectLink$Mutation.fromJson(result.data!).useChatDirectLink
      as UseChatDirectLink$Mutation$UseChatDirectLink$UseChatDirectLinkOk);
}