mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-29 11:03:05 -05:00
refactor: contribution api
This commit is contained in:
@@ -72,6 +72,8 @@ class GithubMeUser extends GithubMeAuditEntryActor
|
||||
@override
|
||||
GithubMeRepositoryConnection repositories;
|
||||
|
||||
GithubMeContributionsCollection contributionsCollection;
|
||||
|
||||
@override
|
||||
@JsonKey(name: '__typename')
|
||||
String resolveType;
|
||||
@@ -91,6 +93,7 @@ class GithubMeUser extends GithubMeAuditEntryActor
|
||||
followers,
|
||||
following,
|
||||
repositories,
|
||||
contributionsCollection,
|
||||
resolveType
|
||||
];
|
||||
Map<String, dynamic> toJson() => _$GithubMeUserToJson(this);
|
||||
@@ -154,6 +157,66 @@ class GithubMeRepositoryConnection with EquatableMixin {
|
||||
Map<String, dynamic> toJson() => _$GithubMeRepositoryConnectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeContributionsCollection with EquatableMixin {
|
||||
GithubMeContributionsCollection();
|
||||
|
||||
factory GithubMeContributionsCollection.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeContributionsCollectionFromJson(json);
|
||||
|
||||
GithubMeContributionCalendar contributionCalendar;
|
||||
|
||||
@override
|
||||
List<Object> get props => [contributionCalendar];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubMeContributionsCollectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeContributionCalendar with EquatableMixin {
|
||||
GithubMeContributionCalendar();
|
||||
|
||||
factory GithubMeContributionCalendar.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeContributionCalendarFromJson(json);
|
||||
|
||||
List<GithubMeContributionCalendarWeek> weeks;
|
||||
|
||||
@override
|
||||
List<Object> get props => [weeks];
|
||||
Map<String, dynamic> toJson() => _$GithubMeContributionCalendarToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeContributionCalendarWeek with EquatableMixin {
|
||||
GithubMeContributionCalendarWeek();
|
||||
|
||||
factory GithubMeContributionCalendarWeek.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubMeContributionCalendarWeekFromJson(json);
|
||||
|
||||
List<GithubMeContributionCalendarDay> contributionDays;
|
||||
|
||||
@override
|
||||
List<Object> get props => [contributionDays];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubMeContributionCalendarWeekToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeContributionCalendarDay with EquatableMixin {
|
||||
GithubMeContributionCalendarDay();
|
||||
|
||||
factory GithubMeContributionCalendarDay.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubMeContributionCalendarDayFromJson(json);
|
||||
|
||||
String color;
|
||||
|
||||
@override
|
||||
List<Object> get props => [color];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubMeContributionCalendarDayToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubMeAuditEntryActor with EquatableMixin {
|
||||
GithubMeAuditEntryActor();
|
||||
@@ -452,6 +515,41 @@ class GithubMeQuery extends GraphQLQuery<GithubMe, JsonSerializable> {
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
])),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'contributionsCollection'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'contributionCalendar'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'weeks'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'contributionDays'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet:
|
||||
SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'color'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
]))
|
||||
]))
|
||||
]))
|
||||
]))
|
||||
]))
|
||||
]))
|
||||
|
||||
@@ -44,6 +44,10 @@ GithubMeUser _$GithubMeUserFromJson(Map<String, dynamic> json) {
|
||||
? null
|
||||
: GithubMeRepositoryConnection.fromJson(
|
||||
json['repositories'] as Map<String, dynamic>)
|
||||
..contributionsCollection = json['contributionsCollection'] == null
|
||||
? null
|
||||
: GithubMeContributionsCollection.fromJson(
|
||||
json['contributionsCollection'] as Map<String, dynamic>)
|
||||
..resolveType = json['__typename'] as String;
|
||||
}
|
||||
|
||||
@@ -62,6 +66,7 @@ Map<String, dynamic> _$GithubMeUserToJson(GithubMeUser instance) =>
|
||||
'followers': instance.followers?.toJson(),
|
||||
'following': instance.following?.toJson(),
|
||||
'repositories': instance.repositories?.toJson(),
|
||||
'contributionsCollection': instance.contributionsCollection?.toJson(),
|
||||
'__typename': instance.resolveType,
|
||||
};
|
||||
|
||||
@@ -110,6 +115,67 @@ Map<String, dynamic> _$GithubMeRepositoryConnectionToJson(
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubMeContributionsCollection _$GithubMeContributionsCollectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeContributionsCollection()
|
||||
..contributionCalendar = json['contributionCalendar'] == null
|
||||
? null
|
||||
: GithubMeContributionCalendar.fromJson(
|
||||
json['contributionCalendar'] as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeContributionsCollectionToJson(
|
||||
GithubMeContributionsCollection instance) =>
|
||||
<String, dynamic>{
|
||||
'contributionCalendar': instance.contributionCalendar?.toJson(),
|
||||
};
|
||||
|
||||
GithubMeContributionCalendar _$GithubMeContributionCalendarFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeContributionCalendar()
|
||||
..weeks = (json['weeks'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubMeContributionCalendarWeek.fromJson(
|
||||
e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeContributionCalendarToJson(
|
||||
GithubMeContributionCalendar instance) =>
|
||||
<String, dynamic>{
|
||||
'weeks': instance.weeks?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubMeContributionCalendarWeek _$GithubMeContributionCalendarWeekFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeContributionCalendarWeek()
|
||||
..contributionDays = (json['contributionDays'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubMeContributionCalendarDay.fromJson(
|
||||
e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeContributionCalendarWeekToJson(
|
||||
GithubMeContributionCalendarWeek instance) =>
|
||||
<String, dynamic>{
|
||||
'contributionDays':
|
||||
instance.contributionDays?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubMeContributionCalendarDay _$GithubMeContributionCalendarDayFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeContributionCalendarDay()..color = json['color'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubMeContributionCalendarDayToJson(
|
||||
GithubMeContributionCalendarDay instance) =>
|
||||
<String, dynamic>{
|
||||
'color': instance.color,
|
||||
};
|
||||
|
||||
GithubMeAuditEntryActor _$GithubMeAuditEntryActorFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubMeAuditEntryActor();
|
||||
|
||||
@@ -21,5 +21,14 @@
|
||||
repositories {
|
||||
totalCount
|
||||
}
|
||||
contributionsCollection {
|
||||
contributionCalendar {
|
||||
weeks {
|
||||
contributionDays {
|
||||
color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,8 @@ class GithubUserUser extends GithubUserAuditEntryActor
|
||||
|
||||
GithubUserFollowingConnection following;
|
||||
|
||||
GithubUserContributionsCollection contributionsCollection;
|
||||
|
||||
GithubUserRepositoryConnection repositories;
|
||||
|
||||
GithubUserPinnableItemConnection pinnedItems;
|
||||
@@ -126,6 +128,7 @@ class GithubUserUser extends GithubUserAuditEntryActor
|
||||
starredRepositories,
|
||||
followers,
|
||||
following,
|
||||
contributionsCollection,
|
||||
repositories,
|
||||
pinnedItems,
|
||||
viewerCanFollow,
|
||||
@@ -182,6 +185,68 @@ class GithubUserFollowingConnection with EquatableMixin {
|
||||
Map<String, dynamic> toJson() => _$GithubUserFollowingConnectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubUserContributionsCollection with EquatableMixin {
|
||||
GithubUserContributionsCollection();
|
||||
|
||||
factory GithubUserContributionsCollection.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubUserContributionsCollectionFromJson(json);
|
||||
|
||||
GithubUserContributionCalendar contributionCalendar;
|
||||
|
||||
@override
|
||||
List<Object> get props => [contributionCalendar];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubUserContributionsCollectionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubUserContributionCalendar with EquatableMixin {
|
||||
GithubUserContributionCalendar();
|
||||
|
||||
factory GithubUserContributionCalendar.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubUserContributionCalendarFromJson(json);
|
||||
|
||||
List<GithubUserContributionCalendarWeek> weeks;
|
||||
|
||||
@override
|
||||
List<Object> get props => [weeks];
|
||||
Map<String, dynamic> toJson() => _$GithubUserContributionCalendarToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubUserContributionCalendarWeek with EquatableMixin {
|
||||
GithubUserContributionCalendarWeek();
|
||||
|
||||
factory GithubUserContributionCalendarWeek.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubUserContributionCalendarWeekFromJson(json);
|
||||
|
||||
List<GithubUserContributionCalendarDay> contributionDays;
|
||||
|
||||
@override
|
||||
List<Object> get props => [contributionDays];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubUserContributionCalendarWeekToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubUserContributionCalendarDay with EquatableMixin {
|
||||
GithubUserContributionCalendarDay();
|
||||
|
||||
factory GithubUserContributionCalendarDay.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$GithubUserContributionCalendarDayFromJson(json);
|
||||
|
||||
String color;
|
||||
|
||||
@override
|
||||
List<Object> get props => [color];
|
||||
Map<String, dynamic> toJson() =>
|
||||
_$GithubUserContributionCalendarDayToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GithubUserRepositoryConnection with EquatableMixin {
|
||||
GithubUserRepositoryConnection();
|
||||
@@ -768,6 +833,44 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
])),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'contributionsCollection'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'contributionCalendar'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(value: 'weeks'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet:
|
||||
SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name: NameNode(
|
||||
value: 'contributionDays'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet:
|
||||
SelectionSetNode(selections: [
|
||||
FieldNode(
|
||||
name:
|
||||
NameNode(value: 'color'),
|
||||
alias: null,
|
||||
arguments: [],
|
||||
directives: [],
|
||||
selectionSet: null)
|
||||
]))
|
||||
]))
|
||||
]))
|
||||
])),
|
||||
FieldNode(
|
||||
name: NameNode(value: 'repositories'),
|
||||
alias: null,
|
||||
|
||||
@@ -57,6 +57,10 @@ GithubUserUser _$GithubUserUserFromJson(Map<String, dynamic> json) {
|
||||
? null
|
||||
: GithubUserFollowingConnection.fromJson(
|
||||
json['following'] as Map<String, dynamic>)
|
||||
..contributionsCollection = json['contributionsCollection'] == null
|
||||
? null
|
||||
: GithubUserContributionsCollection.fromJson(
|
||||
json['contributionsCollection'] as Map<String, dynamic>)
|
||||
..repositories = json['repositories'] == null
|
||||
? null
|
||||
: GithubUserRepositoryConnection.fromJson(
|
||||
@@ -84,6 +88,7 @@ Map<String, dynamic> _$GithubUserUserToJson(GithubUserUser instance) =>
|
||||
'starredRepositories': instance.starredRepositories?.toJson(),
|
||||
'followers': instance.followers?.toJson(),
|
||||
'following': instance.following?.toJson(),
|
||||
'contributionsCollection': instance.contributionsCollection?.toJson(),
|
||||
'repositories': instance.repositories?.toJson(),
|
||||
'pinnedItems': instance.pinnedItems?.toJson(),
|
||||
'viewerCanFollow': instance.viewerCanFollow,
|
||||
@@ -129,6 +134,67 @@ Map<String, dynamic> _$GithubUserFollowingConnectionToJson(
|
||||
'totalCount': instance.totalCount,
|
||||
};
|
||||
|
||||
GithubUserContributionsCollection _$GithubUserContributionsCollectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubUserContributionsCollection()
|
||||
..contributionCalendar = json['contributionCalendar'] == null
|
||||
? null
|
||||
: GithubUserContributionCalendar.fromJson(
|
||||
json['contributionCalendar'] as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubUserContributionsCollectionToJson(
|
||||
GithubUserContributionsCollection instance) =>
|
||||
<String, dynamic>{
|
||||
'contributionCalendar': instance.contributionCalendar?.toJson(),
|
||||
};
|
||||
|
||||
GithubUserContributionCalendar _$GithubUserContributionCalendarFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubUserContributionCalendar()
|
||||
..weeks = (json['weeks'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubUserContributionCalendarWeek.fromJson(
|
||||
e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubUserContributionCalendarToJson(
|
||||
GithubUserContributionCalendar instance) =>
|
||||
<String, dynamic>{
|
||||
'weeks': instance.weeks?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubUserContributionCalendarWeek _$GithubUserContributionCalendarWeekFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubUserContributionCalendarWeek()
|
||||
..contributionDays = (json['contributionDays'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: GithubUserContributionCalendarDay.fromJson(
|
||||
e as Map<String, dynamic>))
|
||||
?.toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubUserContributionCalendarWeekToJson(
|
||||
GithubUserContributionCalendarWeek instance) =>
|
||||
<String, dynamic>{
|
||||
'contributionDays':
|
||||
instance.contributionDays?.map((e) => e?.toJson())?.toList(),
|
||||
};
|
||||
|
||||
GithubUserContributionCalendarDay _$GithubUserContributionCalendarDayFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubUserContributionCalendarDay()..color = json['color'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubUserContributionCalendarDayToJson(
|
||||
GithubUserContributionCalendarDay instance) =>
|
||||
<String, dynamic>{
|
||||
'color': instance.color,
|
||||
};
|
||||
|
||||
GithubUserRepositoryConnection _$GithubUserRepositoryConnectionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return GithubUserRepositoryConnection()
|
||||
|
||||
@@ -20,6 +20,15 @@ query($login: String!) {
|
||||
following {
|
||||
totalCount
|
||||
}
|
||||
contributionsCollection {
|
||||
contributionCalendar {
|
||||
weeks {
|
||||
contributionDays {
|
||||
color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories(
|
||||
first: 6
|
||||
ownerAffiliations: OWNER
|
||||
|
||||
Reference in New Issue
Block a user