| 301 | } |
| 302 | |
| 303 | func (c *Client) ArchiveTemplateVersions(ctx context.Context, template uuid.UUID, all bool) (ArchiveTemplateVersionsResponse, error) { |
| 304 | res, err := c.Request(ctx, http.MethodPost, |
| 305 | fmt.Sprintf("/api/v2/templates/%s/versions/archive", template), |
| 306 | ArchiveTemplateVersionsRequest{ |
| 307 | All: all, |
| 308 | }, |
| 309 | ) |
| 310 | if err != nil { |
| 311 | return ArchiveTemplateVersionsResponse{}, err |
| 312 | } |
| 313 | defer res.Body.Close() |
| 314 | if res.StatusCode != http.StatusOK { |
| 315 | return ArchiveTemplateVersionsResponse{}, ReadBodyAsError(res) |
| 316 | } |
| 317 | var resp ArchiveTemplateVersionsResponse |
| 318 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 319 | } |
| 320 | |
| 321 | //nolint:revive |
| 322 | func (c *Client) SetArchiveTemplateVersion(ctx context.Context, templateVersion uuid.UUID, archive bool) error { |