Skip to content

Commit 27929dd

Browse files
authored
Merge pull request #294 from SpinlockLabs/fix_gists
Fix getting gists
2 parents d4325c1 + 5f4a221 commit 27929dd

File tree

14 files changed

+182
-30
lines changed

14 files changed

+182
-30
lines changed

lib/src/common/model/gists.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:json_annotation/json_annotation.dart';
55
part 'gists.g.dart';
66

77
/// Model class for gists.
8-
@JsonSerializable(createToJson: false)
8+
@JsonSerializable()
99
class Gist {
1010
Gist({
1111
this.id,
@@ -26,7 +26,7 @@ class Gist {
2626
bool? public;
2727
User? owner;
2828
User? user;
29-
List<GistFile>? files;
29+
Map<String, GistFile>? files;
3030

3131
@JsonKey(name: 'html_url')
3232
String? htmlUrl;
@@ -47,24 +47,24 @@ class Gist {
4747
DateTime? updatedAt;
4848

4949
factory Gist.fromJson(Map<String, dynamic> input) => _$GistFromJson(input);
50+
Map<String, dynamic> toJson() => _$GistToJson(this);
5051
}
5152

5253
/// Model class for a gist file.
53-
@JsonSerializable(createToJson: false)
54+
@JsonSerializable()
5455
class GistFile {
5556
GistFile({
56-
this.name,
57+
this.filename,
5758
this.size,
5859
this.rawUrl,
5960
this.type,
6061
this.language,
6162
this.truncated,
6263
this.content,
6364
});
64-
String? name;
65-
int? size;
6665

67-
@JsonKey(name: 'raw_url')
66+
String? filename;
67+
int? size;
6868
String? rawUrl;
6969
String? type;
7070
String? language;
@@ -73,10 +73,11 @@ class GistFile {
7373

7474
factory GistFile.fromJson(Map<String, dynamic> input) =>
7575
_$GistFileFromJson(input);
76+
Map<String, dynamic> toJson() => _$GistFileToJson(this);
7677
}
7778

7879
/// Model class for a gist fork.
79-
@JsonSerializable(createToJson: false)
80+
@JsonSerializable()
8081
class GistFork {
8182
GistFork({this.user, this.id, this.createdAt, this.updatedAt});
8283
User? user;
@@ -90,10 +91,11 @@ class GistFork {
9091

9192
factory GistFork.fromJson(Map<String, dynamic> input) =>
9293
_$GistForkFromJson(input);
94+
Map<String, dynamic> toJson() => _$GistForkToJson(this);
9395
}
9496

9597
/// Model class for a gits history entry.
96-
@JsonSerializable(createToJson: false)
98+
@JsonSerializable()
9799
class GistHistoryEntry {
98100
GistHistoryEntry({
99101
this.version,
@@ -121,6 +123,7 @@ class GistHistoryEntry {
121123

122124
factory GistHistoryEntry.fromJson(Map<String, dynamic> input) =>
123125
_$GistHistoryEntryFromJson(input);
126+
Map<String, dynamic> toJson() => _$GistHistoryEntryToJson(this);
124127
}
125128

126129
/// Model class for gist comments.

lib/src/common/model/gists.g.dart

Lines changed: 46 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/common/model/misc.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
33
part 'misc.g.dart';
44

55
/// Model class for a Gitignore Template.
6-
@JsonSerializable(createToJson: false)
6+
@JsonSerializable()
77
class GitignoreTemplate {
88
GitignoreTemplate({this.name, this.source});
99

@@ -15,6 +15,7 @@ class GitignoreTemplate {
1515

1616
factory GitignoreTemplate.fromJson(Map<String, dynamic> input) =>
1717
_$GitignoreTemplateFromJson(input);
18+
Map<String, dynamic> toJson() => _$GitignoreTemplateToJson(this);
1819
}
1920

2021
/// Model class for GitHub Rate Limit Information.

lib/src/common/model/misc.g.dart

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/common/model/notifications.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:json_annotation/json_annotation.dart';
44
part 'notifications.g.dart';
55

66
/// Model class for notifications.
7-
@JsonSerializable(createToJson: false)
7+
@JsonSerializable()
88
class Notification {
99
Notification({
1010
this.id,
@@ -36,10 +36,11 @@ class Notification {
3636

3737
factory Notification.fromJson(Map<String, dynamic> input) =>
3838
_$NotificationFromJson(input);
39+
Map<String, dynamic> toJson() => _$NotificationToJson(this);
3940
}
4041

4142
/// Model class for a notification subject.
42-
@JsonSerializable(createToJson: false)
43+
@JsonSerializable()
4344
class NotificationSubject {
4445
NotificationSubject({this.title, this.type, this.url, this.latestCommentUrl});
4546
final String? title;
@@ -51,4 +52,5 @@ class NotificationSubject {
5152

5253
factory NotificationSubject.fromJson(Map<String, dynamic> input) =>
5354
_$NotificationSubjectFromJson(input);
55+
Map<String, dynamic> toJson() => _$NotificationSubjectToJson(this);
5456
}

lib/src/common/model/notifications.g.dart

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/common/model/orgs.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Organization {
8282
}
8383

8484
/// Model class for organization membership.
85-
@JsonSerializable(createToJson: false)
85+
@JsonSerializable()
8686
class OrganizationMembership {
8787
OrganizationMembership({
8888
this.state,
@@ -94,10 +94,11 @@ class OrganizationMembership {
9494
factory OrganizationMembership.fromJson(Map<String, dynamic> input) {
9595
return _$OrganizationMembershipFromJson(input);
9696
}
97+
Map<String, dynamic> toJson() => _$OrganizationMembershipToJson(this);
9798
}
9899

99100
/// Model class for a GitHub team.
100-
@JsonSerializable(createToJson: false)
101+
@JsonSerializable()
101102
class Team {
102103
Team({
103104
this.name,
@@ -131,6 +132,7 @@ class Team {
131132
factory Team.fromJson(Map<String, dynamic> input) {
132133
return _$TeamFromJson(input);
133134
}
135+
Map<String, dynamic> toJson() => _$TeamToJson(this);
134136
}
135137

136138
/// Model class for the team membership state.
@@ -145,7 +147,7 @@ class TeamMembershipState {
145147
}
146148

147149
/// Model class for a team member.
148-
@JsonSerializable(createToJson: false)
150+
@JsonSerializable()
149151
class TeamMember {
150152
TeamMember(
151153
{this.login,
@@ -179,4 +181,5 @@ class TeamMember {
179181
factory TeamMember.fromJson(Map<String, dynamic> input) {
180182
return _$TeamMemberFromJson(input);
181183
}
184+
Map<String, dynamic> toJson() => _$TeamMemberToJson(this);
182185
}

lib/src/common/model/orgs.g.dart

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/common/model/repos.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
33

44
part 'repos.g.dart';
55

6-
@JsonSerializable(
7-
createToJson: false,
8-
)
6+
@JsonSerializable()
97
class GitHubComparison {
108
final String? url;
119
final String? status;
@@ -19,6 +17,7 @@ class GitHubComparison {
1917

2018
factory GitHubComparison.fromJson(Map<String, dynamic> json) =>
2119
_$GitHubComparisonFromJson(json);
20+
Map<String, dynamic> toJson() => _$GitHubComparisonToJson(this);
2221

2322
@override
2423
String toString() {
@@ -201,7 +200,7 @@ class RepositoryPermissions {
201200
Map<String, dynamic> toJson() => _$RepositoryPermissionsToJson(this);
202201
}
203202

204-
@JsonSerializable(createToJson: false)
203+
@JsonSerializable()
205204
class Tag {
206205
final String name;
207206
final CommitInfo commit;
@@ -213,6 +212,7 @@ class Tag {
213212
Tag(this.name, this.commit, this.zipUrl, this.tarUrl);
214213

215214
factory Tag.fromJson(Map<String, dynamic> input) => _$TagFromJson(input);
215+
Map<String, dynamic> toJson() => _$TagToJson(this);
216216

217217
@override
218218
String toString() => 'Tag: $name';

0 commit comments

Comments
 (0)