mirror of
https://github.com/google/go-github.git
synced 2026-10-28 16:34:37 +08:00
8502 lines
206 KiB
Go
8502 lines
206 KiB
Go
// Code generated by gen-iterators; DO NOT EDIT.
|
|
// Instead, please run "go generate ./..." as described here:
|
|
// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
|
|
|
|
// Copyright 2026 The go-github AUTHORS. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package github
|
|
|
|
import (
|
|
"context"
|
|
"iter"
|
|
)
|
|
|
|
// ListArtifactsIter returns an iterator that paginates through all results of ListArtifacts.
|
|
func (s *ActionsService) ListArtifactsIter(ctx context.Context, owner string, repo string, opts *ListArtifactsOptions) iter.Seq2[*Artifact, error] {
|
|
return func(yield func(*Artifact, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListArtifactsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListArtifacts(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Artifact
|
|
if results != nil {
|
|
iterItems = results.Artifacts
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCacheUsageByRepoForOrgIter returns an iterator that paginates through all results of ListCacheUsageByRepoForOrg.
|
|
func (s *ActionsService) ListCacheUsageByRepoForOrgIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsCacheUsage, error] {
|
|
return func(yield func(*ActionsCacheUsage, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCacheUsageByRepoForOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsCacheUsage
|
|
if results != nil {
|
|
iterItems = results.RepoCacheUsage
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCachesIter returns an iterator that paginates through all results of ListCaches.
|
|
func (s *ActionsService) ListCachesIter(ctx context.Context, owner string, repo string, opts *ActionsCacheListOptions) iter.Seq2[*ActionsCache, error] {
|
|
return func(yield func(*ActionsCache, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ActionsCacheListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCaches(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsCache
|
|
if results != nil {
|
|
iterItems = results.ActionsCaches
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEnabledOrgsInEnterpriseIter returns an iterator that paginates through all results of ListEnabledOrgsInEnterprise.
|
|
func (s *ActionsService) ListEnabledOrgsInEnterpriseIter(ctx context.Context, owner string, opts *ListOptions) iter.Seq2[*Organization, error] {
|
|
return func(yield func(*Organization, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEnabledOrgsInEnterprise(ctx, owner, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Organization
|
|
if results != nil {
|
|
iterItems = results.Organizations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEnabledReposInOrgIter returns an iterator that paginates through all results of ListEnabledReposInOrg.
|
|
func (s *ActionsService) ListEnabledReposInOrgIter(ctx context.Context, owner string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEnabledReposInOrg(ctx, owner, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEnvSecretsIter returns an iterator that paginates through all results of ListEnvSecrets.
|
|
func (s *ActionsService) ListEnvSecretsIter(ctx context.Context, owner string, repo string, env string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEnvSecrets(ctx, owner, repo, env, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEnvVariablesIter returns an iterator that paginates through all results of ListEnvVariables.
|
|
func (s *ActionsService) ListEnvVariablesIter(ctx context.Context, owner string, repo string, env string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEnvVariables(ctx, owner, repo, env, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHostedRunnersIter returns an iterator that paginates through all results of ListHostedRunners.
|
|
func (s *ActionsService) ListHostedRunnersIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*HostedRunner, error] {
|
|
return func(yield func(*HostedRunner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHostedRunners(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*HostedRunner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets.
|
|
func (s *ActionsService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgSecrets(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgVariablesIter returns an iterator that paginates through all results of ListOrgVariables.
|
|
func (s *ActionsService) ListOrgVariablesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgVariables(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationPoliciesIter returns an iterator that paginates through all results of ListOrganizationPolicies.
|
|
func (s *ActionsService) ListOrganizationPoliciesIter(ctx context.Context, org string, opts *ActionsPolicyListOptions) iter.Seq2[*ActionsPolicy, error] {
|
|
return func(yield func(*ActionsPolicy, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ActionsPolicyListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationPolicies(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsPolicy
|
|
if results != nil {
|
|
iterItems = results.Policies
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationRunnerGroupsIter returns an iterator that paginates through all results of ListOrganizationRunnerGroups.
|
|
func (s *ActionsService) ListOrganizationRunnerGroupsIter(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) iter.Seq2[*RunnerGroup, error] {
|
|
return func(yield func(*RunnerGroup, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOrgRunnerGroupOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationRunnerGroups(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*RunnerGroup
|
|
if results != nil {
|
|
iterItems = results.RunnerGroups
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationRunnersIter returns an iterator that paginates through all results of ListOrganizationRunners.
|
|
func (s *ActionsService) ListOrganizationRunnersIter(ctx context.Context, org string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] {
|
|
return func(yield func(*Runner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListRunnersOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationRunners(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Runner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoOrgSecretsIter returns an iterator that paginates through all results of ListRepoOrgSecrets.
|
|
func (s *ActionsService) ListRepoOrgSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoOrgSecrets(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoOrgVariablesIter returns an iterator that paginates through all results of ListRepoOrgVariables.
|
|
func (s *ActionsService) ListRepoOrgVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoOrgVariables(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets.
|
|
func (s *ActionsService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoVariablesIter returns an iterator that paginates through all results of ListRepoVariables.
|
|
func (s *ActionsService) ListRepoVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoVariables(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter returns an iterator that paginates through all results of ListRepositoriesSelfHostedRunnersAllowedInOrganization.
|
|
func (s *ActionsService) ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoriesSelfHostedRunnersAllowedInOrganization(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryAccessRunnerGroupIter returns an iterator that paginates through all results of ListRepositoryAccessRunnerGroup.
|
|
func (s *ActionsService) ListRepositoryAccessRunnerGroupIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryAccessRunnerGroup(ctx, org, groupID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryPoliciesIter returns an iterator that paginates through all results of ListRepositoryPolicies.
|
|
func (s *ActionsService) ListRepositoryPoliciesIter(ctx context.Context, owner string, repo string, opts *ActionsPolicyListOptions) iter.Seq2[*ActionsPolicy, error] {
|
|
return func(yield func(*ActionsPolicy, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ActionsPolicyListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryPolicies(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsPolicy
|
|
if results != nil {
|
|
iterItems = results.Policies
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryWorkflowRunsIter returns an iterator that paginates through all results of ListRepositoryWorkflowRuns.
|
|
func (s *ActionsService) ListRepositoryWorkflowRunsIter(ctx context.Context, owner string, repo string, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] {
|
|
return func(yield func(*WorkflowRun, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListWorkflowRunsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryWorkflowRuns(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*WorkflowRun
|
|
if results != nil {
|
|
iterItems = results.WorkflowRuns
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRunnerGroupHostedRunnersIter returns an iterator that paginates through all results of ListRunnerGroupHostedRunners.
|
|
func (s *ActionsService) ListRunnerGroupHostedRunnersIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*HostedRunner, error] {
|
|
return func(yield func(*HostedRunner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRunnerGroupHostedRunners(ctx, org, groupID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*HostedRunner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRunnerGroupRunnersIter returns an iterator that paginates through all results of ListRunnerGroupRunners.
|
|
func (s *ActionsService) ListRunnerGroupRunnersIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*Runner, error] {
|
|
return func(yield func(*Runner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRunnerGroupRunners(ctx, org, groupID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Runner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRunnersIter returns an iterator that paginates through all results of ListRunners.
|
|
func (s *ActionsService) ListRunnersIter(ctx context.Context, owner string, repo string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] {
|
|
return func(yield func(*Runner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListRunnersOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRunners(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Runner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret.
|
|
func (s *ActionsService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForOrgVariableIter returns an iterator that paginates through all results of ListSelectedReposForOrgVariable.
|
|
func (s *ActionsService) ListSelectedReposForOrgVariableIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForOrgVariable(ctx, org, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWorkflowJobsIter returns an iterator that paginates through all results of ListWorkflowJobs.
|
|
func (s *ActionsService) ListWorkflowJobsIter(ctx context.Context, owner string, repo string, runID int64, opts *ListWorkflowJobsOptions) iter.Seq2[*WorkflowJob, error] {
|
|
return func(yield func(*WorkflowJob, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListWorkflowJobsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWorkflowJobs(ctx, owner, repo, runID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*WorkflowJob
|
|
if results != nil {
|
|
iterItems = results.Jobs
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWorkflowJobsAttemptIter returns an iterator that paginates through all results of ListWorkflowJobsAttempt.
|
|
func (s *ActionsService) ListWorkflowJobsAttemptIter(ctx context.Context, owner string, repo string, runID int64, attemptNumber int64, opts *ListOptions) iter.Seq2[*WorkflowJob, error] {
|
|
return func(yield func(*WorkflowJob, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWorkflowJobsAttempt(ctx, owner, repo, runID, attemptNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*WorkflowJob
|
|
if results != nil {
|
|
iterItems = results.Jobs
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWorkflowRunArtifactsIter returns an iterator that paginates through all results of ListWorkflowRunArtifacts.
|
|
func (s *ActionsService) ListWorkflowRunArtifactsIter(ctx context.Context, owner string, repo string, runID int64, opts *ListOptions) iter.Seq2[*Artifact, error] {
|
|
return func(yield func(*Artifact, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWorkflowRunArtifacts(ctx, owner, repo, runID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Artifact
|
|
if results != nil {
|
|
iterItems = results.Artifacts
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWorkflowRunsByFileNameIter returns an iterator that paginates through all results of ListWorkflowRunsByFileName.
|
|
func (s *ActionsService) ListWorkflowRunsByFileNameIter(ctx context.Context, owner string, repo string, workflowFileName string, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] {
|
|
return func(yield func(*WorkflowRun, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListWorkflowRunsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWorkflowRunsByFileName(ctx, owner, repo, workflowFileName, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*WorkflowRun
|
|
if results != nil {
|
|
iterItems = results.WorkflowRuns
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWorkflowRunsByIDIter returns an iterator that paginates through all results of ListWorkflowRunsByID.
|
|
func (s *ActionsService) ListWorkflowRunsByIDIter(ctx context.Context, owner string, repo string, workflowID int64, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] {
|
|
return func(yield func(*WorkflowRun, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListWorkflowRunsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWorkflowRunsByID(ctx, owner, repo, workflowID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*WorkflowRun
|
|
if results != nil {
|
|
iterItems = results.WorkflowRuns
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWorkflowsIter returns an iterator that paginates through all results of ListWorkflows.
|
|
func (s *ActionsService) ListWorkflowsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Workflow, error] {
|
|
return func(yield func(*Workflow, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWorkflows(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Workflow
|
|
if results != nil {
|
|
iterItems = results.Workflows
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEventsIter returns an iterator that paginates through all results of ListEvents.
|
|
func (s *ActivityService) ListEventsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEvents(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEventsForOrganizationIter returns an iterator that paginates through all results of ListEventsForOrganization.
|
|
func (s *ActivityService) ListEventsForOrganizationIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEventsForOrganization(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEventsForRepoNetworkIter returns an iterator that paginates through all results of ListEventsForRepoNetwork.
|
|
func (s *ActivityService) ListEventsForRepoNetworkIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEventsForRepoNetwork(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEventsPerformedByUserIter returns an iterator that paginates through all results of ListEventsPerformedByUser.
|
|
func (s *ActivityService) ListEventsPerformedByUserIter(ctx context.Context, user string, publicOnly bool, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEventsPerformedByUser(ctx, user, publicOnly, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEventsReceivedByUserIter returns an iterator that paginates through all results of ListEventsReceivedByUser.
|
|
func (s *ActivityService) ListEventsReceivedByUserIter(ctx context.Context, user string, publicOnly bool, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEventsReceivedByUser(ctx, user, publicOnly, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIssueEventsForRepositoryIter returns an iterator that paginates through all results of ListIssueEventsForRepository.
|
|
func (s *ActivityService) ListIssueEventsForRepositoryIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*IssueEvent, error] {
|
|
return func(yield func(*IssueEvent, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListIssueEventsForRepository(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListNotificationsIter returns an iterator that paginates through all results of ListNotifications.
|
|
func (s *ActivityService) ListNotificationsIter(ctx context.Context, opts *NotificationListOptions) iter.Seq2[*Notification, error] {
|
|
return func(yield func(*Notification, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &NotificationListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListNotifications(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryEventsIter returns an iterator that paginates through all results of ListRepositoryEvents.
|
|
func (s *ActivityService) ListRepositoryEventsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryNotificationsIter returns an iterator that paginates through all results of ListRepositoryNotifications.
|
|
func (s *ActivityService) ListRepositoryNotificationsIter(ctx context.Context, owner string, repo string, opts *NotificationListOptions) iter.Seq2[*Notification, error] {
|
|
return func(yield func(*Notification, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &NotificationListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryNotifications(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListStargazersIter returns an iterator that paginates through all results of ListStargazers.
|
|
func (s *ActivityService) ListStargazersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Stargazer, error] {
|
|
return func(yield func(*Stargazer, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListStargazers(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListStarredIter returns an iterator that paginates through all results of ListStarred.
|
|
func (s *ActivityService) ListStarredIter(ctx context.Context, user string, opts *ActivityListStarredOptions) iter.Seq2[*StarredRepository, error] {
|
|
return func(yield func(*StarredRepository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ActivityListStarredOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListStarred(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserEventsForOrganizationIter returns an iterator that paginates through all results of ListUserEventsForOrganization.
|
|
func (s *ActivityService) ListUserEventsForOrganizationIter(ctx context.Context, org string, user string, opts *ListOptions) iter.Seq2[*Event, error] {
|
|
return func(yield func(*Event, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserEventsForOrganization(ctx, org, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWatchedIter returns an iterator that paginates through all results of ListWatched.
|
|
func (s *ActivityService) ListWatchedIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWatched(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListWatchersIter returns an iterator that paginates through all results of ListWatchers.
|
|
func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListWatchers(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *AgentTasksService) ListIter(ctx context.Context, opts *AgentTaskListOptions) iter.Seq2[*AgentTask, error] {
|
|
return func(yield func(*AgentTask, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &AgentTaskListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*AgentTask
|
|
if results != nil {
|
|
iterItems = results.Tasks
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByRepoIter returns an iterator that paginates through all results of ListByRepo.
|
|
func (s *AgentTasksService) ListByRepoIter(ctx context.Context, owner string, repo string, opts *AgentTaskListByRepoOptions) iter.Seq2[*AgentTask, error] {
|
|
return func(yield func(*AgentTask, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &AgentTaskListByRepoOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*AgentTask
|
|
if results != nil {
|
|
iterItems = results.Tasks
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets.
|
|
func (s *AgentsService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgSecrets(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgVariablesIter returns an iterator that paginates through all results of ListOrgVariables.
|
|
func (s *AgentsService) ListOrgVariablesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgVariables(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoOrgSecretsIter returns an iterator that paginates through all results of ListRepoOrgSecrets.
|
|
func (s *AgentsService) ListRepoOrgSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoOrgSecrets(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoOrgVariablesIter returns an iterator that paginates through all results of ListRepoOrgVariables.
|
|
func (s *AgentsService) ListRepoOrgVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoOrgVariables(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets.
|
|
func (s *AgentsService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoVariablesIter returns an iterator that paginates through all results of ListRepoVariables.
|
|
func (s *AgentsService) ListRepoVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
|
|
return func(yield func(*ActionsVariable, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoVariables(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ActionsVariable
|
|
if results != nil {
|
|
iterItems = results.Variables
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret.
|
|
func (s *AgentsService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForOrgVariableIter returns an iterator that paginates through all results of ListSelectedReposForOrgVariable.
|
|
func (s *AgentsService) ListSelectedReposForOrgVariableIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForOrgVariable(ctx, org, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries.
|
|
func (s *AppsService) ListHookDeliveriesIter(ctx context.Context, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] {
|
|
return func(yield func(*HookDelivery, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCursorOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHookDeliveries(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.Cursor == "" {
|
|
break
|
|
}
|
|
opts.Cursor = resp.Cursor
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInstallationRequestsIter returns an iterator that paginates through all results of ListInstallationRequests.
|
|
func (s *AppsService) ListInstallationRequestsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*InstallationRequest, error] {
|
|
return func(yield func(*InstallationRequest, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInstallationRequests(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInstallationsIter returns an iterator that paginates through all results of ListInstallations.
|
|
func (s *AppsService) ListInstallationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Installation, error] {
|
|
return func(yield func(*Installation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInstallations(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListReposIter returns an iterator that paginates through all results of ListRepos.
|
|
func (s *AppsService) ListReposIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepos(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserInstallationsIter returns an iterator that paginates through all results of ListUserInstallations.
|
|
func (s *AppsService) ListUserInstallationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Installation, error] {
|
|
return func(yield func(*Installation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserInstallations(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserReposIter returns an iterator that paginates through all results of ListUserRepos.
|
|
func (s *AppsService) ListUserReposIter(ctx context.Context, id int64, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserRepos(ctx, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCheckRunAnnotationsIter returns an iterator that paginates through all results of ListCheckRunAnnotations.
|
|
func (s *ChecksService) ListCheckRunAnnotationsIter(ctx context.Context, owner string, repo string, checkRunID int64, opts *ListOptions) iter.Seq2[*CheckRunAnnotation, error] {
|
|
return func(yield func(*CheckRunAnnotation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCheckRunAnnotations(ctx, owner, repo, checkRunID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCheckRunsCheckSuiteIter returns an iterator that paginates through all results of ListCheckRunsCheckSuite.
|
|
func (s *ChecksService) ListCheckRunsCheckSuiteIter(ctx context.Context, owner string, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] {
|
|
return func(yield func(*CheckRun, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCheckRunsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCheckRunsCheckSuite(ctx, owner, repo, checkSuiteID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CheckRun
|
|
if results != nil {
|
|
iterItems = results.CheckRuns
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCheckRunsForRefIter returns an iterator that paginates through all results of ListCheckRunsForRef.
|
|
func (s *ChecksService) ListCheckRunsForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] {
|
|
return func(yield func(*CheckRun, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCheckRunsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCheckRunsForRef(ctx, owner, repo, ref, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CheckRun
|
|
if results != nil {
|
|
iterItems = results.CheckRuns
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCheckSuitesForRefIter returns an iterator that paginates through all results of ListCheckSuitesForRef.
|
|
func (s *ChecksService) ListCheckSuitesForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckSuiteOptions) iter.Seq2[*CheckSuite, error] {
|
|
return func(yield func(*CheckSuite, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCheckSuiteOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCheckSuitesForRef(ctx, owner, repo, ref, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CheckSuite
|
|
if results != nil {
|
|
iterItems = results.CheckSuites
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAcceptedAssignmentsIter returns an iterator that paginates through all results of ListAcceptedAssignments.
|
|
func (s *ClassroomService) ListAcceptedAssignmentsIter(ctx context.Context, assignmentID int64, opts *ListOptions) iter.Seq2[*AcceptedAssignment, error] {
|
|
return func(yield func(*AcceptedAssignment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAcceptedAssignments(ctx, assignmentID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListClassroomAssignmentsIter returns an iterator that paginates through all results of ListClassroomAssignments.
|
|
func (s *ClassroomService) ListClassroomAssignmentsIter(ctx context.Context, classroomID int64, opts *ListOptions) iter.Seq2[*ClassroomAssignment, error] {
|
|
return func(yield func(*ClassroomAssignment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListClassroomAssignments(ctx, classroomID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListClassroomsIter returns an iterator that paginates through all results of ListClassrooms.
|
|
func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Classroom, error] {
|
|
return func(yield func(*Classroom, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListClassrooms(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFindingsIter returns an iterator that paginates through all results of ListFindings.
|
|
func (s *CodeQualityService) ListFindingsIter(ctx context.Context, owner string, repo string, opts *ListCodeQualityFindingsOptions) iter.Seq2[*CodeQualityFinding, error] {
|
|
return func(yield func(*CodeQualityFinding, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCodeQualityFindingsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFindings(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAlertInstancesIter returns an iterator that paginates through all results of ListAlertInstances.
|
|
func (s *CodeScanningService) ListAlertInstancesIter(ctx context.Context, owner string, repo string, id int64, opts *AlertInstancesListOptions) iter.Seq2[*MostRecentInstance, error] {
|
|
return func(yield func(*MostRecentInstance, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &AlertInstancesListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAlertInstances(ctx, owner, repo, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAlertsForOrgIter returns an iterator that paginates through all results of ListAlertsForOrg.
|
|
func (s *CodeScanningService) ListAlertsForOrgIter(ctx context.Context, org string, opts *AlertListOptions) iter.Seq2[*Alert, error] {
|
|
return func(yield func(*Alert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &AlertListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAlertsForOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAlertsForRepoIter returns an iterator that paginates through all results of ListAlertsForRepo.
|
|
func (s *CodeScanningService) ListAlertsForRepoIter(ctx context.Context, owner string, repo string, opts *AlertListOptions) iter.Seq2[*Alert, error] {
|
|
return func(yield func(*Alert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &AlertListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAnalysesForRepoIter returns an iterator that paginates through all results of ListAnalysesForRepo.
|
|
func (s *CodeScanningService) ListAnalysesForRepoIter(ctx context.Context, owner string, repo string, opts *AnalysesListOptions) iter.Seq2[*ScanningAnalysis, error] {
|
|
return func(yield func(*ScanningAnalysis, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &AnalysesListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAnalysesForRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *CodespacesService) ListIter(ctx context.Context, opts *ListCodespacesOptions) iter.Seq2[*Codespace, error] {
|
|
return func(yield func(*Codespace, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCodespacesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Codespace
|
|
if results != nil {
|
|
iterItems = results.Codespaces
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListDevContainerConfigurationsIter returns an iterator that paginates through all results of ListDevContainerConfigurations.
|
|
func (s *CodespacesService) ListDevContainerConfigurationsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*DevContainer, error] {
|
|
return func(yield func(*DevContainer, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListDevContainerConfigurations(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*DevContainer
|
|
if results != nil {
|
|
iterItems = results.Devcontainers
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInOrgIter returns an iterator that paginates through all results of ListInOrg.
|
|
func (s *CodespacesService) ListInOrgIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Codespace, error] {
|
|
return func(yield func(*Codespace, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Codespace
|
|
if results != nil {
|
|
iterItems = results.Codespaces
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInRepoIter returns an iterator that paginates through all results of ListInRepo.
|
|
func (s *CodespacesService) ListInRepoIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Codespace, error] {
|
|
return func(yield func(*Codespace, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Codespace
|
|
if results != nil {
|
|
iterItems = results.Codespaces
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets.
|
|
func (s *CodespacesService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgSecrets(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets.
|
|
func (s *CodespacesService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret.
|
|
func (s *CodespacesService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForUserSecretIter returns an iterator that paginates through all results of ListSelectedReposForUserSecret.
|
|
func (s *CodespacesService) ListSelectedReposForUserSecretIter(ctx context.Context, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForUserSecret(ctx, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserCodespacesInOrgIter returns an iterator that paginates through all results of ListUserCodespacesInOrg.
|
|
func (s *CodespacesService) ListUserCodespacesInOrgIter(ctx context.Context, org string, username string, opts *ListOptions) iter.Seq2[*Codespace, error] {
|
|
return func(yield func(*Codespace, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserCodespacesInOrg(ctx, org, username, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Codespace
|
|
if results != nil {
|
|
iterItems = results.Codespaces
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserSecretsIter returns an iterator that paginates through all results of ListUserSecrets.
|
|
func (s *CodespacesService) ListUserSecretsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserSecrets(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCopilotEnterpriseSeatsIter returns an iterator that paginates through all results of ListCopilotEnterpriseSeats.
|
|
func (s *CopilotService) ListCopilotEnterpriseSeatsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] {
|
|
return func(yield func(*CopilotSeatDetails, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCopilotEnterpriseSeats(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CopilotSeatDetails
|
|
if results != nil {
|
|
iterItems = results.Seats
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCopilotSeatsIter returns an iterator that paginates through all results of ListCopilotSeats.
|
|
func (s *CopilotService) ListCopilotSeatsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] {
|
|
return func(yield func(*CopilotSeatDetails, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCopilotSeats(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CopilotSeatDetails
|
|
if results != nil {
|
|
iterItems = results.Seats
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationCodingAgentRepositoriesIter returns an iterator that paginates through all results of ListOrganizationCodingAgentRepositories.
|
|
func (s *CopilotService) ListOrganizationCodingAgentRepositoriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationCodingAgentRepositories(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationCopilotSpacesIter returns an iterator that paginates through all results of ListOrganizationCopilotSpaces.
|
|
func (s *CopilotService) ListOrganizationCopilotSpacesIter(ctx context.Context, org string, opts *ListCursorOptions) iter.Seq2[*CopilotSpace, error] {
|
|
return func(yield func(*CopilotSpace, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCursorOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationCopilotSpaces(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CopilotSpace
|
|
if results != nil {
|
|
iterItems = results.Spaces
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgAlertsIter returns an iterator that paginates through all results of ListOrgAlerts.
|
|
func (s *DependabotService) ListOrgAlertsIter(ctx context.Context, org string, opts *ListAlertsOptions) iter.Seq2[*DependabotAlert, error] {
|
|
return func(yield func(*DependabotAlert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListAlertsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgAlerts(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets.
|
|
func (s *DependabotService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgSecrets(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoAlertsIter returns an iterator that paginates through all results of ListRepoAlerts.
|
|
func (s *DependabotService) ListRepoAlertsIter(ctx context.Context, owner string, repo string, opts *ListAlertsOptions) iter.Seq2[*DependabotAlert, error] {
|
|
return func(yield func(*DependabotAlert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListAlertsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoAlerts(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets.
|
|
func (s *DependabotService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
|
|
return func(yield func(*Secret, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Secret
|
|
if results != nil {
|
|
iterItems = results.Secrets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret.
|
|
func (s *DependabotService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserStatesForBudgetIter returns an iterator that paginates through all results of GetUserStatesForBudget.
|
|
func (s *EnterpriseService) ListUserStatesForBudgetIter(ctx context.Context, enterprise string, budgetID string, opts *EnterpriseGetUserStatesOptions) iter.Seq2[*EnterpriseBudgetUserState, error] {
|
|
return func(yield func(*EnterpriseBudgetUserState, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &EnterpriseGetUserStatesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.GetUserStatesForBudget(ctx, enterprise, budgetID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*EnterpriseBudgetUserState
|
|
if results != nil {
|
|
iterItems = results.UserStates
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAppAccessibleOrganizationRepositoriesIter returns an iterator that paginates through all results of ListAppAccessibleOrganizationRepositories.
|
|
func (s *EnterpriseService) ListAppAccessibleOrganizationRepositoriesIter(ctx context.Context, enterprise string, org string, opts *ListOptions) iter.Seq2[*AccessibleRepository, error] {
|
|
return func(yield func(*AccessibleRepository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAppAccessibleOrganizationRepositories(ctx, enterprise, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAppInstallableOrganizationsIter returns an iterator that paginates through all results of ListAppInstallableOrganizations.
|
|
func (s *EnterpriseService) ListAppInstallableOrganizationsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*InstallableOrganization, error] {
|
|
return func(yield func(*InstallableOrganization, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAppInstallableOrganizations(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAppInstallationsIter returns an iterator that paginates through all results of ListAppInstallations.
|
|
func (s *EnterpriseService) ListAppInstallationsIter(ctx context.Context, enterprise string, org string, opts *ListOptions) iter.Seq2[*Installation, error] {
|
|
return func(yield func(*Installation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAppInstallations(ctx, enterprise, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAssignmentsIter returns an iterator that paginates through all results of ListAssignments.
|
|
func (s *EnterpriseService) ListAssignmentsIter(ctx context.Context, enterprise string, enterpriseTeam string, opts *ListOptions) iter.Seq2[*Organization, error] {
|
|
return func(yield func(*Organization, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAssignments(ctx, enterprise, enterpriseTeam, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListBudgetsIter returns an iterator that paginates through all results of ListBudgets.
|
|
func (s *EnterpriseService) ListBudgetsIter(ctx context.Context, enterprise string, opts *EnterpriseListBudgetsOptions) iter.Seq2[*EnterpriseBudget, error] {
|
|
return func(yield func(*EnterpriseBudget, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &EnterpriseListBudgetsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListBudgets(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*EnterpriseBudget
|
|
if results != nil {
|
|
iterItems = results.Budgets
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCodeSecurityConfigurationRepositoriesIter returns an iterator that paginates through all results of ListCodeSecurityConfigurationRepositories.
|
|
func (s *EnterpriseService) ListCodeSecurityConfigurationRepositoriesIter(ctx context.Context, enterprise string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) iter.Seq2[*RepositoryAttachment, error] {
|
|
return func(yield func(*RepositoryAttachment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCodeSecurityConfigurationRepositoriesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, enterprise, configurationID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCodeSecurityConfigurationsIter returns an iterator that paginates through all results of ListCodeSecurityConfigurations.
|
|
func (s *EnterpriseService) ListCodeSecurityConfigurationsIter(ctx context.Context, enterprise string, opts *ListEnterpriseCodeSecurityConfigurationOptions) iter.Seq2[*CodeSecurityConfiguration, error] {
|
|
return func(yield func(*CodeSecurityConfiguration, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListEnterpriseCodeSecurityConfigurationOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCodeSecurityConfigurations(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListConsumedLicensesIter returns an iterator that paginates through all results of ListConsumedLicenses.
|
|
func (s *EnterpriseService) ListConsumedLicensesIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseLicensedUsers, error] {
|
|
return func(yield func(*EnterpriseLicensedUsers, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListConsumedLicenses(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*EnterpriseLicensedUsers
|
|
if results != nil {
|
|
iterItems = results.Users
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEnterpriseNetworkConfigurationsIter returns an iterator that paginates through all results of ListEnterpriseNetworkConfigurations.
|
|
func (s *EnterpriseService) ListEnterpriseNetworkConfigurationsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*NetworkConfiguration, error] {
|
|
return func(yield func(*NetworkConfiguration, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEnterpriseNetworkConfigurations(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*NetworkConfiguration
|
|
if results != nil {
|
|
iterItems = results.NetworkConfigurations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHostedRunnersIter returns an iterator that paginates through all results of ListHostedRunners.
|
|
func (s *EnterpriseService) ListHostedRunnersIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*HostedRunner, error] {
|
|
return func(yield func(*HostedRunner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHostedRunners(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*HostedRunner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationAccessRunnerGroupIter returns an iterator that paginates through all results of ListOrganizationAccessRunnerGroup.
|
|
func (s *EnterpriseService) ListOrganizationAccessRunnerGroupIter(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) iter.Seq2[*Organization, error] {
|
|
return func(yield func(*Organization, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationAccessRunnerGroup(ctx, enterprise, groupID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Organization
|
|
if results != nil {
|
|
iterItems = results.Organizations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationCustomPropertyValuesIter returns an iterator that paginates through all results of ListOrganizationCustomPropertyValues.
|
|
func (s *EnterpriseService) ListOrganizationCustomPropertyValuesIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseCustomPropertiesValues, error] {
|
|
return func(yield func(*EnterpriseCustomPropertiesValues, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationCustomPropertyValues(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoriesForOrgAppInstallationIter returns an iterator that paginates through all results of ListRepositoriesForOrgAppInstallation.
|
|
func (s *EnterpriseService) ListRepositoriesForOrgAppInstallationIter(ctx context.Context, enterprise string, org string, installationID int64, opts *ListOptions) iter.Seq2[*AccessibleRepository, error] {
|
|
return func(yield func(*AccessibleRepository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoriesForOrgAppInstallation(ctx, enterprise, org, installationID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRunnerGroupRunnersIter returns an iterator that paginates through all results of ListRunnerGroupRunners.
|
|
func (s *EnterpriseService) ListRunnerGroupRunnersIter(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) iter.Seq2[*Runner, error] {
|
|
return func(yield func(*Runner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRunnerGroupRunners(ctx, enterprise, groupID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Runner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRunnerGroupsIter returns an iterator that paginates through all results of ListRunnerGroups.
|
|
func (s *EnterpriseService) ListRunnerGroupsIter(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) iter.Seq2[*EnterpriseRunnerGroup, error] {
|
|
return func(yield func(*EnterpriseRunnerGroup, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListEnterpriseRunnerGroupOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRunnerGroups(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*EnterpriseRunnerGroup
|
|
if results != nil {
|
|
iterItems = results.RunnerGroups
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRunnersIter returns an iterator that paginates through all results of ListRunners.
|
|
func (s *EnterpriseService) ListRunnersIter(ctx context.Context, enterprise string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] {
|
|
return func(yield func(*Runner, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListRunnersOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRunners(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Runner
|
|
if results != nil {
|
|
iterItems = results.Runners
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamMembersIter returns an iterator that paginates through all results of ListTeamMembers.
|
|
func (s *EnterpriseService) ListTeamMembersIter(ctx context.Context, enterprise string, enterpriseTeam string, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamMembers(ctx, enterprise, enterpriseTeam, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamsIter returns an iterator that paginates through all results of ListTeams.
|
|
func (s *EnterpriseService) ListTeamsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseTeam, error] {
|
|
return func(yield func(*EnterpriseTeam, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeams(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListVisualStudioSubscriptionsIter returns an iterator that paginates through all results of ListVisualStudioSubscriptions.
|
|
func (s *EnterpriseService) ListVisualStudioSubscriptionsIter(ctx context.Context, enterprise string, opts *ListVisualStudioSubscriptionsOptions) iter.Seq2[*VisualStudioSubscriptionAssignment, error] {
|
|
return func(yield func(*VisualStudioSubscriptionAssignment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListVisualStudioSubscriptionsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListVisualStudioSubscriptions(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*VisualStudioSubscriptionAssignment
|
|
if results != nil {
|
|
iterItems = results.VisualStudioSubscriptions
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *GistsService) ListIter(ctx context.Context, user string, opts *GistListOptions) iter.Seq2[*Gist, error] {
|
|
return func(yield func(*Gist, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &GistListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAllIter returns an iterator that paginates through all results of ListAll.
|
|
func (s *GistsService) ListAllIter(ctx context.Context, opts *GistListOptions) iter.Seq2[*Gist, error] {
|
|
return func(yield func(*Gist, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &GistListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAll(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentsIter returns an iterator that paginates through all results of ListComments.
|
|
func (s *GistsService) ListCommentsIter(ctx context.Context, gistID string, opts *ListOptions) iter.Seq2[*GistComment, error] {
|
|
return func(yield func(*GistComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListComments(ctx, gistID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommitsIter returns an iterator that paginates through all results of ListCommits.
|
|
func (s *GistsService) ListCommitsIter(ctx context.Context, id string, opts *ListOptions) iter.Seq2[*GistCommit, error] {
|
|
return func(yield func(*GistCommit, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommits(ctx, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListForksIter returns an iterator that paginates through all results of ListForks.
|
|
func (s *GistsService) ListForksIter(ctx context.Context, id string, opts *ListOptions) iter.Seq2[*GistFork, error] {
|
|
return func(yield func(*GistFork, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListForks(ctx, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListStarredIter returns an iterator that paginates through all results of ListStarred.
|
|
func (s *GistsService) ListStarredIter(ctx context.Context, opts *GistListOptions) iter.Seq2[*Gist, error] {
|
|
return func(yield func(*Gist, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &GistListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListStarred(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAllIssuesIter returns an iterator that paginates through all results of ListAllIssues.
|
|
func (s *IssuesService) ListAllIssuesIter(ctx context.Context, opts *ListAllIssuesOptions) iter.Seq2[*Issue, error] {
|
|
return func(yield func(*Issue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListAllIssuesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAllIssues(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAssigneesIter returns an iterator that paginates through all results of ListAssignees.
|
|
func (s *IssuesService) ListAssigneesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAssignees(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListBlockedByIter returns an iterator that paginates through all results of ListBlockedBy.
|
|
func (s *IssuesService) ListBlockedByIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) iter.Seq2[*Issue, error] {
|
|
return func(yield func(*Issue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListBlockedBy(ctx, owner, repo, issueNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListBlockingIter returns an iterator that paginates through all results of ListBlocking.
|
|
func (s *IssuesService) ListBlockingIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) iter.Seq2[*Issue, error] {
|
|
return func(yield func(*Issue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListBlocking(ctx, owner, repo, issueNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByOrgIter returns an iterator that paginates through all results of ListByOrg.
|
|
func (s *IssuesService) ListByOrgIter(ctx context.Context, org string, opts *IssueListByOrgOptions) iter.Seq2[*Issue, error] {
|
|
return func(yield func(*Issue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &IssueListByOrgOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByRepoIter returns an iterator that paginates through all results of ListByRepo.
|
|
func (s *IssuesService) ListByRepoIter(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) iter.Seq2[*Issue, error] {
|
|
return func(yield func(*Issue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &IssueListByRepoOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentsIter returns an iterator that paginates through all results of ListComments.
|
|
func (s *IssuesService) ListCommentsIter(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) iter.Seq2[*IssueComment, error] {
|
|
return func(yield func(*IssueComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &IssueListCommentsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListComments(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIssueEventsIter returns an iterator that paginates through all results of ListIssueEvents.
|
|
func (s *IssuesService) ListIssueEventsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*IssueEvent, error] {
|
|
return func(yield func(*IssueEvent, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListIssueEvents(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIssueTimelineIter returns an iterator that paginates through all results of ListIssueTimeline.
|
|
func (s *IssuesService) ListIssueTimelineIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Timeline, error] {
|
|
return func(yield func(*Timeline, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListIssueTimeline(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListLabelsIter returns an iterator that paginates through all results of ListLabels.
|
|
func (s *IssuesService) ListLabelsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Label, error] {
|
|
return func(yield func(*Label, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListLabels(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListLabelsByIssueIter returns an iterator that paginates through all results of ListLabelsByIssue.
|
|
func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] {
|
|
return func(yield func(*Label, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListLabelsByIssue(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListLabelsForMilestoneIter returns an iterator that paginates through all results of ListLabelsForMilestone.
|
|
func (s *IssuesService) ListLabelsForMilestoneIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] {
|
|
return func(yield func(*Label, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListLabelsForMilestone(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListMilestonesIter returns an iterator that paginates through all results of ListMilestones.
|
|
func (s *IssuesService) ListMilestonesIter(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) iter.Seq2[*Milestone, error] {
|
|
return func(yield func(*Milestone, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &MilestoneListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListMilestones(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryEventsIter returns an iterator that paginates through all results of ListRepositoryEvents.
|
|
func (s *IssuesService) ListRepositoryEventsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*IssueEvent, error] {
|
|
return func(yield func(*IssueEvent, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserIssuesIter returns an iterator that paginates through all results of ListUserIssues.
|
|
func (s *IssuesService) ListUserIssuesIter(ctx context.Context, opts *ListUserIssuesOptions) iter.Seq2[*Issue, error] {
|
|
return func(yield func(*Issue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListUserIssuesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserIssues(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *LicensesService) ListIter(ctx context.Context, opts *ListLicensesOptions) iter.Seq2[*License, error] {
|
|
return func(yield func(*License, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListLicensesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListMarketplacePurchasesForUserIter returns an iterator that paginates through all results of ListMarketplacePurchasesForUser.
|
|
func (s *MarketplaceService) ListMarketplacePurchasesForUserIter(ctx context.Context, opts *ListOptions) iter.Seq2[*MarketplacePurchase, error] {
|
|
return func(yield func(*MarketplacePurchase, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListMarketplacePurchasesForUser(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPlanAccountsForPlanIter returns an iterator that paginates through all results of ListPlanAccountsForPlan.
|
|
func (s *MarketplaceService) ListPlanAccountsForPlanIter(ctx context.Context, planID int64, opts *ListOptions) iter.Seq2[*MarketplacePlanAccount, error] {
|
|
return func(yield func(*MarketplacePlanAccount, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPlanAccountsForPlan(ctx, planID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPlansIter returns an iterator that paginates through all results of ListPlans.
|
|
func (s *MarketplaceService) ListPlansIter(ctx context.Context, opts *ListOptions) iter.Seq2[*MarketplacePlan, error] {
|
|
return func(yield func(*MarketplacePlan, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPlans(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListMigrationsIter returns an iterator that paginates through all results of ListMigrations.
|
|
func (s *MigrationService) ListMigrationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Migration, error] {
|
|
return func(yield func(*Migration, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListMigrations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserMigrationsIter returns an iterator that paginates through all results of ListUserMigrations.
|
|
func (s *MigrationService) ListUserMigrationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserMigration, error] {
|
|
return func(yield func(*UserMigration, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserMigrations(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *OrganizationsService) ListIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Organization, error] {
|
|
return func(yield func(*Organization, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAllRepositoryRulesetsIter returns an iterator that paginates through all results of ListAllRepositoryRulesets.
|
|
func (s *OrganizationsService) ListAllRepositoryRulesetsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*RepositoryRuleset, error] {
|
|
return func(yield func(*RepositoryRuleset, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAllRepositoryRulesets(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations.
|
|
func (s *OrganizationsService) ListAttestationsIter(ctx context.Context, org string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] {
|
|
return func(yield func(*Attestation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAttestations(ctx, org, subjectDigest, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Attestation
|
|
if results != nil {
|
|
iterItems = results.Attestations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListBlockedUsersIter returns an iterator that paginates through all results of ListBlockedUsers.
|
|
func (s *OrganizationsService) ListBlockedUsersIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListBlockedUsers(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCodeSecurityConfigurationRepositoriesIter returns an iterator that paginates through all results of ListCodeSecurityConfigurationRepositories.
|
|
func (s *OrganizationsService) ListCodeSecurityConfigurationRepositoriesIter(ctx context.Context, org string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) iter.Seq2[*RepositoryAttachment, error] {
|
|
return func(yield func(*RepositoryAttachment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCodeSecurityConfigurationRepositoriesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, org, configurationID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCodeSecurityConfigurationsIter returns an iterator that paginates through all results of ListCodeSecurityConfigurations.
|
|
func (s *OrganizationsService) ListCodeSecurityConfigurationsIter(ctx context.Context, org string, opts *ListOrgCodeSecurityConfigurationOptions) iter.Seq2[*CodeSecurityConfiguration, error] {
|
|
return func(yield func(*CodeSecurityConfiguration, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOrgCodeSecurityConfigurationOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCodeSecurityConfigurations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCredentialAuthorizationsIter returns an iterator that paginates through all results of ListCredentialAuthorizations.
|
|
func (s *OrganizationsService) ListCredentialAuthorizationsIter(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) iter.Seq2[*CredentialAuthorization, error] {
|
|
return func(yield func(*CredentialAuthorization, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &CredentialAuthorizationsListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCredentialAuthorizations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCustomPropertyValuesIter returns an iterator that paginates through all results of ListCustomPropertyValues.
|
|
func (s *OrganizationsService) ListCustomPropertyValuesIter(ctx context.Context, org string, opts *ListCustomPropertyValuesOptions) iter.Seq2[*RepoCustomPropertyValue, error] {
|
|
return func(yield func(*RepoCustomPropertyValue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCustomPropertyValuesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCustomPropertyValues(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFailedOrgInvitationsIter returns an iterator that paginates through all results of ListFailedOrgInvitations.
|
|
func (s *OrganizationsService) ListFailedOrgInvitationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Invitation, error] {
|
|
return func(yield func(*Invitation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFailedOrgInvitations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFineGrainedPersonalAccessTokenRequestsIter returns an iterator that paginates through all results of ListFineGrainedPersonalAccessTokenRequests.
|
|
func (s *OrganizationsService) ListFineGrainedPersonalAccessTokenRequestsIter(ctx context.Context, org string, opts *ListFineGrainedPATOptions) iter.Seq2[*FineGrainedPersonalAccessTokenRequest, error] {
|
|
return func(yield func(*FineGrainedPersonalAccessTokenRequest, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListFineGrainedPATOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFineGrainedPersonalAccessTokenRequests(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFineGrainedPersonalAccessTokensIter returns an iterator that paginates through all results of ListFineGrainedPersonalAccessTokens.
|
|
func (s *OrganizationsService) ListFineGrainedPersonalAccessTokensIter(ctx context.Context, org string, opts *ListFineGrainedPATOptions) iter.Seq2[*PersonalAccessToken, error] {
|
|
return func(yield func(*PersonalAccessToken, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListFineGrainedPATOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFineGrainedPersonalAccessTokens(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries.
|
|
func (s *OrganizationsService) ListHookDeliveriesIter(ctx context.Context, org string, id int64, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] {
|
|
return func(yield func(*HookDelivery, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCursorOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHookDeliveries(ctx, org, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.Cursor == "" {
|
|
break
|
|
}
|
|
opts.Cursor = resp.Cursor
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHooksIter returns an iterator that paginates through all results of ListHooks.
|
|
func (s *OrganizationsService) ListHooksIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Hook, error] {
|
|
return func(yield func(*Hook, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHooks(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListImmutableReleaseRepositoriesIter returns an iterator that paginates through all results of ListImmutableReleaseRepositories.
|
|
func (s *OrganizationsService) ListImmutableReleaseRepositoriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListImmutableReleaseRepositories(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Repository
|
|
if results != nil {
|
|
iterItems = results.Repositories
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInstallationsIter returns an iterator that paginates through all results of ListInstallations.
|
|
func (s *OrganizationsService) ListInstallationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Installation, error] {
|
|
return func(yield func(*Installation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInstallations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Installation
|
|
if results != nil {
|
|
iterItems = results.Installations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListMembersIter returns an iterator that paginates through all results of ListMembers.
|
|
func (s *OrganizationsService) ListMembersIter(ctx context.Context, org string, opts *ListMembersOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListMembersOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListMembers(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListNetworkConfigurationsIter returns an iterator that paginates through all results of ListNetworkConfigurations.
|
|
func (s *OrganizationsService) ListNetworkConfigurationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*NetworkConfiguration, error] {
|
|
return func(yield func(*NetworkConfiguration, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListNetworkConfigurations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*NetworkConfiguration
|
|
if results != nil {
|
|
iterItems = results.NetworkConfigurations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgInvitationTeamsIter returns an iterator that paginates through all results of ListOrgInvitationTeams.
|
|
func (s *OrganizationsService) ListOrgInvitationTeamsIter(ctx context.Context, org string, invitationID string, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgInvitationTeams(ctx, org, invitationID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrgMembershipsIter returns an iterator that paginates through all results of ListOrgMemberships.
|
|
func (s *OrganizationsService) ListOrgMembershipsIter(ctx context.Context, opts *ListOrgMembershipsOptions) iter.Seq2[*Membership, error] {
|
|
return func(yield func(*Membership, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOrgMembershipsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrgMemberships(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOutsideCollaboratorsIter returns an iterator that paginates through all results of ListOutsideCollaborators.
|
|
func (s *OrganizationsService) ListOutsideCollaboratorsIter(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOutsideCollaboratorsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOutsideCollaborators(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPackagesIter returns an iterator that paginates through all results of ListPackages.
|
|
func (s *OrganizationsService) ListPackagesIter(ctx context.Context, org string, opts *PackageListOptions) iter.Seq2[*Package, error] {
|
|
return func(yield func(*Package, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &PackageListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPackages(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPendingOrgInvitationsIter returns an iterator that paginates through all results of ListPendingOrgInvitations.
|
|
func (s *OrganizationsService) ListPendingOrgInvitationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Invitation, error] {
|
|
return func(yield func(*Invitation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPendingOrgInvitations(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamsAssignedToOrgRoleIter returns an iterator that paginates through all results of ListTeamsAssignedToOrgRole.
|
|
func (s *OrganizationsService) ListTeamsAssignedToOrgRoleIter(ctx context.Context, org string, roleID int64, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamsAssignedToOrgRole(ctx, org, roleID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUsersAssignedToOrgRoleIter returns an iterator that paginates through all results of ListUsersAssignedToOrgRole.
|
|
func (s *OrganizationsService) ListUsersAssignedToOrgRoleIter(ctx context.Context, org string, roleID int64, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUsersAssignedToOrgRole(ctx, org, roleID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationPrivateRegistriesIter returns an iterator that paginates through all results of ListOrganizationPrivateRegistries.
|
|
func (s *PrivateRegistriesService) ListOrganizationPrivateRegistriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*PrivateRegistry, error] {
|
|
return func(yield func(*PrivateRegistry, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationPrivateRegistries(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*PrivateRegistry
|
|
if results != nil {
|
|
iterItems = results.Configurations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationProjectFieldsIter returns an iterator that paginates through all results of ListOrganizationProjectFields.
|
|
func (s *ProjectsService) ListOrganizationProjectFieldsIter(ctx context.Context, org string, projectNumber int, opts *ListProjectsOptions) iter.Seq2[*ProjectV2Field, error] {
|
|
return func(yield func(*ProjectV2Field, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationProjectFields(ctx, org, projectNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationProjectItemsIter returns an iterator that paginates through all results of ListOrganizationProjectItems.
|
|
func (s *ProjectsService) ListOrganizationProjectItemsIter(ctx context.Context, org string, projectNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] {
|
|
return func(yield func(*ProjectV2Item, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectItemsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationProjectItems(ctx, org, projectNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationProjectViewItemsIter returns an iterator that paginates through all results of ListOrganizationProjectViewItems.
|
|
func (s *ProjectsService) ListOrganizationProjectViewItemsIter(ctx context.Context, org string, projectNumber int, viewNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] {
|
|
return func(yield func(*ProjectV2Item, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectItemsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationProjectViewItems(ctx, org, projectNumber, viewNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListOrganizationProjectsIter returns an iterator that paginates through all results of ListOrganizationProjects.
|
|
func (s *ProjectsService) ListOrganizationProjectsIter(ctx context.Context, org string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] {
|
|
return func(yield func(*ProjectV2, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListOrganizationProjects(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserProjectFieldsIter returns an iterator that paginates through all results of ListUserProjectFields.
|
|
func (s *ProjectsService) ListUserProjectFieldsIter(ctx context.Context, user string, projectNumber int, opts *ListProjectsOptions) iter.Seq2[*ProjectV2Field, error] {
|
|
return func(yield func(*ProjectV2Field, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserProjectFields(ctx, user, projectNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserProjectItemsIter returns an iterator that paginates through all results of ListUserProjectItems.
|
|
func (s *ProjectsService) ListUserProjectItemsIter(ctx context.Context, username string, projectNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] {
|
|
return func(yield func(*ProjectV2Item, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectItemsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserProjectItems(ctx, username, projectNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserProjectViewItemsIter returns an iterator that paginates through all results of ListUserProjectViewItems.
|
|
func (s *ProjectsService) ListUserProjectViewItemsIter(ctx context.Context, username string, projectNumber int, viewNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] {
|
|
return func(yield func(*ProjectV2Item, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectItemsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserProjectViewItems(ctx, username, projectNumber, viewNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserProjectsIter returns an iterator that paginates through all results of ListUserProjects.
|
|
func (s *ProjectsService) ListUserProjectsIter(ctx context.Context, username string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] {
|
|
return func(yield func(*ProjectV2, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListProjectsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserProjects(ctx, username, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *PullRequestsService) ListIter(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) iter.Seq2[*PullRequest, error] {
|
|
return func(yield func(*PullRequest, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &PullRequestListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentsIter returns an iterator that paginates through all results of ListComments.
|
|
func (s *PullRequestsService) ListCommentsIter(ctx context.Context, owner string, repo string, number int, opts *PullRequestListCommentsOptions) iter.Seq2[*PullRequestComment, error] {
|
|
return func(yield func(*PullRequestComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &PullRequestListCommentsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListComments(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommitsIter returns an iterator that paginates through all results of ListCommits.
|
|
func (s *PullRequestsService) ListCommitsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*RepositoryCommit, error] {
|
|
return func(yield func(*RepositoryCommit, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommits(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFilesIter returns an iterator that paginates through all results of ListFiles.
|
|
func (s *PullRequestsService) ListFilesIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*CommitFile, error] {
|
|
return func(yield func(*CommitFile, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFiles(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPullRequestsWithCommitIter returns an iterator that paginates through all results of ListPullRequestsWithCommit.
|
|
func (s *PullRequestsService) ListPullRequestsWithCommitIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*PullRequest, error] {
|
|
return func(yield func(*PullRequest, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPullRequestsWithCommit(ctx, owner, repo, sha, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListReviewCommentsIter returns an iterator that paginates through all results of ListReviewComments.
|
|
func (s *PullRequestsService) ListReviewCommentsIter(ctx context.Context, owner string, repo string, number int, reviewID int64, opts *ListOptions) iter.Seq2[*PullRequestComment, error] {
|
|
return func(yield func(*PullRequestComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListReviewComments(ctx, owner, repo, number, reviewID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListReviewsIter returns an iterator that paginates through all results of ListReviews.
|
|
func (s *PullRequestsService) ListReviewsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*PullRequestReview, error] {
|
|
return func(yield func(*PullRequestReview, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListReviews(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListStacksIter returns an iterator that paginates through all results of ListStacks.
|
|
func (s *PullRequestsService) ListStacksIter(ctx context.Context, owner string, repo string, opts *PullRequestListStacksOptions) iter.Seq2[*PullRequestStackMinimal, error] {
|
|
return func(yield func(*PullRequestStackMinimal, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &PullRequestListStacksOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListStacks(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentReactionsIter returns an iterator that paginates through all results of ListCommentReactions.
|
|
func (s *ReactionsService) ListCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommentReactions(ctx, owner, repo, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIssueCommentReactionsIter returns an iterator that paginates through all results of ListIssueCommentReactions.
|
|
func (s *ReactionsService) ListIssueCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListIssueCommentReactions(ctx, owner, repo, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIssueReactionsIter returns an iterator that paginates through all results of ListIssueReactions.
|
|
func (s *ReactionsService) ListIssueReactionsIter(ctx context.Context, owner string, repo string, number int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListIssueReactions(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPullRequestCommentReactionsIter returns an iterator that paginates through all results of ListPullRequestCommentReactions.
|
|
func (s *ReactionsService) ListPullRequestCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPullRequestCommentReactions(ctx, owner, repo, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListReleaseReactionsIter returns an iterator that paginates through all results of ListReleaseReactions.
|
|
func (s *ReactionsService) ListReleaseReactionsIter(ctx context.Context, owner string, repo string, releaseID int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListReleaseReactions(ctx, owner, repo, releaseID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamDiscussionCommentReactionsIter returns an iterator that paginates through all results of ListTeamDiscussionCommentReactions.
|
|
func (s *ReactionsService) ListTeamDiscussionCommentReactionsIter(ctx context.Context, teamID int64, discussionNumber int, commentNumber int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamDiscussionCommentReactions(ctx, teamID, discussionNumber, commentNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamDiscussionReactionsIter returns an iterator that paginates through all results of ListTeamDiscussionReactions.
|
|
func (s *ReactionsService) ListTeamDiscussionReactionsIter(ctx context.Context, teamID int64, discussionNumber int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] {
|
|
return func(yield func(*Reaction, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListReactionOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamDiscussionReactions(ctx, teamID, discussionNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommitComparisonFilesIter returns an iterator that paginates through all results of CompareCommits.
|
|
func (s *RepositoriesService) ListCommitComparisonFilesIter(ctx context.Context, owner string, repo string, base string, head string, opts *ListOptions) iter.Seq2[*CommitFile, error] {
|
|
return func(yield func(*CommitFile, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.CompareCommits(ctx, owner, repo, base, head, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CommitFile
|
|
if results != nil {
|
|
iterItems = results.Files
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCombinedStatusIter returns an iterator that paginates through all results of GetCombinedStatus.
|
|
func (s *RepositoriesService) ListCombinedStatusIter(ctx context.Context, owner string, repo string, ref string, opts *ListOptions) iter.Seq2[*RepoStatus, error] {
|
|
return func(yield func(*RepoStatus, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.GetCombinedStatus(ctx, owner, repo, ref, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*RepoStatus
|
|
if results != nil {
|
|
iterItems = results.Statuses
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommitFilesIter returns an iterator that paginates through all results of GetCommit.
|
|
func (s *RepositoriesService) ListCommitFilesIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*CommitFile, error] {
|
|
return func(yield func(*CommitFile, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.GetCommit(ctx, owner, repo, sha, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CommitFile
|
|
if results != nil {
|
|
iterItems = results.Files
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIter returns an iterator that paginates through all results of List.
|
|
func (s *RepositoriesService) ListIter(ctx context.Context, user string, opts *RepositoryListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &RepositoryListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.List(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAllTopicsIter returns an iterator that paginates through all results of ListAllTopics.
|
|
func (s *RepositoriesService) ListAllTopicsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[string, error] {
|
|
return func(yield func(string, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAllTopics(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(*new(string), err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations.
|
|
func (s *RepositoriesService) ListAttestationsIter(ctx context.Context, owner string, repo string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] {
|
|
return func(yield func(*Attestation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAttestations(ctx, owner, repo, subjectDigest, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Attestation
|
|
if results != nil {
|
|
iterItems = results.Attestations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListBranchesIter returns an iterator that paginates through all results of ListBranches.
|
|
func (s *RepositoriesService) ListBranchesIter(ctx context.Context, owner string, repo string, opts *BranchListOptions) iter.Seq2[*Branch, error] {
|
|
return func(yield func(*Branch, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &BranchListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListBranches(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByAuthenticatedUserIter returns an iterator that paginates through all results of ListByAuthenticatedUser.
|
|
func (s *RepositoriesService) ListByAuthenticatedUserIter(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &RepositoryListByAuthenticatedUserOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByAuthenticatedUser(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByOrgIter returns an iterator that paginates through all results of ListByOrg.
|
|
func (s *RepositoriesService) ListByOrgIter(ctx context.Context, org string, opts *RepositoryListByOrgOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &RepositoryListByOrgOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByUserIter returns an iterator that paginates through all results of ListByUser.
|
|
func (s *RepositoriesService) ListByUserIter(ctx context.Context, user string, opts *RepositoryListByUserOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &RepositoryListByUserOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByUser(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCollaboratorsIter returns an iterator that paginates through all results of ListCollaborators.
|
|
func (s *RepositoriesService) ListCollaboratorsIter(ctx context.Context, owner string, repo string, opts *ListCollaboratorsOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCollaboratorsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCollaborators(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentsIter returns an iterator that paginates through all results of ListComments.
|
|
func (s *RepositoriesService) ListCommentsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryComment, error] {
|
|
return func(yield func(*RepositoryComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListComments(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommitCommentsIter returns an iterator that paginates through all results of ListCommitComments.
|
|
func (s *RepositoriesService) ListCommitCommentsIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*RepositoryComment, error] {
|
|
return func(yield func(*RepositoryComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommitComments(ctx, owner, repo, sha, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommitsIter returns an iterator that paginates through all results of ListCommits.
|
|
func (s *RepositoriesService) ListCommitsIter(ctx context.Context, owner string, repo string, opts *CommitsListOptions) iter.Seq2[*RepositoryCommit, error] {
|
|
return func(yield func(*RepositoryCommit, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &CommitsListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommits(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListContributorsIter returns an iterator that paginates through all results of ListContributors.
|
|
func (s *RepositoriesService) ListContributorsIter(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) iter.Seq2[*Contributor, error] {
|
|
return func(yield func(*Contributor, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListContributorsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListContributors(ctx, owner, repository, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCustomDeploymentRuleIntegrationsIter returns an iterator that paginates through all results of ListCustomDeploymentRuleIntegrations.
|
|
func (s *RepositoriesService) ListCustomDeploymentRuleIntegrationsIter(ctx context.Context, owner string, repo string, environment string, opts *ListOptions) iter.Seq2[*CustomDeploymentProtectionRuleApp, error] {
|
|
return func(yield func(*CustomDeploymentProtectionRuleApp, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCustomDeploymentRuleIntegrations(ctx, owner, repo, environment, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*CustomDeploymentProtectionRuleApp
|
|
if results != nil {
|
|
iterItems = results.AvailableIntegrations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListDeploymentBranchPoliciesIter returns an iterator that paginates through all results of ListDeploymentBranchPolicies.
|
|
func (s *RepositoriesService) ListDeploymentBranchPoliciesIter(ctx context.Context, owner string, repo string, environment string, opts *ListOptions) iter.Seq2[*DeploymentBranchPolicy, error] {
|
|
return func(yield func(*DeploymentBranchPolicy, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListDeploymentBranchPolicies(ctx, owner, repo, environment, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*DeploymentBranchPolicy
|
|
if results != nil {
|
|
iterItems = results.BranchPolicies
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListDeploymentStatusesIter returns an iterator that paginates through all results of ListDeploymentStatuses.
|
|
func (s *RepositoriesService) ListDeploymentStatusesIter(ctx context.Context, owner string, repo string, deployment int64, opts *ListOptions) iter.Seq2[*DeploymentStatus, error] {
|
|
return func(yield func(*DeploymentStatus, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListDeploymentStatuses(ctx, owner, repo, deployment, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListDeploymentsIter returns an iterator that paginates through all results of ListDeployments.
|
|
func (s *RepositoriesService) ListDeploymentsIter(ctx context.Context, owner string, repo string, opts *DeploymentsListOptions) iter.Seq2[*Deployment, error] {
|
|
return func(yield func(*Deployment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &DeploymentsListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListDeployments(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEnvironmentsIter returns an iterator that paginates through all results of ListEnvironments.
|
|
func (s *RepositoriesService) ListEnvironmentsIter(ctx context.Context, owner string, repo string, opts *EnvironmentListOptions) iter.Seq2[*Environment, error] {
|
|
return func(yield func(*Environment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &EnvironmentListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEnvironments(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Environment
|
|
if results != nil {
|
|
iterItems = results.Environments
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListForksIter returns an iterator that paginates through all results of ListForks.
|
|
func (s *RepositoriesService) ListForksIter(ctx context.Context, owner string, repo string, opts *RepositoryListForksOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &RepositoryListForksOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListForks(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries.
|
|
func (s *RepositoriesService) ListHookDeliveriesIter(ctx context.Context, owner string, repo string, id int64, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] {
|
|
return func(yield func(*HookDelivery, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListCursorOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHookDeliveries(ctx, owner, repo, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.Cursor == "" {
|
|
break
|
|
}
|
|
opts.Cursor = resp.Cursor
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListHooksIter returns an iterator that paginates through all results of ListHooks.
|
|
func (s *RepositoriesService) ListHooksIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Hook, error] {
|
|
return func(yield func(*Hook, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListHooks(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInvitationsIter returns an iterator that paginates through all results of ListInvitations.
|
|
func (s *RepositoriesService) ListInvitationsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryInvitation, error] {
|
|
return func(yield func(*RepositoryInvitation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInvitations(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListKeysIter returns an iterator that paginates through all results of ListKeys.
|
|
func (s *RepositoriesService) ListKeysIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Key, error] {
|
|
return func(yield func(*Key, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListKeys(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPagesBuildsIter returns an iterator that paginates through all results of ListPagesBuilds.
|
|
func (s *RepositoriesService) ListPagesBuildsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*PagesBuild, error] {
|
|
return func(yield func(*PagesBuild, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPagesBuilds(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPreReceiveHooksIter returns an iterator that paginates through all results of ListPreReceiveHooks.
|
|
func (s *RepositoriesService) ListPreReceiveHooksIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*PreReceiveHook, error] {
|
|
return func(yield func(*PreReceiveHook, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPreReceiveHooks(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListReleaseAssetsIter returns an iterator that paginates through all results of ListReleaseAssets.
|
|
func (s *RepositoriesService) ListReleaseAssetsIter(ctx context.Context, owner string, repo string, id int64, opts *ListOptions) iter.Seq2[*ReleaseAsset, error] {
|
|
return func(yield func(*ReleaseAsset, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListReleaseAssets(ctx, owner, repo, id, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListReleasesIter returns an iterator that paginates through all results of ListReleases.
|
|
func (s *RepositoriesService) ListReleasesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryRelease, error] {
|
|
return func(yield func(*RepositoryRelease, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListReleases(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositoryActivitiesIter returns an iterator that paginates through all results of ListRepositoryActivities.
|
|
func (s *RepositoriesService) ListRepositoryActivitiesIter(ctx context.Context, owner string, repo string, opts *ListRepositoryActivityOptions) iter.Seq2[*RepositoryActivity, error] {
|
|
return func(yield func(*RepositoryActivity, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListRepositoryActivityOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositoryActivities(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListStatusesIter returns an iterator that paginates through all results of ListStatuses.
|
|
func (s *RepositoriesService) ListStatusesIter(ctx context.Context, owner string, repo string, ref string, opts *ListOptions) iter.Seq2[*RepoStatus, error] {
|
|
return func(yield func(*RepoStatus, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListStatuses(ctx, owner, repo, ref, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTagsIter returns an iterator that paginates through all results of ListTags.
|
|
func (s *RepositoriesService) ListTagsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryTag, error] {
|
|
return func(yield func(*RepositoryTag, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTags(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamsIter returns an iterator that paginates through all results of ListTeams.
|
|
func (s *RepositoriesService) ListTeamsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeams(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAlertsForEnterpriseIter returns an iterator that paginates through all results of ListAlertsForEnterprise.
|
|
func (s *SecretScanningService) ListAlertsForEnterpriseIter(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] {
|
|
return func(yield func(*SecretScanningAlert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &SecretScanningAlertListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAlertsForEnterprise(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAlertsForOrgIter returns an iterator that paginates through all results of ListAlertsForOrg.
|
|
func (s *SecretScanningService) ListAlertsForOrgIter(ctx context.Context, org string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] {
|
|
return func(yield func(*SecretScanningAlert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &SecretScanningAlertListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAlertsForOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAlertsForRepoIter returns an iterator that paginates through all results of ListAlertsForRepo.
|
|
func (s *SecretScanningService) ListAlertsForRepoIter(ctx context.Context, owner string, repo string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] {
|
|
return func(yield func(*SecretScanningAlert, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &SecretScanningAlertListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" && resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCustomPatternsForEnterpriseIter returns an iterator that paginates through all results of ListCustomPatternsForEnterprise.
|
|
func (s *SecretScanningService) ListCustomPatternsForEnterpriseIter(ctx context.Context, enterprise string, opts *SecretScanningCustomPatternListOptions) iter.Seq2[*SecretScanningCustomPattern, error] {
|
|
return func(yield func(*SecretScanningCustomPattern, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &SecretScanningCustomPatternListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCustomPatternsForEnterprise(ctx, enterprise, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCustomPatternsForOrgIter returns an iterator that paginates through all results of ListCustomPatternsForOrg.
|
|
func (s *SecretScanningService) ListCustomPatternsForOrgIter(ctx context.Context, org string, opts *SecretScanningCustomPatternListOptions) iter.Seq2[*SecretScanningCustomPattern, error] {
|
|
return func(yield func(*SecretScanningCustomPattern, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &SecretScanningCustomPatternListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCustomPatternsForOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCustomPatternsForRepoIter returns an iterator that paginates through all results of ListCustomPatternsForRepo.
|
|
func (s *SecretScanningService) ListCustomPatternsForRepoIter(ctx context.Context, owner string, repo string, opts *SecretScanningCustomPatternListOptions) iter.Seq2[*SecretScanningCustomPattern, error] {
|
|
return func(yield func(*SecretScanningCustomPattern, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &SecretScanningCustomPatternListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCustomPatternsForRepo(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListLocationsForAlertIter returns an iterator that paginates through all results of ListLocationsForAlert.
|
|
func (s *SecretScanningService) ListLocationsForAlertIter(ctx context.Context, owner string, repo string, number int64, opts *ListOptions) iter.Seq2[*SecretScanningAlertLocation, error] {
|
|
return func(yield func(*SecretScanningAlertLocation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListLocationsForAlert(ctx, owner, repo, number, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListGlobalSecurityAdvisoriesIter returns an iterator that paginates through all results of ListGlobalSecurityAdvisories.
|
|
func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisoriesIter(ctx context.Context, opts *ListGlobalSecurityAdvisoriesOptions) iter.Seq2[*GlobalSecurityAdvisory, error] {
|
|
return func(yield func(*GlobalSecurityAdvisory, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListGlobalSecurityAdvisoriesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListGlobalSecurityAdvisories(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositorySecurityAdvisoriesIter returns an iterator that paginates through all results of ListRepositorySecurityAdvisories.
|
|
func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesIter(ctx context.Context, owner string, repo string, opts *ListRepositorySecurityAdvisoriesOptions) iter.Seq2[*SecurityAdvisory, error] {
|
|
return func(yield func(*SecurityAdvisory, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListRepositorySecurityAdvisoriesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositorySecurityAdvisories(ctx, owner, repo, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListRepositorySecurityAdvisoriesForOrgIter returns an iterator that paginates through all results of ListRepositorySecurityAdvisoriesForOrg.
|
|
func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrgIter(ctx context.Context, org string, opts *ListRepositorySecurityAdvisoriesOptions) iter.Seq2[*SecurityAdvisory, error] {
|
|
return func(yield func(*SecurityAdvisory, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListRepositorySecurityAdvisoriesOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListRepositorySecurityAdvisoriesForOrg(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListByIssueIter returns an iterator that paginates through all results of ListByIssue.
|
|
func (s *SubIssueService) ListByIssueIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) iter.Seq2[*SubIssue, error] {
|
|
return func(yield func(*SubIssue, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListByIssue(ctx, owner, repo, issueNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListChildTeamsByParentIDIter returns an iterator that paginates through all results of ListChildTeamsByParentID.
|
|
func (s *TeamsService) ListChildTeamsByParentIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListChildTeamsByParentID(ctx, orgID, teamID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListChildTeamsByParentSlugIter returns an iterator that paginates through all results of ListChildTeamsByParentSlug.
|
|
func (s *TeamsService) ListChildTeamsByParentSlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListChildTeamsByParentSlug(ctx, org, slug, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentsByIDIter returns an iterator that paginates through all results of ListCommentsByID.
|
|
func (s *TeamsService) ListCommentsByIDIter(ctx context.Context, orgID int64, teamID int64, discussionNumber int, opts *DiscussionCommentListOptions) iter.Seq2[*DiscussionComment, error] {
|
|
return func(yield func(*DiscussionComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &DiscussionCommentListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommentsByID(ctx, orgID, teamID, discussionNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListCommentsBySlugIter returns an iterator that paginates through all results of ListCommentsBySlug.
|
|
func (s *TeamsService) ListCommentsBySlugIter(ctx context.Context, org string, slug string, discussionNumber int, opts *DiscussionCommentListOptions) iter.Seq2[*DiscussionComment, error] {
|
|
return func(yield func(*DiscussionComment, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &DiscussionCommentListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListCommentsBySlug(ctx, org, slug, discussionNumber, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListDiscussionsByIDIter returns an iterator that paginates through all results of ListDiscussionsByID.
|
|
func (s *TeamsService) ListDiscussionsByIDIter(ctx context.Context, orgID int64, teamID int64, opts *DiscussionListOptions) iter.Seq2[*TeamDiscussion, error] {
|
|
return func(yield func(*TeamDiscussion, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &DiscussionListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListDiscussionsByID(ctx, orgID, teamID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListDiscussionsBySlugIter returns an iterator that paginates through all results of ListDiscussionsBySlug.
|
|
func (s *TeamsService) ListDiscussionsBySlugIter(ctx context.Context, org string, slug string, opts *DiscussionListOptions) iter.Seq2[*TeamDiscussion, error] {
|
|
return func(yield func(*TeamDiscussion, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &DiscussionListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListDiscussionsBySlug(ctx, org, slug, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListExternalGroupsIter returns an iterator that paginates through all results of ListExternalGroups.
|
|
func (s *TeamsService) ListExternalGroupsIter(ctx context.Context, org string, opts *ListExternalGroupsOptions) iter.Seq2[*ExternalGroup, error] {
|
|
return func(yield func(*ExternalGroup, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListExternalGroupsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListExternalGroups(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*ExternalGroup
|
|
if results != nil {
|
|
iterItems = results.Groups
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListIDPGroupsInOrganizationIter returns an iterator that paginates through all results of ListIDPGroupsInOrganization.
|
|
func (s *TeamsService) ListIDPGroupsInOrganizationIter(ctx context.Context, org string, opts *ListIDPGroupsOptions) iter.Seq2[*IDPGroup, error] {
|
|
return func(yield func(*IDPGroup, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListIDPGroupsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListIDPGroupsInOrganization(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*IDPGroup
|
|
if results != nil {
|
|
iterItems = results.Groups
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.After == "" {
|
|
break
|
|
}
|
|
opts.ListCursorOptions.After = resp.After
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPendingTeamInvitationsByIDIter returns an iterator that paginates through all results of ListPendingTeamInvitationsByID.
|
|
func (s *TeamsService) ListPendingTeamInvitationsByIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Invitation, error] {
|
|
return func(yield func(*Invitation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPendingTeamInvitationsByID(ctx, orgID, teamID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPendingTeamInvitationsBySlugIter returns an iterator that paginates through all results of ListPendingTeamInvitationsBySlug.
|
|
func (s *TeamsService) ListPendingTeamInvitationsBySlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Invitation, error] {
|
|
return func(yield func(*Invitation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPendingTeamInvitationsBySlug(ctx, org, slug, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamMembersByIDIter returns an iterator that paginates through all results of ListTeamMembersByID.
|
|
func (s *TeamsService) ListTeamMembersByIDIter(ctx context.Context, orgID int64, teamID int64, opts *TeamListTeamMembersOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &TeamListTeamMembersOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamMembersByID(ctx, orgID, teamID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamMembersBySlugIter returns an iterator that paginates through all results of ListTeamMembersBySlug.
|
|
func (s *TeamsService) ListTeamMembersBySlugIter(ctx context.Context, org string, slug string, opts *TeamListTeamMembersOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &TeamListTeamMembersOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamMembersBySlug(ctx, org, slug, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamReposByIDIter returns an iterator that paginates through all results of ListTeamReposByID.
|
|
func (s *TeamsService) ListTeamReposByIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamReposByID(ctx, orgID, teamID, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamReposBySlugIter returns an iterator that paginates through all results of ListTeamReposBySlug.
|
|
func (s *TeamsService) ListTeamReposBySlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Repository, error] {
|
|
return func(yield func(*Repository, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeamReposBySlug(ctx, org, slug, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListTeamsIter returns an iterator that paginates through all results of ListTeams.
|
|
func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListTeams(ctx, org, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserTeamsIter returns an iterator that paginates through all results of ListUserTeams.
|
|
func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Team, error] {
|
|
return func(yield func(*Team, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserTeams(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations.
|
|
func (s *UsersService) ListAttestationsIter(ctx context.Context, user string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] {
|
|
return func(yield func(*Attestation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListAttestations(ctx, user, subjectDigest, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
var iterItems []*Attestation
|
|
if results != nil {
|
|
iterItems = results.Attestations
|
|
}
|
|
for _, item := range iterItems {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListBlockedUsersIter returns an iterator that paginates through all results of ListBlockedUsers.
|
|
func (s *UsersService) ListBlockedUsersIter(ctx context.Context, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListBlockedUsers(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListEmailsIter returns an iterator that paginates through all results of ListEmails.
|
|
func (s *UsersService) ListEmailsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserEmail, error] {
|
|
return func(yield func(*UserEmail, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListEmails(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFollowersIter returns an iterator that paginates through all results of ListFollowers.
|
|
func (s *UsersService) ListFollowersIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFollowers(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListFollowingIter returns an iterator that paginates through all results of ListFollowing.
|
|
func (s *UsersService) ListFollowingIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*User, error] {
|
|
return func(yield func(*User, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListFollowing(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListGPGKeysIter returns an iterator that paginates through all results of ListGPGKeys.
|
|
func (s *UsersService) ListGPGKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*GPGKey, error] {
|
|
return func(yield func(*GPGKey, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListGPGKeys(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListInvitationsIter returns an iterator that paginates through all results of ListInvitations.
|
|
func (s *UsersService) ListInvitationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*RepositoryInvitation, error] {
|
|
return func(yield func(*RepositoryInvitation, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListInvitations(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListKeysIter returns an iterator that paginates through all results of ListKeys.
|
|
func (s *UsersService) ListKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Key, error] {
|
|
return func(yield func(*Key, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListKeys(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPackageVersionsIter returns an iterator that paginates through all results of ListPackageVersions.
|
|
func (s *UsersService) ListPackageVersionsIter(ctx context.Context, packageType string, packageName string, opts *ListPackageVersionsOptions) iter.Seq2[*PackageVersion, error] {
|
|
return func(yield func(*PackageVersion, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListPackageVersionsOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPackageVersions(ctx, packageType, packageName, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPackagesIter returns an iterator that paginates through all results of ListPackages.
|
|
func (s *UsersService) ListPackagesIter(ctx context.Context, user string, opts *PackageListOptions) iter.Seq2[*Package, error] {
|
|
return func(yield func(*Package, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &PackageListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPackages(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.ListOptions.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListPublicEmailsIter returns an iterator that paginates through all results of ListPublicEmails.
|
|
func (s *UsersService) ListPublicEmailsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserEmail, error] {
|
|
return func(yield func(*UserEmail, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListPublicEmails(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSSHSigningKeysIter returns an iterator that paginates through all results of ListSSHSigningKeys.
|
|
func (s *UsersService) ListSSHSigningKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*SSHSigningKey, error] {
|
|
return func(yield func(*SSHSigningKey, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSSHSigningKeys(ctx, user, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListSocialAccountsIter returns an iterator that paginates through all results of ListSocialAccounts.
|
|
func (s *UsersService) ListSocialAccountsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*SocialAccount, error] {
|
|
return func(yield func(*SocialAccount, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListSocialAccounts(ctx, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|
|
|
|
// ListUserSocialAccountsIter returns an iterator that paginates through all results of ListUserSocialAccounts.
|
|
func (s *UsersService) ListUserSocialAccountsIter(ctx context.Context, username string, opts *ListOptions) iter.Seq2[*SocialAccount, error] {
|
|
return func(yield func(*SocialAccount, error) bool) {
|
|
// Create a copy of opts to avoid mutating the caller's struct
|
|
if opts == nil {
|
|
opts = &ListOptions{}
|
|
} else {
|
|
opts = new(*opts)
|
|
}
|
|
|
|
for {
|
|
results, resp, err := s.ListUserSocialAccounts(ctx, username, opts)
|
|
if err != nil {
|
|
yield(nil, err)
|
|
return
|
|
}
|
|
|
|
for _, item := range results {
|
|
if !yield(item, nil) {
|
|
return
|
|
}
|
|
}
|
|
|
|
if resp.NextPage == 0 {
|
|
break
|
|
}
|
|
opts.Page = resp.NextPage
|
|
}
|
|
}
|
|
}
|