/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { budgetsApiKeyEvents } from "../funcs/budgetsApiKeyEvents.js"; import { budgetsDeleteApiKey } from "../funcs/budgetsDeleteApiKey.js"; import { budgetsDeleteExternalUser } from "../funcs/budgetsDeleteExternalUser.js"; import { budgetsDeleteExternalUserDefault } from "../funcs/budgetsDeleteExternalUserDefault.js"; import { budgetsDeleteOrg } from "../funcs/budgetsDeleteOrg.js"; import { budgetsDeleteTeam } from "../funcs/budgetsDeleteTeam.js"; import { budgetsDeleteTeamDefault } from "../funcs/budgetsDeleteTeamDefault.js"; import { budgetsDeleteUser } from "../funcs/budgetsDeleteUser.js"; import { budgetsDeleteUserDefault } from "../funcs/budgetsDeleteUserDefault.js"; import { budgetsExternalUserDefaultEvents } from "../funcs/budgetsExternalUserDefaultEvents.js"; import { budgetsExternalUserEvents } from "../funcs/budgetsExternalUserEvents.js"; import { budgetsGetApiKey } from "../funcs/budgetsGetApiKey.js"; import { budgetsGetCurrency } from "../funcs/budgetsGetCurrency.js"; import { budgetsGetExternalUser } from "../funcs/budgetsGetExternalUser.js"; import { budgetsGetExternalUserDefault } from "../funcs/budgetsGetExternalUserDefault.js"; import { budgetsGetOrg } from "../funcs/budgetsGetOrg.js"; import { budgetsGetTeam } from "../funcs/budgetsGetTeam.js"; import { budgetsGetTeamDefault } from "../funcs/budgetsGetTeamDefault.js"; import { budgetsGetUser } from "../funcs/budgetsGetUser.js"; import { budgetsGetUserDefault } from "../funcs/budgetsGetUserDefault.js"; import { budgetsList } from "../funcs/budgetsList.js"; import { budgetsOrgEvents } from "../funcs/budgetsOrgEvents.js"; import { budgetsSetApiKey } from "../funcs/budgetsSetApiKey.js"; import { budgetsSetCurrency } from "../funcs/budgetsSetCurrency.js"; import { budgetsSetExternalUser } from "../funcs/budgetsSetExternalUser.js"; import { budgetsSetExternalUserDefault } from "../funcs/budgetsSetExternalUserDefault.js"; import { budgetsSetOrg } from "../funcs/budgetsSetOrg.js"; import { budgetsSetTeam } from "../funcs/budgetsSetTeam.js"; import { budgetsSetTeamDefault } from "../funcs/budgetsSetTeamDefault.js"; import { budgetsSetUser } from "../funcs/budgetsSetUser.js"; import { budgetsSetUserDefault } from "../funcs/budgetsSetUserDefault.js"; import { budgetsTeamDefaultEvents } from "../funcs/budgetsTeamDefaultEvents.js"; import { budgetsTeamEvents } from "../funcs/budgetsTeamEvents.js"; import { budgetsUserDefaultEvents } from "../funcs/budgetsUserDefaultEvents.js"; import { budgetsUserEvents } from "../funcs/budgetsUserEvents.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Budgets extends ClientSDK { /** * List budgets * * @remarks * Cluster admins see all budgets; org admins see their org's budgets (including member budgets and per-member default budgets) plus budgets on API keys in their org. */ async list( options?: RequestOptions, ): Promise { return unwrapAsync(budgetsList( this, options, )); } /** * List org budgets * * @remarks * Returns the org's budgets (self-budget and/or ceiling) with each one's live spend gauge. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. */ async getOrg( request: operations.GetOrgBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetOrg( this, request, options, )); } /** * Set an org budget * * @remarks * Creates or updates a budget for the org. One budget per (scope, owner); editing re-evaluates against live spend. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. */ async setOrg( request: operations.SetOrgBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetOrg( this, request, options, )); } /** * Delete an org budget * * @remarks * Removes the org's budget for the given owner; enforcement and alerts stop. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. */ async deleteOrg( request: operations.DeleteOrgBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteOrg( this, request, options, )); } /** * List org budget events * * @remarks * Returns recent threshold-alert and block events for the org's budgets. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. */ async orgEvents( request: operations.ListOrgBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsOrgEvents( this, request, options, )); } /** * List apikey budgets * * @remarks * Returns the apikey's budgets (self-budget and/or ceiling) with each one's live spend gauge. Callable by cluster admins, or org admins for API keys in their own organization. */ async getApiKey( request: operations.GetApiKeyBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetApiKey( this, request, options, )); } /** * Set an apikey budget * * @remarks * Creates or updates a budget for the apikey. One budget per (scope, owner); editing re-evaluates against live spend. Callable by cluster admins, or org admins for API keys in their own organization. */ async setApiKey( request: operations.SetApiKeyBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetApiKey( this, request, options, )); } /** * Delete an apikey budget * * @remarks * Removes the apikey's budget for the given owner; enforcement and alerts stop. Callable by cluster admins, or org admins for API keys in their own organization. */ async deleteApiKey( request: operations.DeleteApiKeyBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteApiKey( this, request, options, )); } /** * List apikey budget events * * @remarks * Returns recent threshold-alert and block events for the apikey's budgets. Callable by cluster admins, or org admins for API keys in their own organization. */ async apiKeyEvents( request: operations.ListApiKeyBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsApiKeyEvents( this, request, options, )); } /** * List user budgets * * @remarks * Returns the user's budgets in the target org (self-budget and/or ceiling) with each one's live spend gauge. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for users in their own organization (owner=org). */ async getUser( request: operations.GetUserBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetUser( this, request, options, )); } /** * Set a user budget * * @remarks * Creates or updates a budget for the user in the target org. One budget per (scope, owner); editing re-evaluates against live spend. An explicit user budget replaces the org's per-user default budget of the same owner and period for this user (exemption-by-override — it may raise or tighten it); different-period defaults, org budgets, and API-key budgets still apply. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for users in their own organization (owner=org). */ async setUser( request: operations.SetUserBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetUser( this, request, options, )); } /** * Delete a user budget * * @remarks * Removes the user's budget for the given owner; the org's per-user default budget (if any) applies to them again. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for users in their own organization (owner=org). */ async deleteUser( request: operations.DeleteUserBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteUser( this, request, options, )); } /** * List user budget events * * @remarks * Returns recent threshold-alert and block events for the user's budgets in the target org. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for users in their own organization (owner=org). */ async userEvents( request: operations.ListUserBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsUserEvents( this, request, options, )); } /** * List team budgets * * @remarks * Returns the team's budgets in the target org (self-budget and/or ceiling) with each one's live spend gauge. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for teams in their own organization (owner=org). */ async getTeam( request: operations.GetTeamBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetTeam( this, request, options, )); } /** * Set a team budget * * @remarks * Creates or updates a budget for the team in the target org. One budget per (scope, owner); editing re-evaluates against live spend. An explicit team budget replaces the org's per-team default budget of the same owner and period for this team (exemption-by-override — it may raise or tighten it); different-period defaults, org budgets, and API-key budgets still apply. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for teams in their own organization (owner=org). */ async setTeam( request: operations.SetTeamBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetTeam( this, request, options, )); } /** * Delete a team budget * * @remarks * Removes the team's budget for the given owner; the org's per-team default budget (if any) applies to them again. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for teams in their own organization (owner=org). */ async deleteTeam( request: operations.DeleteTeamBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteTeam( this, request, options, )); } /** * List team budget events * * @remarks * Returns recent threshold-alert and block events for the team's budgets in the target org. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for teams in their own organization (owner=org). */ async teamEvents( request: operations.ListTeamBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsTeamEvents( this, request, options, )); } /** * List external user budgets * * @remarks * Returns the external user's budgets in the target org (self-budget and/or ceiling) with each one's live spend gauge. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for external users in their own organization (owner=org). */ async getExternalUser( request: operations.GetExternalUserBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetExternalUser( this, request, options, )); } /** * Set a external user budget * * @remarks * Creates or updates a budget for the external user in the target org. One budget per (scope, owner); editing re-evaluates against live spend. An explicit external user budget replaces the org's per-external user default budget of the same owner and period for this external user (exemption-by-override — it may raise or tighten it); different-period defaults, org budgets, and API-key budgets still apply. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for external users in their own organization (owner=org). */ async setExternalUser( request: operations.SetExternalUserBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetExternalUser( this, request, options, )); } /** * Delete a external user budget * * @remarks * Removes the external user's budget for the given owner; the org's per-external user default budget (if any) applies to them again. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for external users in their own organization (owner=org). */ async deleteExternalUser( request: operations.DeleteExternalUserBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteExternalUser( this, request, options, )); } /** * List external user budget events * * @remarks * Returns recent threshold-alert and block events for the external user's budgets in the target org. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for external users in their own organization (owner=org). */ async externalUserEvents( request: operations.ListExternalUserBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsExternalUserEvents( this, request, options, )); } /** * List per-user default budgets * * @remarks * Returns the org's per-user default budgets (self-set and/or operator ceiling). A default budget applies to every user in the org against that user's own spend counter, unless an explicit user budget of the same owner and period exists for them. It has no spend gauge of its own. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async getUserDefault( request: operations.GetUserDefaultBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetUserDefault( this, request, options, )); } /** * Set a per-user default budget * * @remarks * Creates or updates the org's per-user default budget: a cap applying to EACH user in the org individually (not in aggregate), unless an explicit user budget of the same owner and period exists for them. Threshold alerts and blocks fire per user. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async setUserDefault( request: operations.SetUserDefaultBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetUserDefault( this, request, options, )); } /** * Delete a per-user default budget * * @remarks * Removes the org's per-user default budget for the given owner; only explicit user budgets remain. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async deleteUserDefault( request: operations.DeleteUserDefaultBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteUserDefault( this, request, options, )); } /** * List per-user default budget events * * @remarks * Returns recent threshold-alert and block events for the org's per-user default budgets. Each event's target_id names the user it fired for. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async userDefaultEvents( request: operations.ListUserDefaultBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsUserDefaultEvents( this, request, options, )); } /** * List per-team default budgets * * @remarks * Returns the org's per-team default budgets (self-set and/or operator ceiling). A default budget applies to every team in the org against that team's own spend counter, unless an explicit team budget of the same owner and period exists for them. It has no spend gauge of its own. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async getTeamDefault( request: operations.GetTeamDefaultBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetTeamDefault( this, request, options, )); } /** * Set a per-team default budget * * @remarks * Creates or updates the org's per-team default budget: a cap applying to EACH team in the org individually (not in aggregate), unless an explicit team budget of the same owner and period exists for them. Threshold alerts and blocks fire per team. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async setTeamDefault( request: operations.SetTeamDefaultBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetTeamDefault( this, request, options, )); } /** * Delete a per-team default budget * * @remarks * Removes the org's per-team default budget for the given owner; only explicit team budgets remain. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async deleteTeamDefault( request: operations.DeleteTeamDefaultBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteTeamDefault( this, request, options, )); } /** * List per-team default budget events * * @remarks * Returns recent threshold-alert and block events for the org's per-team default budgets. Each event's target_id names the team it fired for. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async teamDefaultEvents( request: operations.ListTeamDefaultBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsTeamDefaultEvents( this, request, options, )); } /** * List per-external user default budgets * * @remarks * Returns the org's per-external user default budgets (self-set and/or operator ceiling). A default budget applies to every external user in the org against that external user's own spend counter, unless an explicit external user budget of the same owner and period exists for them. It has no spend gauge of its own. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async getExternalUserDefault( request: operations.GetExternalUserDefaultBudgetsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetExternalUserDefault( this, request, options, )); } /** * Set a per-external user default budget * * @remarks * Creates or updates the org's per-external user default budget: a cap applying to EACH external user in the org individually (not in aggregate), unless an explicit external user budget of the same owner and period exists for them. Threshold alerts and blocks fire per external user. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async setExternalUserDefault( request: operations.SetExternalUserDefaultBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetExternalUserDefault( this, request, options, )); } /** * Delete a per-external user default budget * * @remarks * Removes the org's per-external user default budget for the given owner; only explicit external user budgets remain. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async deleteExternalUserDefault( request: operations.DeleteExternalUserDefaultBudgetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsDeleteExternalUserDefault( this, request, options, )); } /** * List per-external user default budget events * * @remarks * Returns recent threshold-alert and block events for the org's per-external user default budgets. Each event's target_id names the external user it fired for. Targets the caller's own organization (inferred from the API key or session) unless the optional org_id query parameter names another org — cluster admins only. Callable by cluster admins, or org admins for their own organization (owner=org). */ async externalUserDefaultEvents( request: operations.ListExternalUserDefaultBudgetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsExternalUserDefaultEvents( this, request, options, )); } /** * Get display currency */ async getCurrency( options?: RequestOptions, ): Promise { return unwrapAsync(budgetsGetCurrency( this, options, )); } /** * Set display currency * * @remarks * ISO 4217 code used for display on budgets and cost reports. No conversion is performed anywhere. */ async setCurrency( request: operations.SetCurrencyRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(budgetsSetCurrency( this, request, options, )); } }