Skip to content

Commit a6bf1d5

Browse files
committed
增加一些model
1 parent 52ee8fe commit a6bf1d5

20 files changed

Lines changed: 1007 additions & 0 deletions

‎lib/common/model/Event.dart‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'package:gsy_github_app_flutter/common/model/EventPayload.dart';
2+
import 'package:gsy_github_app_flutter/common/model/Repository.dart';
3+
import 'package:gsy_github_app_flutter/common/model/User.dart';
4+
import 'package:json_annotation/json_annotation.dart';
5+
6+
/**
7+
* Created by guoshuyu
8+
* Date: 2018-07-31
9+
*/
10+
11+
part 'Event.g.dart';
12+
13+
@JsonSerializable()
14+
class Event extends Object with _$EventSerializerMixin {
15+
String id;
16+
String type;
17+
User actor;
18+
Repository repo;
19+
User org;
20+
EventPayload payload;
21+
@JsonKey(name: "public")
22+
bool isPublic;
23+
@JsonKey(name: "created_at")
24+
DateTime createdAt;
25+
26+
Event(
27+
this.id,
28+
this.type,
29+
this.actor,
30+
this.repo,
31+
this.org,
32+
this.payload,
33+
this.isPublic,
34+
this.createdAt,
35+
);
36+
37+
factory Event.fromJson(Map<String, dynamic> json) => _$EventFromJson(json);
38+
}

‎lib/common/model/Event.g.dart‎

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

‎lib/common/model/EventPayload.dart‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import 'package:gsy_github_app_flutter/common/model/Issue.dart';
2+
import 'package:gsy_github_app_flutter/common/model/IssueEvent.dart';
3+
import 'package:gsy_github_app_flutter/common/model/PushEventCommit.dart';
4+
import 'package:gsy_github_app_flutter/common/model/Release.dart';
5+
import 'package:json_annotation/json_annotation.dart';
6+
7+
/**
8+
* Created by guoshuyu
9+
* Date: 2018-07-31
10+
*/
11+
12+
part 'EventPayload.g.dart';
13+
14+
@JsonSerializable()
15+
class EventPayload extends Object with _$EventPayloadSerializerMixin {
16+
17+
@JsonKey(name: "push_id")
18+
String pushId;
19+
int size;
20+
@JsonKey(name: "distinct_size")
21+
int distinctSize;
22+
String ref;
23+
String head;
24+
String before;
25+
List<PushEventCommit> commits;
26+
27+
String action;
28+
@JsonKey(name: "ref_type")
29+
String refType;
30+
@JsonKey(name: "master_branch")
31+
String masterBranch;
32+
String description;
33+
@JsonKey(name: "pusher_type")
34+
String pusherType;
35+
36+
Release release;
37+
Issue issue;
38+
IssueEvent comment;
39+
40+
EventPayload();
41+
42+
factory EventPayload.fromJson(Map<String, dynamic> json) => _$EventPayloadFromJson(json);
43+
}

‎lib/common/model/EventPayload.g.dart‎

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

‎lib/common/model/Issue.dart‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import 'package:gsy_github_app_flutter/common/model/User.dart';
2+
import 'package:json_annotation/json_annotation.dart';
3+
4+
/**
5+
* Created by guoshuyu
6+
* Date: 2018-07-31
7+
*/
8+
9+
part 'Issue.g.dart';
10+
11+
@JsonSerializable()
12+
class Issue extends Object with _$IssueSerializerMixin {
13+
String id;
14+
int number;
15+
String title;
16+
String state;
17+
bool locked;
18+
@JsonKey(name: "comments")
19+
int commentNum;
20+
21+
@JsonKey(name: "created_at")
22+
DateTime createdAt;
23+
@JsonKey(name: "updated_at")
24+
DateTime updatedAt;
25+
@JsonKey(name: "closed_at")
26+
DateTime closedAt;
27+
String body;
28+
@JsonKey(name: "body_html")
29+
String bodyHtml;
30+
31+
User user;
32+
@JsonKey(name: "repository_url")
33+
String repoUrl;
34+
@JsonKey(name: "html_url")
35+
String htmlUrl;
36+
37+
Issue(
38+
this.id,
39+
this.number,
40+
this.title,
41+
this.state,
42+
this.locked,
43+
this.commentNum,
44+
this.createdAt,
45+
this.updatedAt,
46+
this.closedAt,
47+
this.body,
48+
this.bodyHtml,
49+
this.user,
50+
this.repoUrl,
51+
this.htmlUrl,
52+
);
53+
54+
factory Issue.fromJson(Map<String, dynamic> json) => _$IssueFromJson(json);
55+
}

‎lib/common/model/Issue.g.dart‎

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

‎lib/common/model/IssueEvent.dart‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import 'package:gsy_github_app_flutter/common/model/User.dart';
2+
import 'package:json_annotation/json_annotation.dart';
3+
4+
/**
5+
* Created by guoshuyu
6+
* Date: 2018-07-31
7+
*/
8+
9+
part 'IssueEvent.g.dart';
10+
11+
@JsonSerializable()
12+
class IssueEvent extends Object with _$IssueEventSerializerMixin {
13+
String id;
14+
User user;
15+
@JsonKey(name: "created_at")
16+
DateTime createdAt;
17+
@JsonKey(name: "updated_at")
18+
DateTime updatedAt;
19+
@JsonKey(name: "author_association")
20+
String authorAssociation;
21+
String body;
22+
@JsonKey(name: "body_html")
23+
String bodyHtml;
24+
@JsonKey(name: "event")
25+
String type;
26+
@JsonKey(name: "html_url")
27+
String htmlUrl;
28+
29+
IssueEvent(
30+
this.id,
31+
this.user,
32+
this.createdAt,
33+
this.updatedAt,
34+
this.authorAssociation,
35+
this.body,
36+
this.bodyHtml,
37+
this.type,
38+
this.htmlUrl,
39+
);
40+
41+
factory IssueEvent.fromJson(Map<String, dynamic> json) => _$IssueEventFromJson(json);
42+
}

0 commit comments

Comments
 (0)