MCPcopy Index your code
hub / github.com/google/go-github / ListByOrg

Method ListByOrg

github/repos.go:447–469  ·  view source on GitHub ↗

ListByOrg lists the repositories for an organization. GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories meta:operation GET /orgs/{org}/repos

(ctx context.Context, org string, opts *RepositoryListByOrgOptions)

Source from the content-addressed store, hash-verified

445//
446//meta:operation GET /orgs/{org}/repos
447func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) {
448 u := fmt.Sprintf("orgs/%v/repos", org)
449 u, err := addOptions(u, opts)
450 if err != nil {
451 return nil, nil, err
452 }
453
454 req, err := s.client.NewRequest(ctx, "GET", u, nil)
455 if err != nil {
456 return nil, nil, err
457 }
458
459 acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
460 req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
461
462 var repos []*Repository
463 resp, err := s.client.Do(req, &repos)
464 if err != nil {
465 return nil, resp, err
466 }
467
468 return repos, resp, nil
469}
470
471// RepositoryListAllOptions specifies the optional parameters to the
472// RepositoriesService.ListAll method.

Callers 1

ListByOrgIterMethod · 0.95

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45

Tested by

no test coverage detected