| 125 | } |
| 126 | |
| 127 | func (c *artifactClient) Get(repo ghrepo.Interface, issueNumber int, number int) (*ArtifactWithVersions, error) { |
| 128 | u, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "issues", strconv.Itoa(issueNumber), "artifacts", strconv.Itoa(number)) |
| 129 | if err != nil { |
| 130 | return nil, err |
| 131 | } |
| 132 | |
| 133 | var response struct { |
| 134 | Artifact Artifact `json:"artifact"` |
| 135 | Versions []Version `json:"versions"` |
| 136 | } |
| 137 | if err := c.apiClient.REST(repo.RepoHost(), "GET", u.String(), nil, &response); err != nil { |
| 138 | return nil, err |
| 139 | } |
| 140 | return &ArtifactWithVersions{Artifact: response.Artifact, Versions: response.Versions}, nil |
| 141 | } |
| 142 | |
| 143 | // Delete ignores the response's body. A successful delete can get 204 No |
| 144 | // Content, which has none, or 200 with the deleted artifact's number, which |