mirror of
https://github.com/git-touch/git-touch
synced 2025-02-01 08:26:53 +01:00
feat: handle release event
This commit is contained in:
parent
829c7fa514
commit
5f340e4502
@ -59,6 +59,7 @@ class GithubEventPayload {
|
||||
GithubEventIssue issue;
|
||||
GithubEventIssue pullRequest;
|
||||
GithubEventComment comment;
|
||||
GithubEventRelease release;
|
||||
String action;
|
||||
String ref;
|
||||
String before;
|
||||
@ -92,7 +93,7 @@ class GithubEventIssue {
|
||||
_$GithubEventIssueFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class GithubEventComment {
|
||||
String body;
|
||||
GithubEventUser user;
|
||||
@ -103,7 +104,7 @@ class GithubEventComment {
|
||||
_$GithubEventCommentFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class GithubEventCommit {
|
||||
String sha;
|
||||
String message;
|
||||
@ -114,6 +115,17 @@ class GithubEventCommit {
|
||||
_$GithubEventCommitFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class GithubEventRelease {
|
||||
String htmlUrl;
|
||||
String tagName;
|
||||
|
||||
GithubEventRelease();
|
||||
|
||||
factory GithubEventRelease.fromJson(Map<String, dynamic> json) =>
|
||||
_$GithubEventReleaseFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class GithubTrendingItem {
|
||||
String author;
|
||||
|
@ -65,6 +65,9 @@ GithubEventPayload _$GithubEventPayloadFromJson(Map<String, dynamic> json) {
|
||||
..comment = json['comment'] == null
|
||||
? null
|
||||
: GithubEventComment.fromJson(json['comment'] as Map<String, dynamic>)
|
||||
..release = json['release'] == null
|
||||
? null
|
||||
: GithubEventRelease.fromJson(json['release'] as Map<String, dynamic>)
|
||||
..action = json['action'] as String
|
||||
..ref = json['ref'] as String
|
||||
..before = json['before'] as String
|
||||
@ -82,6 +85,7 @@ Map<String, dynamic> _$GithubEventPayloadToJson(GithubEventPayload instance) =>
|
||||
'issue': instance.issue,
|
||||
'pull_request': instance.pullRequest,
|
||||
'comment': instance.comment,
|
||||
'release': instance.release,
|
||||
'action': instance.action,
|
||||
'ref': instance.ref,
|
||||
'before': instance.before,
|
||||
@ -146,6 +150,18 @@ Map<String, dynamic> _$GithubEventCommitToJson(GithubEventCommit instance) =>
|
||||
'message': instance.message,
|
||||
};
|
||||
|
||||
GithubEventRelease _$GithubEventReleaseFromJson(Map<String, dynamic> json) {
|
||||
return GithubEventRelease()
|
||||
..htmlUrl = json['html_url'] as String
|
||||
..tagName = json['tag_name'] as String;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$GithubEventReleaseToJson(GithubEventRelease instance) =>
|
||||
<String, dynamic>{
|
||||
'html_url': instance.htmlUrl,
|
||||
'tag_name': instance.tagName,
|
||||
};
|
||||
|
||||
GithubTrendingItem _$GithubTrendingItemFromJson(Map<String, dynamic> json) {
|
||||
return GithubTrendingItem()
|
||||
..author = json['author'] as String
|
||||
|
@ -367,6 +367,16 @@ class EventItem extends StatelessWidget {
|
||||
card: _buildCommitsCard(context),
|
||||
);
|
||||
case 'ReleaseEvent':
|
||||
return _buildItem(
|
||||
context: context,
|
||||
spans: [
|
||||
TextSpan(text: ' released '),
|
||||
_buildLinkSpan(
|
||||
context, e.payload.release.tagName, e.payload.release.htmlUrl),
|
||||
TextSpan(text: ' at '),
|
||||
_buildRepo(context)
|
||||
],
|
||||
);
|
||||
case 'RepositoryEvent':
|
||||
case 'RepositoryImportEvent':
|
||||
case 'RepositoryVulnerabilityAlertEvent':
|
||||
|
Loading…
x
Reference in New Issue
Block a user