StarterTemplates lists example templates available in Coder.
(ctx context.Context)
| 514 | |
| 515 | // StarterTemplates lists example templates available in Coder. |
| 516 | func (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 | |
| 529 | type InvalidatePresetsResponse struct { |
| 530 | Invalidated []InvalidatedPreset `json:"invalidated"` |