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
2 changes: 1 addition & 1 deletion api/spec/packages/aip-client-javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export type {
UpdateMeterRequest,
AppCustomerDataStripe,
AppCustomerDataExternalInvoicing,
CurrencyFiat,
ListCostBasesParamsFilter,
CurrencyAmount,
PriceFlat,
Expand Down Expand Up @@ -118,7 +119,6 @@ export type {
FeatureReference,
AppReference,
ChargeReference,
CurrencyFiat,
Event,
MeterQueryRow,
AppStripeCreateCustomerPortalSessionResult,
Expand Down
67 changes: 24 additions & 43 deletions api/spec/packages/aip-client-javascript/src/models/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,29 @@ export const createCurrencyCode = z
.union([currencyCode])
.describe('Fiat or custom currency code.')

export const currencyFiat = z
.object({
type: z.literal('fiat').describe('The type of the currency.'),
name: z
.string()
.min(1)
.max(256)

.describe(
'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".',
),
symbol: z
.string()
.min(1)
.optional()

.describe(
'The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.',
),
code: currencyCode,
})
.describe('Currency describes a currency supported by the billing system.')

export const listCostBasesParamsFilter = z
.object({
fiat_code: currencyCode.optional(),
Expand Down Expand Up @@ -1591,36 +1614,6 @@ export const chargeReference = z
})
.describe('Reference to a charge associated with an invoice line.')

export const currencyFiat = z
.object({
id: ulid,
type: z.literal('fiat').describe('The type of the currency.'),
name: z
.string()
.min(1)
.max(256)

.describe(
'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".',
),
description: z
.string()
.min(1)
.max(256)
.optional()
.describe('Description of the currency.'),
symbol: z
.string()
.min(1)
.optional()

.describe(
'The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.',
),
code: currencyCode,
})
.describe('Currency describes a currency supported by the billing system.')

export const dateTimeFieldFilter = z
.union([
dateTime,
Expand Down Expand Up @@ -2768,7 +2761,6 @@ export const listCurrenciesParamsFilter = z

export const currencyCustom = z
.object({
id: ulid,
type: z.literal('custom').describe('The type of the currency.'),
name: z
.string()
Expand All @@ -2778,12 +2770,6 @@ export const currencyCustom = z
.describe(
'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".',
),
description: z
.string()
.min(1)
.max(256)
.optional()
.describe('Description of the currency.'),
symbol: z
.string()
.min(1)
Expand All @@ -2792,6 +2778,7 @@ export const currencyCustom = z
.describe(
'The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.',
),
id: ulid,
code: currencyCodeCustom,
created_at: dateTime,
})
Expand All @@ -2807,12 +2794,6 @@ export const createCurrencyCustomRequest = z
.describe(
'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".',
),
description: z
.string()
.min(1)
.max(256)
.optional()
.describe('Description of the currency.'),
symbol: z
.string()
.min(1)
Expand Down
43 changes: 18 additions & 25 deletions api/spec/packages/aip-client-javascript/src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,23 @@ export interface AppCustomerDataExternalInvoicing {
labels?: Labels
}

/** Currency describes a currency supported by the billing system. */
export interface CurrencyFiat {
/** The type of the currency. */
type: 'fiat'
/**
* The name of the currency. It should be a human-readable string that represents
* the name of the currency, such as "US Dollar" or "Euro".
*/
name: string
/**
* The symbol of the currency. It should be a string that represents the symbol of
* the currency, such as "$" for US Dollar or "€" for Euro.
*/
symbol?: string
code: string
}

/** Filter options for listing cost bases. */
export interface ListCostBasesParamsFilter {
/** Filter cost bases by fiat currency code. */
Expand Down Expand Up @@ -800,26 +817,6 @@ export interface ChargeReference {
id: string
}

/** Currency describes a currency supported by the billing system. */
export interface CurrencyFiat {
id: string
/** The type of the currency. */
type: 'fiat'
/**
* The name of the currency. It should be a human-readable string that represents
* the name of the currency, such as "US Dollar" or "Euro".
*/
name: string
/** Description of the currency. */
description?: string
/**
* The symbol of the currency. It should be a string that represents the symbol of
* the currency, such as "$" for US Dollar or "€" for Euro.
*/
symbol?: string
code: string
}

/** Metering event following the CloudEvents specification. */
export interface Event {
/** Identifies the event. */
Expand Down Expand Up @@ -2079,21 +2076,19 @@ export interface ListCurrenciesParamsFilter {

/** Describes custom currency. */
export interface CurrencyCustom {
id: string
/** The type of the currency. */
type: 'custom'
/**
* The name of the currency. It should be a human-readable string that represents
* the name of the currency, such as "US Dollar" or "Euro".
*/
name: string
/** Description of the currency. */
description?: string
/**
* The symbol of the currency. It should be a string that represents the symbol of
* the currency, such as "$" for US Dollar or "€" for Euro.
*/
symbol?: string
id: string
code: string
/** An ISO-8601 timestamp representation of the custom currency creation date. */
created_at: string
Expand All @@ -2106,8 +2101,6 @@ export interface CreateCurrencyCustomRequest {
* the name of the currency, such as "US Dollar" or "Euro".
*/
name: string
/** Description of the currency. */
description?: string
/**
* The symbol of the currency. It should be a string that represents the symbol of
* the currency, such as "$" for US Dollar or "€" for Euro.
Expand Down
16 changes: 4 additions & 12 deletions api/spec/packages/aip/src/currencies/currency.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ union CurrencyCode {
*/
@friendlyName("BillingCustomCurrencyBase")
model CurrencyBase<T extends CurrencyType> {
#suppress "@openmeter/api-spec-aip/doc-decorator" "shared model"
@visibility(Lifecycle.Read)
id: Shared.ULID;

/**
* The type of the currency.
*/
Expand All @@ -63,14 +59,6 @@ model CurrencyBase<T extends CurrencyType> {
@maxLength(256)
name: string;

/**
* Description of the currency.
*/
@visibility(Lifecycle.Create, Lifecycle.Read)
@minLength(1)
@maxLength(256)
description?: string;

/**
* The symbol of the currency. It should be a string that represents the symbol of
* the currency, such as "$" for US Dollar or "€" for Euro.
Expand Down Expand Up @@ -108,6 +96,10 @@ scalar CurrencyCodeCustom extends string;
model CurrencyCustom {
...CurrencyBase<CurrencyType.Custom>;

#suppress "@openmeter/api-spec-aip/doc-decorator" "shared model"
@visibility(Lifecycle.Read)
id: Shared.ULID;

#suppress "@openmeter/api-spec-aip/doc-decorator" "shared model"
@visibility(Lifecycle.Create, Lifecycle.Read)
code: CurrencyCodeCustom;
Expand Down
Loading
Loading