Info fetches metadata from the latest published release and page one of the releases listing.
(ctx context.Context, slug string)
| 200 | // Info fetches metadata from the latest published release and page one of the |
| 201 | // releases listing. |
| 202 | func (c *Client) Info(ctx context.Context, slug string) (*registry.Detail, error) { |
| 203 | repo, err := parseRepoSlug(slug) |
| 204 | if err != nil { |
| 205 | return nil, err |
| 206 | } |
| 207 | |
| 208 | latest, err := c.fetchLatestRelease(ctx, repo) |
| 209 | if err != nil { |
| 210 | return nil, err |
| 211 | } |
| 212 | releases, err := c.fetchReleasePage(ctx, repo) |
| 213 | if err != nil { |
| 214 | return nil, err |
| 215 | } |
| 216 | |
| 217 | return ®istry.Detail{ |
| 218 | Listing: registry.Listing{ |
| 219 | Slug: repo.full, |
| 220 | Name: firstNonEmpty(latest.Name, repo.name), |
| 221 | Description: releaseDescription(latest), |
| 222 | Author: firstNonEmpty(latest.Author.Login, repo.owner), |
| 223 | Version: strings.TrimSpace(latest.TagName), |
| 224 | Downloads: releaseDownloadCount(latest), |
| 225 | Source: c.Name(), |
| 226 | }, |
| 227 | Readme: strings.TrimSpace(latest.Body), |
| 228 | Repository: githubRepositoryBaseURL + "/" + repo.full, |
| 229 | Versions: releaseVersions(releases), |
| 230 | }, nil |
| 231 | } |
| 232 | |
| 233 | // Download fetches the selected release archive stream. |
| 234 | func (c *Client) Download( |