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

Method PostWorkspaceUsage

codersdk/workspaces.go:388–399  ·  view source on GitHub ↗

PostWorkspaceUsage marks the workspace as having been used recently. Deprecated: use PostWorkspaceUsageWithBody instead

(ctx context.Context, id uuid.UUID)

Source from the content-addressed store, hash-verified

386// PostWorkspaceUsage marks the workspace as having been used recently.
387// Deprecated: use PostWorkspaceUsageWithBody instead
388func (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.

Callers 3

Calls 5

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

Tested by 2