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)
| 455 | // TemplateVersionByName returns a template version by it's friendly name. |
| 456 | // This is used for path-based routing. Like: /templates/example/versions/helloworld |
| 457 | func (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 | |
| 470 | func (c *Client) TemplateDAUsLocalTZ(ctx context.Context, templateID uuid.UUID) (*DAUsResponse, error) { |
| 471 | return c.TemplateDAUs(ctx, templateID, TimezoneOffsetHour(time.Local)) |