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

Method GroupAIBudget

codersdk/aibridge.go:387–402  ·  view source on GitHub ↗

GroupAIBudget returns the AI spend budget configured for the given group.

(ctx context.Context, group uuid.UUID)

Source from the content-addressed store, hash-verified

385
386// GroupAIBudget returns the AI spend budget configured for the given group.
387func (c *Client) GroupAIBudget(ctx context.Context, group uuid.UUID) (GroupAIBudget, error) {
388 res, err := c.Request(ctx, http.MethodGet,
389 fmt.Sprintf("/api/v2/groups/%s/ai/budget", group.String()),
390 nil,
391 )
392 if err != nil {
393 return GroupAIBudget{}, xerrors.Errorf("make request: %w", err)
394 }
395 defer res.Body.Close()
396
397 if res.StatusCode != http.StatusOK {
398 return GroupAIBudget{}, ReadBodyAsError(res)
399 }
400 var resp GroupAIBudget
401 return resp, json.NewDecoder(res.Body).Decode(&resp)
402}
403
404// UpsertGroupAIBudget creates or updates the AI spend budget for the given group.
405func (c *Client) UpsertGroupAIBudget(ctx context.Context, group uuid.UUID, req UpsertGroupAIBudgetRequest) (GroupAIBudget, error) {

Callers 1

TestGroupAIBudgetFunction · 0.80

Calls 5

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

Tested by 1

TestGroupAIBudgetFunction · 0.64