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

Method StarterTemplates

codersdk/templates.go:516–527  ·  view source on GitHub ↗

StarterTemplates lists example templates available in Coder.

(ctx context.Context)

Source from the content-addressed store, hash-verified

514
515// StarterTemplates lists example templates available in Coder.
516func (c *Client) StarterTemplates(ctx context.Context) ([]TemplateExample, error) {
517 res, err := c.Request(ctx, http.MethodGet, "/api/v2/templates/examples", nil)
518 if err != nil {
519 return nil, err
520 }
521 defer res.Body.Close()
522 if res.StatusCode != http.StatusOK {
523 return nil, ReadBodyAsError(res)
524 }
525 var templateExamples []TemplateExample
526 return templateExamples, json.NewDecoder(res.Body).Decode(&templateExamples)
527}
528
529type InvalidatePresetsResponse struct {
530 Invalidated []InvalidatedPreset `json:"invalidated"`

Callers 3

TemplateExamplesMethod · 0.95
TestStarterTemplatesFunction · 0.80
setupStarterTemplateFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1

TestStarterTemplatesFunction · 0.64