improvement(gh): drop orgs repos

This commit is contained in:
Rongjian Zhang 2020-02-07 15:43:35 +08:00
parent a3b617f7fc
commit a4b54d317c
4 changed files with 376 additions and 752 deletions

View File

@ -4872,54 +4872,18 @@ class GhIssuesQuery extends GraphQLQuery<GhIssues, GhIssuesArguments> {
@JsonSerializable(explicitToJson: true)
class GhRepos with EquatableMixin {
GhRepos({this.repositoryOwner});
GhRepos({this.user});
factory GhRepos.fromJson(Map<String, dynamic> json) =>
_$GhReposFromJson(json);
GhReposRepositoryOwner repositoryOwner;
GhReposUser user;
@override
List<Object> get props => [repositoryOwner];
List<Object> get props => [user];
Map<String, dynamic> toJson() => _$GhReposToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposRepositoryOwner with EquatableMixin {
GhReposRepositoryOwner({this.login, this.avatarUrl});
factory GhReposRepositoryOwner.fromJson(Map<String, dynamic> json) {
switch (json['__typename'].toString()) {
case 'User':
return GhReposUser.fromJson(json);
case 'Organization':
return GhReposOrganization.fromJson(json);
default:
}
return _$GhReposRepositoryOwnerFromJson(json);
}
String login;
String avatarUrl;
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [login, avatarUrl, resolveType];
Map<String, dynamic> toJson() {
switch (resolveType) {
case 'User':
return (this as GhReposUser).toJson();
case 'Organization':
return (this as GhReposOrganization).toJson();
default:
}
return _$GhReposRepositoryOwnerToJson(this);
}
}
@JsonSerializable(explicitToJson: true)
class GhReposUser extends GhReposAuditEntryActor
with EquatableMixin
@ -4933,11 +4897,18 @@ class GhReposUser extends GhReposAuditEntryActor
GhReposUniformResourceLocatable,
GhReposProfileOwner,
GhReposSponsorable {
GhReposUser({this.repositories, this.starredRepositories});
GhReposUser({this.starredRepositories});
factory GhReposUser.fromJson(Map<String, dynamic> json) =>
_$GhReposUserFromJson(json);
@override
String login;
@override
String avatarUrl;
@override
GhReposRepositoryConnection repositories;
GhReposStarredRepositoryConnection starredRepositories;
@ -4946,15 +4917,9 @@ class GhReposUser extends GhReposAuditEntryActor
@JsonKey(name: '__typename')
String resolveType;
@override
String login;
@override
String avatarUrl;
@override
List<Object> get props =>
[repositories, starredRepositories, resolveType, login, avatarUrl];
[login, avatarUrl, repositories, starredRepositories, resolveType];
Map<String, dynamic> toJson() => _$GhReposUserToJson(this);
}
@ -5054,6 +5019,25 @@ class GhReposRepository extends GhReposPinnableItem
Map<String, dynamic> toJson() => _$GhReposRepositoryToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposRepositoryOwner with EquatableMixin {
GhReposRepositoryOwner({this.login, this.avatarUrl});
factory GhReposRepositoryOwner.fromJson(Map<String, dynamic> json) =>
_$GhReposRepositoryOwnerFromJson(json);
String login;
String avatarUrl;
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [login, avatarUrl, resolveType];
Map<String, dynamic> toJson() => _$GhReposRepositoryOwnerToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposStargazerConnection with EquatableMixin {
GhReposStargazerConnection({this.totalCount});
@ -5274,31 +5258,37 @@ class GhReposAuditEntryActor with EquatableMixin {
@JsonSerializable(explicitToJson: true)
class GhReposActor with EquatableMixin {
GhReposActor();
GhReposActor({this.login, this.avatarUrl});
factory GhReposActor.fromJson(Map<String, dynamic> json) =>
_$GhReposActorFromJson(json);
String login;
String avatarUrl;
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [resolveType];
List<Object> get props => [login, avatarUrl, resolveType];
Map<String, dynamic> toJson() => _$GhReposActorToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposProfileOwner with EquatableMixin {
GhReposProfileOwner();
GhReposProfileOwner({this.login});
factory GhReposProfileOwner.fromJson(Map<String, dynamic> json) =>
_$GhReposProfileOwnerFromJson(json);
String login;
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [resolveType];
List<Object> get props => [login, resolveType];
Map<String, dynamic> toJson() => _$GhReposProfileOwnerToJson(this);
}
@ -5317,73 +5307,6 @@ class GhReposSponsorable with EquatableMixin {
Map<String, dynamic> toJson() => _$GhReposSponsorableToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposOrganization extends GhReposAuditEntryActor
with EquatableMixin
implements
GhReposNode,
GhReposActor,
GhReposRegistryPackageOwner,
GhReposRegistryPackageSearch,
GhReposProjectOwner,
GhReposRepositoryOwner,
GhReposUniformResourceLocatable,
GhReposMemberStatusable,
GhReposProfileOwner,
GhReposSponsorable {
GhReposOrganization({this.pinnableItems});
factory GhReposOrganization.fromJson(Map<String, dynamic> json) =>
_$GhReposOrganizationFromJson(json);
GhReposPinnableItemConnection pinnableItems;
@override
@JsonKey(name: '__typename')
String resolveType;
@override
String login;
@override
String avatarUrl;
@override
List<Object> get props => [pinnableItems, resolveType, login, avatarUrl];
Map<String, dynamic> toJson() => _$GhReposOrganizationToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposPinnableItemConnection with EquatableMixin {
GhReposPinnableItemConnection({this.pageInfo, this.nodes});
factory GhReposPinnableItemConnection.fromJson(Map<String, dynamic> json) =>
_$GhReposPinnableItemConnectionFromJson(json);
GhReposPageInfo pageInfo;
List<GhReposPinnableItem> nodes;
@override
List<Object> get props => [pageInfo, nodes];
Map<String, dynamic> toJson() => _$GhReposPinnableItemConnectionToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposMemberStatusable with EquatableMixin {
GhReposMemberStatusable();
factory GhReposMemberStatusable.fromJson(Map<String, dynamic> json) =>
_$GhReposMemberStatusableFromJson(json);
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [resolveType];
Map<String, dynamic> toJson() => _$GhReposMemberStatusableToJson(this);
}
@JsonSerializable(explicitToJson: true)
class GhReposArguments extends JsonSerializable with EquatableMixin {
GhReposArguments({@required this.owner, this.after, @required this.isStar});
@ -5433,7 +5356,7 @@ class GhReposQuery extends GraphQLQuery<GhRepos, GhReposArguments> {
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'repositoryOwner'),
name: NameNode(value: 'user'),
alias: null,
arguments: [
ArgumentNode(
@ -5460,521 +5383,317 @@ class GhReposQuery extends GraphQLQuery<GhRepos, GhReposArguments> {
arguments: [],
directives: [],
selectionSet: null),
InlineFragmentNode(
typeCondition: TypeConditionNode(
on: NamedTypeNode(
name: NameNode(value: 'User'), isNonNull: false)),
directives: [],
FieldNode(
name: NameNode(value: 'repositories'),
alias: null,
arguments: [
ArgumentNode(
name: NameNode(value: 'first'),
value: IntValueNode(value: '30')),
ArgumentNode(
name: NameNode(value: 'after'),
value: VariableNode(name: NameNode(value: 'after'))),
ArgumentNode(
name: NameNode(value: 'orderBy'),
value: ObjectValueNode(fields: [
ObjectFieldNode(
name: NameNode(value: 'field'),
value: EnumValueNode(
name: NameNode(value: 'UPDATED_AT'))),
ObjectFieldNode(
name: NameNode(value: 'direction'),
value: EnumValueNode(
name: NameNode(value: 'DESC')))
]))
],
directives: [
DirectiveNode(name: NameNode(value: 'skip'), arguments: [
ArgumentNode(
name: NameNode(value: 'if'),
value:
VariableNode(name: NameNode(value: 'isStar')))
])
],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'repositories'),
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [
ArgumentNode(
name: NameNode(value: 'first'),
value: IntValueNode(value: '30')),
ArgumentNode(
name: NameNode(value: 'after'),
value: VariableNode(
name: NameNode(value: 'after'))),
ArgumentNode(
name: NameNode(value: 'orderBy'),
value: ObjectValueNode(fields: [
ObjectFieldNode(
name: NameNode(value: 'field'),
value: EnumValueNode(
name: NameNode(value: 'UPDATED_AT'))),
ObjectFieldNode(
name: NameNode(value: 'direction'),
value: EnumValueNode(
name: NameNode(value: 'DESC')))
]))
],
directives: [
DirectiveNode(
name: NameNode(value: 'skip'),
arguments: [
ArgumentNode(
name: NameNode(value: 'if'),
value: VariableNode(
name: NameNode(value: 'isStar')))
])
],
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'pageInfo'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
name: NameNode(value: 'hasNextPage'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'pageInfo'),
name: NameNode(value: 'endCursor'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'hasNextPage'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'endCursor'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'nodes'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'owner'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'description'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isPrivate'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isFork'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'stargazers'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'forks'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'primaryLanguage'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'color'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
]))
]))
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'starredRepositories'),
name: NameNode(value: 'nodes'),
alias: null,
arguments: [
ArgumentNode(
name: NameNode(value: 'first'),
value: IntValueNode(value: '30')),
ArgumentNode(
name: NameNode(value: 'after'),
value: VariableNode(
name: NameNode(value: 'after'))),
ArgumentNode(
name: NameNode(value: 'orderBy'),
value: ObjectValueNode(fields: [
ObjectFieldNode(
name: NameNode(value: 'field'),
value: EnumValueNode(
name: NameNode(value: 'STARRED_AT'))),
ObjectFieldNode(
name: NameNode(value: 'direction'),
value: EnumValueNode(
name: NameNode(value: 'DESC')))
]))
],
directives: [
DirectiveNode(
name: NameNode(value: 'include'),
arguments: [
ArgumentNode(
name: NameNode(value: 'if'),
value: VariableNode(
name: NameNode(value: 'isStar')))
])
],
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'pageInfo'),
name: NameNode(value: 'owner'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'hasNextPage'),
name: NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'endCursor'),
name: NameNode(value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'nodes'),
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'description'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isPrivate'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isFork'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'stargazers'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'owner'),
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'forks'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'primaryLanguage'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'color'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'description'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isPrivate'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isFork'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'stargazers'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'forks'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'primaryLanguage'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'color'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
]))
selectionSet: null)
]))
]))
])),
InlineFragmentNode(
typeCondition: TypeConditionNode(
on: NamedTypeNode(
name: NameNode(value: 'Organization'),
isNonNull: false)),
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'pinnableItems'),
alias: null,
FieldNode(
name: NameNode(value: 'starredRepositories'),
alias: null,
arguments: [
ArgumentNode(
name: NameNode(value: 'first'),
value: IntValueNode(value: '30')),
ArgumentNode(
name: NameNode(value: 'after'),
value: VariableNode(name: NameNode(value: 'after'))),
ArgumentNode(
name: NameNode(value: 'orderBy'),
value: ObjectValueNode(fields: [
ObjectFieldNode(
name: NameNode(value: 'field'),
value: EnumValueNode(
name: NameNode(value: 'STARRED_AT'))),
ObjectFieldNode(
name: NameNode(value: 'direction'),
value: EnumValueNode(
name: NameNode(value: 'DESC')))
]))
],
directives: [
DirectiveNode(
name: NameNode(value: 'include'),
arguments: [
ArgumentNode(
name: NameNode(value: 'first'),
value: IntValueNode(value: '30')),
ArgumentNode(
name: NameNode(value: 'after'),
name: NameNode(value: 'if'),
value: VariableNode(
name: NameNode(value: 'after'))),
ArgumentNode(
name: NameNode(value: 'types'),
value: ListValueNode(values: [
EnumValueNode(
name: NameNode(value: 'REPOSITORY'))
]))
],
directives: [
DirectiveNode(
name: NameNode(value: 'skip'),
arguments: [
ArgumentNode(
name: NameNode(value: 'if'),
value: VariableNode(
name: NameNode(value: 'isStar')))
])
],
name: NameNode(value: 'isStar')))
])
],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'pageInfo'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: '__typename'),
name: NameNode(value: 'hasNextPage'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'pageInfo'),
name: NameNode(value: 'endCursor'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'nodes'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'owner'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'hasNextPage'),
name: NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'endCursor'),
name: NameNode(value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'nodes'),
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'description'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isPrivate'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isFork'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'stargazers'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
InlineFragmentNode(
typeCondition: TypeConditionNode(
on: NamedTypeNode(
name:
NameNode(value: 'Repository'),
isNonNull: false)),
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'owner'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name:
NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(
value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name:
NameNode(value: 'description'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isPrivate'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'isFork'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'stargazers'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(
value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'forks'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(
value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(
value: 'primaryLanguage'),
alias: null,
arguments: [],
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name:
NameNode(value: 'color'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
]))
]))
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'forks'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'totalCount'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
FieldNode(
name: NameNode(value: 'primaryLanguage'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'color'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
]))
]))
]))

