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

Method TemplateVersionByName

codersdk/templates.go:457–468  ·  view source on GitHub ↗

TemplateVersionByName returns a template version by it's friendly name. This is used for path-based routing. Like: /templates/example/versions/helloworld

(ctx context.Context, template uuid.UUID, name string)

Source from the content-addressed store, hash-verified

455// TemplateVersionByName returns a template version by it's friendly name.
456// This is used for path-based routing. Like: /templates/example/versions/helloworld
457func (c *Client) TemplateVersionByName(ctx context.Context, template uuid.UUID, name string) (TemplateVersion, error) {
458 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templates/%s/versions/%s", template, name), nil)
459 if err != nil {
460 return TemplateVersion{}, err
461 }
462 defer res.Body.Close()
463 if res.StatusCode != http.StatusOK {
464 return TemplateVersion{}, ReadBodyAsError(res)
465 }
466 var templateVersion TemplateVersion
467 return templateVersion, json.NewDecoder(res.Body).Decode(&templateVersion)
468}
469
470func (c *Client) TemplateDAUsLocalTZ(ctx context.Context, templateID uuid.UUID) (*DAUsResponse, error) {
471 return c.TemplateDAUs(ctx, templateID, TimezoneOffsetHour(time.Local))

Callers 5

templatePresetsListMethod · 0.80
templatePullMethod · 0.80
CreateMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1