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

Method TemplateDAUs

codersdk/templates.go:476–491  ·  view source on GitHub ↗

TemplateDAUs requires a tzOffset in hours. Use 0 for UTC, and TimezoneOffsetHour(time.Local) for the local timezone.

(ctx context.Context, templateID uuid.UUID, tzOffset int)

Source from the content-addressed store, hash-verified

474// TemplateDAUs requires a tzOffset in hours. Use 0 for UTC, and TimezoneOffsetHour(time.Local) for the
475// local timezone.
476func (c *Client) TemplateDAUs(ctx context.Context, templateID uuid.UUID, tzOffset int) (*DAUsResponse, error) {
477 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templates/%s/daus", templateID), nil, DAURequest{
478 TZHourOffset: tzOffset,
479 }.asRequestOption())
480 if err != nil {
481 return nil, xerrors.Errorf("execute request: %w", err)
482 }
483 defer res.Body.Close()
484
485 if res.StatusCode != http.StatusOK {
486 return nil, ReadBodyAsError(res)
487 }
488
489 var resp DAUsResponse
490 return &resp, json.NewDecoder(res.Body).Decode(&resp)
491}
492
493// AgentStatsReportRequest is a WebSocket request by coderd
494// to the agent for stats.

Callers 2

TemplateDAUsLocalTZMethod · 0.95
TestTemplateMetricsFunction · 0.80

Calls 5

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

Tested by 1

TestTemplateMetricsFunction · 0.64