diff --git a/github/gen-iterators.go b/github/gen-iterators.go index 57131320674..ea1399edacb 100644 --- a/github/gen-iterators.go +++ b/github/gen-iterators.go @@ -22,7 +22,9 @@ import ( "go/token" "log" "os" + "reflect" "slices" + "strconv" "strings" "text/template" ) @@ -95,9 +97,10 @@ type templateData struct { } type structDef struct { - Name string - Fields map[string]string - Embeds []string + Name string + Fields map[string]string + FieldJSON map[string]string + Embeds []string } type method struct { @@ -118,11 +121,30 @@ type method struct { UseListOptions bool UsePage bool UseAfter bool + WrappedItemsField string TestJSON1 string TestJSON2 string TestJSON3 string } +type methodInfo struct { + RecvTypeRaw string + RecvType string + RecvVar string + ClientField string + Args string + CallArgs string + TestCallArgs string + ZeroArgs string + OptsType string + OptsName string + OptsIsPtr bool + UseListCursorOptions bool + UseListOptions bool + UsePage bool + UseAfter bool +} + // customTestJSON maps method names to the JSON response they expect in tests. // This is needed for methods that internally unmarshal a wrapper struct // even though they return a slice. @@ -148,17 +170,34 @@ func (t *templateData) processStructs(f *ast.File) { } sd := &structDef{ - Name: ts.Name.Name, - Fields: make(map[string]string), + Name: ts.Name.Name, + Fields: make(map[string]string), + FieldJSON: make(map[string]string), } + fieldJSON := "" for _, field := range st.Fields.List { typeStr := typeToString(field.Type) + fieldJSON = "" + if field.Tag != nil { + if unquotedTag, err := strconv.Unquote(field.Tag.Value); err == nil { + fieldJSON = reflect.StructTag(unquotedTag).Get("json") + if idx := strings.Index(fieldJSON, ","); idx >= 0 { + fieldJSON = fieldJSON[:idx] + } + if fieldJSON == "-" { + fieldJSON = "" + } + } + } if len(field.Names) == 0 { sd.Embeds = append(sd.Embeds, strings.TrimPrefix(typeStr, "*")) } else { for _, name := range field.Names { sd.Fields[name.Name] = typeStr + if fieldJSON != "" { + sd.FieldJSON[name.Name] = fieldJSON + } } } } @@ -257,121 +296,251 @@ func (t *templateData) processMethods(f *ast.File) error { continue } - sliceRet, ok := fd.Type.Results.List[0].Type.(*ast.ArrayType) + methodInfo, ok := t.isMethodIteratable(fd) if !ok { continue } - eltType := typeToString(sliceRet.Elt) - if typeToString(fd.Type.Results.List[1].Type) != "*Response" { - continue - } - if typeToString(fd.Type.Results.List[2].Type) != "error" { - continue + switch retType := fd.Type.Results.List[0].Type.(type) { + case *ast.ArrayType: + t.processReturnArrayType(fd, retType, methodInfo) + case *ast.StarExpr: + t.processReturnStarExpr(fd, retType, methodInfo) + default: + log.Fatalf("unhandled return type: %T", retType) } + } + return nil +} - recvType := typeToString(fd.Recv.List[0].Type) - if !strings.HasPrefix(recvType, "*") || !strings.HasSuffix(recvType, "Service") { - continue - } - recvVar := "" - if len(fd.Recv.List[0].Names) > 0 { - recvVar = fd.Recv.List[0].Names[0].Name - } +func (t *templateData) isMethodIteratable(fd *ast.FuncDecl) (*methodInfo, bool) { + if !validateMethodShape(fd) { + return nil, false + } - args := []string{} - callArgs := []string{} - testCallArgs := []string{} - zeroArgs := []string{} - var optsType string - var optsName string - hasOpts := false - optsIsPtr := false - - for _, field := range fd.Type.Params.List { - typeStr := typeToString(field.Type) - zeroArg := getZeroValue(typeStr) - for _, name := range field.Names { - args = append(args, fmt.Sprintf("%s %s", name.Name, typeStr)) - callArgs = append(callArgs, name.Name) - zeroArgs = append(zeroArgs, zeroArg) - - if strings.HasSuffix(typeStr, "Options") { - optsType = strings.TrimPrefix(typeStr, "*") - optsName = name.Name - hasOpts = true - optsIsPtr = strings.HasPrefix(typeStr, "*") - } + methodInfo, ok := t.collectMethodInfo(fd) + if !ok { + return nil, false + } + + return methodInfo, true +} + +func validateMethodShape(fd *ast.FuncDecl) bool { + if typeToString(fd.Type.Results.List[1].Type) != "*Response" { + return false + } + if typeToString(fd.Type.Results.List[2].Type) != "error" { + return false + } + + recvType := typeToString(fd.Recv.List[0].Type) + if !strings.HasPrefix(recvType, "*") || !strings.HasSuffix(recvType, "Service") { + return false + } + + return true +} + +func (t *templateData) collectMethodInfo(fd *ast.FuncDecl) (*methodInfo, bool) { + recvType := typeToString(fd.Recv.List[0].Type) + recvVar := "" + if len(fd.Recv.List[0].Names) > 0 { + recvVar = fd.Recv.List[0].Names[0].Name + } + + args := []string{} + callArgs := []string{} + testCallArgs := []string{} + zeroArgs := []string{} + var optsType string + var optsName string + hasOpts := false + optsIsPtr := false + + for _, field := range fd.Type.Params.List { + typeStr := typeToString(field.Type) + zeroArg := getZeroValue(typeStr) + for _, name := range field.Names { + args = append(args, fmt.Sprintf("%v %v", name.Name, typeStr)) + callArgs = append(callArgs, name.Name) + zeroArgs = append(zeroArgs, zeroArg) + + if strings.HasSuffix(typeStr, "Options") { + optsType = strings.TrimPrefix(typeStr, "*") + optsName = name.Name + hasOpts = true + optsIsPtr = strings.HasPrefix(typeStr, "*") } - // second pass: generate testCallArgs after optsName is identified - for _, name := range field.Names { - if name.Name == optsName { - testCallArgs = append(testCallArgs, name.Name) - } else { - testCallArgs = append(testCallArgs, zeroArg) - } + } + // second pass: generate testCallArgs after optsName is identified + for _, name := range field.Names { + if name.Name == optsName { + testCallArgs = append(testCallArgs, name.Name) + } else { + testCallArgs = append(testCallArgs, zeroArg) } } + } - if !hasOpts { - continue - } + if !hasOpts { + return nil, false + } - useListCursorOptions := t.hasListCursorOptions(optsType) - useListOptions := t.hasListOptions(optsType) - usePage := t.hasIntPage(optsType) - useAfter := t.hasStringAfter(optsType) + useListCursorOptions := t.hasListCursorOptions(optsType) + useListOptions := t.hasListOptions(optsType) + usePage := t.hasIntPage(optsType) + useAfter := t.hasStringAfter(optsType) - if !useListCursorOptions && !useListOptions && !usePage && !useAfter { - logf("Skipping %s.%s: opts %s does not have ListCursorOptions, ListOptions, Page int, or After string", recvType, fd.Name.Name, optsType) - continue - } + if !useListCursorOptions && !useListOptions && !usePage && !useAfter { + logf("Skipping %v.%v: opts %v does not have ListCursorOptions, ListOptions, Page int, or After string", recvType, fd.Name.Name, optsType) + return nil, false + } - recType := strings.TrimPrefix(recvType, "*") - clientField := strings.TrimSuffix(recType, "Service") - if clientField == "Migration" { - clientField = "Migrations" - } - if clientField == "s" { - logf("WARNING: clientField is 's' for %s.%s (recvType=%s)", recvType, fd.Name.Name, recType) - } + recType := strings.TrimPrefix(recvType, "*") + clientField := strings.TrimSuffix(recType, "Service") + if clientField == "Migration" { + clientField = "Migrations" + } + if clientField == "s" { + logf("WARNING: clientField is 's' for %v.%v (recvType=%v)", recvType, fd.Name.Name, recType) + } - testJSON, emptyReturnValue := "[]", "{}" - if val, ok := customTestJSON[fd.Name.Name]; ok { - testJSON = val - } - if eltType == "string" { - emptyReturnValue = `""` - } - testJSON1 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v,%[1]v]", emptyReturnValue)) // Call 1 - return 3 items - testJSON2 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v,%[1]v,%[1]v]", emptyReturnValue)) // Call 1 part 2 - return 4 items - testJSON3 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v]", emptyReturnValue)) // Call 2 - return 2 items - - m := &method{ - RecvType: recType, - RecvVar: recvVar, - ClientField: clientField, - MethodName: fd.Name.Name, - IterMethod: fd.Name.Name + "Iter", - Args: strings.Join(args, ", "), - CallArgs: strings.Join(callArgs, ", "), - TestCallArgs: strings.Join(testCallArgs, ", "), - ZeroArgs: strings.Join(zeroArgs, ", "), - ReturnType: eltType, - OptsType: optsType, - OptsName: optsName, - OptsIsPtr: optsIsPtr, - UseListCursorOptions: useListCursorOptions, - UseListOptions: useListOptions, - UsePage: usePage, - UseAfter: useAfter, - TestJSON1: testJSON1, - TestJSON2: testJSON2, - TestJSON3: testJSON3, + return &methodInfo{ + RecvTypeRaw: recvType, + RecvType: recType, + RecvVar: recvVar, + ClientField: clientField, + Args: strings.Join(args, ", "), + CallArgs: strings.Join(callArgs, ", "), + TestCallArgs: strings.Join(testCallArgs, ", "), + ZeroArgs: strings.Join(zeroArgs, ", "), + OptsType: optsType, + OptsName: optsName, + OptsIsPtr: optsIsPtr, + UseListCursorOptions: useListCursorOptions, + UseListOptions: useListOptions, + UsePage: usePage, + UseAfter: useAfter, + }, true +} + +func (t *templateData) processReturnArrayType(fd *ast.FuncDecl, sliceRet *ast.ArrayType, methodInfo *methodInfo) { + testJSON, emptyReturnValue := "[]", "{}" + if val, ok := customTestJSON[fd.Name.Name]; ok { + testJSON = val + } + + eltType := typeToString(sliceRet.Elt) + if eltType == "string" { + emptyReturnValue = `""` + } + testJSON1 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v,%[1]v]", emptyReturnValue)) // Call 1 - return 3 items + testJSON2 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v,%[1]v,%[1]v]", emptyReturnValue)) // Call 1 part 2 - return 4 items + testJSON3 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v]", emptyReturnValue)) // Call 2 - return 2 items + + m := &method{ + RecvType: methodInfo.RecvType, + RecvVar: methodInfo.RecvVar, + ClientField: methodInfo.ClientField, + MethodName: fd.Name.Name, + IterMethod: fd.Name.Name + "Iter", + Args: methodInfo.Args, + CallArgs: methodInfo.CallArgs, + TestCallArgs: methodInfo.TestCallArgs, + ZeroArgs: methodInfo.ZeroArgs, + ReturnType: eltType, + OptsType: methodInfo.OptsType, + OptsName: methodInfo.OptsName, + OptsIsPtr: methodInfo.OptsIsPtr, + UseListCursorOptions: methodInfo.UseListCursorOptions, + UseListOptions: methodInfo.UseListOptions, + UsePage: methodInfo.UsePage, + UseAfter: methodInfo.UseAfter, + TestJSON1: testJSON1, + TestJSON2: testJSON2, + TestJSON3: testJSON3, + } + t.Methods = append(t.Methods, m) +} + +func (t *templateData) processReturnStarExpr(fd *ast.FuncDecl, starRet *ast.StarExpr, methodInfo *methodInfo) { + wrapperType := typeToString(starRet.X) + wrapperDef, ok := t.Structs[wrapperType] + if !ok { + logf("Skipping %v.%v: wrapper type %v not found", methodInfo.RecvTypeRaw, fd.Name.Name, wrapperType) + return + } + + itemsField, itemsType, ok := findSinglePointerSliceField(wrapperDef) + if !ok { + logf("Skipping %v.%v: wrapper %v does not contain exactly one []*T field", methodInfo.RecvTypeRaw, fd.Name.Name, wrapperType) + return + } + + testJSON, emptyReturnValue := "[]", "{}" + if jsonField, ok := wrapperDef.FieldJSON[itemsField]; ok && jsonField != "" { + testJSON = fmt.Sprintf(`{"%v": []}`, jsonField) + } else { + testJSON = fmt.Sprintf(`{"%v": []}`, lowerFirst(itemsField)) + } + if val, ok := customTestJSON[fd.Name.Name]; ok { + testJSON = val + } + + eltType := strings.TrimPrefix(itemsType, "[]") + if eltType == "string" { + emptyReturnValue = `""` + } + testJSON1 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v,%[1]v]", emptyReturnValue)) // Call 1 - return 3 items + testJSON2 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v,%[1]v,%[1]v]", emptyReturnValue)) // Call 1 part 2 - return 4 items + testJSON3 := strings.ReplaceAll(testJSON, "[]", fmt.Sprintf("[%v,%[1]v]", emptyReturnValue)) // Call 2 - return 2 items + + m := &method{ + RecvType: methodInfo.RecvType, + RecvVar: methodInfo.RecvVar, + ClientField: methodInfo.ClientField, + MethodName: fd.Name.Name, + IterMethod: fd.Name.Name + "Iter", + Args: methodInfo.Args, + CallArgs: methodInfo.CallArgs, + TestCallArgs: methodInfo.TestCallArgs, + ZeroArgs: methodInfo.ZeroArgs, + ReturnType: eltType, + OptsType: methodInfo.OptsType, + OptsName: methodInfo.OptsName, + OptsIsPtr: methodInfo.OptsIsPtr, + UseListCursorOptions: methodInfo.UseListCursorOptions, + UseListOptions: methodInfo.UseListOptions, + UsePage: methodInfo.UsePage, + UseAfter: methodInfo.UseAfter, + WrappedItemsField: itemsField, + TestJSON1: testJSON1, + TestJSON2: testJSON2, + TestJSON3: testJSON3, + } + t.Methods = append(t.Methods, m) +} + +func findSinglePointerSliceField(sd *structDef) (fieldName, fieldType string, ok bool) { + matches := []string{} + for name, typeStr := range sd.Fields { + if strings.HasPrefix(typeStr, "[]*") { + matches = append(matches, name) } - t.Methods = append(t.Methods, m) } - return nil + if len(matches) != 1 { + return "", "", false + } + fieldName = matches[0] + return fieldName, sd.Fields[fieldName], true +} + +func lowerFirst(s string) string { + if s == "" { + return s + } + return strings.ToLower(s[:1]) + s[1:] } func typeToString(expr ast.Expr) string { @@ -385,7 +554,7 @@ func typeToString(expr ast.Expr) string { case *ast.ArrayType: return "[]" + typeToString(x.Elt) case *ast.MapType: - return fmt.Sprintf("map[%s]%s", typeToString(x.Key), typeToString(x.Value)) + return fmt.Sprintf("map[%v]%v", typeToString(x.Key), typeToString(x.Value)) default: return "" } @@ -454,13 +623,21 @@ func ({{.RecvVar}} *{{.RecvType}}) {{.IterMethod}}({{.Args}}) iter.Seq2[{{.Retur {{end}} for { - items, resp, err := {{.RecvVar}}.{{.MethodName}}({{.CallArgs}}) + results, resp, err := {{.RecvVar}}.{{.MethodName}}({{.CallArgs}}) if err != nil { yield({{if hasPrefix .ReturnType "*"}}nil{{else}}*new({{.ReturnType}}){{end}}, err) return } - for _, item := range items { + {{if .WrappedItemsField -}} + var iterItems []{{.ReturnType}} + if results != nil { + iterItems = results.{{.WrappedItemsField}} + } + for _, item := range iterItems { + {{else -}} + for _, item := range results { + {{end -}} if !yield(item, nil) { return } diff --git a/github/github-iterators.go b/github/github-iterators.go index fdc9500a428..cdc88d681b2 100644 --- a/github/github-iterators.go +++ b/github/github-iterators.go @@ -14,9 +14,44 @@ import ( "iter" ) -// 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) { +// 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 = Ptr(*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{} @@ -25,13 +60,17 @@ func (s *ActivityService) ListEventsIter(ctx context.Context, opts *ListOptions) } for { - items, resp, err := s.ListEvents(ctx, opts) + results, resp, err := s.ListCacheUsageByRepoForOrg(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*ActionsCacheUsage + if results != nil { + iterItems = results.RepoCacheUsage + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -45,9 +84,44 @@ func (s *ActivityService) ListEventsIter(ctx context.Context, opts *ListOptions) } } -// 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) { +// 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 = Ptr(*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{} @@ -56,13 +130,17 @@ func (s *ActivityService) ListEventsForOrganizationIter(ctx context.Context, org } for { - items, resp, err := s.ListEventsForOrganization(ctx, org, opts) + results, resp, err := s.ListEnabledOrgsInEnterprise(ctx, owner, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Organization + if results != nil { + iterItems = results.Organizations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -76,9 +154,9 @@ func (s *ActivityService) ListEventsForOrganizationIter(ctx context.Context, org } } -// 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) { +// 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{} @@ -87,13 +165,17 @@ func (s *ActivityService) ListEventsForRepoNetworkIter(ctx context.Context, owne } for { - items, resp, err := s.ListEventsForRepoNetwork(ctx, owner, repo, opts) + results, resp, err := s.ListEnabledReposInOrg(ctx, owner, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -107,9 +189,9 @@ func (s *ActivityService) ListEventsForRepoNetworkIter(ctx context.Context, owne } } -// 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) { +// ListEnvSecretsIter returns an iterator that paginates through all results of ListEnvSecrets. +func (s *ActionsService) ListEnvSecretsIter(ctx context.Context, repoID int, 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{} @@ -118,13 +200,17 @@ func (s *ActivityService) ListEventsPerformedByUserIter(ctx context.Context, use } for { - items, resp, err := s.ListEventsPerformedByUser(ctx, user, publicOnly, opts) + results, resp, err := s.ListEnvSecrets(ctx, repoID, env, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -138,9 +224,9 @@ func (s *ActivityService) ListEventsPerformedByUserIter(ctx context.Context, use } } -// 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) { +// 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{} @@ -149,13 +235,17 @@ func (s *ActivityService) ListEventsReceivedByUserIter(ctx context.Context, user } for { - items, resp, err := s.ListEventsReceivedByUser(ctx, user, publicOnly, opts) + results, resp, err := s.ListEnvVariables(ctx, owner, repo, env, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -169,9 +259,9 @@ func (s *ActivityService) ListEventsReceivedByUserIter(ctx context.Context, user } } -// 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) { +// 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{} @@ -180,13 +270,17 @@ func (s *ActivityService) ListIssueEventsForRepositoryIter(ctx context.Context, } for { - items, resp, err := s.ListIssueEventsForRepository(ctx, owner, repo, opts) + results, resp, err := s.ListHostedRunners(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -200,24 +294,28 @@ func (s *ActivityService) ListIssueEventsForRepositoryIter(ctx context.Context, } } -// 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) { +// 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 = &NotificationListOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListNotifications(ctx, opts) + results, resp, err := s.ListOrgSecrets(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -226,14 +324,14 @@ func (s *ActivityService) ListNotificationsIter(ctx context.Context, opts *Notif if resp.NextPage == 0 { break } - opts.ListOptions.Page = resp.NextPage + opts.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) { +// 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{} @@ -242,13 +340,17 @@ func (s *ActivityService) ListRepositoryEventsIter(ctx context.Context, owner st } for { - items, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) + results, resp, err := s.ListOrgVariables(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -262,24 +364,28 @@ func (s *ActivityService) ListRepositoryEventsIter(ctx context.Context, owner st } } -// 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) { +// 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 = &NotificationListOptions{} + opts = &ListOrgRunnerGroupOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListRepositoryNotifications(ctx, owner, repo, opts) + results, resp, err := s.ListOrganizationRunnerGroups(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*RunnerGroup + if results != nil { + iterItems = results.RunnerGroups + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -293,9 +399,44 @@ func (s *ActivityService) ListRepositoryNotificationsIter(ctx context.Context, o } } -// 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) { +// 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 = Ptr(*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{} @@ -304,13 +445,17 @@ func (s *ActivityService) ListStargazersIter(ctx context.Context, owner string, } for { - items, resp, err := s.ListStargazers(ctx, owner, repo, opts) + results, resp, err := s.ListRepoOrgSecrets(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -324,24 +469,28 @@ func (s *ActivityService) ListStargazersIter(ctx context.Context, owner string, } } -// 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) { +// 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 = &ActivityListStarredOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListStarred(ctx, user, opts) + results, resp, err := s.ListRepoOrgVariables(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -350,14 +499,14 @@ func (s *ActivityService) ListStarredIter(ctx context.Context, user string, opts if resp.NextPage == 0 { break } - opts.ListOptions.Page = resp.NextPage + opts.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) { +// 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{} @@ -366,13 +515,17 @@ func (s *ActivityService) ListUserEventsForOrganizationIter(ctx context.Context, } for { - items, resp, err := s.ListUserEventsForOrganization(ctx, org, user, opts) + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -386,8 +539,43 @@ func (s *ActivityService) ListUserEventsForOrganizationIter(ctx context.Context, } } -// 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] { +// 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 = Ptr(*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 { @@ -397,13 +585,17 @@ func (s *ActivityService) ListWatchedIter(ctx context.Context, user string, opts } for { - items, resp, err := s.ListWatched(ctx, user, opts) + results, resp, err := s.ListRepositoriesSelfHostedRunnersAllowedInOrganization(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -417,9 +609,9 @@ func (s *ActivityService) ListWatchedIter(ctx context.Context, user string, opts } } -// 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) { +// 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{} @@ -428,13 +620,17 @@ func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, re } for { - items, resp, err := s.ListWatchers(ctx, owner, repo, opts) + results, resp, err := s.ListRepositoryAccessRunnerGroup(ctx, org, groupID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -448,40 +644,44 @@ func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, re } } -// 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) { +// 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 = &ListCursorOptions{} + opts = &ListWorkflowRunsOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListHookDeliveries(ctx, opts) + results, resp, err := s.ListRepositoryWorkflowRuns(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { if !yield(item, nil) { return } } - if resp.After == "" { + if resp.NextPage == 0 { break } - opts.After = resp.After + opts.ListOptions.Page = resp.NextPage } } } -// 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) { +// 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{} @@ -490,13 +690,17 @@ func (s *AppsService) ListInstallationRequestsIter(ctx context.Context, opts *Li } for { - items, resp, err := s.ListInstallationRequests(ctx, opts) + results, resp, err := s.ListRunnerGroupRunners(ctx, org, groupID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -510,9 +714,44 @@ func (s *AppsService) ListInstallationRequestsIter(ctx context.Context, opts *Li } } -// 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) { +// 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 = Ptr(*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{} @@ -521,13 +760,17 @@ func (s *AppsService) ListInstallationsIter(ctx context.Context, opts *ListOptio } for { - items, resp, err := s.ListInstallations(ctx, opts) + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -541,9 +784,9 @@ func (s *AppsService) ListInstallationsIter(ctx context.Context, opts *ListOptio } } -// 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) { +// 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{} @@ -552,13 +795,17 @@ func (s *AppsService) ListUserInstallationsIter(ctx context.Context, opts *ListO } for { - items, resp, err := s.ListUserInstallations(ctx, opts) + results, resp, err := s.ListSelectedReposForOrgVariable(ctx, org, name, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -572,9 +819,44 @@ func (s *AppsService) ListUserInstallationsIter(ctx context.Context, opts *ListO } } -// 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) { +// 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 = Ptr(*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{} @@ -583,13 +865,17 @@ func (s *ChecksService) ListCheckRunAnnotationsIter(ctx context.Context, owner s } for { - items, resp, err := s.ListCheckRunAnnotations(ctx, owner, repo, checkRunID, opts) + results, resp, err := s.ListWorkflowJobsAttempt(ctx, owner, repo, runID, attemptNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*WorkflowJob + if results != nil { + iterItems = results.Jobs + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -603,40 +889,1651 @@ func (s *ChecksService) ListCheckRunAnnotationsIter(ctx context.Context, owner s } } -// 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) { +// 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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 + } + } +} + +// 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 = Ptr(*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.After == "" { + break + } + opts.After = resp.After + } + } +} + +// 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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 + } + } +} + +// 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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 = Ptr(*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 + } + } +} + +// 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 = Ptr(*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 = Ptr(*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 = &ListOptions{} + opts = &ListAlertsOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListAcceptedAssignments(ctx, assignmentID, opts) + results, resp, err := s.ListRepoAlerts(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } } - if resp.NextPage == 0 { + if resp.After == "" && resp.NextPage == 0 { break } - opts.Page = resp.NextPage + opts.ListCursorOptions.After = resp.After + opts.ListOptions.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) { +// 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{} @@ -645,13 +2542,17 @@ func (s *ClassroomService) ListClassroomAssignmentsIter(ctx context.Context, cla } for { - items, resp, err := s.ListClassroomAssignments(ctx, classroomID, opts) + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -665,9 +2566,9 @@ func (s *ClassroomService) ListClassroomAssignmentsIter(ctx context.Context, cla } } -// 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) { +// 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{} @@ -676,13 +2577,17 @@ func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOpt } for { - items, resp, err := s.ListClassrooms(ctx, opts) + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -696,24 +2601,24 @@ func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOpt } } -// 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) { +// 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 = &AlertInstancesListOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListAlertInstances(ctx, owner, repo, id, opts) + results, resp, err := s.ListAppAccessibleOrganizationRepositories(ctx, enterprise, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -722,93 +2627,91 @@ func (s *CodeScanningService) ListAlertInstancesIter(ctx context.Context, owner if resp.NextPage == 0 { break } - opts.ListOptions.Page = resp.NextPage + opts.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) { +// 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 = &AlertListOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListAlertsForOrg(ctx, org, opts) + results, resp, err := s.ListAppInstallableOrganizations(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } } - if resp.After == "" && resp.NextPage == 0 { + if resp.NextPage == 0 { break } - opts.ListCursorOptions.After = resp.After - opts.ListOptions.Page = resp.NextPage + opts.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) { +// 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 = &AlertListOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) + results, resp, err := s.ListAppInstallations(ctx, enterprise, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } } - if resp.After == "" && resp.NextPage == 0 { + if resp.NextPage == 0 { break } - opts.ListCursorOptions.After = resp.After - opts.ListOptions.Page = resp.NextPage + opts.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) { +// 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 = &AnalysesListOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListAnalysesForRepo(ctx, owner, repo, opts) + results, resp, err := s.ListAssignments(ctx, enterprise, enterpriseTeam, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -817,78 +2720,76 @@ func (s *CodeScanningService) ListAnalysesForRepoIter(ctx context.Context, owner if resp.NextPage == 0 { break } - opts.ListOptions.Page = resp.NextPage + opts.Page = resp.NextPage } } } -// 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) { +// 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 = &ListAlertsOptions{} + opts = &ListCodeSecurityConfigurationRepositoriesOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListOrgAlerts(ctx, org, opts) + results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, enterprise, configurationID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } } - if resp.After == "" && resp.NextPage == 0 { + if resp.After == "" { break } - opts.ListCursorOptions.After = resp.After - opts.ListOptions.Page = resp.NextPage + opts.After = resp.After } } } -// 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) { +// 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 = &ListAlertsOptions{} + opts = &ListEnterpriseCodeSecurityConfigurationOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListRepoAlerts(ctx, owner, repo, opts) + results, resp, err := s.ListCodeSecurityConfigurations(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } } - if resp.After == "" && resp.NextPage == 0 { + if resp.After == "" { break } - opts.ListCursorOptions.After = resp.After - opts.ListOptions.Page = resp.NextPage + opts.After = resp.After } } } -// 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) { +// 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{} @@ -897,13 +2798,17 @@ func (s *EnterpriseService) ListAppAccessibleOrganizationRepositoriesIter(ctx co } for { - items, resp, err := s.ListAppAccessibleOrganizationRepositories(ctx, enterprise, org, opts) + results, resp, err := s.ListEnterpriseNetworkConfigurations(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*NetworkConfiguration + if results != nil { + iterItems = results.NetworkConfigurations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -917,9 +2822,9 @@ func (s *EnterpriseService) ListAppAccessibleOrganizationRepositoriesIter(ctx co } } -// 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) { +// 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{} @@ -928,13 +2833,17 @@ func (s *EnterpriseService) ListAppInstallableOrganizationsIter(ctx context.Cont } for { - items, resp, err := s.ListAppInstallableOrganizations(ctx, enterprise, opts) + results, resp, err := s.ListHostedRunners(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -948,9 +2857,9 @@ func (s *EnterpriseService) ListAppInstallableOrganizationsIter(ctx context.Cont } } -// 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) { +// 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{} @@ -959,13 +2868,17 @@ func (s *EnterpriseService) ListAppInstallationsIter(ctx context.Context, enterp } for { - items, resp, err := s.ListAppInstallations(ctx, enterprise, org, opts) + results, resp, err := s.ListOrganizationAccessRunnerGroup(ctx, enterprise, groupID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Organization + if results != nil { + iterItems = results.Organizations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -979,9 +2892,9 @@ func (s *EnterpriseService) ListAppInstallationsIter(ctx context.Context, enterp } } -// 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) { +// 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{} @@ -990,13 +2903,13 @@ func (s *EnterpriseService) ListAssignmentsIter(ctx context.Context, enterprise } for { - items, resp, err := s.ListAssignments(ctx, enterprise, enterpriseTeam, opts) + results, resp, err := s.ListOrganizationCustomPropertyValues(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1010,86 +2923,94 @@ func (s *EnterpriseService) ListAssignmentsIter(ctx context.Context, enterprise } } -// 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) { +// 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 = &ListCodeSecurityConfigurationRepositoriesOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, enterprise, configurationID, opts) + results, resp, err := s.ListRepositoriesForOrgAppInstallation(ctx, enterprise, org, installationID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } } - if resp.After == "" { + if resp.NextPage == 0 { break } - opts.After = resp.After + opts.Page = resp.NextPage } } } -// 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) { +// 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 = &ListEnterpriseCodeSecurityConfigurationOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListCodeSecurityConfigurations(ctx, enterprise, opts) + results, resp, err := s.ListRunnerGroupRunners(ctx, enterprise, groupID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { if !yield(item, nil) { return } } - if resp.After == "" { + if resp.NextPage == 0 { break } - opts.After = resp.After + 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) { +// 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 = &ListOptions{} + opts = &ListEnterpriseRunnerGroupOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListOrganizationCustomPropertyValues(ctx, enterprise, opts) + results, resp, err := s.ListRunnerGroups(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*EnterpriseRunnerGroup + if results != nil { + iterItems = results.RunnerGroups + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -1098,29 +3019,33 @@ func (s *EnterpriseService) ListOrganizationCustomPropertyValuesIter(ctx context if resp.NextPage == 0 { break } - opts.Page = resp.NextPage + opts.ListOptions.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) { +// 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 = &ListOptions{} + opts = &ListRunnersOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListRepositoriesForOrgAppInstallation(ctx, enterprise, org, installationID, opts) + results, resp, err := s.ListRunners(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -1129,7 +3054,7 @@ func (s *EnterpriseService) ListRepositoriesForOrgAppInstallationIter(ctx contex if resp.NextPage == 0 { break } - opts.Page = resp.NextPage + opts.ListOptions.Page = resp.NextPage } } } @@ -1145,13 +3070,13 @@ func (s *EnterpriseService) ListTeamMembersIter(ctx context.Context, enterprise } for { - items, resp, err := s.ListTeamMembers(ctx, enterprise, enterpriseTeam, opts) + results, resp, err := s.ListTeamMembers(ctx, enterprise, enterpriseTeam, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1176,13 +3101,13 @@ func (s *EnterpriseService) ListTeamsIter(ctx context.Context, enterprise string } for { - items, resp, err := s.ListTeams(ctx, enterprise, opts) + results, resp, err := s.ListTeams(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1207,13 +3132,13 @@ func (s *GistsService) ListIter(ctx context.Context, user string, opts *GistList } for { - items, resp, err := s.List(ctx, user, opts) + results, resp, err := s.List(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1238,13 +3163,13 @@ func (s *GistsService) ListAllIter(ctx context.Context, opts *GistListOptions) i } for { - items, resp, err := s.ListAll(ctx, opts) + results, resp, err := s.ListAll(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1269,13 +3194,13 @@ func (s *GistsService) ListCommentsIter(ctx context.Context, gistID string, opts } for { - items, resp, err := s.ListComments(ctx, gistID, opts) + results, resp, err := s.ListComments(ctx, gistID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1300,13 +3225,13 @@ func (s *GistsService) ListCommitsIter(ctx context.Context, id string, opts *Lis } for { - items, resp, err := s.ListCommits(ctx, id, opts) + results, resp, err := s.ListCommits(ctx, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1331,13 +3256,13 @@ func (s *GistsService) ListForksIter(ctx context.Context, id string, opts *ListO } for { - items, resp, err := s.ListForks(ctx, id, opts) + results, resp, err := s.ListForks(ctx, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1362,13 +3287,13 @@ func (s *GistsService) ListStarredIter(ctx context.Context, opts *GistListOption } for { - items, resp, err := s.ListStarred(ctx, opts) + results, resp, err := s.ListStarred(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1393,13 +3318,13 @@ func (s *IssuesService) ListIter(ctx context.Context, all bool, opts *IssueListO } for { - items, resp, err := s.List(ctx, all, opts) + results, resp, err := s.List(ctx, all, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1424,13 +3349,13 @@ func (s *IssuesService) ListAssigneesIter(ctx context.Context, owner string, rep } for { - items, resp, err := s.ListAssignees(ctx, owner, repo, opts) + results, resp, err := s.ListAssignees(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1455,13 +3380,13 @@ func (s *IssuesService) ListByOrgIter(ctx context.Context, org string, opts *Iss } for { - items, resp, err := s.ListByOrg(ctx, org, opts) + results, resp, err := s.ListByOrg(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1486,13 +3411,13 @@ func (s *IssuesService) ListByRepoIter(ctx context.Context, owner string, repo s } for { - items, resp, err := s.ListByRepo(ctx, owner, repo, opts) + results, resp, err := s.ListByRepo(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1518,13 +3443,13 @@ func (s *IssuesService) ListCommentsIter(ctx context.Context, owner string, repo } for { - items, resp, err := s.ListComments(ctx, owner, repo, number, opts) + results, resp, err := s.ListComments(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1549,13 +3474,13 @@ func (s *IssuesService) ListIssueEventsIter(ctx context.Context, owner string, r } for { - items, resp, err := s.ListIssueEvents(ctx, owner, repo, number, opts) + results, resp, err := s.ListIssueEvents(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1580,13 +3505,13 @@ func (s *IssuesService) ListIssueTimelineIter(ctx context.Context, owner string, } for { - items, resp, err := s.ListIssueTimeline(ctx, owner, repo, number, opts) + results, resp, err := s.ListIssueTimeline(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1611,13 +3536,13 @@ func (s *IssuesService) ListLabelsIter(ctx context.Context, owner string, repo s } for { - items, resp, err := s.ListLabels(ctx, owner, repo, opts) + results, resp, err := s.ListLabels(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1642,13 +3567,13 @@ func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, } for { - items, resp, err := s.ListLabelsByIssue(ctx, owner, repo, number, opts) + results, resp, err := s.ListLabelsByIssue(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1673,13 +3598,13 @@ func (s *IssuesService) ListLabelsForMilestoneIter(ctx context.Context, owner st } for { - items, resp, err := s.ListLabelsForMilestone(ctx, owner, repo, number, opts) + results, resp, err := s.ListLabelsForMilestone(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1704,13 +3629,13 @@ func (s *IssuesService) ListMilestonesIter(ctx context.Context, owner string, re } for { - items, resp, err := s.ListMilestones(ctx, owner, repo, opts) + results, resp, err := s.ListMilestones(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1735,13 +3660,13 @@ func (s *IssuesService) ListRepositoryEventsIter(ctx context.Context, owner stri } for { - items, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) + results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1766,13 +3691,13 @@ func (s *LicensesService) ListIter(ctx context.Context, opts *ListLicensesOption } for { - items, resp, err := s.List(ctx, opts) + results, resp, err := s.List(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1797,13 +3722,13 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUserIter(ctx context.Con } for { - items, resp, err := s.ListMarketplacePurchasesForUser(ctx, opts) + results, resp, err := s.ListMarketplacePurchasesForUser(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1828,13 +3753,13 @@ func (s *MarketplaceService) ListPlanAccountsForPlanIter(ctx context.Context, pl } for { - items, resp, err := s.ListPlanAccountsForPlan(ctx, planID, opts) + results, resp, err := s.ListPlanAccountsForPlan(ctx, planID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1859,13 +3784,13 @@ func (s *MarketplaceService) ListPlansIter(ctx context.Context, opts *ListOption } for { - items, resp, err := s.ListPlans(ctx, opts) + results, resp, err := s.ListPlans(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1890,13 +3815,13 @@ func (s *MigrationService) ListMigrationsIter(ctx context.Context, org string, o } for { - items, resp, err := s.ListMigrations(ctx, org, opts) + results, resp, err := s.ListMigrations(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1921,13 +3846,13 @@ func (s *MigrationService) ListUserMigrationsIter(ctx context.Context, opts *Lis } for { - items, resp, err := s.ListUserMigrations(ctx, opts) + results, resp, err := s.ListUserMigrations(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -1952,13 +3877,48 @@ func (s *OrganizationsService) ListIter(ctx context.Context, user string, opts * } for { - items, resp, err := s.List(ctx, user, opts) + 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 + } + } +} + +// 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 = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, org, subjectDigest, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -1983,13 +3943,13 @@ func (s *OrganizationsService) ListBlockedUsersIter(ctx context.Context, org str } for { - items, resp, err := s.ListBlockedUsers(ctx, org, opts) + results, resp, err := s.ListBlockedUsers(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2014,13 +3974,13 @@ func (s *OrganizationsService) ListCodeSecurityConfigurationRepositoriesIter(ctx } for { - items, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, org, configurationID, opts) + results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, org, configurationID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2045,13 +4005,13 @@ func (s *OrganizationsService) ListCodeSecurityConfigurationsIter(ctx context.Co } for { - items, resp, err := s.ListCodeSecurityConfigurations(ctx, org, opts) + results, resp, err := s.ListCodeSecurityConfigurations(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2076,13 +4036,13 @@ func (s *OrganizationsService) ListCredentialAuthorizationsIter(ctx context.Cont } for { - items, resp, err := s.ListCredentialAuthorizations(ctx, org, opts) + results, resp, err := s.ListCredentialAuthorizations(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2107,13 +4067,13 @@ func (s *OrganizationsService) ListCustomPropertyValuesIter(ctx context.Context, } for { - items, resp, err := s.ListCustomPropertyValues(ctx, org, opts) + results, resp, err := s.ListCustomPropertyValues(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2138,13 +4098,106 @@ func (s *OrganizationsService) ListFailedOrgInvitationsIter(ctx context.Context, } for { - items, resp, err := s.ListFailedOrgInvitations(ctx, org, opts) + 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 + } + } +} + +// 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 = Ptr(*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 = Ptr(*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.After == "" { + break + } + opts.After = resp.After + } + } +} + +// 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 = Ptr(*opts) + } + + for { + results, resp, err := s.ListHooks(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2158,24 +4211,28 @@ func (s *OrganizationsService) ListFailedOrgInvitationsIter(ctx context.Context, } } -// 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) { +// 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 = &ListFineGrainedPATOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListFineGrainedPersonalAccessTokens(ctx, org, opts) + results, resp, err := s.ListImmutableReleaseRepositories(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -2184,60 +4241,64 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokensIter(ctx conte if resp.NextPage == 0 { break } - opts.ListOptions.Page = resp.NextPage + opts.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) { +// 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 = &ListCursorOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListHookDeliveries(ctx, org, id, opts) + results, resp, err := s.ListInstallations(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Installation + if results != nil { + iterItems = results.Installations + } + for _, item := range iterItems { if !yield(item, nil) { return } } - if resp.After == "" { + if resp.NextPage == 0 { break } - opts.After = resp.After + opts.Page = resp.NextPage } } } -// 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) { +// 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 = &ListOptions{} + opts = &ListMembersOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListHooks(ctx, org, opts) + results, resp, err := s.ListMembers(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2246,29 +4307,33 @@ func (s *OrganizationsService) ListHooksIter(ctx context.Context, org string, op if resp.NextPage == 0 { break } - opts.Page = resp.NextPage + opts.ListOptions.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) { +// 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 = &ListMembersOptions{} + opts = &ListOptions{} } else { opts = Ptr(*opts) } for { - items, resp, err := s.ListMembers(ctx, org, opts) + results, resp, err := s.ListNetworkConfigurations(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*NetworkConfiguration + if results != nil { + iterItems = results.NetworkConfigurations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -2277,7 +4342,7 @@ func (s *OrganizationsService) ListMembersIter(ctx context.Context, org string, if resp.NextPage == 0 { break } - opts.ListOptions.Page = resp.NextPage + opts.Page = resp.NextPage } } } @@ -2293,13 +4358,13 @@ func (s *OrganizationsService) ListOrgInvitationTeamsIter(ctx context.Context, o } for { - items, resp, err := s.ListOrgInvitationTeams(ctx, org, invitationID, opts) + results, resp, err := s.ListOrgInvitationTeams(ctx, org, invitationID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2324,13 +4389,13 @@ func (s *OrganizationsService) ListOrgMembershipsIter(ctx context.Context, opts } for { - items, resp, err := s.ListOrgMemberships(ctx, opts) + results, resp, err := s.ListOrgMemberships(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2355,13 +4420,13 @@ func (s *OrganizationsService) ListOutsideCollaboratorsIter(ctx context.Context, } for { - items, resp, err := s.ListOutsideCollaborators(ctx, org, opts) + results, resp, err := s.ListOutsideCollaborators(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2386,13 +4451,13 @@ func (s *OrganizationsService) ListPackagesIter(ctx context.Context, org string, } for { - items, resp, err := s.ListPackages(ctx, org, opts) + results, resp, err := s.ListPackages(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2417,13 +4482,13 @@ func (s *OrganizationsService) ListPendingOrgInvitationsIter(ctx context.Context } for { - items, resp, err := s.ListPendingOrgInvitations(ctx, org, opts) + results, resp, err := s.ListPendingOrgInvitations(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2448,13 +4513,13 @@ func (s *OrganizationsService) ListTeamsAssignedToOrgRoleIter(ctx context.Contex } for { - items, resp, err := s.ListTeamsAssignedToOrgRole(ctx, org, roleID, opts) + results, resp, err := s.ListTeamsAssignedToOrgRole(ctx, org, roleID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2479,13 +4544,48 @@ func (s *OrganizationsService) ListUsersAssignedToOrgRoleIter(ctx context.Contex } for { - items, resp, err := s.ListUsersAssignedToOrgRole(ctx, org, roleID, opts) + 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 = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationPrivateRegistries(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*PrivateRegistry + if results != nil { + iterItems = results.Configurations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -2510,13 +4610,13 @@ func (s *ProjectsService) ListOrganizationProjectFieldsIter(ctx context.Context, } for { - items, resp, err := s.ListOrganizationProjectFields(ctx, org, projectNumber, opts) + results, resp, err := s.ListOrganizationProjectFields(ctx, org, projectNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2541,13 +4641,13 @@ func (s *ProjectsService) ListOrganizationProjectItemsIter(ctx context.Context, } for { - items, resp, err := s.ListOrganizationProjectItems(ctx, org, projectNumber, opts) + results, resp, err := s.ListOrganizationProjectItems(ctx, org, projectNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2572,13 +4672,13 @@ func (s *ProjectsService) ListOrganizationProjectsIter(ctx context.Context, org } for { - items, resp, err := s.ListOrganizationProjects(ctx, org, opts) + results, resp, err := s.ListOrganizationProjects(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2603,13 +4703,13 @@ func (s *ProjectsService) ListUserProjectFieldsIter(ctx context.Context, user st } for { - items, resp, err := s.ListUserProjectFields(ctx, user, projectNumber, opts) + results, resp, err := s.ListUserProjectFields(ctx, user, projectNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2634,13 +4734,13 @@ func (s *ProjectsService) ListUserProjectItemsIter(ctx context.Context, username } for { - items, resp, err := s.ListUserProjectItems(ctx, username, projectNumber, opts) + results, resp, err := s.ListUserProjectItems(ctx, username, projectNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2665,13 +4765,13 @@ func (s *ProjectsService) ListUserProjectsIter(ctx context.Context, username str } for { - items, resp, err := s.ListUserProjects(ctx, username, opts) + results, resp, err := s.ListUserProjects(ctx, username, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2696,13 +4796,13 @@ func (s *PullRequestsService) ListIter(ctx context.Context, owner string, repo s } for { - items, resp, err := s.List(ctx, owner, repo, opts) + results, resp, err := s.List(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2727,13 +4827,13 @@ func (s *PullRequestsService) ListCommentsIter(ctx context.Context, owner string } for { - items, resp, err := s.ListComments(ctx, owner, repo, number, opts) + results, resp, err := s.ListComments(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2758,13 +4858,13 @@ func (s *PullRequestsService) ListCommitsIter(ctx context.Context, owner string, } for { - items, resp, err := s.ListCommits(ctx, owner, repo, number, opts) + results, resp, err := s.ListCommits(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2789,13 +4889,13 @@ func (s *PullRequestsService) ListFilesIter(ctx context.Context, owner string, r } for { - items, resp, err := s.ListFiles(ctx, owner, repo, number, opts) + results, resp, err := s.ListFiles(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2820,13 +4920,13 @@ func (s *PullRequestsService) ListPullRequestsWithCommitIter(ctx context.Context } for { - items, resp, err := s.ListPullRequestsWithCommit(ctx, owner, repo, sha, opts) + results, resp, err := s.ListPullRequestsWithCommit(ctx, owner, repo, sha, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2851,13 +4951,13 @@ func (s *PullRequestsService) ListReviewCommentsIter(ctx context.Context, owner } for { - items, resp, err := s.ListReviewComments(ctx, owner, repo, number, reviewID, opts) + results, resp, err := s.ListReviewComments(ctx, owner, repo, number, reviewID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2882,13 +4982,13 @@ func (s *PullRequestsService) ListReviewsIter(ctx context.Context, owner string, } for { - items, resp, err := s.ListReviews(ctx, owner, repo, number, opts) + results, resp, err := s.ListReviews(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2913,13 +5013,13 @@ func (s *ReactionsService) ListCommentReactionsIter(ctx context.Context, owner s } for { - items, resp, err := s.ListCommentReactions(ctx, owner, repo, id, opts) + results, resp, err := s.ListCommentReactions(ctx, owner, repo, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2944,13 +5044,13 @@ func (s *ReactionsService) ListIssueCommentReactionsIter(ctx context.Context, ow } for { - items, resp, err := s.ListIssueCommentReactions(ctx, owner, repo, id, opts) + results, resp, err := s.ListIssueCommentReactions(ctx, owner, repo, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -2975,13 +5075,13 @@ func (s *ReactionsService) ListIssueReactionsIter(ctx context.Context, owner str } for { - items, resp, err := s.ListIssueReactions(ctx, owner, repo, number, opts) + results, resp, err := s.ListIssueReactions(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3006,13 +5106,13 @@ func (s *ReactionsService) ListPullRequestCommentReactionsIter(ctx context.Conte } for { - items, resp, err := s.ListPullRequestCommentReactions(ctx, owner, repo, id, opts) + results, resp, err := s.ListPullRequestCommentReactions(ctx, owner, repo, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3037,13 +5137,13 @@ func (s *ReactionsService) ListReleaseReactionsIter(ctx context.Context, owner s } for { - items, resp, err := s.ListReleaseReactions(ctx, owner, repo, releaseID, opts) + results, resp, err := s.ListReleaseReactions(ctx, owner, repo, releaseID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3068,13 +5168,13 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactionsIter(ctx context.Co } for { - items, resp, err := s.ListTeamDiscussionCommentReactions(ctx, teamID, discussionNumber, commentNumber, opts) + results, resp, err := s.ListTeamDiscussionCommentReactions(ctx, teamID, discussionNumber, commentNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3099,13 +5199,13 @@ func (s *ReactionsService) ListTeamDiscussionReactionsIter(ctx context.Context, } for { - items, resp, err := s.ListTeamDiscussionReactions(ctx, teamID, discussionNumber, opts) + results, resp, err := s.ListTeamDiscussionReactions(ctx, teamID, discussionNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3130,13 +5230,13 @@ func (s *RepositoriesService) ListIter(ctx context.Context, user string, opts *R } for { - items, resp, err := s.List(ctx, user, opts) + results, resp, err := s.List(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3161,13 +5261,48 @@ func (s *RepositoriesService) ListAllTopicsIter(ctx context.Context, owner strin } for { - items, resp, err := s.ListAllTopics(ctx, owner, repo, opts) + results, resp, err := s.ListAllTopics(ctx, owner, repo, opts) if err != nil { yield(*new(string), err) return } - for _, item := range items { + 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 = Ptr(*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 } @@ -3192,13 +5327,13 @@ func (s *RepositoriesService) ListBranchesIter(ctx context.Context, owner string } for { - items, resp, err := s.ListBranches(ctx, owner, repo, opts) + results, resp, err := s.ListBranches(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3223,13 +5358,13 @@ func (s *RepositoriesService) ListByAuthenticatedUserIter(ctx context.Context, o } for { - items, resp, err := s.ListByAuthenticatedUser(ctx, opts) + results, resp, err := s.ListByAuthenticatedUser(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3254,13 +5389,13 @@ func (s *RepositoriesService) ListByOrgIter(ctx context.Context, org string, opt } for { - items, resp, err := s.ListByOrg(ctx, org, opts) + results, resp, err := s.ListByOrg(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3285,13 +5420,13 @@ func (s *RepositoriesService) ListByUserIter(ctx context.Context, user string, o } for { - items, resp, err := s.ListByUser(ctx, user, opts) + results, resp, err := s.ListByUser(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3316,13 +5451,13 @@ func (s *RepositoriesService) ListCollaboratorsIter(ctx context.Context, owner s } for { - items, resp, err := s.ListCollaborators(ctx, owner, repo, opts) + results, resp, err := s.ListCollaborators(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3347,13 +5482,13 @@ func (s *RepositoriesService) ListCommentsIter(ctx context.Context, owner string } for { - items, resp, err := s.ListComments(ctx, owner, repo, opts) + results, resp, err := s.ListComments(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3378,13 +5513,13 @@ func (s *RepositoriesService) ListCommitCommentsIter(ctx context.Context, owner } for { - items, resp, err := s.ListCommitComments(ctx, owner, repo, sha, opts) + results, resp, err := s.ListCommitComments(ctx, owner, repo, sha, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3409,13 +5544,13 @@ func (s *RepositoriesService) ListCommitsIter(ctx context.Context, owner string, } for { - items, resp, err := s.ListCommits(ctx, owner, repo, opts) + results, resp, err := s.ListCommits(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3440,13 +5575,13 @@ func (s *RepositoriesService) ListContributorsIter(ctx context.Context, owner st } for { - items, resp, err := s.ListContributors(ctx, owner, repository, opts) + results, resp, err := s.ListContributors(ctx, owner, repository, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3460,6 +5595,76 @@ func (s *RepositoriesService) ListContributorsIter(ctx context.Context, owner st } } +// 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 = Ptr(*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 = Ptr(*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) { @@ -3471,13 +5676,13 @@ func (s *RepositoriesService) ListDeploymentStatusesIter(ctx context.Context, ow } for { - items, resp, err := s.ListDeploymentStatuses(ctx, owner, repo, deployment, opts) + results, resp, err := s.ListDeploymentStatuses(ctx, owner, repo, deployment, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3502,13 +5707,48 @@ func (s *RepositoriesService) ListDeploymentsIter(ctx context.Context, owner str } for { - items, resp, err := s.ListDeployments(ctx, owner, repo, opts) + 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 = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvironments(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Environment + if results != nil { + iterItems = results.Environments + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -3533,13 +5773,13 @@ func (s *RepositoriesService) ListForksIter(ctx context.Context, owner string, r } for { - items, resp, err := s.ListForks(ctx, owner, repo, opts) + results, resp, err := s.ListForks(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3564,13 +5804,13 @@ func (s *RepositoriesService) ListHookDeliveriesIter(ctx context.Context, owner } for { - items, resp, err := s.ListHookDeliveries(ctx, owner, repo, id, opts) + results, resp, err := s.ListHookDeliveries(ctx, owner, repo, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3595,13 +5835,13 @@ func (s *RepositoriesService) ListHooksIter(ctx context.Context, owner string, r } for { - items, resp, err := s.ListHooks(ctx, owner, repo, opts) + results, resp, err := s.ListHooks(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3626,13 +5866,13 @@ func (s *RepositoriesService) ListInvitationsIter(ctx context.Context, owner str } for { - items, resp, err := s.ListInvitations(ctx, owner, repo, opts) + results, resp, err := s.ListInvitations(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3657,13 +5897,13 @@ func (s *RepositoriesService) ListKeysIter(ctx context.Context, owner string, re } for { - items, resp, err := s.ListKeys(ctx, owner, repo, opts) + results, resp, err := s.ListKeys(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3688,13 +5928,13 @@ func (s *RepositoriesService) ListPagesBuildsIter(ctx context.Context, owner str } for { - items, resp, err := s.ListPagesBuilds(ctx, owner, repo, opts) + results, resp, err := s.ListPagesBuilds(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3719,13 +5959,13 @@ func (s *RepositoriesService) ListPreReceiveHooksIter(ctx context.Context, owner } for { - items, resp, err := s.ListPreReceiveHooks(ctx, owner, repo, opts) + results, resp, err := s.ListPreReceiveHooks(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3750,13 +5990,13 @@ func (s *RepositoriesService) ListReleaseAssetsIter(ctx context.Context, owner s } for { - items, resp, err := s.ListReleaseAssets(ctx, owner, repo, id, opts) + results, resp, err := s.ListReleaseAssets(ctx, owner, repo, id, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3781,13 +6021,13 @@ func (s *RepositoriesService) ListReleasesIter(ctx context.Context, owner string } for { - items, resp, err := s.ListReleases(ctx, owner, repo, opts) + results, resp, err := s.ListReleases(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3812,13 +6052,13 @@ func (s *RepositoriesService) ListRepositoryActivitiesIter(ctx context.Context, } for { - items, resp, err := s.ListRepositoryActivities(ctx, owner, repo, opts) + results, resp, err := s.ListRepositoryActivities(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3843,13 +6083,13 @@ func (s *RepositoriesService) ListStatusesIter(ctx context.Context, owner string } for { - items, resp, err := s.ListStatuses(ctx, owner, repo, ref, opts) + results, resp, err := s.ListStatuses(ctx, owner, repo, ref, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3874,13 +6114,13 @@ func (s *RepositoriesService) ListTagsIter(ctx context.Context, owner string, re } for { - items, resp, err := s.ListTags(ctx, owner, repo, opts) + results, resp, err := s.ListTags(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3905,13 +6145,13 @@ func (s *RepositoriesService) ListTeamsIter(ctx context.Context, owner string, r } for { - items, resp, err := s.ListTeams(ctx, owner, repo, opts) + results, resp, err := s.ListTeams(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3936,13 +6176,13 @@ func (s *SecretScanningService) ListAlertsForEnterpriseIter(ctx context.Context, } for { - items, resp, err := s.ListAlertsForEnterprise(ctx, enterprise, opts) + results, resp, err := s.ListAlertsForEnterprise(ctx, enterprise, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -3968,13 +6208,13 @@ func (s *SecretScanningService) ListAlertsForOrgIter(ctx context.Context, org st } for { - items, resp, err := s.ListAlertsForOrg(ctx, org, opts) + results, resp, err := s.ListAlertsForOrg(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4000,13 +6240,13 @@ func (s *SecretScanningService) ListAlertsForRepoIter(ctx context.Context, owner } for { - items, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) + results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4032,13 +6272,13 @@ func (s *SecretScanningService) ListLocationsForAlertIter(ctx context.Context, o } for { - items, resp, err := s.ListLocationsForAlert(ctx, owner, repo, number, opts) + results, resp, err := s.ListLocationsForAlert(ctx, owner, repo, number, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4063,13 +6303,13 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisoriesIter(ctx context } for { - items, resp, err := s.ListGlobalSecurityAdvisories(ctx, opts) + results, resp, err := s.ListGlobalSecurityAdvisories(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4094,13 +6334,13 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesIter(ctx con } for { - items, resp, err := s.ListRepositorySecurityAdvisories(ctx, owner, repo, opts) + results, resp, err := s.ListRepositorySecurityAdvisories(ctx, owner, repo, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4125,13 +6365,13 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrgIter(c } for { - items, resp, err := s.ListRepositorySecurityAdvisoriesForOrg(ctx, org, opts) + results, resp, err := s.ListRepositorySecurityAdvisoriesForOrg(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4156,13 +6396,13 @@ func (s *SubIssueService) ListByIssueIter(ctx context.Context, owner string, rep } for { - items, resp, err := s.ListByIssue(ctx, owner, repo, issueNumber, opts) + results, resp, err := s.ListByIssue(ctx, owner, repo, issueNumber, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4187,13 +6427,13 @@ func (s *TeamsService) ListChildTeamsByParentIDIter(ctx context.Context, orgID i } for { - items, resp, err := s.ListChildTeamsByParentID(ctx, orgID, teamID, opts) + results, resp, err := s.ListChildTeamsByParentID(ctx, orgID, teamID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4218,13 +6458,13 @@ func (s *TeamsService) ListChildTeamsByParentSlugIter(ctx context.Context, org s } for { - items, resp, err := s.ListChildTeamsByParentSlug(ctx, org, slug, opts) + results, resp, err := s.ListChildTeamsByParentSlug(ctx, org, slug, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4249,13 +6489,13 @@ func (s *TeamsService) ListCommentsByIDIter(ctx context.Context, orgID int64, te } for { - items, resp, err := s.ListCommentsByID(ctx, orgID, teamID, discussionNumber, options) + results, resp, err := s.ListCommentsByID(ctx, orgID, teamID, discussionNumber, options) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4280,13 +6520,13 @@ func (s *TeamsService) ListCommentsBySlugIter(ctx context.Context, org string, s } for { - items, resp, err := s.ListCommentsBySlug(ctx, org, slug, discussionNumber, options) + results, resp, err := s.ListCommentsBySlug(ctx, org, slug, discussionNumber, options) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4311,13 +6551,13 @@ func (s *TeamsService) ListDiscussionsByIDIter(ctx context.Context, orgID int64, } for { - items, resp, err := s.ListDiscussionsByID(ctx, orgID, teamID, opts) + results, resp, err := s.ListDiscussionsByID(ctx, orgID, teamID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4342,13 +6582,48 @@ func (s *TeamsService) ListDiscussionsBySlugIter(ctx context.Context, org string } for { - items, resp, err := s.ListDiscussionsBySlug(ctx, org, slug, opts) + 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 = Ptr(*opts) + } + + for { + results, resp, err := s.ListExternalGroups(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*ExternalGroup + if results != nil { + iterItems = results.Groups + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -4362,6 +6637,41 @@ func (s *TeamsService) ListDiscussionsBySlugIter(ctx context.Context, org string } } +// 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 = Ptr(*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) { @@ -4373,13 +6683,13 @@ func (s *TeamsService) ListPendingTeamInvitationsByIDIter(ctx context.Context, o } for { - items, resp, err := s.ListPendingTeamInvitationsByID(ctx, orgID, teamID, opts) + results, resp, err := s.ListPendingTeamInvitationsByID(ctx, orgID, teamID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4404,13 +6714,13 @@ func (s *TeamsService) ListPendingTeamInvitationsBySlugIter(ctx context.Context, } for { - items, resp, err := s.ListPendingTeamInvitationsBySlug(ctx, org, slug, opts) + results, resp, err := s.ListPendingTeamInvitationsBySlug(ctx, org, slug, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4435,13 +6745,13 @@ func (s *TeamsService) ListTeamMembersByIDIter(ctx context.Context, orgID int64, } for { - items, resp, err := s.ListTeamMembersByID(ctx, orgID, teamID, opts) + results, resp, err := s.ListTeamMembersByID(ctx, orgID, teamID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4466,13 +6776,13 @@ func (s *TeamsService) ListTeamMembersBySlugIter(ctx context.Context, org string } for { - items, resp, err := s.ListTeamMembersBySlug(ctx, org, slug, opts) + results, resp, err := s.ListTeamMembersBySlug(ctx, org, slug, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4497,13 +6807,13 @@ func (s *TeamsService) ListTeamReposByIDIter(ctx context.Context, orgID int64, t } for { - items, resp, err := s.ListTeamReposByID(ctx, orgID, teamID, opts) + results, resp, err := s.ListTeamReposByID(ctx, orgID, teamID, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4528,13 +6838,13 @@ func (s *TeamsService) ListTeamReposBySlugIter(ctx context.Context, org string, } for { - items, resp, err := s.ListTeamReposBySlug(ctx, org, slug, opts) + results, resp, err := s.ListTeamReposBySlug(ctx, org, slug, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4559,13 +6869,13 @@ func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *List } for { - items, resp, err := s.ListTeams(ctx, org, opts) + results, resp, err := s.ListTeams(ctx, org, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4590,13 +6900,48 @@ func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) } for { - items, resp, err := s.ListUserTeams(ctx, opts) + 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 = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, user, subjectDigest, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { if !yield(item, nil) { return } @@ -4621,13 +6966,13 @@ func (s *UsersService) ListBlockedUsersIter(ctx context.Context, opts *ListOptio } for { - items, resp, err := s.ListBlockedUsers(ctx, opts) + results, resp, err := s.ListBlockedUsers(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4652,13 +6997,13 @@ func (s *UsersService) ListEmailsIter(ctx context.Context, opts *ListOptions) it } for { - items, resp, err := s.ListEmails(ctx, opts) + results, resp, err := s.ListEmails(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4683,13 +7028,13 @@ func (s *UsersService) ListFollowersIter(ctx context.Context, user string, opts } for { - items, resp, err := s.ListFollowers(ctx, user, opts) + results, resp, err := s.ListFollowers(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4714,13 +7059,13 @@ func (s *UsersService) ListFollowingIter(ctx context.Context, user string, opts } for { - items, resp, err := s.ListFollowing(ctx, user, opts) + results, resp, err := s.ListFollowing(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4745,13 +7090,13 @@ func (s *UsersService) ListGPGKeysIter(ctx context.Context, user string, opts *L } for { - items, resp, err := s.ListGPGKeys(ctx, user, opts) + results, resp, err := s.ListGPGKeys(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4776,13 +7121,13 @@ func (s *UsersService) ListInvitationsIter(ctx context.Context, opts *ListOption } for { - items, resp, err := s.ListInvitations(ctx, opts) + results, resp, err := s.ListInvitations(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4807,13 +7152,13 @@ func (s *UsersService) ListKeysIter(ctx context.Context, user string, opts *List } for { - items, resp, err := s.ListKeys(ctx, user, opts) + results, resp, err := s.ListKeys(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4838,13 +7183,13 @@ func (s *UsersService) ListPackagesIter(ctx context.Context, user string, opts * } for { - items, resp, err := s.ListPackages(ctx, user, opts) + results, resp, err := s.ListPackages(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4869,13 +7214,13 @@ func (s *UsersService) ListSSHSigningKeysIter(ctx context.Context, user string, } for { - items, resp, err := s.ListSSHSigningKeys(ctx, user, opts) + results, resp, err := s.ListSSHSigningKeys(ctx, user, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4900,13 +7245,13 @@ func (s *UsersService) ListSocialAccountsIter(ctx context.Context, opts *ListOpt } for { - items, resp, err := s.ListSocialAccounts(ctx, opts) + results, resp, err := s.ListSocialAccounts(ctx, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } @@ -4931,13 +7276,13 @@ func (s *UsersService) ListUserSocialAccountsIter(ctx context.Context, username } for { - items, resp, err := s.ListUserSocialAccounts(ctx, username, opts) + results, resp, err := s.ListUserSocialAccounts(ctx, username, opts) if err != nil { yield(nil, err) return } - for _, item := range items { + for _, item := range results { if !yield(item, nil) { return } diff --git a/github/github-iterators_test.go b/github/github-iterators_test.go index 21e09280b9e..055d4966413 100644 --- a/github/github-iterators_test.go +++ b/github/github-iterators_test.go @@ -15,7 +15,7 @@ import ( "testing" ) -func TestActivityService_ListEventsIter(t *testing.T) { +func TestActionsService_ListArtifactsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -24,19 +24,19 @@ func TestActivityService_ListEventsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{}]}`) } }) - iter := client.Activity.ListEventsIter(t.Context(), nil) + iter := client.Actions.ListArtifactsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -45,11 +45,11 @@ func TestActivityService_ListEventsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListEventsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListArtifactsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Activity.ListEventsIter(t.Context(), opts) + opts := &ListArtifactsOptions{} + iter = client.Actions.ListArtifactsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -58,10 +58,10 @@ func TestActivityService_ListEventsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListEventsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListArtifactsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListEventsIter(t.Context(), nil) + iter = client.Actions.ListArtifactsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -70,12 +70,12 @@ func TestActivityService_ListEventsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListEventsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListArtifactsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListEventsIter(t.Context(), nil) + iter = client.Actions.ListArtifactsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *Artifact, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -83,11 +83,11 @@ func TestActivityService_ListEventsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListEventsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListArtifactsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { +func TestActionsService_ListCacheUsageByRepoForOrgIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -96,19 +96,19 @@ func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repository_cache_usages": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repository_cache_usages": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repository_cache_usages": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repository_cache_usages": [{},{}]}`) } }) - iter := client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil) + iter := client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -117,11 +117,11 @@ func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListEventsForOrganizationIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", opts) + iter = client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -130,10 +130,10 @@ func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListEventsForOrganizationIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil) + iter = client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -142,12 +142,12 @@ func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListEventsForOrganizationIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil) + iter = client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *ActionsCacheUsage, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -155,11 +155,11 @@ func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListEventsForOrganizationIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { +func TestActionsService_ListCachesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -168,19 +168,19 @@ func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"actions_caches": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"actions_caches": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"actions_caches": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"actions_caches": [{},{}]}`) } }) - iter := client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil) + iter := client.Actions.ListCachesIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -189,11 +189,11 @@ func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListCachesIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", opts) + opts := &ActionsCacheListOptions{} + iter = client.Actions.ListCachesIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -202,10 +202,10 @@ func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListCachesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil) + iter = client.Actions.ListCachesIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -214,12 +214,12 @@ func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListCachesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil) + iter = client.Actions.ListCachesIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *ActionsCache, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -227,11 +227,11 @@ func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListCachesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { +func TestActionsService_ListEnabledOrgsInEnterpriseIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -240,19 +240,19 @@ func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{}]}`) } }) - iter := client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil) + iter := client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -261,11 +261,11 @@ func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListEventsPerformedByUserIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, opts) + iter = client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -274,10 +274,10 @@ func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListEventsPerformedByUserIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil) + iter = client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -286,12 +286,12 @@ func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListEventsPerformedByUserIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil) + iter = client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *Organization, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -299,11 +299,11 @@ func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListEventsPerformedByUserIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { +func TestActionsService_ListEnabledReposInOrgIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -312,19 +312,19 @@ func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil) + iter := client.Actions.ListEnabledReposInOrgIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -333,11 +333,11 @@ func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListEventsReceivedByUserIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnabledReposInOrgIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, opts) + iter = client.Actions.ListEnabledReposInOrgIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -346,10 +346,10 @@ func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListEventsReceivedByUserIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnabledReposInOrgIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil) + iter = client.Actions.ListEnabledReposInOrgIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -358,12 +358,12 @@ func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListEventsReceivedByUserIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnabledReposInOrgIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil) + iter = client.Actions.ListEnabledReposInOrgIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -371,11 +371,11 @@ func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListEventsReceivedByUserIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnabledReposInOrgIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { +func TestActionsService_ListEnvSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -384,19 +384,19 @@ func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil) + iter := client.Actions.ListEnvSecretsIter(t.Context(), 0, "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -405,11 +405,11 @@ func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnvSecretsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", opts) + iter = client.Actions.ListEnvSecretsIter(t.Context(), 0, "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -418,10 +418,10 @@ func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnvSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil) + iter = client.Actions.ListEnvSecretsIter(t.Context(), 0, "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -430,12 +430,12 @@ func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnvSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil) + iter = client.Actions.ListEnvSecretsIter(t.Context(), 0, "", nil) gotItems = 0 - iter(func(item *IssueEvent, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -443,11 +443,11 @@ func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnvSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListNotificationsIter(t *testing.T) { +func TestActionsService_ListEnvVariablesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -456,19 +456,19 @@ func TestActivityService_ListNotificationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) } }) - iter := client.Activity.ListNotificationsIter(t.Context(), nil) + iter := client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -477,11 +477,11 @@ func TestActivityService_ListNotificationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListNotificationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnvVariablesIter call 1 got %v items; want %v", gotItems, want) } - opts := &NotificationListOptions{} - iter = client.Activity.ListNotificationsIter(t.Context(), opts) + opts := &ListOptions{} + iter = client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -490,10 +490,10 @@ func TestActivityService_ListNotificationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListNotificationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListEnvVariablesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListNotificationsIter(t.Context(), nil) + iter = client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -502,12 +502,12 @@ func TestActivityService_ListNotificationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListNotificationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnvVariablesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListNotificationsIter(t.Context(), nil) + iter = client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", nil) gotItems = 0 - iter(func(item *Notification, err error) bool { + iter(func(item *ActionsVariable, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -515,11 +515,11 @@ func TestActivityService_ListNotificationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListNotificationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListEnvVariablesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListRepositoryEventsIter(t *testing.T) { +func TestActionsService_ListHostedRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -528,19 +528,19 @@ func TestActivityService_ListRepositoryEventsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil) + iter := client.Actions.ListHostedRunnersIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -549,11 +549,11 @@ func TestActivityService_ListRepositoryEventsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListRepositoryEventsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListHostedRunnersIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", opts) + iter = client.Actions.ListHostedRunnersIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -562,10 +562,10 @@ func TestActivityService_ListRepositoryEventsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListRepositoryEventsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListHostedRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil) + iter = client.Actions.ListHostedRunnersIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -574,12 +574,12 @@ func TestActivityService_ListRepositoryEventsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListRepositoryEventsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListHostedRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil) + iter = client.Actions.ListHostedRunnersIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *HostedRunner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -587,11 +587,11 @@ func TestActivityService_ListRepositoryEventsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListRepositoryEventsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListHostedRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { +func TestActionsService_ListOrgSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -600,19 +600,19 @@ func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil) + iter := client.Actions.ListOrgSecretsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -621,11 +621,11 @@ func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListRepositoryNotificationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrgSecretsIter call 1 got %v items; want %v", gotItems, want) } - opts := &NotificationListOptions{} - iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Actions.ListOrgSecretsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -634,10 +634,10 @@ func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListRepositoryNotificationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrgSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil) + iter = client.Actions.ListOrgSecretsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -646,12 +646,12 @@ func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListRepositoryNotificationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil) + iter = client.Actions.ListOrgSecretsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Notification, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -659,11 +659,11 @@ func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListRepositoryNotificationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListStargazersIter(t *testing.T) { +func TestActionsService_ListOrgVariablesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -672,19 +672,19 @@ func TestActivityService_ListStargazersIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) } }) - iter := client.Activity.ListStargazersIter(t.Context(), "", "", nil) + iter := client.Actions.ListOrgVariablesIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -693,11 +693,11 @@ func TestActivityService_ListStargazersIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListStargazersIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrgVariablesIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListStargazersIter(t.Context(), "", "", opts) + iter = client.Actions.ListOrgVariablesIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -706,10 +706,10 @@ func TestActivityService_ListStargazersIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListStargazersIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrgVariablesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListStargazersIter(t.Context(), "", "", nil) + iter = client.Actions.ListOrgVariablesIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -718,12 +718,12 @@ func TestActivityService_ListStargazersIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListStargazersIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrgVariablesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListStargazersIter(t.Context(), "", "", nil) + iter = client.Actions.ListOrgVariablesIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Stargazer, err error) bool { + iter(func(item *ActionsVariable, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -731,11 +731,11 @@ func TestActivityService_ListStargazersIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListStargazersIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrgVariablesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListStarredIter(t *testing.T) { +func TestActionsService_ListOrganizationRunnerGroupsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -744,19 +744,19 @@ func TestActivityService_ListStarredIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{}]}`) } }) - iter := client.Activity.ListStarredIter(t.Context(), "", nil) + iter := client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -765,11 +765,11 @@ func TestActivityService_ListStarredIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListStarredIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ActivityListStarredOptions{} - iter = client.Activity.ListStarredIter(t.Context(), "", opts) + opts := &ListOrgRunnerGroupOptions{} + iter = client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -778,10 +778,10 @@ func TestActivityService_ListStarredIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListStarredIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListStarredIter(t.Context(), "", nil) + iter = client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -790,12 +790,12 @@ func TestActivityService_ListStarredIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListStarredIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListStarredIter(t.Context(), "", nil) + iter = client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *StarredRepository, err error) bool { + iter(func(item *RunnerGroup, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -803,11 +803,11 @@ func TestActivityService_ListStarredIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListStarredIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { +func TestActionsService_ListOrganizationRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -816,19 +816,19 @@ func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil) + iter := client.Actions.ListOrganizationRunnersIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -837,11 +837,11 @@ func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrganizationRunnersIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", opts) + opts := &ListRunnersOptions{} + iter = client.Actions.ListOrganizationRunnersIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -850,10 +850,10 @@ func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListOrganizationRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil) + iter = client.Actions.ListOrganizationRunnersIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -862,12 +862,12 @@ func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrganizationRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil) + iter = client.Actions.ListOrganizationRunnersIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Event, err error) bool { + iter(func(item *Runner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -875,11 +875,11 @@ func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListOrganizationRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListWatchedIter(t *testing.T) { +func TestActionsService_ListRepoOrgSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -888,19 +888,19 @@ func TestActivityService_ListWatchedIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Activity.ListWatchedIter(t.Context(), "", nil) + iter := client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -909,11 +909,11 @@ func TestActivityService_ListWatchedIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListWatchedIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoOrgSecretsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListWatchedIter(t.Context(), "", opts) + iter = client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -922,10 +922,10 @@ func TestActivityService_ListWatchedIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListWatchedIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoOrgSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListWatchedIter(t.Context(), "", nil) + iter = client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -934,12 +934,12 @@ func TestActivityService_ListWatchedIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListWatchedIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListWatchedIter(t.Context(), "", nil) + iter = client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Repository, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -947,11 +947,11 @@ func TestActivityService_ListWatchedIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListWatchedIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestActivityService_ListWatchersIter(t *testing.T) { +func TestActionsService_ListRepoOrgVariablesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -960,19 +960,19 @@ func TestActivityService_ListWatchersIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) } }) - iter := client.Activity.ListWatchersIter(t.Context(), "", "", nil) + iter := client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -981,11 +981,11 @@ func TestActivityService_ListWatchersIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Activity.ListWatchersIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoOrgVariablesIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Activity.ListWatchersIter(t.Context(), "", "", opts) + iter = client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -994,10 +994,10 @@ func TestActivityService_ListWatchersIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Activity.ListWatchersIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoOrgVariablesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Activity.ListWatchersIter(t.Context(), "", "", nil) + iter = client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1006,12 +1006,12 @@ func TestActivityService_ListWatchersIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Activity.ListWatchersIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoOrgVariablesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Activity.ListWatchersIter(t.Context(), "", "", nil) + iter = client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *ActionsVariable, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1019,11 +1019,11 @@ func TestActivityService_ListWatchersIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Activity.ListWatchersIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoOrgVariablesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestAppsService_ListHookDeliveriesIter(t *testing.T) { +func TestActionsService_ListRepoSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1031,20 +1031,20 @@ func TestAppsService_ListHookDeliveriesIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Apps.ListHookDeliveriesIter(t.Context(), nil) + iter := client.Actions.ListRepoSecretsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1053,11 +1053,11 @@ func TestAppsService_ListHookDeliveriesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Apps.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoSecretsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListCursorOptions{} - iter = client.Apps.ListHookDeliveriesIter(t.Context(), opts) + opts := &ListOptions{} + iter = client.Actions.ListRepoSecretsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1066,10 +1066,10 @@ func TestAppsService_ListHookDeliveriesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Apps.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Apps.ListHookDeliveriesIter(t.Context(), nil) + iter = client.Actions.ListRepoSecretsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1078,12 +1078,12 @@ func TestAppsService_ListHookDeliveriesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Apps.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Apps.ListHookDeliveriesIter(t.Context(), nil) + iter = client.Actions.ListRepoSecretsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *HookDelivery, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1091,11 +1091,11 @@ func TestAppsService_ListHookDeliveriesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Apps.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestAppsService_ListInstallationRequestsIter(t *testing.T) { +func TestActionsService_ListRepoVariablesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1104,19 +1104,19 @@ func TestAppsService_ListInstallationRequestsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"variables": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"variables": [{},{}]}`) } }) - iter := client.Apps.ListInstallationRequestsIter(t.Context(), nil) + iter := client.Actions.ListRepoVariablesIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1125,11 +1125,11 @@ func TestAppsService_ListInstallationRequestsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Apps.ListInstallationRequestsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoVariablesIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Apps.ListInstallationRequestsIter(t.Context(), opts) + iter = client.Actions.ListRepoVariablesIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1138,10 +1138,10 @@ func TestAppsService_ListInstallationRequestsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Apps.ListInstallationRequestsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepoVariablesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Apps.ListInstallationRequestsIter(t.Context(), nil) + iter = client.Actions.ListRepoVariablesIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1150,12 +1150,12 @@ func TestAppsService_ListInstallationRequestsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Apps.ListInstallationRequestsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoVariablesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Apps.ListInstallationRequestsIter(t.Context(), nil) + iter = client.Actions.ListRepoVariablesIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *InstallationRequest, err error) bool { + iter(func(item *ActionsVariable, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1163,11 +1163,11 @@ func TestAppsService_ListInstallationRequestsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Apps.ListInstallationRequestsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepoVariablesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestAppsService_ListInstallationsIter(t *testing.T) { +func TestActionsService_ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1176,19 +1176,19 @@ func TestAppsService_ListInstallationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Apps.ListInstallationsIter(t.Context(), nil) + iter := client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1197,11 +1197,11 @@ func TestAppsService_ListInstallationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Apps.ListInstallationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Apps.ListInstallationsIter(t.Context(), opts) + iter = client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1210,10 +1210,10 @@ func TestAppsService_ListInstallationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Apps.ListInstallationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Apps.ListInstallationsIter(t.Context(), nil) + iter = client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1222,12 +1222,12 @@ func TestAppsService_ListInstallationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Apps.ListInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Apps.ListInstallationsIter(t.Context(), nil) + iter = client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Installation, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1235,11 +1235,11 @@ func TestAppsService_ListInstallationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Apps.ListInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestAppsService_ListUserInstallationsIter(t *testing.T) { +func TestActionsService_ListRepositoryAccessRunnerGroupIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1248,19 +1248,19 @@ func TestAppsService_ListUserInstallationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `{"installations": [{},{},{}]}`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `{"installations": [{},{},{},{}]}`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `{"installations": [{},{}]}`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `{"installations": [{},{}]}`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Apps.ListUserInstallationsIter(t.Context(), nil) + iter := client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -1269,11 +1269,11 @@ func TestAppsService_ListUserInstallationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Apps.ListUserInstallationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Apps.ListUserInstallationsIter(t.Context(), opts) + iter = client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1282,10 +1282,10 @@ func TestAppsService_ListUserInstallationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Apps.ListUserInstallationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Apps.ListUserInstallationsIter(t.Context(), nil) + iter = client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1294,12 +1294,12 @@ func TestAppsService_ListUserInstallationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Apps.ListUserInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Apps.ListUserInstallationsIter(t.Context(), nil) + iter = client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, nil) gotItems = 0 - iter(func(item *Installation, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1307,11 +1307,11 @@ func TestAppsService_ListUserInstallationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Apps.ListUserInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { +func TestActionsService_ListRepositoryWorkflowRunsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1320,19 +1320,19 @@ func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{}]}`) } }) - iter := client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil) + iter := client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1341,11 +1341,11 @@ func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, opts) + opts := &ListWorkflowRunsOptions{} + iter = client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1354,10 +1354,10 @@ func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil) + iter = client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1366,12 +1366,12 @@ func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil) + iter = client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *CheckRunAnnotation, err error) bool { + iter(func(item *WorkflowRun, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1379,11 +1379,11 @@ func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { +func TestActionsService_ListRunnerGroupRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1392,19 +1392,19 @@ func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil) + iter := client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -1413,11 +1413,11 @@ func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, opts) + iter = client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1426,10 +1426,10 @@ func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil) + iter = client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1438,12 +1438,12 @@ func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil) + iter = client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil) gotItems = 0 - iter(func(item *AcceptedAssignment, err error) bool { + iter(func(item *Runner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1451,11 +1451,11 @@ func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { +func TestActionsService_ListRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1464,19 +1464,19 @@ func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil) + iter := client.Actions.ListRunnersIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1485,11 +1485,11 @@ func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRunnersIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, opts) + opts := &ListRunnersOptions{} + iter = client.Actions.ListRunnersIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1498,10 +1498,10 @@ func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil) + iter = client.Actions.ListRunnersIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1510,12 +1510,12 @@ func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil) + iter = client.Actions.ListRunnersIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *ClassroomAssignment, err error) bool { + iter(func(item *Runner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1523,11 +1523,11 @@ func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestClassroomService_ListClassroomsIter(t *testing.T) { +func TestActionsService_ListSelectedReposForOrgSecretIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1536,19 +1536,19 @@ func TestClassroomService_ListClassroomsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Classroom.ListClassroomsIter(t.Context(), nil) + iter := client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1557,11 +1557,11 @@ func TestClassroomService_ListClassroomsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Classroom.ListClassroomsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Classroom.ListClassroomsIter(t.Context(), opts) + iter = client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1570,10 +1570,10 @@ func TestClassroomService_ListClassroomsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Classroom.ListClassroomsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Classroom.ListClassroomsIter(t.Context(), nil) + iter = client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1582,12 +1582,12 @@ func TestClassroomService_ListClassroomsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Classroom.ListClassroomsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Classroom.ListClassroomsIter(t.Context(), nil) + iter = client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Classroom, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1595,11 +1595,11 @@ func TestClassroomService_ListClassroomsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Classroom.ListClassroomsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { +func TestActionsService_ListSelectedReposForOrgVariableIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1608,19 +1608,19 @@ func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil) + iter := client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1629,11 +1629,11 @@ func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.CodeScanning.ListAlertInstancesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 1 got %v items; want %v", gotItems, want) } - opts := &AlertInstancesListOptions{} - iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, opts) + opts := &ListOptions{} + iter = client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1642,10 +1642,10 @@ func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.CodeScanning.ListAlertInstancesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 2 got %v items; want %v", gotItems, want) } - iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil) + iter = client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1654,12 +1654,12 @@ func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAlertInstancesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil) + iter = client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *MostRecentInstance, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1667,11 +1667,11 @@ func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAlertInstancesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { +func TestActionsService_ListWorkflowJobsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1679,20 +1679,20 @@ func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"jobs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"jobs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"jobs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"jobs": [{},{}]}`) } }) - iter := client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil) + iter := client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -1701,11 +1701,11 @@ func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowJobsIter call 1 got %v items; want %v", gotItems, want) } - opts := &AlertListOptions{} - iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", opts) + opts := &ListWorkflowJobsOptions{} + iter = client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1714,10 +1714,10 @@ func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowJobsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil) + iter = client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1726,12 +1726,12 @@ func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowJobsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil) + iter = client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *Alert, err error) bool { + iter(func(item *WorkflowJob, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1739,11 +1739,11 @@ func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowJobsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { +func TestActionsService_ListWorkflowJobsAttemptIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1751,20 +1751,20 @@ func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"jobs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"jobs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"jobs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"jobs": [{},{}]}`) } }) - iter := client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil) + iter := client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -1773,11 +1773,11 @@ func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 1 got %v items; want %v", gotItems, want) } - opts := &AlertListOptions{} - iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1786,10 +1786,10 @@ func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 2 got %v items; want %v", gotItems, want) } - iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1798,12 +1798,12 @@ func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, nil) gotItems = 0 - iter(func(item *Alert, err error) bool { + iter(func(item *WorkflowJob, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1811,11 +1811,11 @@ func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { +func TestActionsService_ListWorkflowRunArtifactsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1824,19 +1824,19 @@ func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"artifacts": [{},{}]}`) } }) - iter := client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil) + iter := client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -1845,11 +1845,11 @@ func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 1 got %v items; want %v", gotItems, want) } - opts := &AnalysesListOptions{} - iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1858,10 +1858,10 @@ func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1870,12 +1870,12 @@ func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *ScanningAnalysis, err error) bool { + iter(func(item *Artifact, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1883,11 +1883,11 @@ func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestDependabotService_ListOrgAlertsIter(t *testing.T) { +func TestActionsService_ListWorkflowRunsByFileNameIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1895,20 +1895,20 @@ func TestDependabotService_ListOrgAlertsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"workflow_runs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{}]}`) } }) - iter := client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil) + iter := client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -1917,11 +1917,11 @@ func TestDependabotService_ListOrgAlertsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Dependabot.ListOrgAlertsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListAlertsOptions{} - iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", opts) + opts := &ListWorkflowRunsOptions{} + iter = client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -1930,10 +1930,10 @@ func TestDependabotService_ListOrgAlertsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Dependabot.ListOrgAlertsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil) + iter = client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -1942,12 +1942,12 @@ func TestDependabotService_ListOrgAlertsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Dependabot.ListOrgAlertsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil) + iter = client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", nil) gotItems = 0 - iter(func(item *DependabotAlert, err error) bool { + iter(func(item *WorkflowRun, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -1955,11 +1955,11 @@ func TestDependabotService_ListOrgAlertsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Dependabot.ListOrgAlertsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestDependabotService_ListRepoAlertsIter(t *testing.T) { +func TestActionsService_ListWorkflowRunsByIDIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -1967,20 +1967,20 @@ func TestDependabotService_ListRepoAlertsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"workflow_runs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflow_runs": [{},{}]}`) } }) - iter := client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil) + iter := client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -1989,11 +1989,11 @@ func TestDependabotService_ListRepoAlertsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Dependabot.ListRepoAlertsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListAlertsOptions{} - iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", opts) + opts := &ListWorkflowRunsOptions{} + iter = client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2002,10 +2002,10 @@ func TestDependabotService_ListRepoAlertsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Dependabot.ListRepoAlertsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2014,12 +2014,12 @@ func TestDependabotService_ListRepoAlertsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Dependabot.ListRepoAlertsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *DependabotAlert, err error) bool { + iter(func(item *WorkflowRun, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2027,11 +2027,11 @@ func TestDependabotService_ListRepoAlertsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Dependabot.ListRepoAlertsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *testing.T) { +func TestActionsService_ListWorkflowsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2040,19 +2040,19 @@ func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *test switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"workflows": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"workflows": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflows": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"workflows": [{},{}]}`) } }) - iter := client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil) + iter := client.Actions.ListWorkflowsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2061,11 +2061,11 @@ func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *test } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", opts) + iter = client.Actions.ListWorkflowsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2074,10 +2074,10 @@ func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *test } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Actions.ListWorkflowsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2086,12 +2086,12 @@ func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *test } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil) + iter = client.Actions.ListWorkflowsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *AccessibleRepository, err error) bool { + iter(func(item *Workflow, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2099,11 +2099,11 @@ func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *test return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Actions.ListWorkflowsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { +func TestActivityService_ListEventsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2124,7 +2124,7 @@ func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { } }) - iter := client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil) + iter := client.Activity.ListEventsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -2133,11 +2133,11 @@ func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", opts) + iter = client.Activity.ListEventsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2146,10 +2146,10 @@ func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil) + iter = client.Activity.ListEventsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2158,12 +2158,12 @@ func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil) + iter = client.Activity.ListEventsIter(t.Context(), nil) gotItems = 0 - iter(func(item *InstallableOrganization, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2171,11 +2171,11 @@ func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { +func TestActivityService_ListEventsForOrganizationIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2196,7 +2196,7 @@ func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { } }) - iter := client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil) + iter := client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2205,11 +2205,11 @@ func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListAppInstallationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsForOrganizationIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", opts) + iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2218,10 +2218,10 @@ func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListAppInstallationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsForOrganizationIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil) + iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2230,12 +2230,12 @@ func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListAppInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsForOrganizationIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil) + iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Installation, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2243,11 +2243,11 @@ func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListAppInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsForOrganizationIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { +func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2268,7 +2268,7 @@ func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { } }) - iter := client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil) + iter := client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2277,11 +2277,11 @@ func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListAssignmentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", opts) + iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2290,10 +2290,10 @@ func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListAssignmentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil) + iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2302,12 +2302,12 @@ func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil) + iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Organization, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2315,11 +2315,11 @@ func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *testing.T) { +func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2327,7 +2327,7 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *test callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -2340,7 +2340,7 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *test } }) - iter := client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + iter := client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil) var gotItems int for _, err := range iter { gotItems++ @@ -2349,11 +2349,11 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *test } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsPerformedByUserIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListCodeSecurityConfigurationRepositoriesOptions{} - iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, opts) + opts := &ListOptions{} + iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2362,10 +2362,10 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *test } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsPerformedByUserIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2374,12 +2374,12 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *test } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsPerformedByUserIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil) gotItems = 0 - iter(func(item *RepositoryAttachment, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2387,11 +2387,11 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *test return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsPerformedByUserIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { +func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2399,7 +2399,7 @@ func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -2412,7 +2412,7 @@ func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { } }) - iter := client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + iter := client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil) var gotItems int for _, err := range iter { gotItems++ @@ -2421,11 +2421,11 @@ func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsReceivedByUserIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListEnterpriseCodeSecurityConfigurationOptions{} - iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2434,10 +2434,10 @@ func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListEventsReceivedByUserIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2446,12 +2446,12 @@ func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsReceivedByUserIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil) gotItems = 0 - iter(func(item *CodeSecurityConfiguration, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2459,11 +2459,11 @@ func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListEventsReceivedByUserIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T) { +func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2484,7 +2484,7 @@ func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T } }) - iter := client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil) + iter := client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2493,11 +2493,11 @@ func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", opts) + iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2506,10 +2506,10 @@ func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil) + iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2518,12 +2518,12 @@ func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil) + iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *EnterpriseCustomPropertiesValues, err error) bool { + iter(func(item *IssueEvent, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2531,11 +2531,11 @@ func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing.T) { +func TestActivityService_ListNotificationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2556,7 +2556,7 @@ func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing. } }) - iter := client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil) + iter := client.Activity.ListNotificationsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -2565,11 +2565,11 @@ func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing. } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListNotificationsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, opts) + opts := &NotificationListOptions{} + iter = client.Activity.ListNotificationsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2578,10 +2578,10 @@ func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing. } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListNotificationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil) + iter = client.Activity.ListNotificationsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2590,12 +2590,12 @@ func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing. } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListNotificationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil) + iter = client.Activity.ListNotificationsIter(t.Context(), nil) gotItems = 0 - iter(func(item *AccessibleRepository, err error) bool { + iter(func(item *Notification, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2603,11 +2603,11 @@ func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing. return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListNotificationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { +func TestActivityService_ListRepositoryEventsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2628,7 +2628,7 @@ func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { } }) - iter := client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil) + iter := client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2637,11 +2637,11 @@ func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListTeamMembersIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListRepositoryEventsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", opts) + iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2650,10 +2650,10 @@ func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListTeamMembersIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListRepositoryEventsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil) + iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2662,12 +2662,12 @@ func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListTeamMembersIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListRepositoryEventsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil) + iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2675,11 +2675,11 @@ func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListTeamMembersIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListRepositoryEventsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestEnterpriseService_ListTeamsIter(t *testing.T) { +func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2700,7 +2700,7 @@ func TestEnterpriseService_ListTeamsIter(t *testing.T) { } }) - iter := client.Enterprise.ListTeamsIter(t.Context(), "", nil) + iter := client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2709,11 +2709,11 @@ func TestEnterpriseService_ListTeamsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Enterprise.ListTeamsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListRepositoryNotificationsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Enterprise.ListTeamsIter(t.Context(), "", opts) + opts := &NotificationListOptions{} + iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2722,10 +2722,10 @@ func TestEnterpriseService_ListTeamsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Enterprise.ListTeamsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListRepositoryNotificationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Enterprise.ListTeamsIter(t.Context(), "", nil) + iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2734,12 +2734,12 @@ func TestEnterpriseService_ListTeamsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Enterprise.ListTeamsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListRepositoryNotificationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Enterprise.ListTeamsIter(t.Context(), "", nil) + iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *EnterpriseTeam, err error) bool { + iter(func(item *Notification, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2747,11 +2747,11 @@ func TestEnterpriseService_ListTeamsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Enterprise.ListTeamsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListRepositoryNotificationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestGistsService_ListIter(t *testing.T) { +func TestActivityService_ListStargazersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2772,7 +2772,7 @@ func TestGistsService_ListIter(t *testing.T) { } }) - iter := client.Gists.ListIter(t.Context(), "", nil) + iter := client.Activity.ListStargazersIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2781,11 +2781,11 @@ func TestGistsService_ListIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Gists.ListIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListStargazersIter call 1 got %v items; want %v", gotItems, want) } - opts := &GistListOptions{} - iter = client.Gists.ListIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Activity.ListStargazersIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2794,10 +2794,10 @@ func TestGistsService_ListIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Gists.ListIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListStargazersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Gists.ListIter(t.Context(), "", nil) + iter = client.Activity.ListStargazersIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2806,12 +2806,12 @@ func TestGistsService_ListIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Gists.ListIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListStargazersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Gists.ListIter(t.Context(), "", nil) + iter = client.Activity.ListStargazersIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Gist, err error) bool { + iter(func(item *Stargazer, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2819,11 +2819,11 @@ func TestGistsService_ListIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Gists.ListIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListStargazersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestGistsService_ListAllIter(t *testing.T) { +func TestActivityService_ListStarredIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2844,7 +2844,7 @@ func TestGistsService_ListAllIter(t *testing.T) { } }) - iter := client.Gists.ListAllIter(t.Context(), nil) + iter := client.Activity.ListStarredIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2853,11 +2853,11 @@ func TestGistsService_ListAllIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Gists.ListAllIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListStarredIter call 1 got %v items; want %v", gotItems, want) } - opts := &GistListOptions{} - iter = client.Gists.ListAllIter(t.Context(), opts) + opts := &ActivityListStarredOptions{} + iter = client.Activity.ListStarredIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2866,10 +2866,10 @@ func TestGistsService_ListAllIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Gists.ListAllIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListStarredIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Gists.ListAllIter(t.Context(), nil) + iter = client.Activity.ListStarredIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2878,12 +2878,12 @@ func TestGistsService_ListAllIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Gists.ListAllIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListStarredIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Gists.ListAllIter(t.Context(), nil) + iter = client.Activity.ListStarredIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Gist, err error) bool { + iter(func(item *StarredRepository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2891,11 +2891,11 @@ func TestGistsService_ListAllIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Gists.ListAllIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListStarredIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestGistsService_ListCommentsIter(t *testing.T) { +func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2916,7 +2916,7 @@ func TestGistsService_ListCommentsIter(t *testing.T) { } }) - iter := client.Gists.ListCommentsIter(t.Context(), "", nil) + iter := client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2925,11 +2925,11 @@ func TestGistsService_ListCommentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Gists.ListCommentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Gists.ListCommentsIter(t.Context(), "", opts) + iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -2938,10 +2938,10 @@ func TestGistsService_ListCommentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Gists.ListCommentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Gists.ListCommentsIter(t.Context(), "", nil) + iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -2950,12 +2950,12 @@ func TestGistsService_ListCommentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Gists.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Gists.ListCommentsIter(t.Context(), "", nil) + iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *GistComment, err error) bool { + iter(func(item *Event, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -2963,11 +2963,11 @@ func TestGistsService_ListCommentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Gists.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestGistsService_ListCommitsIter(t *testing.T) { +func TestActivityService_ListWatchedIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -2988,7 +2988,7 @@ func TestGistsService_ListCommitsIter(t *testing.T) { } }) - iter := client.Gists.ListCommitsIter(t.Context(), "", nil) + iter := client.Activity.ListWatchedIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -2997,11 +2997,11 @@ func TestGistsService_ListCommitsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Gists.ListCommitsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListWatchedIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Gists.ListCommitsIter(t.Context(), "", opts) + iter = client.Activity.ListWatchedIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3010,10 +3010,10 @@ func TestGistsService_ListCommitsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Gists.ListCommitsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListWatchedIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Gists.ListCommitsIter(t.Context(), "", nil) + iter = client.Activity.ListWatchedIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3022,12 +3022,12 @@ func TestGistsService_ListCommitsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Gists.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListWatchedIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Gists.ListCommitsIter(t.Context(), "", nil) + iter = client.Activity.ListWatchedIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *GistCommit, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3035,11 +3035,11 @@ func TestGistsService_ListCommitsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Gists.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListWatchedIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestGistsService_ListForksIter(t *testing.T) { +func TestActivityService_ListWatchersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3060,7 +3060,7 @@ func TestGistsService_ListForksIter(t *testing.T) { } }) - iter := client.Gists.ListForksIter(t.Context(), "", nil) + iter := client.Activity.ListWatchersIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -3069,11 +3069,11 @@ func TestGistsService_ListForksIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Gists.ListForksIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListWatchersIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Gists.ListForksIter(t.Context(), "", opts) + iter = client.Activity.ListWatchersIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3082,10 +3082,10 @@ func TestGistsService_ListForksIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Gists.ListForksIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Activity.ListWatchersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Gists.ListForksIter(t.Context(), "", nil) + iter = client.Activity.ListWatchersIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3094,12 +3094,12 @@ func TestGistsService_ListForksIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Gists.ListForksIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListWatchersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Gists.ListForksIter(t.Context(), "", nil) + iter = client.Activity.ListWatchersIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *GistFork, err error) bool { + iter(func(item *User, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3107,11 +3107,11 @@ func TestGistsService_ListForksIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Gists.ListForksIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Activity.ListWatchersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestGistsService_ListStarredIter(t *testing.T) { +func TestAppsService_ListHookDeliveriesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3119,7 +3119,7 @@ func TestGistsService_ListStarredIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -3132,7 +3132,7 @@ func TestGistsService_ListStarredIter(t *testing.T) { } }) - iter := client.Gists.ListStarredIter(t.Context(), nil) + iter := client.Apps.ListHookDeliveriesIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -3141,11 +3141,11 @@ func TestGistsService_ListStarredIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Gists.ListStarredIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want) } - opts := &GistListOptions{} - iter = client.Gists.ListStarredIter(t.Context(), opts) + opts := &ListCursorOptions{} + iter = client.Apps.ListHookDeliveriesIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3154,10 +3154,10 @@ func TestGistsService_ListStarredIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Gists.ListStarredIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Gists.ListStarredIter(t.Context(), nil) + iter = client.Apps.ListHookDeliveriesIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3166,12 +3166,12 @@ func TestGistsService_ListStarredIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Gists.ListStarredIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Gists.ListStarredIter(t.Context(), nil) + iter = client.Apps.ListHookDeliveriesIter(t.Context(), nil) gotItems = 0 - iter(func(item *Gist, err error) bool { + iter(func(item *HookDelivery, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3179,11 +3179,11 @@ func TestGistsService_ListStarredIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Gists.ListStarredIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListIter(t *testing.T) { +func TestAppsService_ListInstallationRequestsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3204,7 +3204,7 @@ func TestIssuesService_ListIter(t *testing.T) { } }) - iter := client.Issues.ListIter(t.Context(), false, nil) + iter := client.Apps.ListInstallationRequestsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -3213,11 +3213,11 @@ func TestIssuesService_ListIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListInstallationRequestsIter call 1 got %v items; want %v", gotItems, want) } - opts := &IssueListOptions{} - iter = client.Issues.ListIter(t.Context(), false, opts) + opts := &ListOptions{} + iter = client.Apps.ListInstallationRequestsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3226,10 +3226,10 @@ func TestIssuesService_ListIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListInstallationRequestsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListIter(t.Context(), false, nil) + iter = client.Apps.ListInstallationRequestsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3238,12 +3238,12 @@ func TestIssuesService_ListIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListInstallationRequestsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListIter(t.Context(), false, nil) + iter = client.Apps.ListInstallationRequestsIter(t.Context(), nil) gotItems = 0 - iter(func(item *Issue, err error) bool { + iter(func(item *InstallationRequest, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3251,11 +3251,11 @@ func TestIssuesService_ListIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListInstallationRequestsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListAssigneesIter(t *testing.T) { +func TestAppsService_ListInstallationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3276,7 +3276,7 @@ func TestIssuesService_ListAssigneesIter(t *testing.T) { } }) - iter := client.Issues.ListAssigneesIter(t.Context(), "", "", nil) + iter := client.Apps.ListInstallationsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -3285,11 +3285,11 @@ func TestIssuesService_ListAssigneesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListAssigneesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListInstallationsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Issues.ListAssigneesIter(t.Context(), "", "", opts) + iter = client.Apps.ListInstallationsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3298,10 +3298,10 @@ func TestIssuesService_ListAssigneesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListAssigneesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListInstallationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListAssigneesIter(t.Context(), "", "", nil) + iter = client.Apps.ListInstallationsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3310,12 +3310,12 @@ func TestIssuesService_ListAssigneesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListAssigneesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListAssigneesIter(t.Context(), "", "", nil) + iter = client.Apps.ListInstallationsIter(t.Context(), nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *Installation, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3323,11 +3323,11 @@ func TestIssuesService_ListAssigneesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListAssigneesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListByOrgIter(t *testing.T) { +func TestAppsService_ListReposIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3336,19 +3336,19 @@ func TestIssuesService_ListByOrgIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Issues.ListByOrgIter(t.Context(), "", nil) + iter := client.Apps.ListReposIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -3357,11 +3357,11 @@ func TestIssuesService_ListByOrgIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListByOrgIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListReposIter call 1 got %v items; want %v", gotItems, want) } - opts := &IssueListOptions{} - iter = client.Issues.ListByOrgIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Apps.ListReposIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3370,10 +3370,10 @@ func TestIssuesService_ListByOrgIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListByOrgIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListReposIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListByOrgIter(t.Context(), "", nil) + iter = client.Apps.ListReposIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3382,12 +3382,12 @@ func TestIssuesService_ListByOrgIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListByOrgIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListReposIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListByOrgIter(t.Context(), "", nil) + iter = client.Apps.ListReposIter(t.Context(), nil) gotItems = 0 - iter(func(item *Issue, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3395,11 +3395,11 @@ func TestIssuesService_ListByOrgIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListByOrgIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListReposIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListByRepoIter(t *testing.T) { +func TestAppsService_ListUserInstallationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3407,20 +3407,20 @@ func TestIssuesService_ListByRepoIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"installations": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"installations": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"installations": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"installations": [{},{}]}`) } }) - iter := client.Issues.ListByRepoIter(t.Context(), "", "", nil) + iter := client.Apps.ListUserInstallationsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -3429,11 +3429,11 @@ func TestIssuesService_ListByRepoIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListByRepoIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListUserInstallationsIter call 1 got %v items; want %v", gotItems, want) } - opts := &IssueListByRepoOptions{} - iter = client.Issues.ListByRepoIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Apps.ListUserInstallationsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3442,10 +3442,10 @@ func TestIssuesService_ListByRepoIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListByRepoIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListUserInstallationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListByRepoIter(t.Context(), "", "", nil) + iter = client.Apps.ListUserInstallationsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3454,12 +3454,12 @@ func TestIssuesService_ListByRepoIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListByRepoIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListUserInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListByRepoIter(t.Context(), "", "", nil) + iter = client.Apps.ListUserInstallationsIter(t.Context(), nil) gotItems = 0 - iter(func(item *Issue, err error) bool { + iter(func(item *Installation, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3467,11 +3467,11 @@ func TestIssuesService_ListByRepoIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListByRepoIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListUserInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListCommentsIter(t *testing.T) { +func TestAppsService_ListUserReposIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3480,19 +3480,19 @@ func TestIssuesService_ListCommentsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil) + iter := client.Apps.ListUserReposIter(t.Context(), 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -3501,11 +3501,11 @@ func TestIssuesService_ListCommentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListCommentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListUserReposIter call 1 got %v items; want %v", gotItems, want) } - opts := &IssueListCommentsOptions{} - iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, opts) + opts := &ListOptions{} + iter = client.Apps.ListUserReposIter(t.Context(), 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3514,10 +3514,10 @@ func TestIssuesService_ListCommentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListCommentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Apps.ListUserReposIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil) + iter = client.Apps.ListUserReposIter(t.Context(), 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3526,12 +3526,12 @@ func TestIssuesService_ListCommentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListUserReposIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil) + iter = client.Apps.ListUserReposIter(t.Context(), 0, nil) gotItems = 0 - iter(func(item *IssueComment, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3539,11 +3539,11 @@ func TestIssuesService_ListCommentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Apps.ListUserReposIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListIssueEventsIter(t *testing.T) { +func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3564,7 +3564,7 @@ func TestIssuesService_ListIssueEventsIter(t *testing.T) { } }) - iter := client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil) + iter := client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -3573,11 +3573,11 @@ func TestIssuesService_ListIssueEventsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListIssueEventsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, opts) + iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3586,10 +3586,10 @@ func TestIssuesService_ListIssueEventsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListIssueEventsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil) + iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3598,12 +3598,12 @@ func TestIssuesService_ListIssueEventsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListIssueEventsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil) + iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *IssueEvent, err error) bool { + iter(func(item *CheckRunAnnotation, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3611,11 +3611,11 @@ func TestIssuesService_ListIssueEventsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListIssueEventsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListIssueTimelineIter(t *testing.T) { +func TestChecksService_ListCheckRunsCheckSuiteIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3624,19 +3624,19 @@ func TestIssuesService_ListIssueTimelineIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{}]}`) } }) - iter := client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil) + iter := client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -3645,11 +3645,11 @@ func TestIssuesService_ListIssueTimelineIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListIssueTimelineIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, opts) + opts := &ListCheckRunsOptions{} + iter = client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3658,10 +3658,10 @@ func TestIssuesService_ListIssueTimelineIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListIssueTimelineIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil) + iter = client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3670,12 +3670,12 @@ func TestIssuesService_ListIssueTimelineIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListIssueTimelineIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil) + iter = client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *Timeline, err error) bool { + iter(func(item *CheckRun, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3683,11 +3683,11 @@ func TestIssuesService_ListIssueTimelineIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListIssueTimelineIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListLabelsIter(t *testing.T) { +func TestChecksService_ListCheckRunsForRefIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3696,19 +3696,19 @@ func TestIssuesService_ListLabelsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"check_runs": [{},{}]}`) } }) - iter := client.Issues.ListLabelsIter(t.Context(), "", "", nil) + iter := client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -3717,11 +3717,11 @@ func TestIssuesService_ListLabelsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListLabelsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckRunsForRefIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Issues.ListLabelsIter(t.Context(), "", "", opts) + opts := &ListCheckRunsOptions{} + iter = client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3730,10 +3730,10 @@ func TestIssuesService_ListLabelsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListLabelsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckRunsForRefIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListLabelsIter(t.Context(), "", "", nil) + iter = client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3742,12 +3742,12 @@ func TestIssuesService_ListLabelsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListLabelsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckRunsForRefIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListLabelsIter(t.Context(), "", "", nil) + iter = client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", nil) gotItems = 0 - iter(func(item *Label, err error) bool { + iter(func(item *CheckRun, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3755,11 +3755,11 @@ func TestIssuesService_ListLabelsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListLabelsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckRunsForRefIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { +func TestChecksService_ListCheckSuitesForRefIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3768,19 +3768,19 @@ func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"check_suites": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"check_suites": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"check_suites": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"check_suites": [{},{}]}`) } }) - iter := client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil) + iter := client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -3789,11 +3789,11 @@ func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListLabelsByIssueIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckSuitesForRefIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, opts) + opts := &ListCheckSuiteOptions{} + iter = client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3802,10 +3802,10 @@ func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListLabelsByIssueIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Checks.ListCheckSuitesForRefIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil) + iter = client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3814,12 +3814,12 @@ func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListLabelsByIssueIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckSuitesForRefIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil) + iter = client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", nil) gotItems = 0 - iter(func(item *Label, err error) bool { + iter(func(item *CheckSuite, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3827,11 +3827,11 @@ func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListLabelsByIssueIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Checks.ListCheckSuitesForRefIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { +func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3852,7 +3852,7 @@ func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { } }) - iter := client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil) + iter := client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -3861,11 +3861,11 @@ func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListLabelsForMilestoneIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, opts) + iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3874,10 +3874,10 @@ func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListLabelsForMilestoneIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil) + iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3886,12 +3886,12 @@ func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListLabelsForMilestoneIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil) + iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil) gotItems = 0 - iter(func(item *Label, err error) bool { + iter(func(item *AcceptedAssignment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3899,11 +3899,11 @@ func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListLabelsForMilestoneIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListMilestonesIter(t *testing.T) { +func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3924,7 +3924,7 @@ func TestIssuesService_ListMilestonesIter(t *testing.T) { } }) - iter := client.Issues.ListMilestonesIter(t.Context(), "", "", nil) + iter := client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -3933,11 +3933,11 @@ func TestIssuesService_ListMilestonesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListMilestonesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 1 got %v items; want %v", gotItems, want) } - opts := &MilestoneListOptions{} - iter = client.Issues.ListMilestonesIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -3946,10 +3946,10 @@ func TestIssuesService_ListMilestonesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListMilestonesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListMilestonesIter(t.Context(), "", "", nil) + iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -3958,12 +3958,12 @@ func TestIssuesService_ListMilestonesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListMilestonesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListMilestonesIter(t.Context(), "", "", nil) + iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil) gotItems = 0 - iter(func(item *Milestone, err error) bool { + iter(func(item *ClassroomAssignment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -3971,11 +3971,11 @@ func TestIssuesService_ListMilestonesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListMilestonesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { +func TestClassroomService_ListClassroomsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -3996,7 +3996,7 @@ func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { } }) - iter := client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil) + iter := client.Classroom.ListClassroomsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -4005,11 +4005,11 @@ func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Issues.ListRepositoryEventsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Classroom.ListClassroomsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", opts) + iter = client.Classroom.ListClassroomsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4018,10 +4018,10 @@ func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Issues.ListRepositoryEventsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Classroom.ListClassroomsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil) + iter = client.Classroom.ListClassroomsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4030,12 +4030,12 @@ func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Issues.ListRepositoryEventsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Classroom.ListClassroomsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil) + iter = client.Classroom.ListClassroomsIter(t.Context(), nil) gotItems = 0 - iter(func(item *IssueEvent, err error) bool { + iter(func(item *Classroom, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4043,11 +4043,11 @@ func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Issues.ListRepositoryEventsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Classroom.ListClassroomsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestLicensesService_ListIter(t *testing.T) { +func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4068,7 +4068,7 @@ func TestLicensesService_ListIter(t *testing.T) { } }) - iter := client.Licenses.ListIter(t.Context(), nil) + iter := client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -4077,11 +4077,11 @@ func TestLicensesService_ListIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Licenses.ListIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAlertInstancesIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListLicensesOptions{} - iter = client.Licenses.ListIter(t.Context(), opts) + opts := &AlertInstancesListOptions{} + iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4090,10 +4090,10 @@ func TestLicensesService_ListIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Licenses.ListIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAlertInstancesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Licenses.ListIter(t.Context(), nil) + iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4102,12 +4102,12 @@ func TestLicensesService_ListIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Licenses.ListIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAlertInstancesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Licenses.ListIter(t.Context(), nil) + iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *License, err error) bool { + iter(func(item *MostRecentInstance, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4115,11 +4115,11 @@ func TestLicensesService_ListIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Licenses.ListIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAlertInstancesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { +func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4127,7 +4127,7 @@ func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -4140,7 +4140,7 @@ func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { } }) - iter := client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil) + iter := client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4149,11 +4149,11 @@ func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), opts) + opts := &AlertListOptions{} + iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4162,10 +4162,10 @@ func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil) + iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4174,12 +4174,12 @@ func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil) + iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *MarketplacePurchase, err error) bool { + iter(func(item *Alert, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4187,11 +4187,11 @@ func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { +func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4199,7 +4199,7 @@ func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -4212,7 +4212,7 @@ func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { } }) - iter := client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil) + iter := client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4221,11 +4221,11 @@ func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, opts) + opts := &AlertListOptions{} + iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4234,10 +4234,10 @@ func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil) + iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4246,12 +4246,12 @@ func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil) + iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *MarketplacePlanAccount, err error) bool { + iter(func(item *Alert, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4259,11 +4259,11 @@ func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestMarketplaceService_ListPlansIter(t *testing.T) { +func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4284,7 +4284,7 @@ func TestMarketplaceService_ListPlansIter(t *testing.T) { } }) - iter := client.Marketplace.ListPlansIter(t.Context(), nil) + iter := client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4293,11 +4293,11 @@ func TestMarketplaceService_ListPlansIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Marketplace.ListPlansIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Marketplace.ListPlansIter(t.Context(), opts) + opts := &AnalysesListOptions{} + iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4306,10 +4306,10 @@ func TestMarketplaceService_ListPlansIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Marketplace.ListPlansIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Marketplace.ListPlansIter(t.Context(), nil) + iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4318,12 +4318,12 @@ func TestMarketplaceService_ListPlansIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Marketplace.ListPlansIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Marketplace.ListPlansIter(t.Context(), nil) + iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *MarketplacePlan, err error) bool { + iter(func(item *ScanningAnalysis, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4331,11 +4331,11 @@ func TestMarketplaceService_ListPlansIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Marketplace.ListPlansIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestMigrationService_ListMigrationsIter(t *testing.T) { +func TestCodespacesService_ListIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4344,19 +4344,19 @@ func TestMigrationService_ListMigrationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) } }) - iter := client.Migrations.ListMigrationsIter(t.Context(), "", nil) + iter := client.Codespaces.ListIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -4365,11 +4365,11 @@ func TestMigrationService_ListMigrationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Migrations.ListMigrationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Migrations.ListMigrationsIter(t.Context(), "", opts) + opts := &ListCodespacesOptions{} + iter = client.Codespaces.ListIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4378,10 +4378,10 @@ func TestMigrationService_ListMigrationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Migrations.ListMigrationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Migrations.ListMigrationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4390,12 +4390,12 @@ func TestMigrationService_ListMigrationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Migrations.ListMigrationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Migrations.ListMigrationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListIter(t.Context(), nil) gotItems = 0 - iter(func(item *Migration, err error) bool { + iter(func(item *Codespace, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4403,11 +4403,11 @@ func TestMigrationService_ListMigrationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Migrations.ListMigrationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestMigrationService_ListUserMigrationsIter(t *testing.T) { +func TestCodespacesService_ListDevContainerConfigurationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4416,19 +4416,19 @@ func TestMigrationService_ListUserMigrationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"devcontainers": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"devcontainers": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"devcontainers": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"devcontainers": [{},{}]}`) } }) - iter := client.Migrations.ListUserMigrationsIter(t.Context(), nil) + iter := client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4437,11 +4437,11 @@ func TestMigrationService_ListUserMigrationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Migrations.ListUserMigrationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Migrations.ListUserMigrationsIter(t.Context(), opts) + iter = client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4450,10 +4450,10 @@ func TestMigrationService_ListUserMigrationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Migrations.ListUserMigrationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Migrations.ListUserMigrationsIter(t.Context(), nil) + iter = client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4462,12 +4462,12 @@ func TestMigrationService_ListUserMigrationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Migrations.ListUserMigrationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Migrations.ListUserMigrationsIter(t.Context(), nil) + iter = client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *UserMigration, err error) bool { + iter(func(item *DevContainer, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4475,11 +4475,11 @@ func TestMigrationService_ListUserMigrationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Migrations.ListUserMigrationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListIter(t *testing.T) { +func TestCodespacesService_ListInOrgIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4488,19 +4488,19 @@ func TestOrganizationsService_ListIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) } }) - iter := client.Organizations.ListIter(t.Context(), "", nil) + iter := client.Codespaces.ListInOrgIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4509,11 +4509,11 @@ func TestOrganizationsService_ListIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListInOrgIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListIter(t.Context(), "", opts) + iter = client.Codespaces.ListInOrgIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4522,10 +4522,10 @@ func TestOrganizationsService_ListIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListInOrgIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListIter(t.Context(), "", nil) + iter = client.Codespaces.ListInOrgIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4534,12 +4534,12 @@ func TestOrganizationsService_ListIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListInOrgIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListIter(t.Context(), "", nil) + iter = client.Codespaces.ListInOrgIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Organization, err error) bool { + iter(func(item *Codespace, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4547,11 +4547,11 @@ func TestOrganizationsService_ListIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListInOrgIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { +func TestCodespacesService_ListInRepoIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4560,19 +4560,19 @@ func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) } }) - iter := client.Organizations.ListBlockedUsersIter(t.Context(), "", nil) + iter := client.Codespaces.ListInRepoIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4581,11 +4581,11 @@ func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListBlockedUsersIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListInRepoIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", opts) + iter = client.Codespaces.ListInRepoIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4594,10 +4594,10 @@ func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListBlockedUsersIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListInRepoIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", nil) + iter = client.Codespaces.ListInRepoIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4606,12 +4606,12 @@ func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListBlockedUsersIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListInRepoIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", nil) + iter = client.Codespaces.ListInRepoIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *Codespace, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4619,11 +4619,11 @@ func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListBlockedUsersIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListInRepoIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *testing.T) { +func TestCodespacesService_ListOrgSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4631,20 +4631,20 @@ func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *t callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + iter := client.Codespaces.ListOrgSecretsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4653,11 +4653,11 @@ func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *t } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListOrgSecretsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListCodeSecurityConfigurationRepositoriesOptions{} - iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, opts) + opts := &ListOptions{} + iter = client.Codespaces.ListOrgSecretsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4666,10 +4666,10 @@ func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *t } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListOrgSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + iter = client.Codespaces.ListOrgSecretsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4678,12 +4678,12 @@ func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *t } } if gotItems != 1 { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + iter = client.Codespaces.ListOrgSecretsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *RepositoryAttachment, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4691,11 +4691,11 @@ func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *t return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { +func TestCodespacesService_ListRepoSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4703,20 +4703,20 @@ func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + iter := client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4725,11 +4725,11 @@ func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListRepoSecretsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOrgCodeSecurityConfigurationOptions{} - iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4738,10 +4738,10 @@ func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListRepoSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4750,12 +4750,12 @@ func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListRepoSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *CodeSecurityConfiguration, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4763,11 +4763,11 @@ func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListRepoSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { +func TestCodespacesService_ListSelectedReposForOrgSecretIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4776,19 +4776,19 @@ func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil) + iter := client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4797,11 +4797,11 @@ func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 1 got %v items; want %v", gotItems, want) } - opts := &CredentialAuthorizationsListOptions{} - iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4810,10 +4810,10 @@ func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4822,12 +4822,12 @@ func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *CredentialAuthorization, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4835,11 +4835,11 @@ func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { +func TestCodespacesService_ListSelectedReposForUserSecretIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4848,19 +4848,19 @@ func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil) + iter := client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4869,11 +4869,11 @@ func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListCustomPropertyValuesOptions{} - iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4882,10 +4882,10 @@ func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil) + iter = client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4894,12 +4894,12 @@ func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil) + iter = client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *RepoCustomPropertyValue, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4907,11 +4907,11 @@ func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { +func TestCodespacesService_ListUserCodespacesInOrgIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4920,19 +4920,19 @@ func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"codespaces": [{},{}]}`) } }) - iter := client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil) + iter := client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -4941,11 +4941,11 @@ func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", opts) + iter = client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -4954,10 +4954,10 @@ func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -4966,12 +4966,12 @@ func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil) + iter = client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Invitation, err error) bool { + iter(func(item *Codespace, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -4979,11 +4979,11 @@ func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing.T) { +func TestCodespacesService_ListUserSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -4992,19 +4992,19 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil) + iter := client.Codespaces.ListUserSecretsIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -5013,11 +5013,11 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListUserSecretsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListFineGrainedPATOptions{} - iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Codespaces.ListUserSecretsIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5026,10 +5026,10 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Codespaces.ListUserSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil) + iter = client.Codespaces.ListUserSecretsIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5038,12 +5038,12 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing } } if gotItems != 1 { - t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListUserSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil) + iter = client.Codespaces.ListUserSecretsIter(t.Context(), nil) gotItems = 0 - iter(func(item *PersonalAccessToken, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5051,11 +5051,11 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Codespaces.ListUserSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { +func TestCopilotService_ListCopilotEnterpriseSeatsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5063,20 +5063,20 @@ func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"seats": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"seats": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"seats": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"seats": [{},{}]}`) } }) - iter := client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil) + iter := client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5085,11 +5085,11 @@ func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListCursorOptions{} - iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, opts) + opts := &ListOptions{} + iter = client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5098,10 +5098,10 @@ func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil) + iter = client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5110,12 +5110,12 @@ func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil) + iter = client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *HookDelivery, err error) bool { + iter(func(item *CopilotSeatDetails, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5123,11 +5123,11 @@ func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListHooksIter(t *testing.T) { +func TestCopilotService_ListCopilotSeatsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5136,19 +5136,19 @@ func TestOrganizationsService_ListHooksIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"seats": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"seats": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"seats": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"seats": [{},{}]}`) } }) - iter := client.Organizations.ListHooksIter(t.Context(), "", nil) + iter := client.Copilot.ListCopilotSeatsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5157,11 +5157,11 @@ func TestOrganizationsService_ListHooksIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListHooksIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Copilot.ListCopilotSeatsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListHooksIter(t.Context(), "", opts) + iter = client.Copilot.ListCopilotSeatsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5170,10 +5170,10 @@ func TestOrganizationsService_ListHooksIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListHooksIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Copilot.ListCopilotSeatsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListHooksIter(t.Context(), "", nil) + iter = client.Copilot.ListCopilotSeatsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5182,12 +5182,12 @@ func TestOrganizationsService_ListHooksIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListHooksIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Copilot.ListCopilotSeatsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListHooksIter(t.Context(), "", nil) + iter = client.Copilot.ListCopilotSeatsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Hook, err error) bool { + iter(func(item *CopilotSeatDetails, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5195,11 +5195,11 @@ func TestOrganizationsService_ListHooksIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListHooksIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Copilot.ListCopilotSeatsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListMembersIter(t *testing.T) { +func TestDependabotService_ListOrgAlertsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5207,7 +5207,7 @@ func TestOrganizationsService_ListMembersIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -5220,7 +5220,7 @@ func TestOrganizationsService_ListMembersIter(t *testing.T) { } }) - iter := client.Organizations.ListMembersIter(t.Context(), "", nil) + iter := client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5229,11 +5229,11 @@ func TestOrganizationsService_ListMembersIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListMembersIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListOrgAlertsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListMembersOptions{} - iter = client.Organizations.ListMembersIter(t.Context(), "", opts) + opts := &ListAlertsOptions{} + iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5242,10 +5242,10 @@ func TestOrganizationsService_ListMembersIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListMembersIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListOrgAlertsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListMembersIter(t.Context(), "", nil) + iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5254,12 +5254,12 @@ func TestOrganizationsService_ListMembersIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListMembersIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListOrgAlertsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListMembersIter(t.Context(), "", nil) + iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *DependabotAlert, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5267,11 +5267,11 @@ func TestOrganizationsService_ListMembersIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListMembersIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListOrgAlertsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { +func TestDependabotService_ListOrgSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5280,19 +5280,19 @@ func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil) + iter := client.Dependabot.ListOrgSecretsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5301,11 +5301,11 @@ func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListOrgSecretsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", opts) + iter = client.Dependabot.ListOrgSecretsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5314,10 +5314,10 @@ func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListOrgSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil) + iter = client.Dependabot.ListOrgSecretsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5326,12 +5326,12 @@ func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil) + iter = client.Dependabot.ListOrgSecretsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Team, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5339,11 +5339,11 @@ func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { +func TestDependabotService_ListRepoAlertsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5351,7 +5351,7 @@ func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -5364,7 +5364,7 @@ func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { } }) - iter := client.Organizations.ListOrgMembershipsIter(t.Context(), nil) + iter := client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5373,11 +5373,11 @@ func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListOrgMembershipsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListRepoAlertsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOrgMembershipsOptions{} - iter = client.Organizations.ListOrgMembershipsIter(t.Context(), opts) + opts := &ListAlertsOptions{} + iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5386,10 +5386,10 @@ func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListOrgMembershipsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListRepoAlertsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListOrgMembershipsIter(t.Context(), nil) + iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5398,12 +5398,12 @@ func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListOrgMembershipsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListRepoAlertsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListOrgMembershipsIter(t.Context(), nil) + iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Membership, err error) bool { + iter(func(item *DependabotAlert, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5411,11 +5411,11 @@ func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListOrgMembershipsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListRepoAlertsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { +func TestDependabotService_ListRepoSecretsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5424,19 +5424,19 @@ func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"secrets": [{},{}]}`) } }) - iter := client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil) + iter := client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5445,11 +5445,11 @@ func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListRepoSecretsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOutsideCollaboratorsOptions{} - iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5458,10 +5458,10 @@ func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListRepoSecretsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil) + iter = client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5470,12 +5470,12 @@ func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListRepoSecretsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil) + iter = client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *Secret, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5483,11 +5483,11 @@ func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListRepoSecretsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListPackagesIter(t *testing.T) { +func TestDependabotService_ListSelectedReposForOrgSecretIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5496,19 +5496,19 @@ func TestOrganizationsService_ListPackagesIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"repositories": [{},{}]}`) } }) - iter := client.Organizations.ListPackagesIter(t.Context(), "", nil) + iter := client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5517,11 +5517,11 @@ func TestOrganizationsService_ListPackagesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListPackagesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 1 got %v items; want %v", gotItems, want) } - opts := &PackageListOptions{} - iter = client.Organizations.ListPackagesIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5530,10 +5530,10 @@ func TestOrganizationsService_ListPackagesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListPackagesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListPackagesIter(t.Context(), "", nil) + iter = client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5542,12 +5542,12 @@ func TestOrganizationsService_ListPackagesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListPackagesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListPackagesIter(t.Context(), "", nil) + iter = client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Package, err error) bool { + iter(func(item *Repository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5555,11 +5555,11 @@ func TestOrganizationsService_ListPackagesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListPackagesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { +func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5580,7 +5580,7 @@ func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { } }) - iter := client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil) + iter := client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5589,11 +5589,11 @@ func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", opts) + iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5602,10 +5602,10 @@ func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil) + iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5614,12 +5614,12 @@ func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil) + iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Invitation, err error) bool { + iter(func(item *AccessibleRepository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5627,11 +5627,11 @@ func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { +func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5652,7 +5652,7 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { } }) - iter := client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil) + iter := client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5661,11 +5661,11 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, opts) + iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5674,10 +5674,10 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5686,12 +5686,12 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Team, err error) bool { + iter(func(item *InstallableOrganization, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5699,11 +5699,11 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { +func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5724,7 +5724,7 @@ func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { } }) - iter := client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil) + iter := client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5733,11 +5733,11 @@ func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAppInstallationsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, opts) + iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5746,10 +5746,10 @@ func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAppInstallationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5758,12 +5758,12 @@ func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAppInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *Installation, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5771,11 +5771,11 @@ func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAppInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { +func TestEnterpriseService_ListAssignmentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5783,7 +5783,7 @@ func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -5796,7 +5796,7 @@ func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { } }) - iter := client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil) + iter := client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5805,11 +5805,11 @@ func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAssignmentsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListProjectsOptions{} - iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, opts) + opts := &ListOptions{} + iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5818,10 +5818,10 @@ func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListAssignmentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5830,12 +5830,12 @@ func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *ProjectV2Field, err error) bool { + iter(func(item *Organization, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5843,11 +5843,11 @@ func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { +func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5868,7 +5868,7 @@ func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { } }) - iter := client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil) + iter := client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -5877,11 +5877,11 @@ func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListProjectItemsOptions{} - iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, opts) + opts := &ListCodeSecurityConfigurationRepositoriesOptions{} + iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5890,10 +5890,10 @@ func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5902,12 +5902,12 @@ func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) gotItems = 0 - iter(func(item *ProjectV2Item, err error) bool { + iter(func(item *RepositoryAttachment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5915,11 +5915,11 @@ func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { +func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5940,7 +5940,7 @@ func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { } }) - iter := client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil) + iter := client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -5949,11 +5949,11 @@ func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Projects.ListOrganizationProjectsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListProjectsOptions{} - iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", opts) + opts := &ListEnterpriseCodeSecurityConfigurationOptions{} + iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -5962,10 +5962,10 @@ func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Projects.ListOrganizationProjectsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil) + iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -5974,12 +5974,12 @@ func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Projects.ListOrganizationProjectsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil) + iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *ProjectV2, err error) bool { + iter(func(item *CodeSecurityConfiguration, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -5987,11 +5987,11 @@ func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Projects.ListOrganizationProjectsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { +func TestEnterpriseService_ListEnterpriseNetworkConfigurationsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -5999,20 +5999,20 @@ func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"network_configurations": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"network_configurations": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"network_configurations": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"network_configurations": [{},{}]}`) } }) - iter := client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil) + iter := client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6021,11 +6021,11 @@ func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Projects.ListUserProjectFieldsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListProjectsOptions{} - iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, opts) + opts := &ListOptions{} + iter = client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6034,10 +6034,10 @@ func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Projects.ListUserProjectFieldsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6046,12 +6046,12 @@ func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Projects.ListUserProjectFieldsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *ProjectV2Field, err error) bool { + iter(func(item *NetworkConfiguration, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6059,11 +6059,11 @@ func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Projects.ListUserProjectFieldsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { +func TestEnterpriseService_ListHostedRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6071,20 +6071,20 @@ func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil) + iter := client.Enterprise.ListHostedRunnersIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6093,11 +6093,11 @@ func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Projects.ListUserProjectItemsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListHostedRunnersIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListProjectItemsOptions{} - iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, opts) + opts := &ListOptions{} + iter = client.Enterprise.ListHostedRunnersIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6106,10 +6106,10 @@ func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Projects.ListUserProjectItemsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListHostedRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListHostedRunnersIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6118,12 +6118,12 @@ func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Projects.ListUserProjectItemsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListHostedRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil) + iter = client.Enterprise.ListHostedRunnersIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *ProjectV2Item, err error) bool { + iter(func(item *HostedRunner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6131,11 +6131,11 @@ func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Projects.ListUserProjectItemsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListHostedRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestProjectsService_ListUserProjectsIter(t *testing.T) { +func TestEnterpriseService_ListOrganizationAccessRunnerGroupIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6143,20 +6143,20 @@ func TestProjectsService_ListUserProjectsIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"organizations": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"organizations": [{},{}]}`) } }) - iter := client.Projects.ListUserProjectsIter(t.Context(), "", nil) + iter := client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -6165,11 +6165,11 @@ func TestProjectsService_ListUserProjectsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Projects.ListUserProjectsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListProjectsOptions{} - iter = client.Projects.ListUserProjectsIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6178,10 +6178,10 @@ func TestProjectsService_ListUserProjectsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Projects.ListUserProjectsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Projects.ListUserProjectsIter(t.Context(), "", nil) + iter = client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6190,12 +6190,12 @@ func TestProjectsService_ListUserProjectsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Projects.ListUserProjectsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Projects.ListUserProjectsIter(t.Context(), "", nil) + iter = client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, nil) gotItems = 0 - iter(func(item *ProjectV2, err error) bool { + iter(func(item *Organization, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6203,11 +6203,11 @@ func TestProjectsService_ListUserProjectsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Projects.ListUserProjectsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListIter(t *testing.T) { +func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6228,7 +6228,7 @@ func TestPullRequestsService_ListIter(t *testing.T) { } }) - iter := client.PullRequests.ListIter(t.Context(), "", "", nil) + iter := client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6237,11 +6237,11 @@ func TestPullRequestsService_ListIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 1 got %v items; want %v", gotItems, want) } - opts := &PullRequestListOptions{} - iter = client.PullRequests.ListIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6250,10 +6250,10 @@ func TestPullRequestsService_ListIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListIter(t.Context(), "", "", nil) + iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6262,12 +6262,12 @@ func TestPullRequestsService_ListIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListIter(t.Context(), "", "", nil) + iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *PullRequest, err error) bool { + iter(func(item *EnterpriseCustomPropertiesValues, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6275,11 +6275,11 @@ func TestPullRequestsService_ListIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListCommentsIter(t *testing.T) { +func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6300,7 +6300,7 @@ func TestPullRequestsService_ListCommentsIter(t *testing.T) { } }) - iter := client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil) + iter := client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -6309,11 +6309,11 @@ func TestPullRequestsService_ListCommentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListCommentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 1 got %v items; want %v", gotItems, want) } - opts := &PullRequestListCommentsOptions{} - iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, opts) + opts := &ListOptions{} + iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6322,10 +6322,10 @@ func TestPullRequestsService_ListCommentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListCommentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6334,12 +6334,12 @@ func TestPullRequestsService_ListCommentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *PullRequestComment, err error) bool { + iter(func(item *AccessibleRepository, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6347,11 +6347,11 @@ func TestPullRequestsService_ListCommentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListCommitsIter(t *testing.T) { +func TestEnterpriseService_ListRunnerGroupRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6360,19 +6360,19 @@ func TestPullRequestsService_ListCommitsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil) + iter := client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -6381,11 +6381,11 @@ func TestPullRequestsService_ListCommitsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListCommitsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, opts) + iter = client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6394,10 +6394,10 @@ func TestPullRequestsService_ListCommitsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListCommitsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6406,12 +6406,12 @@ func TestPullRequestsService_ListCommitsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil) gotItems = 0 - iter(func(item *RepositoryCommit, err error) bool { + iter(func(item *Runner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6419,11 +6419,11 @@ func TestPullRequestsService_ListCommitsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListFilesIter(t *testing.T) { +func TestEnterpriseService_ListRunnerGroupsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6432,19 +6432,19 @@ func TestPullRequestsService_ListFilesIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runner_groups": [{},{}]}`) } }) - iter := client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil) + iter := client.Enterprise.ListRunnerGroupsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6453,11 +6453,11 @@ func TestPullRequestsService_ListFilesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListFilesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRunnerGroupsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, opts) + opts := &ListEnterpriseRunnerGroupOptions{} + iter = client.Enterprise.ListRunnerGroupsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6466,10 +6466,10 @@ func TestPullRequestsService_ListFilesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListFilesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRunnerGroupsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListRunnerGroupsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6478,12 +6478,12 @@ func TestPullRequestsService_ListFilesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListFilesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRunnerGroupsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListRunnerGroupsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *CommitFile, err error) bool { + iter(func(item *EnterpriseRunnerGroup, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6491,11 +6491,11 @@ func TestPullRequestsService_ListFilesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListFilesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRunnerGroupsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { +func TestEnterpriseService_ListRunnersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6504,19 +6504,19 @@ func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"runners": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"runners": [{},{}]}`) } }) - iter := client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil) + iter := client.Enterprise.ListRunnersIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6525,11 +6525,11 @@ func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRunnersIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", opts) + opts := &ListRunnersOptions{} + iter = client.Enterprise.ListRunnersIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6538,10 +6538,10 @@ func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListRunnersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil) + iter = client.Enterprise.ListRunnersIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6550,12 +6550,12 @@ func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRunnersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil) + iter = client.Enterprise.ListRunnersIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *PullRequest, err error) bool { + iter(func(item *Runner, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6563,11 +6563,11 @@ func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListRunnersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { +func TestEnterpriseService_ListTeamMembersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6588,7 +6588,7 @@ func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { } }) - iter := client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil) + iter := client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6597,11 +6597,11 @@ func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListReviewCommentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListTeamMembersIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, opts) + iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6610,10 +6610,10 @@ func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListReviewCommentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListTeamMembersIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil) + iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6622,12 +6622,12 @@ func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListReviewCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListTeamMembersIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil) + iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *PullRequestComment, err error) bool { + iter(func(item *User, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6635,11 +6635,11 @@ func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListReviewCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListTeamMembersIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestPullRequestsService_ListReviewsIter(t *testing.T) { +func TestEnterpriseService_ListTeamsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6660,7 +6660,7 @@ func TestPullRequestsService_ListReviewsIter(t *testing.T) { } }) - iter := client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil) + iter := client.Enterprise.ListTeamsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6669,11 +6669,11 @@ func TestPullRequestsService_ListReviewsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.PullRequests.ListReviewsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListTeamsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, opts) + iter = client.Enterprise.ListTeamsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6682,10 +6682,10 @@ func TestPullRequestsService_ListReviewsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.PullRequests.ListReviewsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Enterprise.ListTeamsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListTeamsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6694,12 +6694,12 @@ func TestPullRequestsService_ListReviewsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.PullRequests.ListReviewsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListTeamsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil) + iter = client.Enterprise.ListTeamsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *PullRequestReview, err error) bool { + iter(func(item *EnterpriseTeam, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6707,11 +6707,11 @@ func TestPullRequestsService_ListReviewsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.PullRequests.ListReviewsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Enterprise.ListTeamsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListCommentReactionsIter(t *testing.T) { +func TestGistsService_ListIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6732,7 +6732,7 @@ func TestReactionsService_ListCommentReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil) + iter := client.Gists.ListIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6741,11 +6741,11 @@ func TestReactionsService_ListCommentReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, opts) + opts := &GistListOptions{} + iter = client.Gists.ListIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6754,10 +6754,10 @@ func TestReactionsService_ListCommentReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6766,12 +6766,12 @@ func TestReactionsService_ListCommentReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *Gist, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6779,11 +6779,11 @@ func TestReactionsService_ListCommentReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { +func TestGistsService_ListAllIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6804,7 +6804,7 @@ func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil) + iter := client.Gists.ListAllIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -6813,11 +6813,11 @@ func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListAllIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, opts) + opts := &GistListOptions{} + iter = client.Gists.ListAllIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6826,10 +6826,10 @@ func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListAllIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListAllIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6838,12 +6838,12 @@ func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListAllIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListAllIter(t.Context(), nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *Gist, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6851,11 +6851,11 @@ func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListAllIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListIssueReactionsIter(t *testing.T) { +func TestGistsService_ListCommentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6876,7 +6876,7 @@ func TestReactionsService_ListIssueReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil) + iter := client.Gists.ListCommentsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6885,11 +6885,11 @@ func TestReactionsService_ListIssueReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListIssueReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListCommentsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, opts) + opts := &ListOptions{} + iter = client.Gists.ListCommentsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6898,10 +6898,10 @@ func TestReactionsService_ListIssueReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListIssueReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListCommentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListCommentsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6910,12 +6910,12 @@ func TestReactionsService_ListIssueReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListIssueReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListCommentsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *GistComment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6923,11 +6923,11 @@ func TestReactionsService_ListIssueReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListIssueReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { +func TestGistsService_ListCommitsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -6948,7 +6948,7 @@ func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil) + iter := client.Gists.ListCommitsIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -6957,11 +6957,11 @@ func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListCommitsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, opts) + opts := &ListOptions{} + iter = client.Gists.ListCommitsIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -6970,10 +6970,10 @@ func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListCommitsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListCommitsIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -6982,12 +6982,12 @@ func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListCommitsIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *GistCommit, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -6995,11 +6995,11 @@ func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { +func TestGistsService_ListForksIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7020,7 +7020,7 @@ func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil) + iter := client.Gists.ListForksIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7029,11 +7029,11 @@ func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListReleaseReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListForksIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, opts) + opts := &ListOptions{} + iter = client.Gists.ListForksIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7042,10 +7042,10 @@ func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListReleaseReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListForksIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListForksIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7054,12 +7054,12 @@ func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListReleaseReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListForksIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil) + iter = client.Gists.ListForksIter(t.Context(), "", nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *GistFork, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7067,11 +7067,11 @@ func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListReleaseReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListForksIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { +func TestGistsService_ListStarredIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7092,7 +7092,7 @@ func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil) + iter := client.Gists.ListStarredIter(t.Context(), nil) var gotItems int for _, err := range iter { gotItems++ @@ -7101,11 +7101,11 @@ func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListStarredIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, opts) + opts := &GistListOptions{} + iter = client.Gists.ListStarredIter(t.Context(), opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7114,10 +7114,10 @@ func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Gists.ListStarredIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil) + iter = client.Gists.ListStarredIter(t.Context(), nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7126,12 +7126,12 @@ func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListStarredIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil) + iter = client.Gists.ListStarredIter(t.Context(), nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *Gist, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7139,11 +7139,11 @@ func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Gists.ListStarredIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { +func TestIssuesService_ListIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7164,7 +7164,7 @@ func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { } }) - iter := client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil) + iter := client.Issues.ListIter(t.Context(), false, nil) var gotItems int for _, err := range iter { gotItems++ @@ -7173,11 +7173,11 @@ func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListReactionOptions{} - iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, opts) + opts := &IssueListOptions{} + iter = client.Issues.ListIter(t.Context(), false, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7186,10 +7186,10 @@ func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil) + iter = client.Issues.ListIter(t.Context(), false, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7198,12 +7198,12 @@ func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil) + iter = client.Issues.ListIter(t.Context(), false, nil) gotItems = 0 - iter(func(item *Reaction, err error) bool { + iter(func(item *Issue, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7211,11 +7211,11 @@ func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListIter(t *testing.T) { +func TestIssuesService_ListAssigneesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7236,7 +7236,7 @@ func TestRepositoriesService_ListIter(t *testing.T) { } }) - iter := client.Repositories.ListIter(t.Context(), "", nil) + iter := client.Issues.ListAssigneesIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7245,11 +7245,11 @@ func TestRepositoriesService_ListIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListAssigneesIter call 1 got %v items; want %v", gotItems, want) } - opts := &RepositoryListOptions{} - iter = client.Repositories.ListIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Issues.ListAssigneesIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7258,10 +7258,10 @@ func TestRepositoriesService_ListIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListAssigneesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListIter(t.Context(), "", nil) + iter = client.Issues.ListAssigneesIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7270,12 +7270,12 @@ func TestRepositoriesService_ListIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListAssigneesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListIter(t.Context(), "", nil) + iter = client.Issues.ListAssigneesIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Repository, err error) bool { + iter(func(item *User, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7283,11 +7283,11 @@ func TestRepositoriesService_ListIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListAssigneesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { +func TestIssuesService_ListByOrgIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7296,19 +7296,19 @@ func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `{"names": ["","",""]}`) + fmt.Fprint(w, `[{},{},{}]`) case 2: - fmt.Fprint(w, `{"names": ["","","",""]}`) + fmt.Fprint(w, `[{},{},{},{}]`) case 3: - fmt.Fprint(w, `{"names": ["",""]}`) + fmt.Fprint(w, `[{},{}]`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `{"names": ["",""]}`) + fmt.Fprint(w, `[{},{}]`) } }) - iter := client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil) + iter := client.Issues.ListByOrgIter(t.Context(), "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7317,11 +7317,11 @@ func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListAllTopicsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListByOrgIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", opts) + opts := &IssueListOptions{} + iter = client.Issues.ListByOrgIter(t.Context(), "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7330,10 +7330,10 @@ func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListAllTopicsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListByOrgIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil) + iter = client.Issues.ListByOrgIter(t.Context(), "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7342,12 +7342,12 @@ func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListAllTopicsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListByOrgIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil) + iter = client.Issues.ListByOrgIter(t.Context(), "", nil) gotItems = 0 - iter(func(item string, err error) bool { + iter(func(item *Issue, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7355,11 +7355,11 @@ func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListAllTopicsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListByOrgIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListBranchesIter(t *testing.T) { +func TestIssuesService_ListByRepoIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7367,7 +7367,7 @@ func TestRepositoriesService_ListBranchesIter(t *testing.T) { callNum++ switch callNum { case 1: - w.Header().Set("Link", `; rel="next"`) + w.Header().Set("Link", `; rel="next"`) fmt.Fprint(w, `[{},{},{}]`) case 2: fmt.Fprint(w, `[{},{},{},{}]`) @@ -7380,7 +7380,7 @@ func TestRepositoriesService_ListBranchesIter(t *testing.T) { } }) - iter := client.Repositories.ListBranchesIter(t.Context(), "", "", nil) + iter := client.Issues.ListByRepoIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7389,11 +7389,11 @@ func TestRepositoriesService_ListBranchesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListBranchesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListByRepoIter call 1 got %v items; want %v", gotItems, want) } - opts := &BranchListOptions{} - iter = client.Repositories.ListBranchesIter(t.Context(), "", "", opts) + opts := &IssueListByRepoOptions{} + iter = client.Issues.ListByRepoIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7402,10 +7402,10 @@ func TestRepositoriesService_ListBranchesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListBranchesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListByRepoIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListBranchesIter(t.Context(), "", "", nil) + iter = client.Issues.ListByRepoIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7414,12 +7414,12 @@ func TestRepositoriesService_ListBranchesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListBranchesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListByRepoIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListBranchesIter(t.Context(), "", "", nil) + iter = client.Issues.ListByRepoIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Branch, err error) bool { + iter(func(item *Issue, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7427,11 +7427,11 @@ func TestRepositoriesService_ListBranchesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListBranchesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListByRepoIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { +func TestIssuesService_ListCommentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7452,7 +7452,7 @@ func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { } }) - iter := client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil) + iter := client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -7461,11 +7461,11 @@ func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListCommentsIter call 1 got %v items; want %v", gotItems, want) } - opts := &RepositoryListByAuthenticatedUserOptions{} - iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), opts) + opts := &IssueListCommentsOptions{} + iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7474,10 +7474,10 @@ func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListCommentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil) + iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7486,12 +7486,12 @@ func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil) + iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *Repository, err error) bool { + iter(func(item *IssueComment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7499,11 +7499,11 @@ func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListByOrgIter(t *testing.T) { +func TestIssuesService_ListIssueEventsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7524,7 +7524,7 @@ func TestRepositoriesService_ListByOrgIter(t *testing.T) { } }) - iter := client.Repositories.ListByOrgIter(t.Context(), "", nil) + iter := client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -7533,11 +7533,11 @@ func TestRepositoriesService_ListByOrgIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListByOrgIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListIssueEventsIter call 1 got %v items; want %v", gotItems, want) } - opts := &RepositoryListByOrgOptions{} - iter = client.Repositories.ListByOrgIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7546,10 +7546,10 @@ func TestRepositoriesService_ListByOrgIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListByOrgIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListIssueEventsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListByOrgIter(t.Context(), "", nil) + iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7558,12 +7558,12 @@ func TestRepositoriesService_ListByOrgIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListByOrgIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListIssueEventsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListByOrgIter(t.Context(), "", nil) + iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *Repository, err error) bool { + iter(func(item *IssueEvent, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7571,11 +7571,11 @@ func TestRepositoriesService_ListByOrgIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListByOrgIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListIssueEventsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListByUserIter(t *testing.T) { +func TestIssuesService_ListIssueTimelineIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7596,7 +7596,7 @@ func TestRepositoriesService_ListByUserIter(t *testing.T) { } }) - iter := client.Repositories.ListByUserIter(t.Context(), "", nil) + iter := client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -7605,11 +7605,11 @@ func TestRepositoriesService_ListByUserIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListByUserIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListIssueTimelineIter call 1 got %v items; want %v", gotItems, want) } - opts := &RepositoryListByUserOptions{} - iter = client.Repositories.ListByUserIter(t.Context(), "", opts) + opts := &ListOptions{} + iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7618,10 +7618,10 @@ func TestRepositoriesService_ListByUserIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListByUserIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListIssueTimelineIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListByUserIter(t.Context(), "", nil) + iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7630,12 +7630,12 @@ func TestRepositoriesService_ListByUserIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListByUserIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListIssueTimelineIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListByUserIter(t.Context(), "", nil) + iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *Repository, err error) bool { + iter(func(item *Timeline, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7643,11 +7643,11 @@ func TestRepositoriesService_ListByUserIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListByUserIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListIssueTimelineIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { +func TestIssuesService_ListLabelsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7668,7 +7668,7 @@ func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { } }) - iter := client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil) + iter := client.Issues.ListLabelsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7677,11 +7677,11 @@ func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListCollaboratorsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListLabelsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListCollaboratorsOptions{} - iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Issues.ListLabelsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7690,10 +7690,10 @@ func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListCollaboratorsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListLabelsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil) + iter = client.Issues.ListLabelsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7702,12 +7702,12 @@ func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListCollaboratorsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListLabelsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil) + iter = client.Issues.ListLabelsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *User, err error) bool { + iter(func(item *Label, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7715,11 +7715,11 @@ func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListCollaboratorsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListLabelsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListCommentsIter(t *testing.T) { +func TestIssuesService_ListLabelsByIssueIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7740,7 +7740,7 @@ func TestRepositoriesService_ListCommentsIter(t *testing.T) { } }) - iter := client.Repositories.ListCommentsIter(t.Context(), "", "", nil) + iter := client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -7749,11 +7749,11 @@ func TestRepositoriesService_ListCommentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListCommentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListLabelsByIssueIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Repositories.ListCommentsIter(t.Context(), "", "", opts) + iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7762,10 +7762,10 @@ func TestRepositoriesService_ListCommentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListCommentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Issues.ListLabelsByIssueIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListCommentsIter(t.Context(), "", "", nil) + iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7774,12 +7774,12 @@ func TestRepositoriesService_ListCommentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListLabelsByIssueIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListCommentsIter(t.Context(), "", "", nil) + iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *RepositoryComment, err error) bool { + iter(func(item *Label, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7787,11 +7787,11 @@ func TestRepositoriesService_ListCommentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Issues.ListLabelsByIssueIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { +func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7812,7 +7812,4615 @@ func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { } }) - iter := client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil) + iter := client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Issues.ListLabelsForMilestoneIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Issues.ListLabelsForMilestoneIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Issues.ListLabelsForMilestoneIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *Label, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Issues.ListLabelsForMilestoneIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestIssuesService_ListMilestonesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Issues.ListMilestonesIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Issues.ListMilestonesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &MilestoneListOptions{} + iter = client.Issues.ListMilestonesIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Issues.ListMilestonesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Issues.ListMilestonesIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Issues.ListMilestonesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Issues.ListMilestonesIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *Milestone, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Issues.ListMilestonesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestIssuesService_ListRepositoryEventsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Issues.ListRepositoryEventsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Issues.ListRepositoryEventsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Issues.ListRepositoryEventsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *IssueEvent, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Issues.ListRepositoryEventsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestLicensesService_ListIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Licenses.ListIter(t.Context(), nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Licenses.ListIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListLicensesOptions{} + iter = client.Licenses.ListIter(t.Context(), opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Licenses.ListIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Licenses.ListIter(t.Context(), nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Licenses.ListIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Licenses.ListIter(t.Context(), nil) + gotItems = 0 + iter(func(item *License, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Licenses.ListIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil) + gotItems = 0 + iter(func(item *MarketplacePurchase, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil) + gotItems = 0 + iter(func(item *MarketplacePlanAccount, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestMarketplaceService_ListPlansIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Marketplace.ListPlansIter(t.Context(), nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Marketplace.ListPlansIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Marketplace.ListPlansIter(t.Context(), opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Marketplace.ListPlansIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Marketplace.ListPlansIter(t.Context(), nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Marketplace.ListPlansIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Marketplace.ListPlansIter(t.Context(), nil) + gotItems = 0 + iter(func(item *MarketplacePlan, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Marketplace.ListPlansIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestMigrationService_ListMigrationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Migrations.ListMigrationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Migrations.ListMigrationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Migrations.ListMigrationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Migrations.ListMigrationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Migrations.ListMigrationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Migrations.ListMigrationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Migrations.ListMigrationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Migration, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Migrations.ListMigrationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestMigrationService_ListUserMigrationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Migrations.ListUserMigrationsIter(t.Context(), nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Migrations.ListUserMigrationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Migrations.ListUserMigrationsIter(t.Context(), opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Migrations.ListUserMigrationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Migrations.ListUserMigrationsIter(t.Context(), nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Migrations.ListUserMigrationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Migrations.ListUserMigrationsIter(t.Context(), nil) + gotItems = 0 + iter(func(item *UserMigration, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Migrations.ListUserMigrationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Organization, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListAttestationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"attestations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"attestations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"attestations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"attestations": [{},{}]}`) + } + }) + + iter := client.Organizations.ListAttestationsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListAttestationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListAttestationsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListAttestationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListAttestationsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListAttestationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListAttestationsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *Attestation, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListAttestationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListBlockedUsersIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListBlockedUsersIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListBlockedUsersIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListBlockedUsersIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *User, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListBlockedUsersIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListCodeSecurityConfigurationRepositoriesOptions{} + iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *RepositoryAttachment, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOrgCodeSecurityConfigurationOptions{} + iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *CodeSecurityConfiguration, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &CredentialAuthorizationsListOptions{} + iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *CredentialAuthorization, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListCustomPropertyValuesOptions{} + iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *RepoCustomPropertyValue, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Invitation, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListFineGrainedPATOptions{} + iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *PersonalAccessToken, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListCursorOptions{} + iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *HookDelivery, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListHooksIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListHooksIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListHooksIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListHooksIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListHooksIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListHooksIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListHooksIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListHooksIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Hook, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListHooksIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListImmutableReleaseRepositoriesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"repositories": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"repositories": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"repositories": [{},{}]}`) + } + }) + + iter := client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Repository, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListInstallationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"installations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"installations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"installations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"installations": [{},{}]}`) + } + }) + + iter := client.Organizations.ListInstallationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListInstallationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListInstallationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListInstallationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListInstallationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListInstallationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListInstallationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Installation, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListInstallationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListMembersIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListMembersIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListMembersIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListMembersOptions{} + iter = client.Organizations.ListMembersIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListMembersIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListMembersIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListMembersIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListMembersIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *User, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListMembersIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListNetworkConfigurationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"network_configurations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"network_configurations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"network_configurations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"network_configurations": [{},{}]}`) + } + }) + + iter := client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *NetworkConfiguration, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *Team, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListOrgMembershipsIter(t.Context(), nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListOrgMembershipsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOrgMembershipsOptions{} + iter = client.Organizations.ListOrgMembershipsIter(t.Context(), opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListOrgMembershipsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListOrgMembershipsIter(t.Context(), nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListOrgMembershipsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListOrgMembershipsIter(t.Context(), nil) + gotItems = 0 + iter(func(item *Membership, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListOrgMembershipsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOutsideCollaboratorsOptions{} + iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *User, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListPackagesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListPackagesIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListPackagesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &PackageListOptions{} + iter = client.Organizations.ListPackagesIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListPackagesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListPackagesIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListPackagesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListPackagesIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Package, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListPackagesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Invitation, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *Team, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *User, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPrivateRegistriesService_ListOrganizationPrivateRegistriesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"configurations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"configurations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"configurations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"configurations": [{},{}]}`) + } + }) + + iter := client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *PrivateRegistry, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListProjectsOptions{} + iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *ProjectV2Field, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListProjectItemsOptions{} + iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *ProjectV2Item, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Projects.ListOrganizationProjectsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListProjectsOptions{} + iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Projects.ListOrganizationProjectsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Projects.ListOrganizationProjectsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *ProjectV2, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Projects.ListOrganizationProjectsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Projects.ListUserProjectFieldsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListProjectsOptions{} + iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Projects.ListUserProjectFieldsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Projects.ListUserProjectFieldsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *ProjectV2Field, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Projects.ListUserProjectFieldsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestProjectsService_ListUserProjectItemsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Projects.ListUserProjectItemsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListProjectItemsOptions{} + iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Projects.ListUserProjectItemsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Projects.ListUserProjectItemsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil) + gotItems = 0 + iter(func(item *ProjectV2Item, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Projects.ListUserProjectItemsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestProjectsService_ListUserProjectsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Projects.ListUserProjectsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Projects.ListUserProjectsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListProjectsOptions{} + iter = client.Projects.ListUserProjectsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Projects.ListUserProjectsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Projects.ListUserProjectsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Projects.ListUserProjectsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Projects.ListUserProjectsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *ProjectV2, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Projects.ListUserProjectsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &PullRequestListOptions{} + iter = client.PullRequests.ListIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *PullRequest, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListCommentsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListCommentsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &PullRequestListCommentsOptions{} + iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListCommentsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *PullRequestComment, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListCommitsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListCommitsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListCommitsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *RepositoryCommit, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListFilesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListFilesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListFilesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListFilesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *CommitFile, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListFilesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil) + gotItems = 0 + iter(func(item *PullRequest, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListReviewCommentsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListReviewCommentsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListReviewCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil) + gotItems = 0 + iter(func(item *PullRequestComment, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListReviewCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestPullRequestsService_ListReviewsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.PullRequests.ListReviewsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.PullRequests.ListReviewsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.PullRequests.ListReviewsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *PullRequestReview, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.PullRequests.ListReviewsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListCommentReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListIssueReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListIssueReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListIssueReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListIssueReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListIssueReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListReleaseReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListReleaseReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListReleaseReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListReleaseReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListReleaseReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListReactionOptions{} + iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil) + gotItems = 0 + iter(func(item *Reaction, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &RepositoryListOptions{} + iter = client.Repositories.ListIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Repository, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListAllTopicsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"names": ["","",""]}`) + case 2: + fmt.Fprint(w, `{"names": ["","","",""]}`) + case 3: + fmt.Fprint(w, `{"names": ["",""]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"names": ["",""]}`) + } + }) + + iter := client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListAllTopicsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListAllTopicsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListAllTopicsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item string, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListAllTopicsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListAttestationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"attestations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"attestations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"attestations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"attestations": [{},{}]}`) + } + }) + + iter := client.Repositories.ListAttestationsIter(t.Context(), "", "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListAttestationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Repositories.ListAttestationsIter(t.Context(), "", "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListAttestationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListAttestationsIter(t.Context(), "", "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListAttestationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListAttestationsIter(t.Context(), "", "", "", nil) + gotItems = 0 + iter(func(item *Attestation, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListAttestationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListBranchesIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListBranchesIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListBranchesIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &BranchListOptions{} + iter = client.Repositories.ListBranchesIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListBranchesIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListBranchesIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListBranchesIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListBranchesIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *Branch, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListBranchesIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &RepositoryListByAuthenticatedUserOptions{} + iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil) + gotItems = 0 + iter(func(item *Repository, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListByOrgIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListByOrgIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListByOrgIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &RepositoryListByOrgOptions{} + iter = client.Repositories.ListByOrgIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListByOrgIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListByOrgIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListByOrgIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListByOrgIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Repository, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListByOrgIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListByUserIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListByUserIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListByUserIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &RepositoryListByUserOptions{} + iter = client.Repositories.ListByUserIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListByUserIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListByUserIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListByUserIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListByUserIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *Repository, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListByUserIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListCollaboratorsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListCollaboratorsOptions{} + iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListCollaboratorsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListCollaboratorsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *User, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListCollaboratorsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListCommentsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListCommentsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListCommentsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Repositories.ListCommentsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListCommentsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListCommentsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListCommentsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *RepositoryComment, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListCommitCommentsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListCommitCommentsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListCommitCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil) + gotItems = 0 + iter(func(item *RepositoryComment, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListCommitCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListCommitsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListCommitsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListCommitsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &CommitsListOptions{} + iter = client.Repositories.ListCommitsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListCommitsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListCommitsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListCommitsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *RepositoryCommit, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListContributorsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `[{},{},{}]`) + case 2: + fmt.Fprint(w, `[{},{},{},{}]`) + case 3: + fmt.Fprint(w, `[{},{}]`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `[{},{}]`) + } + }) + + iter := client.Repositories.ListContributorsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Repositories.ListContributorsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListContributorsOptions{} + iter = client.Repositories.ListContributorsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Repositories.ListContributorsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Repositories.ListContributorsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Repositories.ListContributorsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Repositories.ListContributorsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *Contributor, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Repositories.ListContributorsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestRepositoriesService_ListCustomDeploymentRuleIntegrationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{}]}`) + } + }) + + iter := client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7821,11 +12429,11 @@ func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListCommitCommentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 1 got %v items; want %v", gotItems, want) } opts := &ListOptions{} - iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", opts) + iter = client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7834,10 +12442,10 @@ func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListCommitCommentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil) + iter = client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7846,12 +12454,12 @@ func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListCommitCommentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil) + iter = client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", nil) gotItems = 0 - iter(func(item *RepositoryComment, err error) bool { + iter(func(item *CustomDeploymentProtectionRuleApp, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7859,11 +12467,11 @@ func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListCommitCommentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListCommitsIter(t *testing.T) { +func TestRepositoriesService_ListDeploymentBranchPoliciesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7872,19 +12480,19 @@ func TestRepositoriesService_ListCommitsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"branch_policies": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"branch_policies": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"branch_policies": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"branch_policies": [{},{}]}`) } }) - iter := client.Repositories.ListCommitsIter(t.Context(), "", "", nil) + iter := client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -7893,11 +12501,11 @@ func TestRepositoriesService_ListCommitsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListCommitsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 1 got %v items; want %v", gotItems, want) } - opts := &CommitsListOptions{} - iter = client.Repositories.ListCommitsIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7906,10 +12514,10 @@ func TestRepositoriesService_ListCommitsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListCommitsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListCommitsIter(t.Context(), "", "", nil) + iter = client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7918,12 +12526,12 @@ func TestRepositoriesService_ListCommitsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListCommitsIter(t.Context(), "", "", nil) + iter = client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", nil) gotItems = 0 - iter(func(item *RepositoryCommit, err error) bool { + iter(func(item *DeploymentBranchPolicy, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -7931,11 +12539,11 @@ func TestRepositoriesService_ListCommitsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListContributorsIter(t *testing.T) { +func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -7956,7 +12564,7 @@ func TestRepositoriesService_ListContributorsIter(t *testing.T) { } }) - iter := client.Repositories.ListContributorsIter(t.Context(), "", "", nil) + iter := client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil) var gotItems int for _, err := range iter { gotItems++ @@ -7965,11 +12573,11 @@ func TestRepositoriesService_ListContributorsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListContributorsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListDeploymentStatusesIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListContributorsOptions{} - iter = client.Repositories.ListContributorsIter(t.Context(), "", "", opts) + opts := &ListOptions{} + iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -7978,10 +12586,10 @@ func TestRepositoriesService_ListContributorsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListContributorsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListDeploymentStatusesIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListContributorsIter(t.Context(), "", "", nil) + iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -7990,12 +12598,12 @@ func TestRepositoriesService_ListContributorsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListContributorsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListDeploymentStatusesIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListContributorsIter(t.Context(), "", "", nil) + iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil) gotItems = 0 - iter(func(item *Contributor, err error) bool { + iter(func(item *DeploymentStatus, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -8003,11 +12611,11 @@ func TestRepositoriesService_ListContributorsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListContributorsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListDeploymentStatusesIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { +func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -8028,7 +12636,7 @@ func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { } }) - iter := client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil) + iter := client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -8037,11 +12645,11 @@ func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListDeploymentStatusesIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListDeploymentsIter call 1 got %v items; want %v", gotItems, want) } - opts := &ListOptions{} - iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, opts) + opts := &DeploymentsListOptions{} + iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -8050,10 +12658,10 @@ func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListDeploymentStatusesIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListDeploymentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil) + iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -8062,12 +12670,12 @@ func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListDeploymentStatusesIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListDeploymentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil) + iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *DeploymentStatus, err error) bool { + iter(func(item *Deployment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -8075,11 +12683,11 @@ func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListDeploymentStatusesIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListDeploymentsIter call 4 got %v items; want 1 (an error)", gotItems) } } -func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { +func TestRepositoriesService_ListEnvironmentsIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) var callNum int @@ -8088,19 +12696,19 @@ func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { switch callNum { case 1: w.Header().Set("Link", `; rel="next"`) - fmt.Fprint(w, `[{},{},{}]`) + fmt.Fprint(w, `{"environments": [{},{},{}]}`) case 2: - fmt.Fprint(w, `[{},{},{},{}]`) + fmt.Fprint(w, `{"environments": [{},{},{},{}]}`) case 3: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"environments": [{},{}]}`) case 4: w.WriteHeader(http.StatusNotFound) case 5: - fmt.Fprint(w, `[{},{}]`) + fmt.Fprint(w, `{"environments": [{},{}]}`) } }) - iter := client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil) + iter := client.Repositories.ListEnvironmentsIter(t.Context(), "", "", nil) var gotItems int for _, err := range iter { gotItems++ @@ -8109,11 +12717,11 @@ func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { } } if want := 7; gotItems != want { - t.Errorf("client.Repositories.ListDeploymentsIter call 1 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListEnvironmentsIter call 1 got %v items; want %v", gotItems, want) } - opts := &DeploymentsListOptions{} - iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", opts) + opts := &EnvironmentListOptions{} + iter = client.Repositories.ListEnvironmentsIter(t.Context(), "", "", opts) gotItems = 0 for _, err := range iter { gotItems++ @@ -8122,10 +12730,10 @@ func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { } } if want := 2; gotItems != want { - t.Errorf("client.Repositories.ListDeploymentsIter call 2 got %v items; want %v", gotItems, want) + t.Errorf("client.Repositories.ListEnvironmentsIter call 2 got %v items; want %v", gotItems, want) } - iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil) + iter = client.Repositories.ListEnvironmentsIter(t.Context(), "", "", nil) gotItems = 0 for _, err := range iter { gotItems++ @@ -8134,12 +12742,12 @@ func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { } } if gotItems != 1 { - t.Errorf("client.Repositories.ListDeploymentsIter call 3 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListEnvironmentsIter call 3 got %v items; want 1 (an error)", gotItems) } - iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil) + iter = client.Repositories.ListEnvironmentsIter(t.Context(), "", "", nil) gotItems = 0 - iter(func(item *Deployment, err error) bool { + iter(func(item *Environment, err error) bool { gotItems++ if err != nil { t.Errorf("Unexpected error: %v", err) @@ -8147,7 +12755,7 @@ func TestRepositoriesService_ListDeploymentsIter(t *testing.T) { return false }) if gotItems != 1 { - t.Errorf("client.Repositories.ListDeploymentsIter call 4 got %v items; want 1 (an error)", gotItems) + t.Errorf("client.Repositories.ListEnvironmentsIter call 4 got %v items; want 1 (an error)", gotItems) } } @@ -10095,6 +14703,150 @@ func TestTeamsService_ListDiscussionsBySlugIter(t *testing.T) { } } +func TestTeamsService_ListExternalGroupsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"groups": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"groups": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"groups": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"groups": [{},{}]}`) + } + }) + + iter := client.Teams.ListExternalGroupsIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Teams.ListExternalGroupsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListExternalGroupsOptions{} + iter = client.Teams.ListExternalGroupsIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Teams.ListExternalGroupsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Teams.ListExternalGroupsIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Teams.ListExternalGroupsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Teams.ListExternalGroupsIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *ExternalGroup, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Teams.ListExternalGroupsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + +func TestTeamsService_ListIDPGroupsInOrganizationIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"groups": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"groups": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"groups": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"groups": [{},{}]}`) + } + }) + + iter := client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListIDPGroupsOptions{} + iter = client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", nil) + gotItems = 0 + iter(func(item *IDPGroup, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + func TestTeamsService_ListPendingTeamInvitationsByIDIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) @@ -10671,6 +15423,78 @@ func TestTeamsService_ListUserTeamsIter(t *testing.T) { } } +func TestUsersService_ListAttestationsIter(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + var callNum int + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + callNum++ + switch callNum { + case 1: + w.Header().Set("Link", `; rel="next"`) + fmt.Fprint(w, `{"attestations": [{},{},{}]}`) + case 2: + fmt.Fprint(w, `{"attestations": [{},{},{},{}]}`) + case 3: + fmt.Fprint(w, `{"attestations": [{},{}]}`) + case 4: + w.WriteHeader(http.StatusNotFound) + case 5: + fmt.Fprint(w, `{"attestations": [{},{}]}`) + } + }) + + iter := client.Users.ListAttestationsIter(t.Context(), "", "", nil) + var gotItems int + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 7; gotItems != want { + t.Errorf("client.Users.ListAttestationsIter call 1 got %v items; want %v", gotItems, want) + } + + opts := &ListOptions{} + iter = client.Users.ListAttestationsIter(t.Context(), "", "", opts) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + if want := 2; gotItems != want { + t.Errorf("client.Users.ListAttestationsIter call 2 got %v items; want %v", gotItems, want) + } + + iter = client.Users.ListAttestationsIter(t.Context(), "", "", nil) + gotItems = 0 + for _, err := range iter { + gotItems++ + if err == nil { + t.Error("expected error; got nil") + } + } + if gotItems != 1 { + t.Errorf("client.Users.ListAttestationsIter call 3 got %v items; want 1 (an error)", gotItems) + } + + iter = client.Users.ListAttestationsIter(t.Context(), "", "", nil) + gotItems = 0 + iter(func(item *Attestation, err error) bool { + gotItems++ + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + return false + }) + if gotItems != 1 { + t.Errorf("client.Users.ListAttestationsIter call 4 got %v items; want 1 (an error)", gotItems) + } +} + func TestUsersService_ListBlockedUsersIter(t *testing.T) { t.Parallel() client, mux, _ := setup(t)