refactor: merge queries

This commit is contained in:
Rongjian Zhang 2020-01-07 21:03:04 +08:00
parent 1b7bcdb7bb
commit 984ec41fec
10 changed files with 815 additions and 1300 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2426,436 +2426,6 @@ Map<String, dynamic> _$GhCommitsArgumentsToJson(GhCommitsArguments instance) =>
'after': instance.after,
};
GhAddStar _$GhAddStarFromJson(Map<String, dynamic> json) {
return GhAddStar()
..addStar = json['addStar'] == null
? null
: GhAddStarAddStarPayload.fromJson(
json['addStar'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhAddStarToJson(GhAddStar instance) => <String, dynamic>{
'addStar': instance.addStar?.toJson(),
};
GhAddStarAddStarPayload _$GhAddStarAddStarPayloadFromJson(
Map<String, dynamic> json) {
return GhAddStarAddStarPayload()
..starrable = json['starrable'] == null
? null
: GhAddStarStarrable.fromJson(
json['starrable'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhAddStarAddStarPayloadToJson(
GhAddStarAddStarPayload instance) =>
<String, dynamic>{
'starrable': instance.starrable?.toJson(),
};
GhAddStarStarrable _$GhAddStarStarrableFromJson(Map<String, dynamic> json) {
return GhAddStarStarrable()
..viewerHasStarred = json['viewerHasStarred'] as bool
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhAddStarStarrableToJson(GhAddStarStarrable instance) =>
<String, dynamic>{
'viewerHasStarred': instance.viewerHasStarred,
'__typename': instance.resolveType,
};
GhAddStarArguments _$GhAddStarArgumentsFromJson(Map<String, dynamic> json) {
return GhAddStarArguments(
id: json['id'] as String,
);
}
Map<String, dynamic> _$GhAddStarArgumentsToJson(GhAddStarArguments instance) =>
<String, dynamic>{
'id': instance.id,
};
GhRemoveStar _$GhRemoveStarFromJson(Map<String, dynamic> json) {
return GhRemoveStar()
..removeStar = json['removeStar'] == null
? null
: GhRemoveStarRemoveStarPayload.fromJson(
json['removeStar'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhRemoveStarToJson(GhRemoveStar instance) =>
<String, dynamic>{
'removeStar': instance.removeStar?.toJson(),
};
GhRemoveStarRemoveStarPayload _$GhRemoveStarRemoveStarPayloadFromJson(
Map<String, dynamic> json) {
return GhRemoveStarRemoveStarPayload()
..starrable = json['starrable'] == null
? null
: GhRemoveStarStarrable.fromJson(
json['starrable'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhRemoveStarRemoveStarPayloadToJson(
GhRemoveStarRemoveStarPayload instance) =>
<String, dynamic>{
'starrable': instance.starrable?.toJson(),
};
GhRemoveStarStarrable _$GhRemoveStarStarrableFromJson(
Map<String, dynamic> json) {
return GhRemoveStarStarrable()
..viewerHasStarred = json['viewerHasStarred'] as bool
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhRemoveStarStarrableToJson(
GhRemoveStarStarrable instance) =>
<String, dynamic>{
'viewerHasStarred': instance.viewerHasStarred,
'__typename': instance.resolveType,
};
GhRemoveStarArguments _$GhRemoveStarArgumentsFromJson(
Map<String, dynamic> json) {
return GhRemoveStarArguments(
id: json['id'] as String,
);
}
Map<String, dynamic> _$GhRemoveStarArgumentsToJson(
GhRemoveStarArguments instance) =>
<String, dynamic>{
'id': instance.id,
};
GhFollowUser _$GhFollowUserFromJson(Map<String, dynamic> json) {
return GhFollowUser()
..followUser = json['followUser'] == null
? null
: GhFollowUserFollowUserPayload.fromJson(
json['followUser'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhFollowUserToJson(GhFollowUser instance) =>
<String, dynamic>{
'followUser': instance.followUser?.toJson(),
};
GhFollowUserFollowUserPayload _$GhFollowUserFollowUserPayloadFromJson(
Map<String, dynamic> json) {
return GhFollowUserFollowUserPayload()
..user = json['user'] == null
? null
: GhFollowUserUser.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhFollowUserFollowUserPayloadToJson(
GhFollowUserFollowUserPayload instance) =>
<String, dynamic>{
'user': instance.user?.toJson(),
};
GhFollowUserUser _$GhFollowUserUserFromJson(Map<String, dynamic> json) {
return GhFollowUserUser()
..viewerIsFollowing = json['viewerIsFollowing'] as bool
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserUserToJson(GhFollowUserUser instance) =>
<String, dynamic>{
'viewerIsFollowing': instance.viewerIsFollowing,
'__typename': instance.resolveType,
};
GhFollowUserAuditEntryActor _$GhFollowUserAuditEntryActorFromJson(
Map<String, dynamic> json) {
return GhFollowUserAuditEntryActor();
}
Map<String, dynamic> _$GhFollowUserAuditEntryActorToJson(
GhFollowUserAuditEntryActor instance) =>
<String, dynamic>{};
GhFollowUserNode _$GhFollowUserNodeFromJson(Map<String, dynamic> json) {
return GhFollowUserNode()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserNodeToJson(GhFollowUserNode instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserActor _$GhFollowUserActorFromJson(Map<String, dynamic> json) {
return GhFollowUserActor()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserActorToJson(GhFollowUserActor instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserRegistryPackageOwner _$GhFollowUserRegistryPackageOwnerFromJson(
Map<String, dynamic> json) {
return GhFollowUserRegistryPackageOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserRegistryPackageOwnerToJson(
GhFollowUserRegistryPackageOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserRegistryPackageSearch _$GhFollowUserRegistryPackageSearchFromJson(
Map<String, dynamic> json) {
return GhFollowUserRegistryPackageSearch()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserRegistryPackageSearchToJson(
GhFollowUserRegistryPackageSearch instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserProjectOwner _$GhFollowUserProjectOwnerFromJson(
Map<String, dynamic> json) {
return GhFollowUserProjectOwner()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserProjectOwnerToJson(
GhFollowUserProjectOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserRepositoryOwner _$GhFollowUserRepositoryOwnerFromJson(
Map<String, dynamic> json) {
return GhFollowUserRepositoryOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserRepositoryOwnerToJson(
GhFollowUserRepositoryOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserUniformResourceLocatable
_$GhFollowUserUniformResourceLocatableFromJson(Map<String, dynamic> json) {
return GhFollowUserUniformResourceLocatable()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserUniformResourceLocatableToJson(
GhFollowUserUniformResourceLocatable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserProfileOwner _$GhFollowUserProfileOwnerFromJson(
Map<String, dynamic> json) {
return GhFollowUserProfileOwner()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserProfileOwnerToJson(
GhFollowUserProfileOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserSponsorable _$GhFollowUserSponsorableFromJson(
Map<String, dynamic> json) {
return GhFollowUserSponsorable()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserSponsorableToJson(
GhFollowUserSponsorable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUserArguments _$GhFollowUserArgumentsFromJson(
Map<String, dynamic> json) {
return GhFollowUserArguments(
id: json['id'] as String,
);
}
Map<String, dynamic> _$GhFollowUserArgumentsToJson(
GhFollowUserArguments instance) =>
<String, dynamic>{
'id': instance.id,
};
GhUnfollowUser _$GhUnfollowUserFromJson(Map<String, dynamic> json) {
return GhUnfollowUser()
..unfollowUser = json['unfollowUser'] == null
? null
: GhUnfollowUserUnfollowUserPayload.fromJson(
json['unfollowUser'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhUnfollowUserToJson(GhUnfollowUser instance) =>
<String, dynamic>{
'unfollowUser': instance.unfollowUser?.toJson(),
};
GhUnfollowUserUnfollowUserPayload _$GhUnfollowUserUnfollowUserPayloadFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserUnfollowUserPayload()
..user = json['user'] == null
? null
: GhUnfollowUserUser.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhUnfollowUserUnfollowUserPayloadToJson(
GhUnfollowUserUnfollowUserPayload instance) =>
<String, dynamic>{
'user': instance.user?.toJson(),
};
GhUnfollowUserUser _$GhUnfollowUserUserFromJson(Map<String, dynamic> json) {
return GhUnfollowUserUser()
..viewerIsFollowing = json['viewerIsFollowing'] as bool
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserUserToJson(GhUnfollowUserUser instance) =>
<String, dynamic>{
'viewerIsFollowing': instance.viewerIsFollowing,
'__typename': instance.resolveType,
};
GhUnfollowUserAuditEntryActor _$GhUnfollowUserAuditEntryActorFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserAuditEntryActor();
}
Map<String, dynamic> _$GhUnfollowUserAuditEntryActorToJson(
GhUnfollowUserAuditEntryActor instance) =>
<String, dynamic>{};
GhUnfollowUserNode _$GhUnfollowUserNodeFromJson(Map<String, dynamic> json) {
return GhUnfollowUserNode()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserNodeToJson(GhUnfollowUserNode instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserActor _$GhUnfollowUserActorFromJson(Map<String, dynamic> json) {
return GhUnfollowUserActor()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserActorToJson(
GhUnfollowUserActor instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserRegistryPackageOwner _$GhUnfollowUserRegistryPackageOwnerFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserRegistryPackageOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserRegistryPackageOwnerToJson(
GhUnfollowUserRegistryPackageOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserRegistryPackageSearch
_$GhUnfollowUserRegistryPackageSearchFromJson(Map<String, dynamic> json) {
return GhUnfollowUserRegistryPackageSearch()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserRegistryPackageSearchToJson(
GhUnfollowUserRegistryPackageSearch instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserProjectOwner _$GhUnfollowUserProjectOwnerFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserProjectOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserProjectOwnerToJson(
GhUnfollowUserProjectOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserRepositoryOwner _$GhUnfollowUserRepositoryOwnerFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserRepositoryOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserRepositoryOwnerToJson(
GhUnfollowUserRepositoryOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserUniformResourceLocatable
_$GhUnfollowUserUniformResourceLocatableFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserUniformResourceLocatable()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserUniformResourceLocatableToJson(
GhUnfollowUserUniformResourceLocatable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserProfileOwner _$GhUnfollowUserProfileOwnerFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserProfileOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserProfileOwnerToJson(
GhUnfollowUserProfileOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserSponsorable _$GhUnfollowUserSponsorableFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserSponsorable()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhUnfollowUserSponsorableToJson(
GhUnfollowUserSponsorable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhUnfollowUserArguments _$GhUnfollowUserArgumentsFromJson(
Map<String, dynamic> json) {
return GhUnfollowUserArguments(
id: json['id'] as String,
);
}
Map<String, dynamic> _$GhUnfollowUserArgumentsToJson(
GhUnfollowUserArguments instance) =>
<String, dynamic>{
'id': instance.id,
};
GhCreateIssue _$GhCreateIssueFromJson(Map<String, dynamic> json) {
return GhCreateIssue()
..createIssue = json['createIssue'] == null
@ -3527,3 +3097,245 @@ Map<String, dynamic> _$GhOpenIssueArgumentsToJson(
'id': instance.id,
'open': instance.open,
};
GhStar _$GhStarFromJson(Map<String, dynamic> json) {
return GhStar()
..addStar = json['addStar'] == null
? null
: GhStarAddStarPayload.fromJson(json['addStar'] as Map<String, dynamic>)
..removeStar = json['removeStar'] == null
? null
: GhStarRemoveStarPayload.fromJson(
json['removeStar'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhStarToJson(GhStar instance) => <String, dynamic>{
'addStar': instance.addStar?.toJson(),
'removeStar': instance.removeStar?.toJson(),
};
GhStarAddStarPayload _$GhStarAddStarPayloadFromJson(Map<String, dynamic> json) {
return GhStarAddStarPayload()
..starrable = json['starrable'] == null
? null
: GhStarStarrable.fromJson(json['starrable'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhStarAddStarPayloadToJson(
GhStarAddStarPayload instance) =>
<String, dynamic>{
'starrable': instance.starrable?.toJson(),
};
GhStarStarrable _$GhStarStarrableFromJson(Map<String, dynamic> json) {
return GhStarStarrable()
..viewerHasStarred = json['viewerHasStarred'] as bool
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhStarStarrableToJson(GhStarStarrable instance) =>
<String, dynamic>{
'viewerHasStarred': instance.viewerHasStarred,
'__typename': instance.resolveType,
};
GhStarRemoveStarPayload _$GhStarRemoveStarPayloadFromJson(
Map<String, dynamic> json) {
return GhStarRemoveStarPayload()
..starrable = json['starrable'] == null
? null
: GhStarStarrable.fromJson(json['starrable'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhStarRemoveStarPayloadToJson(
GhStarRemoveStarPayload instance) =>
<String, dynamic>{
'starrable': instance.starrable?.toJson(),
};
GhStarArguments _$GhStarArgumentsFromJson(Map<String, dynamic> json) {
return GhStarArguments(
id: json['id'] as String,
flag: json['flag'] as bool,
);
}
Map<String, dynamic> _$GhStarArgumentsToJson(GhStarArguments instance) =>
<String, dynamic>{
'id': instance.id,
'flag': instance.flag,
};
GhFollow _$GhFollowFromJson(Map<String, dynamic> json) {
return GhFollow()
..followUser = json['followUser'] == null
? null
: GhFollowFollowUserPayload.fromJson(
json['followUser'] as Map<String, dynamic>)
..unfollowUser = json['unfollowUser'] == null
? null
: GhFollowUnfollowUserPayload.fromJson(
json['unfollowUser'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhFollowToJson(GhFollow instance) => <String, dynamic>{
'followUser': instance.followUser?.toJson(),
'unfollowUser': instance.unfollowUser?.toJson(),
};
GhFollowFollowUserPayload _$GhFollowFollowUserPayloadFromJson(
Map<String, dynamic> json) {
return GhFollowFollowUserPayload()
..user = json['user'] == null
? null
: GhFollowUser.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhFollowFollowUserPayloadToJson(
GhFollowFollowUserPayload instance) =>
<String, dynamic>{
'user': instance.user?.toJson(),
};
GhFollowUser _$GhFollowUserFromJson(Map<String, dynamic> json) {
return GhFollowUser()
..viewerIsFollowing = json['viewerIsFollowing'] as bool
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUserToJson(GhFollowUser instance) =>
<String, dynamic>{
'viewerIsFollowing': instance.viewerIsFollowing,
'__typename': instance.resolveType,
};
GhFollowAuditEntryActor _$GhFollowAuditEntryActorFromJson(
Map<String, dynamic> json) {
return GhFollowAuditEntryActor();
}
Map<String, dynamic> _$GhFollowAuditEntryActorToJson(
GhFollowAuditEntryActor instance) =>
<String, dynamic>{};
GhFollowNode _$GhFollowNodeFromJson(Map<String, dynamic> json) {
return GhFollowNode()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowNodeToJson(GhFollowNode instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowActor _$GhFollowActorFromJson(Map<String, dynamic> json) {
return GhFollowActor()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowActorToJson(GhFollowActor instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowRegistryPackageOwner _$GhFollowRegistryPackageOwnerFromJson(
Map<String, dynamic> json) {
return GhFollowRegistryPackageOwner()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowRegistryPackageOwnerToJson(
GhFollowRegistryPackageOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowRegistryPackageSearch _$GhFollowRegistryPackageSearchFromJson(
Map<String, dynamic> json) {
return GhFollowRegistryPackageSearch()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowRegistryPackageSearchToJson(
GhFollowRegistryPackageSearch instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowProjectOwner _$GhFollowProjectOwnerFromJson(Map<String, dynamic> json) {
return GhFollowProjectOwner()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowProjectOwnerToJson(
GhFollowProjectOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowRepositoryOwner _$GhFollowRepositoryOwnerFromJson(
Map<String, dynamic> json) {
return GhFollowRepositoryOwner()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowRepositoryOwnerToJson(
GhFollowRepositoryOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUniformResourceLocatable _$GhFollowUniformResourceLocatableFromJson(
Map<String, dynamic> json) {
return GhFollowUniformResourceLocatable()
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowUniformResourceLocatableToJson(
GhFollowUniformResourceLocatable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowProfileOwner _$GhFollowProfileOwnerFromJson(Map<String, dynamic> json) {
return GhFollowProfileOwner()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowProfileOwnerToJson(
GhFollowProfileOwner instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowSponsorable _$GhFollowSponsorableFromJson(Map<String, dynamic> json) {
return GhFollowSponsorable()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhFollowSponsorableToJson(
GhFollowSponsorable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhFollowUnfollowUserPayload _$GhFollowUnfollowUserPayloadFromJson(
Map<String, dynamic> json) {
return GhFollowUnfollowUserPayload()
..user = json['user'] == null
? null
: GhFollowUser.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GhFollowUnfollowUserPayloadToJson(
GhFollowUnfollowUserPayload instance) =>
<String, dynamic>{
'user': instance.user?.toJson(),
};
GhFollowArguments _$GhFollowArgumentsFromJson(Map<String, dynamic> json) {
return GhFollowArguments(
id: json['id'] as String,
flag: json['flag'] as bool,
);
}
Map<String, dynamic> _$GhFollowArgumentsToJson(GhFollowArguments instance) =>
<String, dynamic>{
'id': instance.id,
'flag': instance.flag,
};

View File

@ -1,7 +0,0 @@
mutation GhAddStar($id: ID!) {
addStar(input: { starrableId: $id }) {
starrable {
viewerHasStarred
}
}
}

View File

@ -0,0 +1,12 @@
mutation GhFollow($id: ID!, $flag: Boolean!) {
followUser(input: { userId: $id }) @include(if: $flag) {
user {
viewerIsFollowing
}
}
unfollowUser(input: { userId: $id }) @skip(if: $flag) {
user {
viewerIsFollowing
}
}
}

View File

@ -1,7 +0,0 @@
mutation GhFollowUser($id: ID!) {
followUser(input: { userId: $id }) {
user {
viewerIsFollowing
}
}
}

View File

@ -1,7 +0,0 @@
mutation GhRemoveStar($id: ID!) {
removeStar(input: { starrableId: $id }) {
starrable {
viewerHasStarred
}
}
}

View File

@ -0,0 +1,12 @@
mutation GhStar($id: ID!, $flag: Boolean!) {
addStar(input: { starrableId: $id }) @include(if: $flag) {
starrable {
viewerHasStarred
}
}
removeStar(input: { starrableId: $id }) @skip(if: $flag) {
starrable {
viewerHasStarred
}
}
}

View File

@ -1,7 +0,0 @@
mutation GhUnfollowUser($id: ID!) {
unfollowUser(input: { userId: $id }) {
user {
viewerIsFollowing
}
}
}

View File

@ -147,24 +147,19 @@ class RepositoryScreen extends StatelessWidget {
Expanded(child: Container()),
CupertinoButton(
onPressed: () async {
if (repo.viewerHasStarred) {
final res = await auth.gqlClient.execute(
GhRemoveStarQuery(
variables: GhRemoveStarArguments(id: repo.id),
final res = await auth.gqlClient.execute(
GhStarQuery(
variables: GhStarArguments(
id: repo.id,
flag: !repo.viewerHasStarred,
),
);
repo.viewerHasStarred =
res.data.removeStar.starrable.viewerHasStarred;
} else {
final res = await auth.gqlClient.execute(
GhAddStarQuery(
variables: GhAddStarArguments(id: repo.id),
),
);
repo.viewerHasStarred =
),
);
setState(() {
repo.viewerHasStarred = res.data.removeStar
?.starrable?.viewerHasStarred ??
res.data.addStar.starrable.viewerHasStarred;
}
setState(() {});
});
},
minSize: 0,
color: theme.palette.primary,

View File

@ -377,21 +377,19 @@ class UserScreen extends StatelessWidget {
ActionItem(
text: user.viewerIsFollowing ? 'Unfollow' : 'Follow',
onTap: (_) async {
if (user.viewerIsFollowing) {
final res = await auth.gqlClient.execute(
GhUnfollowUserQuery(
variables:
GhUnfollowUserArguments(id: user.id)));
final res = await auth.gqlClient.execute(
GhFollowQuery(
variables: GhFollowArguments(
id: user.id,
flag: !user.viewerIsFollowing,
),
),
);
setState(() {
user.viewerIsFollowing =
res.data.unfollowUser.user.viewerIsFollowing;
} else {
final res = await auth.gqlClient.execute(
GhFollowUserQuery(
variables: GhFollowUserArguments(id: user.id)));
user.viewerIsFollowing =
res.data.followUser.user.viewerIsFollowing;
}
setState(() {});
res.data.unfollowUser?.user?.viewerIsFollowing ??
res.data.followUser.user.viewerIsFollowing;
});
},
),
if (payload != null) ...[