Template returns a single template.
(ctx context.Context, template uuid.UUID)
| 288 | |
| 289 | // Template returns a single template. |
| 290 | func (c *Client) Template(ctx context.Context, template uuid.UUID) (Template, error) { |
| 291 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templates/%s", template), nil) |
| 292 | if err != nil { |
| 293 | return Template{}, xerrors.Errorf("do request: %w", err) |
| 294 | } |
| 295 | defer res.Body.Close() |
| 296 | if res.StatusCode != http.StatusOK { |
| 297 | return Template{}, ReadBodyAsError(res) |
| 298 | } |
| 299 | var resp Template |
| 300 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 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, |