Skip to content

Commit ef75901

Browse files
fixed issues and issue-comment payloads
1 parent 0de5d83 commit ef75901

File tree

2 files changed

+79
-340
lines changed

2 files changed

+79
-340
lines changed

github/payload.go

Lines changed: 64 additions & 284 deletions
Original file line numberDiff line numberDiff line change
@@ -876,60 +876,64 @@ type InstallationRepositoriesPayload struct {
876876
SiteAdmin bool `json:"site_admin"`
877877
} `json:"sender"`
878878
}
879+
type Issue struct {
880+
URL string `json:"url"`
881+
RepositoryURL string `json:"repository_url"`
882+
LabelsURL string `json:"labels_url"`
883+
CommentsURL string `json:"comments_url"`
884+
EventsURL string `json:"events_url"`
885+
HTMLURL string `json:"html_url"`
886+
ID int64 `json:"id"`
887+
NodeID string `json:"node_id"`
888+
Number int64 `json:"number"`
889+
Title string `json:"title"`
890+
User struct {
891+
Login string `json:"login"`
892+
ID int64 `json:"id"`
893+
NodeID string `json:"node_id"`
894+
AvatarURL string `json:"avatar_url"`
895+
GravatarID string `json:"gravatar_id"`
896+
URL string `json:"url"`
897+
HTMLURL string `json:"html_url"`
898+
FollowersURL string `json:"followers_url"`
899+
FollowingURL string `json:"following_url"`
900+
GistsURL string `json:"gists_url"`
901+
StarredURL string `json:"starred_url"`
902+
SubscriptionsURL string `json:"subscriptions_url"`
903+
OrganizationsURL string `json:"organizations_url"`
904+
ReposURL string `json:"repos_url"`
905+
EventsURL string `json:"events_url"`
906+
ReceivedEventsURL string `json:"received_events_url"`
907+
Type string `json:"type"`
908+
SiteAdmin bool `json:"site_admin"`
909+
} `json:"user"`
910+
Labels []struct {
911+
ID int64 `json:"id"`
912+
NodeID string `json:"node_id"`
913+
// TODO check if label description should be removed:
914+
// Description string `json:"description"`
915+
URL string `json:"url"`
916+
Name string `json:"name"`
917+
Color string `json:"color"`
918+
Default bool `json:"default"`
919+
} `json:"labels"`
920+
AuthorAssociation string `json:"author_association"`
921+
State string `json:"state"`
922+
Locked bool `json:"locked"`
923+
Assignee *Assignee `json:"assignee"`
924+
Assignees []*Assignee `json:"assignees"`
925+
Milestone *Milestone `json:"milestone"`
926+
Comments int64 `json:"comments"`
927+
CreatedAt time.Time `json:"created_at"`
928+
UpdatedAt time.Time `json:"updated_at"`
929+
ClosedAt *time.Time `json:"closed_at"`
930+
Body string `json:"body"`
931+
}
879932

