updateWelcomeMessage method

Future<MyUserEventsVersionedMixin?> updateWelcomeMessage(
  1. WelcomeMessageInput? content
)

Updates the WelcomeMessage of the authenticated MyUser.

For the WelcomeMessage to be meaningful, at least one of the WelcomeMessageInput.text or WelcomeMessageInput.attachments arguments must be specified and non-empty.

To attach some Attachments to the WelcomeMessage, first, they should be uploaded with Mutation.uploadAttachment, and only then, the returned Attachment.ids may be used as the WelcomeMessageInput.attachments argument of this mutation.

Authentication

Mandatory.

Result

One of the following MyUserEvents may be produced on success:

Idempotent

Succeeds as no-op (and returns no MyUserEvent) if the authenticated MyUser's WelcomeMessage already has the specified WelcomeMessageInput.text and WelcomeMessageInput.attachments in the same order.

Implementation

Future<MyUserEventsVersionedMixin?> updateWelcomeMessage(
  WelcomeMessageInput? content,
) async {
  Log.debug('updateWelcomeMessage($content)', '$runtimeType');

  final variables = UpdateWelcomeMessageArguments(content: content);
  final QueryResult result = await client.mutate(
    MutationOptions(
      operationName: 'UpdateWelcomeMessage',
      document: UpdateWelcomeMessageMutation(variables: variables).document,
      variables: variables.toJson(),
    ),
    onException:
        (data) => UpdateWelcomeMessageException(
          (UpdateWelcomeMessage$Mutation.fromJson(data).updateWelcomeMessage
                  as UpdateWelcomeMessage$Mutation$UpdateWelcomeMessage$UpdateWelcomeMessageError)
              .code,
        ),
  );
  return DeleteUserDirectLink$Mutation.fromJson(
        result.data!,
      ).deleteChatDirectLink
      as MyUserEventsVersionedMixin?;
}