PostWorkspaceUsage marks the workspace as having been used recently. Deprecated: use PostWorkspaceUsageWithBody instead
(ctx context.Context, id uuid.UUID)
| 386 | // PostWorkspaceUsage marks the workspace as having been used recently. |
| 387 | // Deprecated: use PostWorkspaceUsageWithBody instead |
| 388 | func (c *Client) PostWorkspaceUsage(ctx context.Context, id uuid.UUID) error { |
| 389 | path := fmt.Sprintf("/api/v2/workspaces/%s/usage", id.String()) |
| 390 | res, err := c.Request(ctx, http.MethodPost, path, nil) |
| 391 | if err != nil { |
| 392 | return xerrors.Errorf("post workspace usage: %w", err) |
| 393 | } |
| 394 | defer res.Body.Close() |
| 395 | if res.StatusCode != http.StatusNoContent { |
| 396 | return ReadBodyAsError(res) |
| 397 | } |
| 398 | return nil |
| 399 | } |
| 400 | |
| 401 | // UpdateWorkspaceUsageWithBodyContext periodically posts workspace usage for the workspace |
| 402 | // with the given id and app name in the background. |