refactor: user screen types

This commit is contained in:
Rongjian Zhang
2019-12-07 21:12:48 +08:00
parent 0543138f71
commit 6259faf935
4 changed files with 81 additions and 132 deletions

View File

@@ -35,11 +35,17 @@ class GithubUserRepositoryOwner with EquatableMixin {
return _$GithubUserRepositoryOwnerFromJson(json);
}
String login;
String avatarUrl;
String url;
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [resolveType];
List<Object> get props => [login, avatarUrl, url, resolveType];
Map<String, dynamic> toJson() {
switch (resolveType) {
case 'User':
@@ -70,12 +76,8 @@ class GithubUserUser extends GithubUserAuditEntryActor
factory GithubUserUser.fromJson(Map<String, dynamic> json) =>
_$GithubUserUserFromJson(json);
String login;
String name;
String avatarUrl;
String bio;
String company;
@@ -100,17 +102,22 @@ class GithubUserUser extends GithubUserAuditEntryActor
bool viewerIsFollowing;
String url;
@override
@JsonKey(name: '__typename')
String resolveType;
@override
String login;
@override
String avatarUrl;
@override
String url;
@override
List<Object> get props => [
login,
name,
avatarUrl,
bio,
company,
location,
@@ -123,8 +130,10 @@ class GithubUserUser extends GithubUserAuditEntryActor
pinnedItems,
viewerCanFollow,
viewerIsFollowing,
url,
resolveType
resolveType,
login,
avatarUrl,
url
];
Map<String, dynamic> toJson() => _$GithubUserUserToJson(this);
}
@@ -466,17 +475,11 @@ class GithubUserActor with EquatableMixin {
factory GithubUserActor.fromJson(Map<String, dynamic> json) =>
_$GithubUserActorFromJson(json);
String login;
String avatarUrl;
String url;
@JsonKey(name: '__typename')
String resolveType;
@override
List<Object> get props => [login, avatarUrl, url, resolveType];
List<Object> get props => [resolveType];
Map<String, dynamic> toJson() => _$GithubUserActorToJson(this);
}
@@ -487,8 +490,6 @@ class GithubUserProfileOwner with EquatableMixin {
factory GithubUserProfileOwner.fromJson(Map<String, dynamic> json) =>
_$GithubUserProfileOwnerFromJson(json);
String login;
String name;
String location;
@@ -504,7 +505,7 @@ class GithubUserProfileOwner with EquatableMixin {
@override
List<Object> get props =>
[login, name, location, email, websiteUrl, pinnedItems, resolveType];
[name, location, email, websiteUrl, pinnedItems, resolveType];
Map<String, dynamic> toJson() => _$GithubUserProfileOwnerToJson(this);
}
@@ -542,12 +543,8 @@ class GithubUserOrganization extends GithubUserAuditEntryActor
factory GithubUserOrganization.fromJson(Map<String, dynamic> json) =>
_$GithubUserOrganizationFromJson(json);
String login;
String name;
String avatarUrl;
String description;
String location;
@@ -556,8 +553,6 @@ class GithubUserOrganization extends GithubUserAuditEntryActor
String websiteUrl;
String url;
GithubUserPinnableItemConnection pinnedItems;
GithubUserPinnableItemConnection pinnableItems;
@@ -568,20 +563,29 @@ class GithubUserOrganization extends GithubUserAuditEntryActor
@JsonKey(name: '__typename')
String resolveType;
@override
String login;
@override
String avatarUrl;
@override
String url;
@override
List<Object> get props => [
login,
name,
avatarUrl,
description,
location,
email,
websiteUrl,
url,
pinnedItems,
pinnableItems,
membersWithRole,
resolveType
resolveType,
login,
avatarUrl,
url
];
Map<String, dynamic> toJson() => _$GithubUserOrganizationToJson(this);
}
@@ -665,30 +669,36 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
arguments: [],
directives: [],
selectionSet: null),
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: 'url'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
InlineFragmentNode(
typeCondition: TypeConditionNode(
on: NamedTypeNode(
name: NameNode(value: 'User'), isNonNull: false)),
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'bio'),
alias: null,
@@ -803,12 +813,6 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'login'),
alias: null,
@@ -940,13 +944,6 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(
value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name:
NameNode(value: 'login'),
@@ -1053,12 +1050,6 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'url'),
alias: null,
arguments: [],
directives: [],
selectionSet: null)
])),
InlineFragmentNode(
@@ -1068,24 +1059,12 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
isNonNull: false)),
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'login'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'name'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'avatarUrl'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'description'),
alias: null,
@@ -1110,12 +1089,6 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'url'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name: NameNode(value: 'pinnedItems'),
alias: null,
@@ -1154,13 +1127,6 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(
value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name:
NameNode(value: 'login'),
@@ -1306,13 +1272,6 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
directives: [],
selectionSet:
SelectionSetNode(selections: [
FieldNode(
name: NameNode(
value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode(
name:
NameNode(value: 'login'),