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

Method PostWorkspaceUsageWithBody

codersdk/workspaces.go:373–384  ·  view source on GitHub ↗

PostWorkspaceUsage marks the workspace as having been used recently and records an app stat.

(ctx context.Context, id uuid.UUID, req PostWorkspaceUsageRequest)

Source from the content-addressed store, hash-verified

371
372// PostWorkspaceUsage marks the workspace as having been used recently and records an app stat.
373func (c *Client) PostWorkspaceUsageWithBody(ctx context.Context, id uuid.UUID, req PostWorkspaceUsageRequest) error {
374 path := fmt.Sprintf("/api/v2/workspaces/%s/usage", id.String())
375 res, err := c.Request(ctx, http.MethodPost, path, req)
376 if err != nil {
377 return xerrors.Errorf("post workspace usage: %w", err)
378 }
379 defer res.Body.Close()
380 if res.StatusCode != http.StatusNoContent {
381 return ReadBodyAsError(res)
382 }
383 return nil
384}
385
386// PostWorkspaceUsage marks the workspace as having been used recently.
387// Deprecated: use PostWorkspaceUsageWithBody instead

Calls 5

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

Tested by 1