Go client library for accessing the GitHub API v3
Overall
score
65%
Build a small library that lists repository webhooks with page-number pagination and walks webhook delivery history with cursor-based pagination, exposing navigation data so callers can follow subsequent pages or stop when finished.
after/before/page token) and a page size, returning delivery summaries plus the next/previous cursor tokens needed to continue traversal. @testmaxDeliveries items by following delivery cursors until the limit is hit or no further pages are available, keeping the newest-first ordering used by the API. @test@generates
type HookSummary struct {
ID int64
Name string
TargetURL string
Active bool
}
type HookPageResult struct {
Hooks []HookSummary
Page int
NextPage int
PrevPage int
FirstPage int
LastPage int
}
type DeliverySummary struct {
ID int64
Event string
Status string
Redelivery bool
}
type DeliveryPageResult struct {
Deliveries []DeliverySummary
After string
Before string
NextCursor string
HasNext bool
HasPrev bool
}
type Pager interface {
ListHooks(ctx context.Context, owner, repo string, page, perPage int) (HookPageResult, error)
ListDeliveries(ctx context.Context, owner, repo string, hookID int64, after, before string, perPage int) (DeliveryPageResult, error)
CollectDeliveries(ctx context.Context, owner, repo string, hookID int64, maxDeliveries int, perPage int) ([]DeliverySummary, error)
}
// NewPager returns an implementation backed by a GitHub REST client.
// token may be empty for unauthenticated requests.
func NewPager(httpClient *http.Client, token string) PagerTyped GitHub REST client with pagination helpers.
HTTP client configuration.
Install with Tessl CLI
npx tessl i tessl/golang-github-com-google-go-githubdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10