Skip to content

Commit c9e1ad0

Browse files
authored
Add issue Type to IssueRequest (#3567)
1 parent bdd7396 commit c9e1ad0

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

github/github-accessors.go

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/issues.go

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type IssueRequest struct {
9090
StateReason *string `json:"state_reason,omitempty"`
9191
Milestone *int `json:"milestone,omitempty"`
9292
Assignees *[]string `json:"assignees,omitempty"`
93+
Type *string `json:"type,omitempty"`
9394
}
9495

9596
// IssueListOptions specifies the optional parameters to the IssuesService.List

github/issues_test.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func TestIssuesService_Edit(t *testing.T) {
314314
t.Parallel()
315315
client, mux, _ := setup(t)
316316

317-
input := &IssueRequest{Title: Ptr("t")}
317+
input := &IssueRequest{Title: Ptr("t"), Type: Ptr("bug")}
318318

319319
mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) {
320320
v := new(IssueRequest)
@@ -325,7 +325,7 @@ func TestIssuesService_Edit(t *testing.T) {
325325
t.Errorf("Request body = %+v, want %+v", v, input)
326326
}
327327

328-
fmt.Fprint(w, `{"number":1}`)
328+
fmt.Fprint(w, `{"number":1, "type": {"name": "bug"}}`)
329329
})
330330

331331
ctx := context.Background()
@@ -334,7 +334,7 @@ func TestIssuesService_Edit(t *testing.T) {
334334
t.Errorf("Issues.Edit returned error: %v", err)
335335
}
336336

337-
want := &Issue{Number: Ptr(1)}
337+
want := &Issue{Number: Ptr(1), Type: &IssueType{Name: Ptr("bug")}}
338338
if !cmp.Equal(issue, want) {
339339
t.Errorf("Issues.Edit returned %+v, want %+v", issue, want)
340340
}
@@ -529,6 +529,7 @@ func TestIssueRequest_Marshal(t *testing.T) {
529529
State: Ptr("url"),
530530
Milestone: Ptr(1),
531531
Assignees: &[]string{"a"},
532+
Type: Ptr("issue_type"),
532533
}
533534

534535
want := `{
@@ -542,7 +543,8 @@ func TestIssueRequest_Marshal(t *testing.T) {
542543
"milestone": 1,
543544
"assignees": [
544545
"a"
545-
]
546+
],
547+
"type": "issue_type"
546548
}`
547549

548550
testJSONMarshal(t, u, want)
@@ -582,6 +584,7 @@ func TestIssue_Marshal(t *testing.T) {
582584
NodeID: Ptr("nid"),
583585
TextMatches: []*TextMatch{{ObjectURL: Ptr("ourl")}},
584586
ActiveLockReason: Ptr("alr"),
587+
Type: &IssueType{Name: Ptr("bug")},
585588
}
586589

587590
want := `{
@@ -639,7 +642,10 @@ func TestIssue_Marshal(t *testing.T) {
639642
"object_url": "ourl"
640643
}
641644
],
642-
"active_lock_reason": "alr"
645+
"active_lock_reason": "alr",
646+
"type": {
647+
"name": "bug"
648+
}
643649
}`
644650

645651
testJSONMarshal(t, u, want)

0 commit comments

Comments
 (0)