Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2910,8 +2910,9 @@ export const creditAdjustment = z
export const creditBalance = z
.object({
currency: billingCurrencyCode,
live: numeric,
settled: numeric,
pending: numeric,
available: numeric,
})
.describe('The credit balance by currency.')

Expand Down Expand Up @@ -3968,6 +3969,7 @@ export const createCreditGrantRequest = z
.describe(
'Draw-down priority of the grant. Lower values have higher priority.',
),
effective_at: dateTime.optional(),
expires_after: iso8601Duration.optional(),
key: externalResourceKey.optional(),
})
Expand Down Expand Up @@ -4011,6 +4013,7 @@ export const creditGrant = z
.describe(
'Draw-down priority of the grant. Lower values have higher priority.',
),
effective_at: dateTime.optional(),
expires_after: iso8601Duration.optional(),
key: externalResourceKey.optional(),
expires_at: dateTime.optional(),
Expand Down
37 changes: 30 additions & 7 deletions api/spec/packages/aip-client-javascript/src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2176,16 +2176,15 @@ export interface CreditAdjustment {
/** The credit balance by currency. */
export interface CreditBalance {
currency: string
/** Credits available after applying currently live charge impacts. */
live: string
/** Credits that have been booked on the ledger as of the balance timestamp. */
settled: string
/**
* Credits that have been granted but cannot yet be consumed. Includes grants
* awaiting payment clearance or with a future effective date.
* Credits that have been granted but are not yet written to the ledger, or are
* written to the ledger with a future booked time.
*/
pending: string
/**
* Credits that can be consumed right now. Derived from cleared grants after
* applying eligibility and restriction rules.
*/
available: string
}

/** CreditAdjustment create request. */
Expand Down Expand Up @@ -3563,6 +3562,12 @@ export interface CreateCreditGrantRequest {
filters?: CreateCreditGrantFilters
/** Draw-down priority of the grant. Lower values have higher priority. */
priority: number
/**
* The timestamp when the credit grant becomes effective.
*
* Defaults to the current date and time.
*/
effective_at?: string
/**
* The duration after which the credit grant expires.
*
Expand Down Expand Up @@ -3627,6 +3632,12 @@ export interface CreditGrant {
filters?: CreditGrantFilters
/** Draw-down priority of the grant. Lower values have higher priority. */
priority: number
/**
* The timestamp when the credit grant becomes effective.
*
* Defaults to the current date and time.
*/
effective_at?: string
/**
* The duration after which the credit grant expires.
*
Expand Down Expand Up @@ -5440,6 +5451,12 @@ export interface CreateCreditGrantRequestInput {
filters?: CreateCreditGrantFilters
/** Draw-down priority of the grant. Lower values have higher priority. */
priority?: number
/**
* The timestamp when the credit grant becomes effective.
*
* Defaults to the current date and time.
*/
effective_at?: string
/**
* The duration after which the credit grant expires.
*
Expand Down Expand Up @@ -5498,6 +5515,12 @@ export interface CreditGrantInput {
filters?: CreditGrantFilters
/** Draw-down priority of the grant. Lower values have higher priority. */
priority?: number
/**
* The timestamp when the credit grant becomes effective.
*
* Defaults to the current date and time.
*/
effective_at?: string
/**
* The duration after which the credit grant expires.
*
Expand Down
18 changes: 12 additions & 6 deletions api/spec/packages/aip/src/customers/credits/balance.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,24 @@ model CreditBalance {
currency: Currencies.CurrencyCode;

/**
* Credits that have been granted but cannot yet be consumed. Includes grants
* awaiting payment clearance or with a future effective date.
* Credits available after applying currently live charge impacts.
*/
@visibility(Lifecycle.Read)
@example("200.00")
pending: Shared.Numeric;
live: Shared.Numeric;

/**
* Credits that can be consumed right now. Derived from cleared grants after
* applying eligibility and restriction rules.
* Credits that have been booked on the ledger as of the balance timestamp.
*/
@visibility(Lifecycle.Read)
@example("150.00")
available: Shared.Numeric;
settled: Shared.Numeric;

/**
* Credits that have been granted but are not yet written to the ledger, or are
* written to the ledger with a future booked time.
*/
@visibility(Lifecycle.Read)
@example("50.00")
pending: Shared.Numeric;
}
Comment on lines 33 to 56

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Breaking schema change: available removed and pending semantics silently redefined

The old CreditBalance exposed available (consumable right now) and pending (awaiting payment / future effective). This PR removes available entirely and reuses the field name pending for a different concept (not-yet-ledger-booked grants). Any client currently reading available will get null/missing, and any client reading pending will get a value with entirely different meaning. If this API is consumed by external clients or SDKs, a versioned deprecation or at minimum an explicit changelog entry is needed before merging.

Fix in Claude Code

14 changes: 7 additions & 7 deletions api/spec/packages/aip/src/customers/credits/grant.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ model CreditGrant {
@maxValue(1000)
priority?: int16 = 10;

// /**
// * The timestamp when the credit grant becomes effective.
// *
// * Defaults to the current date and time.
// */
// @visibility(Lifecycle.Create, Lifecycle.Read)
// effective_at?: Shared.DateTime;
/**
* The timestamp when the credit grant becomes effective.
*
* Defaults to the current date and time.
*/
@visibility(Lifecycle.Create, Lifecycle.Read)
effective_at?: Shared.DateTime;

/**
* The duration after which the credit grant expires.
Expand Down
Loading
Loading