Skip to content

Commit c47e022

Browse files
committed
Document Limit, Page, and PerPage fields on all list option structs
Limit caps total results across pages, PerPage controls API page size, Page sets the starting page. Added inline comments to every list opts struct and an expanded doc comment on ListRepoOpts.
1 parent 0056b00 commit c47e022

1 file changed

Lines changed: 38 additions & 33 deletions

File tree

types.go

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,19 @@ const (
9292
)
9393

9494
// ListRepoOpts configures a repo list call.
95+
//
96+
// Pagination: Page and PerPage control the API page size and starting page.
97+
// Limit caps the total number of results returned across all pages. When
98+
// Limit is 0 all results are returned. PerPage defaults to a backend-specific
99+
// value (typically 30-50) when 0.
95100
type ListRepoOpts struct {
96101
Archived ArchivedFilter
97102
Forks ForkFilter
98103
Sort string
99104
Order string
100-
Limit int
101-
Page int
102-
PerPage int
105+
Limit int // max total results; 0 = unlimited
106+
Page int // starting page; 0 or 1 = first page
107+
PerPage int // results per API request; 0 = default
103108
}
104109

105110
// CreateRepoOpts holds options for creating a repository.
@@ -136,9 +141,9 @@ type SearchRepoOpts struct {
136141
Query string
137142
Sort string
138143
Order string
139-
Limit int
140-
Page int
141-
PerPage int
144+
Limit int // max total results; 0 = unlimited
145+
Page int // starting page; 0 or 1 = first page
146+
PerPage int // results per API request; 0 = default
142147
}
143148

144149
// Label represents an issue or pull request label.
@@ -202,9 +207,9 @@ type ListIssueOpts struct {
202207
Author string
203208
Sort string
204209
Order string
205-
Limit int
206-
Page int
207-
PerPage int
210+
Limit int // max total results; 0 = unlimited
211+
Page int // starting page; 0 or 1 = first page
212+
PerPage int // results per API request; 0 = default
208213
}
209214

210215
// UpdateIssueOpts holds options for updating an issue.
@@ -268,9 +273,9 @@ type ListPROpts struct {
268273
Head string
269274
Sort string
270275
Order string
271-
Limit int
272-
Page int
273-
PerPage int
276+
Limit int // max total results; 0 = unlimited
277+
Page int // starting page; 0 or 1 = first page
278+
PerPage int // results per API request; 0 = default
274279
}
275280

276281
// UpdatePROpts holds options for updating a pull request.
@@ -301,9 +306,9 @@ type CreateLabelOpts struct {
301306

302307
// ListLabelOpts holds options for listing labels.
303308
type ListLabelOpts struct {
304-
Limit int
305-
Page int
306-
PerPage int
309+
Limit int // max total results; 0 = unlimited
310+
Page int // starting page; 0 or 1 = first page
311+
PerPage int // results per API request; 0 = default
307312
}
308313

309314
// UpdateLabelOpts holds options for updating a label.
@@ -323,9 +328,9 @@ type CreateMilestoneOpts struct {
323328
// ListMilestoneOpts holds options for listing milestones.
324329
type ListMilestoneOpts struct {
325330
State string // open, closed, all
326-
Limit int
327-
Page int
328-
PerPage int
331+
Limit int // max total results; 0 = unlimited
332+
Page int // starting page; 0 or 1 = first page
333+
PerPage int // results per API request; 0 = default
329334
}
330335

331336
// UpdateMilestoneOpts holds options for updating a milestone.
@@ -376,9 +381,9 @@ type CreateReleaseOpts struct {
376381

377382
// ListReleaseOpts holds options for listing releases.
378383
type ListReleaseOpts struct {
379-
Limit int
380-
Page int
381-
PerPage int
384+
Limit int // max total results; 0 = unlimited
385+
Page int // starting page; 0 or 1 = first page
386+
PerPage int // results per API request; 0 = default
382387
}
383388

384389
// UpdateReleaseOpts holds options for updating a release.
@@ -401,9 +406,9 @@ type Branch struct {
401406

402407
// ListBranchOpts holds options for listing branches.
403408
type ListBranchOpts struct {
404-
Limit int
405-
Page int
406-
PerPage int
409+
Limit int // max total results; 0 = unlimited
410+
Page int // starting page; 0 or 1 = first page
411+
PerPage int // results per API request; 0 = default
407412
}
408413

409414
// CIRun holds normalized metadata about a CI pipeline or workflow run.
@@ -440,9 +445,9 @@ type ListCIRunOpts struct {
440445
Status string
441446
User string
442447
Workflow string
443-
Limit int
444-
Page int
445-
PerPage int
448+
Limit int // max total results; 0 = unlimited
449+
Page int // starting page; 0 or 1 = first page
450+
PerPage int // results per API request; 0 = default
446451
}
447452

448453
// TriggerCIRunOpts holds options for triggering a CI run.
@@ -470,9 +475,9 @@ type CreateDeployKeyOpts struct {
470475

471476
// ListDeployKeyOpts holds options for listing deploy keys.
472477
type ListDeployKeyOpts struct {
473-
Limit int
474-
Page int
475-
PerPage int
478+
Limit int // max total results; 0 = unlimited
479+
Page int // starting page; 0 or 1 = first page
480+
PerPage int // results per API request; 0 = default
476481
}
477482

478483
// Secret holds normalized metadata about a repository secret.
@@ -490,7 +495,7 @@ type SetSecretOpts struct {
490495

491496
// ListSecretOpts holds options for listing secrets.
492497
type ListSecretOpts struct {
493-
Limit int
494-
Page int
495-
PerPage int
498+
Limit int // max total results; 0 = unlimited
499+
Page int // starting page; 0 or 1 = first page
500+
PerPage int // results per API request; 0 = default
496501
}

0 commit comments

Comments
 (0)