GetReadme gets the Readme file for the repository. GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-a-repository-readme meta:operation GET /repos/{owner}/{repo}/readme
(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions)
| 110 | // |
| 111 | //meta:operation GET /repos/{owner}/{repo}/readme |
| 112 | func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { |
| 113 | u := fmt.Sprintf("repos/%v/%v/readme", owner, repo) |
| 114 | u, err := addOptions(u, opts) |
| 115 | if err != nil { |
| 116 | return nil, nil, err |
| 117 | } |
| 118 | |
| 119 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 120 | if err != nil { |
| 121 | return nil, nil, err |
| 122 | } |
| 123 | |
| 124 | var readme *RepositoryContent |
| 125 | resp, err := s.client.Do(req, &readme) |
| 126 | if err != nil { |
| 127 | return nil, resp, err |
| 128 | } |
| 129 | |
| 130 | return readme, resp, nil |
| 131 | } |
| 132 | |
| 133 | // DownloadContents returns an io.ReadCloser that reads the contents of the |
| 134 | // specified file. This function will work with files of any size, as opposed |