Skip to content

Commit 1202368

Browse files
committed
preserver reactions field
1 parent 99bb24a commit 1202368

File tree

1 file changed

+46
-18
lines changed

1 file changed

+46
-18
lines changed

pkg/github/minimal_types.go

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,40 @@ type MinimalProject struct {
136136
OwnerType string `json:"owner_type,omitempty"`
137137
}
138138

139+
// MinimalReactions is the trimmed output type for reaction summaries, dropping the API URL.
140+
type MinimalReactions struct {
141+
TotalCount int `json:"total_count"`
142+
PlusOne int `json:"+1"`
143+
MinusOne int `json:"-1"`
144+
Laugh int `json:"laugh"`
145+
Confused int `json:"confused"`
146+
Heart int `json:"heart"`
147+
Hooray int `json:"hooray"`
148+
Rocket int `json:"rocket"`
149+
Eyes int `json:"eyes"`
150+
}
151+
139152
// MinimalIssue is the trimmed output type for issue objects to reduce verbosity.
140153
type MinimalIssue struct {
141-
Number int `json:"number"`
142-
Title string `json:"title"`
143-
Body string `json:"body,omitempty"`
144-
State string `json:"state"`
145-
StateReason string `json:"state_reason,omitempty"`
146-
Draft bool `json:"draft,omitempty"`
147-
Locked bool `json:"locked,omitempty"`
148-
HTMLURL string `json:"html_url"`
149-
User *MinimalUser `json:"user,omitempty"`
150-
Labels []string `json:"labels,omitempty"`
151-
Assignees []string `json:"assignees,omitempty"`
152-
Milestone string `json:"milestone,omitempty"`
153-
Comments int `json:"comments,omitempty"`
154-
CreatedAt string `json:"created_at,omitempty"`
155-
UpdatedAt string `json:"updated_at,omitempty"`
156-
ClosedAt string `json:"closed_at,omitempty"`
157-
ClosedBy string `json:"closed_by,omitempty"`
158-
IssueType string `json:"issue_type,omitempty"`
154+
Number int `json:"number"`
155+
Title string `json:"title"`
156+
Body string `json:"body,omitempty"`
157+
State string `json:"state"`
158+
StateReason string `json:"state_reason,omitempty"`
159+
Draft bool `json:"draft,omitempty"`
160+
Locked bool `json:"locked,omitempty"`
161+
HTMLURL string `json:"html_url"`
162+
User *MinimalUser `json:"user,omitempty"`
163+
Labels []string `json:"labels,omitempty"`
164+
Assignees []string `json:"assignees,omitempty"`
165+
Milestone string `json:"milestone,omitempty"`
166+
Comments int `json:"comments,omitempty"`
167+
Reactions *MinimalReactions `json:"reactions,omitempty"`
168+
CreatedAt string `json:"created_at,omitempty"`
169+
UpdatedAt string `json:"updated_at,omitempty"`
170+
ClosedAt string `json:"closed_at,omitempty"`
171+
ClosedBy string `json:"closed_by,omitempty"`
172+
IssueType string `json:"issue_type,omitempty"`
159173
}
160174

161175
// Helper functions
@@ -208,6 +222,20 @@ func convertToMinimalIssue(issue *github.Issue) MinimalIssue {
208222
m.IssueType = issueType.GetName()
209223
}
210224

225+
if r := issue.Reactions; r != nil {
226+
m.Reactions = &MinimalReactions{
227+
TotalCount: r.GetTotalCount(),
228+
PlusOne: r.GetPlusOne(),
229+
MinusOne: r.GetMinusOne(),
230+
Laugh: r.GetLaugh(),
231+
Confused: r.GetConfused(),
232+
Heart: r.GetHeart(),
233+
Hooray: r.GetHooray(),
234+
Rocket: r.GetRocket(),
235+
Eyes: r.GetEyes(),
236+
}
237+
}
238+
211239
return m
212240
}
213241

0 commit comments

Comments
 (0)