View File

@ -2371,56 +2371,39 @@ Map<String, dynamic> _$GhIssuesArgumentsToJson(GhIssuesArguments instance) =>
GhRepos _$GhReposFromJson(Map<String, dynamic> json) {
return GhRepos(
repositoryOwner: json['repositoryOwner'] == null
user: json['user'] == null
? null
: GhReposRepositoryOwner.fromJson(
json['repositoryOwner'] as Map<String, dynamic>),
: GhReposUser.fromJson(json['user'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$GhReposToJson(GhRepos instance) => <String, dynamic>{
'repositoryOwner': instance.repositoryOwner?.toJson(),
};
GhReposRepositoryOwner _$GhReposRepositoryOwnerFromJson(
Map<String, dynamic> json) {
return GhReposRepositoryOwner(
login: json['login'] as String,
avatarUrl: json['avatarUrl'] as String,
)..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhReposRepositoryOwnerToJson(
GhReposRepositoryOwner instance) =>
<String, dynamic>{
'login': instance.login,
'avatarUrl': instance.avatarUrl,
'__typename': instance.resolveType,
'user': instance.user?.toJson(),
};
GhReposUser _$GhReposUserFromJson(Map<String, dynamic> json) {
return GhReposUser(
repositories: json['repositories'] == null
? null
: GhReposRepositoryConnection.fromJson(
json['repositories'] as Map<String, dynamic>),
starredRepositories: json['starredRepositories'] == null
? null
: GhReposStarredRepositoryConnection.fromJson(
json['starredRepositories'] as Map<String, dynamic>),
)
..resolveType = json['__typename'] as String
..login = json['login'] as String
..avatarUrl = json['avatarUrl'] as String;
..avatarUrl = json['avatarUrl'] as String
..repositories = json['repositories'] == null
? null
: GhReposRepositoryConnection.fromJson(
json['repositories'] as Map<String, dynamic>)
..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhReposUserToJson(GhReposUser instance) =>
<String, dynamic>{
'login': instance.login,
'avatarUrl': instance.avatarUrl,
'repositories': instance.repositories?.toJson(),
'starredRepositories': instance.starredRepositories?.toJson(),
'__typename': instance.resolveType,
'login': instance.login,
'avatarUrl': instance.avatarUrl,
};
GhReposRepositoryConnection _$GhReposRepositoryConnectionFromJson(
@ -2501,6 +2484,22 @@ Map<String, dynamic> _$GhReposRepositoryToJson(GhReposRepository instance) =>
'__typename': instance.resolveType,
};
GhReposRepositoryOwner _$GhReposRepositoryOwnerFromJson(
Map<String, dynamic> json) {
return GhReposRepositoryOwner(
login: json['login'] as String,
avatarUrl: json['avatarUrl'] as String,
)..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhReposRepositoryOwnerToJson(
GhReposRepositoryOwner instance) =>
<String, dynamic>{
'login': instance.login,
'avatarUrl': instance.avatarUrl,
'__typename': instance.resolveType,
};
GhReposStargazerConnection _$GhReposStargazerConnectionFromJson(
Map<String, dynamic> json) {
return GhReposStargazerConnection(
@ -2676,21 +2675,29 @@ Map<String, dynamic> _$GhReposAuditEntryActorToJson(
<String, dynamic>{};
GhReposActor _$GhReposActorFromJson(Map<String, dynamic> json) {
return GhReposActor()..resolveType = json['__typename'] as String;
return GhReposActor(
login: json['login'] as String,
avatarUrl: json['avatarUrl'] as String,
)..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhReposActorToJson(GhReposActor instance) =>
<String, dynamic>{
'login': instance.login,
'avatarUrl': instance.avatarUrl,
'__typename': instance.resolveType,
};
GhReposProfileOwner _$GhReposProfileOwnerFromJson(Map<String, dynamic> json) {
return GhReposProfileOwner()..resolveType = json['__typename'] as String;
return GhReposProfileOwner(
login: json['login'] as String,
)..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhReposProfileOwnerToJson(
GhReposProfileOwner instance) =>
<String, dynamic>{
'login': instance.login,
'__typename': instance.resolveType,
};
@ -2703,59 +2710,6 @@ Map<String, dynamic> _$GhReposSponsorableToJson(GhReposSponsorable instance) =>
'__typename': instance.resolveType,
};
GhReposOrganization _$GhReposOrganizationFromJson(Map<String, dynamic> json) {
return GhReposOrganization(
pinnableItems: json['pinnableItems'] == null
? null
: GhReposPinnableItemConnection.fromJson(
json['pinnableItems'] as Map<String, dynamic>),
)
..resolveType = json['__typename'] as String
..login = json['login'] as String
..avatarUrl = json['avatarUrl'] as String;
}
Map<String, dynamic> _$GhReposOrganizationToJson(
GhReposOrganization instance) =>
<String, dynamic>{
'pinnableItems': instance.pinnableItems?.toJson(),
'__typename': instance.resolveType,
'login': instance.login,
'avatarUrl': instance.avatarUrl,
};
GhReposPinnableItemConnection _$GhReposPinnableItemConnectionFromJson(
Map<String, dynamic> json) {
return GhReposPinnableItemConnection(
pageInfo: json['pageInfo'] == null
? null
: GhReposPageInfo.fromJson(json['pageInfo'] as Map<String, dynamic>),
nodes: (json['nodes'] as List)
?.map((e) => e == null
? null
: GhReposPinnableItem.fromJson(e as Map<String, dynamic>))
?.toList(),
);
}
Map<String, dynamic> _$GhReposPinnableItemConnectionToJson(
GhReposPinnableItemConnection instance) =>
<String, dynamic>{
'pageInfo': instance.pageInfo?.toJson(),
'nodes': instance.nodes?.map((e) => e?.toJson())?.toList(),
};
GhReposMemberStatusable _$GhReposMemberStatusableFromJson(
Map<String, dynamic> json) {
return GhReposMemberStatusable()..resolveType = json['__typename'] as String;
}
Map<String, dynamic> _$GhReposMemberStatusableToJson(
GhReposMemberStatusable instance) =>
<String, dynamic>{
'__typename': instance.resolveType,
};
GhReposArguments _$GhReposArgumentsFromJson(Map<String, dynamic> json) {
return GhReposArguments(
owner: json['owner'] as String,

View File

@ -1,103 +1,68 @@
query GhRepos($owner: String!, $after: String, $isStar: Boolean!) {
repositoryOwner(login: $owner) {
user(login: $owner) {
__typename
login
avatarUrl
... on User {
repositories(
first: 30
after: $after
orderBy: { field: UPDATED_AT, direction: DESC }
) @skip(if: $isStar) {
totalCount # TODO:
pageInfo {
hasNextPage
endCursor
}
nodes {
owner {
login
avatarUrl
}
name
description
isPrivate
isFork
updatedAt
stargazers {
totalCount
}
forks {
totalCount
}
primaryLanguage {
color
name
}
}
repositories(
first: 30
after: $after
orderBy: { field: UPDATED_AT, direction: DESC }
) @skip(if: $isStar) {
totalCount # TODO:
pageInfo {
hasNextPage
endCursor
}
starredRepositories(
first: 30
after: $after
orderBy: { field: STARRED_AT, direction: DESC }
) @include(if: $isStar) {
pageInfo {
hasNextPage
endCursor
nodes {
owner {
login
avatarUrl
}
nodes {
owner {
login
avatarUrl
}
name
description
isPrivate
isFork
updatedAt
stargazers {
totalCount
}
forks {
totalCount
}
primaryLanguage {
color
name
description
isPrivate
isFork
updatedAt
stargazers {
totalCount
}
forks {
totalCount
}
primaryLanguage {
color
name
}
}
}
}
... on Organization {
pinnableItems(first: 30, after: $after, types: [REPOSITORY])
@skip(if: $isStar) {
__typename
pageInfo {
hasNextPage
endCursor
starredRepositories(
first: 30
after: $after
orderBy: { field: STARRED_AT, direction: DESC }
) @include(if: $isStar) {
pageInfo {
hasNextPage
endCursor
}
nodes {
owner {
login
avatarUrl
}
nodes {
... on Repository {
owner {
login
avatarUrl
}
name
description
isPrivate
isFork
updatedAt
stargazers {
totalCount
}
forks {
totalCount
}
primaryLanguage {
color
name
}
}
name
description
isPrivate
isFork
updatedAt
stargazers {
totalCount
}
forks {
totalCount
}
primaryLanguage {
color
name
}
}
}

View File

@ -25,33 +25,19 @@ class GhReposScreen extends StatelessWidget {
GhReposQuery(
variables:
GhReposArguments(owner: owner, isStar: isStar, after: cursor)));
final data = res.data.repositoryOwner;
switch (data.resolveType) {
case 'User':
final user = data as GhReposUser;
if (isStar) {
return ListPayload(
cursor: user.starredRepositories.pageInfo.endCursor,
items: user.starredRepositories.nodes,
hasMore: user.starredRepositories.pageInfo.hasNextPage,
);
} else {
return ListPayload(
cursor: user.repositories.pageInfo.endCursor,
items: user.repositories.nodes,
hasMore: user.repositories.pageInfo.hasNextPage,
);
}
break;
case 'Organization':
final org = data as GhReposOrganization;
return ListPayload(
cursor: org.pinnableItems.pageInfo.endCursor,
items: org.pinnableItems.nodes,
hasMore: org.pinnableItems.pageInfo.hasNextPage,
);
default:
return null;
final data = res.data.user;
if (isStar) {
return ListPayload(
cursor: data.starredRepositories.pageInfo.endCursor,
items: data.starredRepositories.nodes,
hasMore: data.starredRepositories.pageInfo.hasNextPage,
);
} else {
return ListPayload(
cursor: data.repositories.pageInfo.endCursor,
items: data.repositories.nodes,
hasMore: data.repositories.pageInfo.hasNextPage,
);
}
}