Skip to content

Commit 3a8cf0c

Browse files
authored
Address feedback
1 parent 74712bd commit 3a8cf0c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

github/projects.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@ type ProjectsService service
1818

1919
func (p ProjectV2) String() string { return Stringify(p) }
2020

21-
// ListProjectsOptions specifies optional parameters to list organization projects.
21+
// ListProjectsOptions specifies optional parameters to list projects for user / organization.
2222
type ListProjectsOptions struct {
23+
// A cursor, as given in the Link header. If specified, the query only searches for events before this cursor.
24+
Before string `url:"before,omitempty"`
25+
26+
// A cursor, as given in the Link header. If specified, the query only searches for events after this cursor.
27+
After string `url:"after,omitempty"`
28+
29+
// For paginated result sets, the number of results to include per page.
30+
PerPage int `url:"per_page,omitempty"`
31+
2332
// Q is an optional query string to filter/search projects (when supported).
24-
Q string `url:"q,omitempty"`
25-
ListOptions
26-
ListCursorOptions
33+
Query string `url:"q,omitempty"`
2734
}
2835

2936
// ListOrganizationProjects lists Projects V2 for an organization.

github/projects_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestProjectsService_ListOrganizationProjects(t *testing.T) {
1919
fmt.Fprint(w, `[{"id":1,"title":"T1","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}]`)
2020
})
2121

22-
opts := &ListProjectsOptions{Q: "alpha", ListOptions: ListOptions{Page: 2, PerPage: 1}}
22+
opts := &ListProjectsOptions{Query: "alpha", After: "2", Before: "1"}
2323
ctx := context.Background()
2424
projects, _, err := client.Projects.ListOrganizationProjects(ctx, "o", opts)
2525
if err != nil {
@@ -80,11 +80,11 @@ func TestProjectsService_ListUserProjects(t *testing.T) {
8080
mux.HandleFunc("/users/u/projectsV2", func(w http.ResponseWriter, r *http.Request) {
8181
testMethod(t, r, "GET")
8282
testHeader(t, r, "Accept", mediaTypeProjectsPreview)
83-
testFormValues(t, r, values{"q": "beta", "page": "1", "per_page": "2"})
83+
testFormValues(t, r, values{"q": "beta", "before": "1", "after": "2", "per_page": "2"})
8484
fmt.Fprint(w, `[{"id":2,"title":"UProj","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}]`)
8585
})
8686

87-
opts := &ListProjectsOptions{Q: "beta", ListOptions: ListOptions{Page: 1, PerPage: 2}}
87+
opts := &ListProjectsOptions{Query: "beta", Before: "1", After: "2", PerPage: 2}
8888
ctx := context.Background()
8989
projects, _, err := client.Projects.ListByUser(ctx, "u", opts)
9090
if err != nil {

0 commit comments

Comments
 (0)