Skip to content

Commit

Permalink
Merge pull request #294 from SpinlockLabs/fix_gists
Browse files Browse the repository at this point in the history
Fix getting gists
  • Loading branch information
robrbecker committed Jan 9, 2022
2 parents d4325c1 + 5f4a221 commit 27929dd
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 30 deletions.
21 changes: 12 additions & 9 deletions lib/src/common/model/gists.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:json_annotation/json_annotation.dart';
part 'gists.g.dart';

/// Model class for gists.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class Gist {
Gist({
this.id,
Expand All @@ -26,7 +26,7 @@ class Gist {
bool? public;
User? owner;
User? user;
List<GistFile>? files;
Map<String, GistFile>? files;

@JsonKey(name: 'html_url')
String? htmlUrl;
Expand All @@ -47,24 +47,24 @@ class Gist {
DateTime? updatedAt;

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

/// Model class for a gist file.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class GistFile {
GistFile({
this.name,
this.filename,
this.size,
this.rawUrl,
this.type,
this.language,
this.truncated,
this.content,
});
String? name;
int? size;

@JsonKey(name: 'raw_url')
String? filename;
int? size;
String? rawUrl;
String? type;
String? language;
Expand All @@ -73,10 +73,11 @@ class GistFile {

factory GistFile.fromJson(Map<String, dynamic> input) =>
_$GistFileFromJson(input);
Map<String, dynamic> toJson() => _$GistFileToJson(this);
}

/// Model class for a gist fork.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class GistFork {
GistFork({this.user, this.id, this.createdAt, this.updatedAt});
User? user;
Expand All @@ -90,10 +91,11 @@ class GistFork {

factory GistFork.fromJson(Map<String, dynamic> input) =>
_$GistForkFromJson(input);
Map<String, dynamic> toJson() => _$GistForkToJson(this);
}

/// Model class for a gits history entry.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class GistHistoryEntry {
GistHistoryEntry({
this.version,
Expand Down Expand Up @@ -121,6 +123,7 @@ class GistHistoryEntry {

factory GistHistoryEntry.fromJson(Map<String, dynamic> input) =>
_$GistHistoryEntryFromJson(input);
Map<String, dynamic> toJson() => _$GistHistoryEntryToJson(this);
}

/// Model class for gist comments.
Expand Down
50 changes: 46 additions & 4 deletions lib/src/common/model/gists.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/src/common/model/misc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
part 'misc.g.dart';

/// Model class for a Gitignore Template.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class GitignoreTemplate {
GitignoreTemplate({this.name, this.source});

Expand All @@ -15,6 +15,7 @@ class GitignoreTemplate {

factory GitignoreTemplate.fromJson(Map<String, dynamic> input) =>
_$GitignoreTemplateFromJson(input);
Map<String, dynamic> toJson() => _$GitignoreTemplateToJson(this);
}

/// Model class for GitHub Rate Limit Information.
Expand Down
6 changes: 6 additions & 0 deletions lib/src/common/model/misc.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/src/common/model/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:json_annotation/json_annotation.dart';
part 'notifications.g.dart';

/// Model class for notifications.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class Notification {
Notification({
this.id,
Expand Down Expand Up @@ -36,10 +36,11 @@ class Notification {

factory Notification.fromJson(Map<String, dynamic> input) =>
_$NotificationFromJson(input);
Map<String, dynamic> toJson() => _$NotificationToJson(this);
}

/// Model class for a notification subject.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class NotificationSubject {
NotificationSubject({this.title, this.type, this.url, this.latestCommentUrl});
final String? title;
Expand All @@ -51,4 +52,5 @@ class NotificationSubject {

factory NotificationSubject.fromJson(Map<String, dynamic> input) =>
_$NotificationSubjectFromJson(input);
Map<String, dynamic> toJson() => _$NotificationSubjectToJson(this);
}
22 changes: 22 additions & 0 deletions lib/src/common/model/notifications.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions lib/src/common/model/orgs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Organization {
}

/// Model class for organization membership.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class OrganizationMembership {
OrganizationMembership({
this.state,
Expand All @@ -94,10 +94,11 @@ class OrganizationMembership {
factory OrganizationMembership.fromJson(Map<String, dynamic> input) {
return _$OrganizationMembershipFromJson(input);
}
Map<String, dynamic> toJson() => _$OrganizationMembershipToJson(this);
}

/// Model class for a GitHub team.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class Team {
Team({
this.name,
Expand Down Expand Up @@ -131,6 +132,7 @@ class Team {
factory Team.fromJson(Map<String, dynamic> input) {
return _$TeamFromJson(input);
}
Map<String, dynamic> toJson() => _$TeamToJson(this);
}

/// Model class for the team membership state.
Expand All @@ -145,7 +147,7 @@ class TeamMembershipState {
}

/// Model class for a team member.
@JsonSerializable(createToJson: false)
@JsonSerializable()
class TeamMember {
TeamMember(
{this.login,
Expand Down Expand Up @@ -179,4 +181,5 @@ class TeamMember {
factory TeamMember.fromJson(Map<String, dynamic> input) {
return _$TeamMemberFromJson(input);
}
Map<String, dynamic> toJson() => _$TeamMemberToJson(this);
}
26 changes: 26 additions & 0 deletions lib/src/common/model/orgs.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/src/common/model/repos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import 'package:json_annotation/json_annotation.dart';

part 'repos.g.dart';

@JsonSerializable(
createToJson: false,
)
@JsonSerializable()
class GitHubComparison {
final String? url;
final String? status;
Expand All @@ -19,6 +17,7 @@ class GitHubComparison {

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

@override
String toString() {
Expand Down Expand Up @@ -201,7 +200,7 @@ class RepositoryPermissions {
Map<String, dynamic> toJson() => _$RepositoryPermissionsToJson(this);
}

@JsonSerializable(createToJson: false)
@JsonSerializable()
class Tag {
final String name;
final CommitInfo commit;
Expand All @@ -213,6 +212,7 @@ class Tag {
Tag(this.name, this.commit, this.zipUrl, this.tarUrl);

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

@override
String toString() => 'Tag: $name';
Expand Down

0 comments on commit 27929dd

Please sign in to comment.