updateDirectLink method
- DirectLinkSlug slug,
- DirectLinkLocationInput? location
Creates, updates or disabled the specified DirectLink owned by the authenticated MyUser.
MyUser can have multiple DirectLinks leading to himself or any other DirectLinkLocation.
If the location argument is null or absent, then the specified
DirectLink will be disabled.
Disabled DirectLinks can be re-enabled again by the authenticated MyUser, but can never ever leak to somebody else.
Authentication
Mandatory.
Result
The following DirectLinkEvents may be produced on success:
- DirectLinkCreatedEvent, DirectLinkEnabledEvent,
DirectLinkLocationUpdatedEvent (if the
locationargument is notnull); - DirectLinkDisabledEvent (if the location argument is
nullor absent).
Idempotent
Succeeds as no-op (and returns no DirectLinkEvents) if the specified DirectLink exists, enabled and leads to the specified DirectLinkLocation already, or is disabled already.
Implementation
Future<DirectLinkVersionedEventsMixin?> updateDirectLink(
DirectLinkSlug slug,
DirectLinkLocationInput? location,
) async {
Log.debug('updateDirectLink($slug, location: $location)', '$runtimeType');
final variables = UpdateDirectLinkArguments(slug: slug, location: location);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'UpdateDirectLink',
document: UpdateDirectLinkMutation(variables: variables).document,
variables: variables.toJson(),
),
onException: (data) => UpdateDirectLinkException(
(UpdateDirectLink$Mutation.fromJson(data).updateDirectLink
as UpdateDirectLink$Mutation$UpdateDirectLink$UpdateDirectLinkError)
.code,
),
);
return (UpdateDirectLink$Mutation.fromJson(result.data!).updateDirectLink
as DirectLinkVersionedEventsMixin?);
}