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

Method Template

codersdk/templates.go:290–301  ·  view source on GitHub ↗

Template returns a single template.

(ctx context.Context, template uuid.UUID)

Source from the content-addressed store, hash-verified

288
289// Template returns a single template.
290func (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
303func (c *Client) ArchiveTemplateVersions(ctx context.Context, template uuid.UUID, all bool) (ArchiveTemplateVersionsResponse, error) {
304 res, err := c.Request(ctx, http.MethodPost,

Callers 15

TestTemplateFunction · 0.80
TestTemplatesFunction · 0.80
TestPatchTemplateMetaFunction · 0.80
TestDeleteTemplateFunction · 0.80
TestTemplateMetricsFunction · 0.80
TestExecutorAutostartOKFunction · 0.80
fetchTemplateFunction · 0.80
toolsdk.goFile · 0.80
TestTemplateDeleteFunction · 0.80
TestTemplatePushFunction · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
ErrorfMethod · 0.45

Tested by 15

TestTemplateFunction · 0.64
TestTemplatesFunction · 0.64
TestPatchTemplateMetaFunction · 0.64
TestDeleteTemplateFunction · 0.64
TestTemplateMetricsFunction · 0.64
TestExecutorAutostartOKFunction · 0.64
TestTemplateDeleteFunction · 0.64
TestTemplatePushFunction · 0.64