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

Method GetReadme

github/repos_contents.go:112–131  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

110//
111//meta:operation GET /repos/{owner}/{repo}/readme
112func (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

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45