MCPcopy Index your code
hub / github.com/coder/coder / ArchiveTemplateVersions

Method ArchiveTemplateVersions

codersdk/templates.go:303–319  ·  view source on GitHub ↗
(ctx context.Context, template uuid.UUID, all bool)

Source from the content-addressed store, hash-verified

301}
302
303func (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
322func (c *Client) SetArchiveTemplateVersion(ctx context.Context, templateVersion uuid.UUID, archive bool) error {

Callers 2

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1