DeploymentDAUs requires a tzOffset in hours. Use 0 for UTC, and TimezoneOffsetHour(time.Local) for the local timezone.
(ctx context.Context, tzOffset int)
| 5271 | // DeploymentDAUs requires a tzOffset in hours. Use 0 for UTC, and TimezoneOffsetHour(time.Local) for the |
| 5272 | // local timezone. |
| 5273 | func (c *Client) DeploymentDAUs(ctx context.Context, tzOffset int) (*DAUsResponse, error) { |
| 5274 | res, err := c.Request(ctx, http.MethodGet, "/api/v2/insights/daus", nil, DAURequest{ |
| 5275 | TZHourOffset: tzOffset, |
| 5276 | }.asRequestOption()) |
| 5277 | if err != nil { |
| 5278 | return nil, xerrors.Errorf("execute request: %w", err) |
| 5279 | } |
| 5280 | defer res.Body.Close() |
| 5281 | |
| 5282 | if res.StatusCode != http.StatusOK { |
| 5283 | return nil, ReadBodyAsError(res) |
| 5284 | } |
| 5285 | |
| 5286 | var resp DAUsResponse |
| 5287 | return &resp, json.NewDecoder(res.Body).Decode(&resp) |
| 5288 | } |
| 5289 | |
| 5290 | type AppHostResponse struct { |
| 5291 | // Host is the externally accessible URL for the Coder instance. |