List gists for a user. Passing the empty string will list all public gists if called anonymously. However, if the call is authenticated, it will returns all gists for the authenticated user. GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-a-user GitHu
(ctx context.Context, user string, opts *GistListOptions)
| 103 | //meta:operation GET /gists |
| 104 | //meta:operation GET /users/{username}/gists |
| 105 | func (s *GistsService) List(ctx context.Context, user string, opts *GistListOptions) ([]*Gist, *Response, error) { |
| 106 | var u string |
| 107 | if user != "" { |
| 108 | u = fmt.Sprintf("users/%v/gists", user) |
| 109 | } else { |
| 110 | u = "gists" |
| 111 | } |
| 112 | u, err := addOptions(u, opts) |
| 113 | if err != nil { |
| 114 | return nil, nil, err |
| 115 | } |
| 116 | |
| 117 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 118 | if err != nil { |
| 119 | return nil, nil, err |
| 120 | } |
| 121 | |
| 122 | var gists []*Gist |
| 123 | resp, err := s.client.Do(req, &gists) |
| 124 | if err != nil { |
| 125 | return nil, resp, err |
| 126 | } |
| 127 | |
| 128 | return gists, resp, nil |
| 129 | } |
| 130 | |
| 131 | // ListAll lists all public gists. |
| 132 | // |