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

Method ListByUser

github/repos.go:340–359  ·  view source on GitHub ↗

ListByUser lists public repositories for the specified user. GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-a-user meta:operation GET /users/{username}/repos

(ctx context.Context, user string, opts *RepositoryListByUserOptions)

Source from the content-addressed store, hash-verified

338//
339//meta:operation GET /users/{username}/repos
340func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts *RepositoryListByUserOptions) ([]*Repository, *Response, error) {
341 u := fmt.Sprintf("users/%v/repos", user)
342 u, err := addOptions(u, opts)
343 if err != nil {
344 return nil, nil, err
345 }
346
347 req, err := s.client.NewRequest(ctx, "GET", u, nil)
348 if err != nil {
349 return nil, nil, err
350 }
351
352 var repos []*Repository
353 resp, err := s.client.Do(req, &repos)
354 if err != nil {
355 return nil, resp, err
356 }
357
358 return repos, resp, nil
359}
360
361// RepositoryListByAuthenticatedUserOptions specifies the optional parameters to the
362// RepositoriesService.ListByAuthenticatedUser method.

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45