880933
// IssueCommentPayload contains the information for GitHub's issue_comment hook event
881934
type IssueCommentPayload struct {
882-
Action string `json:"action"`
883-
Issue struct {
884-
URL string `json:"url"`
885-
LabelsURL string `json:"labels_url"`
886-
CommentsURL string `json:"comments_url"`
887-
EventsURL string `json:"events_url"`
888-
HTMLURL string `json:"html_url"`
889-
ID int64 `json:"id"`
890-
NodeID string `json:"node_id"`
891-
Number int64 `json:"number"`
892-
Title string `json:"title"`
893-
User struct {
894-
Login string `json:"login"`
895-
ID int64 `json:"id"`
896-
NodeID string `json:"node_id"`
897-
AvatarURL string `json:"avatar_url"`
898-
GravatarID string `json:"gravatar_id"`
899-
URL string `json:"url"`
900-
HTMLURL string `json:"html_url"`
901-
FollowersURL string `json:"followers_url"`
902-
FollowingURL string `json:"following_url"`
903-
GistsURL string `json:"gists_url"`
904-
StarredURL string `json:"starred_url"`
905-
SubscriptionsURL string `json:"subscriptions_url"`
906-
OrganizationsURL string `json:"organizations_url"`
907-
ReposURL string `json:"repos_url"`
908-
EventsURL string `json:"events_url"`
909-
ReceivedEventsURL string `json:"received_events_url"`
910-
Type string `json:"type"`
911-
SiteAdmin bool `json:"site_admin"`
912-
} `json:"user"`
913-
Labels []struct {
914-
ID int64 `json:"id"`
915-
NodeID string `json:"node_id"`
916-
Description string `json:"description"`
917-
URL string `json:"url"`
918-
Name string `json:"name"`
919-
Color string `json:"color"`
920-
Default bool `json:"default"`
921-
} `json:"labels"`
922-
State string `json:"state"`
923-
Locked bool `json:"locked"`
924-
Assignee *Assignee `json:"assignee"`
925-
Assignees []*Assignee `json:"assignees"`
926-
Milestone *Milestone `json:"milestone"`
927-
Comments int64 `json:"comments"`
928-
CreatedAt time.Time `json:"created_at"`
929-
UpdatedAt time.Time `json:"updated_at"`
930-
ClosedAt *time.Time `json:"closed_at"`
931-
Body string `json:"body"`
932-
} `json:"issue"`
935+
Action string `json:"action"`
936+
Issue Issue `json:"issue"`
933937
Comment struct {
934938
URL string `json:"url"`
935939
HTMLURL string `json:"html_url"`
@@ -961,96 +965,8 @@ type IssueCommentPayload struct {
961965
Body string `json:"body"`
962966
AuthorAssociation string `json:"author_association"`
963967
} `json:"comment"`
964-
Repository struct {
965-
ID int64 `json:"id"`
966-
NodeID string `json:"node_id"`
967-
Name string `json:"name"`
968-
FullName string `json:"full_name"`
969-
Owner struct {
970-
Login string `json:"login"`
971-
ID int64 `json:"id"`
972-
NodeID string `json:"node_id"`
973-
AvatarURL string `json:"avatar_url"`
974-
GravatarID string `json:"gravatar_id"`
975-
URL string `json:"url"`
976-
HTMLURL string `json:"html_url"`
977-
FollowersURL string `json:"followers_url"`
978-
FollowingURL string `json:"following_url"`
979-
GistsURL string `json:"gists_url"`
980-
StarredURL string `json:"starred_url"`
981-
SubscriptionsURL string `json:"subscriptions_url"`
982-
OrganizationsURL string `json:"organizations_url"`
983-
ReposURL string `json:"repos_url"`
984-
EventsURL string `json:"events_url"`
985-
ReceivedEventsURL string `json:"received_events_url"`
986-
Type string `json:"type"`
987-
SiteAdmin bool `json:"site_admin"`
988-
} `json:"owner"`
989-
Private bool `json:"private"`
990-
HTMLURL string `json:"html_url"`
991-
Description string `json:"description"`
992-
Fork bool `json:"fork"`
993-
URL string `json:"url"`
994-
ForksURL string `json:"forks_url"`
995-
KeysURL string `json:"keys_url"`
996-
CollaboratorsURL string `json:"collaborators_url"`
997-
TeamsURL string `json:"teams_url"`
998-
HooksURL string `json:"hooks_url"`
999-
IssueEventsURL string `json:"issue_events_url"`
1000-
EventsURL string `json:"events_url"`
1001-
AssigneesURL string `json:"assignees_url"`
1002-
BranchesURL string `json:"branches_url"`
1003-
TagsURL string `json:"tags_url"`
1004-
BlobsURL string `json:"blobs_url"`
1005-
GitTagsURL string `json:"git_tags_url"`
1006-
GitRefsURL string `json:"git_refs_url"`
1007-
TreesURL string `json:"trees_url"`
1008-
StatusesURL string `json:"statuses_url"`
1009-
LanguagesURL string `json:"languages_url"`
1010-
StargazersURL string `json:"stargazers_url"`
1011-
ContributorsURL string `json:"contributors_url"`
1012-
SubscribersURL string `json:"subscribers_url"`
1013-
SubscriptionURL string `json:"subscription_url"`
1014-
CommitsURL string `json:"commits_url"`
1015-
GitCommitsURL string `json:"git_commits_url"`
1016-
CommentsURL string `json:"comments_url"`
1017-
IssueCommentURL string `json:"issue_comment_url"`
1018-
ContentsURL string `json:"contents_url"`
1019-
CompareURL string `json:"compare_url"`
1020-
MergesURL string `json:"merges_url"`
1021-
ArchiveURL string `json:"archive_url"`
1022-
DownloadsURL string `json:"downloads_url"`
1023-
IssuesURL string `json:"issues_url"`
1024-
PullsURL string `json:"pulls_url"`
1025-
MilestonesURL string `json:"milestones_url"`
1026-
NotificationsURL string `json:"notifications_url"`
1027-
LabelsURL string `json:"labels_url"`
1028-
ReleasesURL string `json:"releases_url"`
1029-
CreatedAt time.Time `json:"created_at"`
1030-
UpdatedAt time.Time `json:"updated_at"`
1031-
PushedAt time.Time `json:"pushed_at"`
1032-
GitURL string `json:"git_url"`
1033-
SSHURL string `json:"ssh_url"`
1034-
CloneURL string `json:"clone_url"`
1035-
SvnURL string `json:"svn_url"`
1036-
Homepage *string `json:"homepage"`
1037-
Size int64 `json:"size"`
1038-
StargazersCount int64 `json:"stargazers_count"`
1039-
WatchersCount int64 `json:"watchers_count"`
1040-
Language *string `json:"language"`
1041-
HasIssues bool `json:"has_issues"`
1042-
HasDownloads bool `json:"has_downloads"`
1043-
HasWiki bool `json:"has_wiki"`
1044-
HasPages bool `json:"has_pages"`
1045-
ForksCount int64 `json:"forks_count"`
1046-
MirrorURL *string `json:"mirror_url"`
1047-
OpenIssuesCount int64 `json:"open_issues_count"`
1048-
Forks int64 `json:"forks"`
1049-
OpenIssues int64 `json:"open_issues"`
1050-
Watchers int64 `json:"watchers"`
1051-
DefaultBranch string `json:"default_branch"`
1052-
} `json:"repository"`
1053-
Sender struct {
968+
Repository Repository `json:"repository"`
969+
Sender struct {
1054970
Login string `json:"login"`
1055971
ID int64 `json:"id"`
1056972
NodeID string `json:"node_id"`
@@ -1070,151 +986,15 @@ type IssueCommentPayload struct {
1070986
Type string `json:"type"`
1071987
SiteAdmin bool `json:"site_admin"`
1072988
} `json:"sender"`
989+
Installation Installation `json:"installation"`
1073990
}
1074991

1075992
// IssuesPayload contains the information for GitHub's issues hook event
1076993
type IssuesPayload struct {
1077-
Action string `json:"action"`
1078-
Issue struct {
1079-
URL string `json:"url"`
1080-
LabelsURL string `json:"labels_url"`
1081-
CommentsURL string `json:"comments_url"`
1082-
EventsURL string `json:"events_url"`
1083-
HTMLURL string `json:"html_url"`
1084-
ID int64 `json:"id"`
1085-
NodeID string `json:"node_id"`
1086-
Number int64 `json:"number"`
1087-
Title string `json:"title"`
1088-
User struct {
1089-
Login string `json:"login"`
1090-
ID int64 `json:"id"`
1091-
NodeID string `json:"node_id"`
1092-
AvatarURL string `json:"avatar_url"`
1093-
GravatarID string `json:"gravatar_id"`
1094-
URL string `json:"url"`
1095-
HTMLURL string `json:"html_url"`
1096-
FollowersURL string `json:"followers_url"`
1097-
FollowingURL string `json:"following_url"`
1098-
GistsURL string `json:"gists_url"`
1099-
StarredURL string `json:"starred_url"`
1100-
SubscriptionsURL string `json:"subscriptions_url"`
1101-
OrganizationsURL string `json:"organizations_url"`
1102-
ReposURL string `json:"repos_url"`
1103-
EventsURL string `json:"events_url"`
1104-
ReceivedEventsURL string `json:"received_events_url"`
1105-
Type string `json:"type"`
1106-
SiteAdmin bool `json:"site_admin"`
1107-
} `json:"user"`
1108-
Labels []struct {
1109-
ID int64 `json:"id"`
1110-
NodeID string `json:"node_id"`
1111-
Description string `json:"description"`
1112-
URL string `json:"url"`
1113-
Name string `json:"name"`
1114-
Color string `json:"color"`
1115-
Default bool `json:"default"`
1116-
} `json:"labels"`
1117-
State string `json:"state"`
1118-
Locked bool `json:"locked"`
1119-
Assignee *Assignee `json:"assignee"`
1120-
Assignees []*Assignee `json:"assignees"`
1121-
Milestone *Milestone `json:"milestone"`
1122-
Comments int64 `json:"comments"`
1123-
CreatedAt time.Time `json:"created_at"`
1124-
UpdatedAt time.Time `json:"updated_at"`
1125-
ClosedAt *time.Time `json:"closed_at"`
1126-
Body string `json:"body"`
1127-
} `json:"issue"`
1128-
Repository struct {
1129-
ID int64 `json:"id"`
1130-
NodeID string `json:"node_id"`
1131-
Name string `json:"name"`
1132-
FullName string `json:"full_name"`
1133-
Owner struct {
1134-
Login string `json:"login"`
1135-
ID int64 `json:"id"`
1136-
NodeID string `json:"node_id"`
1137-
AvatarURL string `json:"avatar_url"`
1138-
GravatarID string `json:"gravatar_id"`
1139-
URL string `json:"url"`
1140-
HTMLURL string `json:"html_url"`
1141-
FollowersURL string `json:"followers_url"`
1142-
FollowingURL string `json:"following_url"`
1143-
GistsURL string `json:"gists_url"`
1144-
StarredURL string `json:"starred_url"`
1145-
SubscriptionsURL string `json:"subscriptions_url"`
1146-
OrganizationsURL string `json:"organizations_url"`
1147-
ReposURL string `json:"repos_url"`
1148-
EventsURL string `json:"events_url"`
1149-
ReceivedEventsURL string `json:"received_events_url"`
1150-
Type string `json:"type"`
1151-
SiteAdmin bool `json:"site_admin"`
1152-
} `json:"owner"`
1153-
Private bool `json:"private"`
1154-
HTMLURL string `json:"html_url"`
1155-
Description string `json:"description"`
1156-
Fork bool `json:"fork"`
1157-
URL string `json:"url"`
1158-
ForksURL string `json:"forks_url"`
1159-
KeysURL string `json:"keys_url"`
1160-
CollaboratorsURL string `json:"collaborators_url"`
1161-
TeamsURL string `json:"teams_url"`
1162-
HooksURL string `json:"hooks_url"`
1163-
IssueEventsURL string `json:"issue_events_url"`
1164-
EventsURL string `json:"events_url"`
1165-
AssigneesURL string `json:"assignees_url"`
1166-
BranchesURL string `json:"branches_url"`
1167-
TagsURL string `json:"tags_url"`
1168-
BlobsURL string `json:"blobs_url"`
1169-
GitTagsURL string `json:"git_tags_url"`
1170-
GitRefsURL string `json:"git_refs_url"`
1171-
TreesURL string `json:"trees_url"`
1172-
StatusesURL string `json:"statuses_url"`
1173-
LanguagesURL string `json:"languages_url"`
1174-
StargazersURL string `json:"stargazers_url"`
1175-
ContributorsURL string `json:"contributors_url"`
1176-
SubscribersURL string `json:"subscribers_url"`
1177-
SubscriptionURL string `json:"subscription_url"`
1178-
CommitsURL string `json:"commits_url"`
1179-
GitCommitsURL string `json:"git_commits_url"`
1180-
CommentsURL string `json:"comments_url"`
1181-
IssueCommentURL string `json:"issue_comment_url"`
1182-
ContentsURL string `json:"contents_url"`
1183-
CompareURL string `json:"compare_url"`
1184-
MergesURL string `json:"merges_url"`
1185-
ArchiveURL string `json:"archive_url"`
1186-
DownloadsURL string `json:"downloads_url"`
1187-
IssuesURL string `json:"issues_url"`
1188-
PullsURL string `json:"pulls_url"`
1189-
MilestonesURL string `json:"milestones_url"`
1190-
NotificationsURL string `json:"notifications_url"`
1191-
LabelsURL string `json:"labels_url"`
1192-
ReleasesURL string `json:"releases_url"`
1193-
CreatedAt time.Time `json:"created_at"`
1194-
UpdatedAt time.Time `json:"updated_at"`
1195-
PushedAt time.Time `json:"pushed_at"`
1196-
GitURL string `json:"git_url"`
1197-
SSHURL string `json:"ssh_url"`
1198-
CloneURL string `json:"clone_url"`
1199-
SvnURL string `json:"svn_url"`
1200-
Homepage *string `json:"homepage"`
1201-
Size int64 `json:"size"`
1202-
StargazersCount int64 `json:"stargazers_count"`
1203-
WatchersCount int64 `json:"watchers_count"`
1204-
Language *string `json:"language"`
1205-
HasIssues bool `json:"has_issues"`
1206-
HasDownloads bool `json:"has_downloads"`
1207-
HasWiki bool `json:"has_wiki"`
1208-
HasPages bool `json:"has_pages"`
1209-
ForksCount int64 `json:"forks_count"`
1210-
MirrorURL *string `json:"mirror_url"`
1211-
OpenIssuesCount int64 `json:"open_issues_count"`
1212-
Forks int64 `json:"forks"`
1213-
OpenIssues int64 `json:"open_issues"`
1214-
Watchers int64 `json:"watchers"`
1215-
DefaultBranch string `json:"default_branch"`
1216-
} `json:"repository"`
1217-
Sender struct {
994+
Action string `json:"action"`
995+
Issue Issue `json:"issue"`
996+
Repository Repository `json:"repository"`
997+
Sender struct {
1218998
Login string `json:"login"`
1219999
ID int64 `json:"id"`
12201000
NodeID string `json:"node_id"`
@@ -1234,8 +1014,8 @@ type IssuesPayload struct {
12341014
Type string `json:"type"`
12351015
SiteAdmin bool `json:"site_admin"`
12361016
} `json:"sender"`
1237-
Assignee *Assignee `json:"assignee"`
1238-
Label *Label `json:"label"`
1017+
Changes interface{} `json:"changes"` //TODO not sure what goes here.
1018+
Installation Installation `json:"installation"`
12391019
}
12401020

12411021
// LabelPayload contains the information for GitHub's label hook event

0 commit comments

Comments
 (0)