GroupAIBudget returns the AI spend budget configured for the given group.
(ctx context.Context, group uuid.UUID)
| 385 | |
| 386 | // GroupAIBudget returns the AI spend budget configured for the given group. |
| 387 | func (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. |
| 405 | func (c *Client) UpsertGroupAIBudget(ctx context.Context, group uuid.UUID, req UpsertGroupAIBudgetRequest) (GroupAIBudget, error) { |