@openmeter/client 1.0.0-beta.231 → 1.0.0-beta.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +24 -14
  2. package/dist/core.js +7 -4
  3. package/dist/funcs/addons.js +59 -11
  4. package/dist/funcs/apps.d.ts +41 -1
  5. package/dist/funcs/apps.js +164 -3
  6. package/dist/funcs/billing.js +34 -7
  7. package/dist/funcs/currencies.d.ts +9 -1
  8. package/dist/funcs/currencies.js +62 -5
  9. package/dist/funcs/customers.js +214 -43
  10. package/dist/funcs/entitlements.js +12 -3
  11. package/dist/funcs/events.js +3 -0
  12. package/dist/funcs/features.js +48 -9
  13. package/dist/funcs/invoices.d.ts +58 -1
  14. package/dist/funcs/invoices.js +202 -7
  15. package/dist/funcs/llmCost.js +26 -5
  16. package/dist/funcs/meters.js +59 -11
  17. package/dist/funcs/planAddons.js +65 -17
  18. package/dist/funcs/plans.js +59 -11
  19. package/dist/funcs/subscriptions.js +87 -17
  20. package/dist/funcs/tax.js +34 -7
  21. package/dist/index.d.ts +1 -2
  22. package/dist/index.js +0 -1
  23. package/dist/lib/config.d.ts +2 -2
  24. package/dist/lib/paginate.d.ts +1 -1
  25. package/dist/lib/version.d.ts +1 -1
  26. package/dist/lib/version.js +1 -1
  27. package/dist/lib/wire.d.ts +1 -0
  28. package/dist/lib/wire.js +26 -4
  29. package/dist/models/operations/apps.d.ts +25 -1
  30. package/dist/models/operations/currencies.d.ts +10 -0
  31. package/dist/models/operations/customers.d.ts +2 -1
  32. package/dist/models/operations/invoices.d.ts +16 -0
  33. package/dist/models/schemas.d.ts +15256 -9856
  34. package/dist/models/schemas.js +938 -447
  35. package/dist/models/types.d.ts +503 -259
  36. package/dist/sdk/apps.d.ts +44 -2
  37. package/dist/sdk/apps.js +53 -1
  38. package/dist/sdk/internal.d.ts +151 -3
  39. package/dist/sdk/internal.js +182 -2
  40. package/dist/sdk/invoices.d.ts +15 -0
  41. package/dist/sdk/invoices.js +32 -0
  42. package/dist/sdk/sdk.d.ts +0 -3
  43. package/dist/sdk/sdk.js +0 -5
  44. package/package.json +3 -3
@@ -9,6 +9,11 @@ export const currencyCode = z
9
9
  .max(3)
10
10
  .regex(new RegExp('^[A-Z]{3}$'))
11
11
  .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.');
12
+ export const currencyCodeCustom = z
13
+ .string()
14
+ .min(4)
15
+ .max(24)
16
+ .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
12
17
  export const numeric = z
13
18
  .string()
14
19
  .regex(new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$'))
@@ -110,9 +115,9 @@ export const cursorMetaPage = z
110
115
  .object({
111
116
  first: z.string().optional().describe('URI to the first page.'),
112
117
  last: z.string().optional().describe('URI to the last page.'),
113
- next: z.string().optional().describe('URI to the next page.'),
114
- previous: z.string().optional().describe('URI to the previous page.'),
115
- size: z.number().int().optional().describe('Requested page size.'),
118
+ next: z.string().nullable().describe('URI to the next page.'),
119
+ previous: z.string().nullable().describe('URI to the previous page.'),
120
+ size: z.number().int().describe('Requested page size.'),
116
121
  })
117
122
  .describe('Cursor pagination metadata.');
118
123
  export const invalidRules = z
@@ -496,9 +501,52 @@ export const rateCardBooleanEntitlement = z
496
501
  export const appType = z
497
502
  .enum(['sandbox', 'stripe', 'external_invoicing'])
498
503
  .describe('The type of the app.');
504
+ export const appCapabilityType = z
505
+ .enum([
506
+ 'report_usage',
507
+ 'report_events',
508
+ 'calculate_tax',
509
+ 'invoice_customers',
510
+ 'collect_payments',
511
+ ])
512
+ .describe('Supported capability types for an App. Each capability defines an integration function that an App can perform.');
513
+ export const appInstallMethods = z
514
+ .enum(['with_oauth2', 'with_api_key', 'no_credentials_required'])
515
+ .describe('Supported installation methods for an app.');
499
516
  export const appStatus = z
500
517
  .enum(['ready', 'unauthorized'])
501
518
  .describe('Connection status of an installed app.');
519
+ export const updateLabels = z
520
+ .record(z.string(), z.string())
521
+ .describe('Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".');
522
+ export const installAppStripeWithApiKey = z
523
+ .object({
524
+ type: z.literal('stripe').describe('Type of the app.'),
525
+ name: z.string().describe('Name of the app.'),
526
+ createBillingProfile: z
527
+ .boolean()
528
+ .describe('If true, a billing profile will be created for the app. The Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
529
+ apiKey: z.string().describe('API key for the app.'),
530
+ })
531
+ .describe('Model for installing an app from the catalog with an API key.');
532
+ export const installAppSandbox = z
533
+ .object({
534
+ type: z.literal('sandbox').describe('Type of the app.'),
535
+ name: z.string().describe('Name of the app.'),
536
+ createBillingProfile: z
537
+ .boolean()
538
+ .describe('If true, a billing profile will be created for the app. The Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
539
+ })
540
+ .describe('Base model for installing an app from the catalog.');
541
+ export const installAppExternalInvoicing = z
542
+ .object({
543
+ type: z.literal('external_invoicing').describe('Type of the app.'),
544
+ name: z.string().describe('Name of the app.'),
545
+ createBillingProfile: z
546
+ .boolean()
547
+ .describe('If true, a billing profile will be created for the app. The Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
548
+ })
549
+ .describe('Base model for installing an app from the catalog.');
502
550
  export const taxIdentificationCode = z
503
551
  .string()
504
552
  .min(1)
@@ -602,9 +650,6 @@ export const invoiceLineExternalReferences = z
602
650
  export const invoiceDetailedLineCostCategory = z
603
651
  .enum(['regular', 'commitment'])
604
652
  .describe('Cost category of a detailed invoice line item.');
605
- export const updateLabels = z
606
- .record(z.string(), z.string())
607
- .describe('Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".');
608
653
  export const updateBillingInvoiceWorkflowInvoicingSettings = z
609
654
  .object({
610
655
  autoAdvance: z
@@ -646,11 +691,9 @@ export const updatePriceFree = z
646
691
  export const currencyType = z
647
692
  .enum(['fiat', 'custom'])
648
693
  .describe('Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.');
649
- export const currencyCodeCustom = z
650
- .string()
651
- .min(3)
652
- .max(24)
653
- .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
694
+ export const currencyExpand = z
695
+ .enum(['cost_basis'])
696
+ .describe("Expands for currencies. Values: - `cost_basis`: The currency's active and scheduled cost basis.");
654
697
  export const featureLlmTokenType = z
655
698
  .enum([
656
699
  'input',
@@ -978,12 +1021,6 @@ export const appCustomerDataExternalInvoicing = z
978
1021
  labels: labels.optional(),
979
1022
  })
980
1023
  .describe('External invoicing customer data.');
981
- export const billingCurrencyCode = z
982
- .union([currencyCode])
983
- .describe('Fiat or custom currency code.');
984
- export const createCurrencyCode = z
985
- .union([currencyCode])
986
- .describe('Fiat or custom currency code.');
987
1024
  export const currencyFiat = z
988
1025
  .object({
989
1026
  type: z.literal('fiat').describe('The type of the currency.'),
@@ -997,6 +1034,22 @@ export const currencyFiat = z
997
1034
  .min(1)
998
1035
  .optional()
999
1036
  .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.'),
1037
+ precision: z
1038
+ .number()
1039
+ .int()
1040
+ .nonnegative()
1041
+ .lte(4294967295)
1042
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
1043
+ decimalMark: z
1044
+ .string()
1045
+ .min(1)
1046
+ .max(1)
1047
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
1048
+ thousandSeparator: z
1049
+ .string()
1050
+ .min(1)
1051
+ .max(1)
1052
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
1000
1053
  code: currencyCode,
1001
1054
  })
1002
1055
  .describe('Currency describes a currency supported by the billing system.');
@@ -1005,6 +1058,43 @@ export const listCostBasesParamsFilter = z
1005
1058
  fiatCode: currencyCode.optional(),
1006
1059
  })
1007
1060
  .describe('Filter options for listing cost bases.');
1061
+ export const billingCurrencyCode = z
1062
+ .union([currencyCode, currencyCodeCustom])
1063
+ .describe('Fiat or custom currency code.');
1064
+ export const createCurrencyCode = z
1065
+ .union([currencyCode, currencyCodeCustom])
1066
+ .describe('Fiat or custom currency code.');
1067
+ export const createCurrencyCustomRequest = z
1068
+ .object({
1069
+ name: z
1070
+ .string()
1071
+ .min(1)
1072
+ .max(256)
1073
+ .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".'),
1074
+ symbol: z
1075
+ .string()
1076
+ .min(1)
1077
+ .optional()
1078
+ .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.'),
1079
+ precision: z
1080
+ .number()
1081
+ .int()
1082
+ .nonnegative()
1083
+ .lte(4294967295)
1084
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
1085
+ decimalMark: z
1086
+ .string()
1087
+ .min(1)
1088
+ .max(1)
1089
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
1090
+ thousandSeparator: z
1091
+ .string()
1092
+ .min(1)
1093
+ .max(1)
1094
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
1095
+ code: currencyCodeCustom,
1096
+ })
1097
+ .describe('CurrencyCustom create request.');
1008
1098
  export const currencyAmount = z
1009
1099
  .object({
1010
1100
  amount: numeric,
@@ -1275,23 +1365,26 @@ export const event = z
1275
1365
  .min(1)
1276
1366
  .describe('Contains a value describing the type of event related to the originating occurrence.'),
1277
1367
  datacontenttype: z
1278
- .union([z.literal('application/json'), z.null()])
1368
+ .literal('application/json')
1369
+ .nullable()
1279
1370
  .optional()
1280
1371
  .describe('Content type of the CloudEvents data value. Only the value "application/json" is allowed over HTTP.'),
1281
1372
  dataschema: z
1282
- .union([z.string(), z.null()])
1373
+ .string()
1374
+ .nullable()
1283
1375
  .optional()
1284
1376
  .describe('Identifies the schema that data adheres to.'),
1285
1377
  subject: z
1286
1378
  .string()
1287
1379
  .min(1)
1288
1380
  .describe('Describes the subject of the event in the context of the event producer (identified by source).'),
1289
- time: z
1290
- .union([dateTime, z.null()])
1381
+ time: dateTime
1382
+ .nullable()
1291
1383
  .optional()
1292
1384
  .describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
1293
1385
  data: z
1294
- .union([z.record(z.string(), z.unknown()), z.null()])
1386
+ .record(z.string(), z.unknown())
1387
+ .nullable()
1295
1388
  .optional()
1296
1389
  .describe('The event payload. Optional, if present it must be a JSON object.'),
1297
1390
  })
@@ -1374,8 +1467,8 @@ export const createCostBasisRequest = z
1374
1467
  export const featureCostQueryRow = z
1375
1468
  .object({
1376
1469
  usage: numeric,
1377
- cost: z
1378
- .union([numeric, z.null()])
1470
+ cost: numeric
1471
+ .nullable()
1379
1472
  .describe('The computed cost amount (usage × unit cost). Null when pricing is not available for the given combination of dimensions.'),
1380
1473
  currency: currencyCode,
1381
1474
  detail: z
@@ -2004,19 +2097,85 @@ export const unitConfig = z
2004
2097
  .describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
2005
2098
  })
2006
2099
  .describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
2007
- export const appCatalogItem = z
2008
- .object({
2009
- type: appType,
2010
- name: z.string().describe('Name of the app.'),
2011
- description: z.string().describe('Description of the app.'),
2012
- })
2013
- .describe('Available apps for billing integrations to connect with third-party services. Apps can have various capabilities like syncing data from or to external systems, integrating with third-party services for tax calculation, delivery of invoices, collection of payments, etc.');
2014
2100
  export const taxCodeAppMapping = z
2015
2101
  .object({
2016
2102
  appType: appType,
2017
2103
  taxCode: z.string().describe('Tax code.'),
2018
2104
  })
2019
2105
  .describe('Mapping of app types to tax codes.');
2106
+ export const appCapability = z
2107
+ .object({
2108
+ type: appCapabilityType,
2109
+ key: resourceKey,
2110
+ name: z.string().describe('Name of the capability.'),
2111
+ description: z.string().describe('Description of the capability.'),
2112
+ })
2113
+ .describe('App capability describes a function that an App can perform.');
2114
+ export const updateAppStripeRequest = z
2115
+ .object({
2116
+ name: z
2117
+ .string()
2118
+ .min(1)
2119
+ .max(256)
2120
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
2121
+ description: z
2122
+ .string()
2123
+ .max(1024)
2124
+ .optional()
2125
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2126
+ labels: updateLabels.optional(),
2127
+ type: z.literal('stripe').describe('The app type.'),
2128
+ secretApiKey: z
2129
+ .string()
2130
+ .optional()
2131
+ .describe('The Stripe secret API key used to authenticate API requests.'),
2132
+ })
2133
+ .describe('AppStripe update request.');
2134
+ export const updateAppSandboxRequest = z
2135
+ .object({
2136
+ name: z
2137
+ .string()
2138
+ .min(1)
2139
+ .max(256)
2140
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
2141
+ description: z
2142
+ .string()
2143
+ .max(1024)
2144
+ .optional()
2145
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2146
+ labels: updateLabels.optional(),
2147
+ type: z.literal('sandbox').describe('The app type.'),
2148
+ })
2149
+ .describe('AppSandbox update request.');
2150
+ export const updateAppExternalInvoicingRequest = z
2151
+ .object({
2152
+ name: z
2153
+ .string()
2154
+ .min(1)
2155
+ .max(256)
2156
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
2157
+ description: z
2158
+ .string()
2159
+ .max(1024)
2160
+ .optional()
2161
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2162
+ labels: updateLabels.optional(),
2163
+ type: z.literal('external_invoicing').describe('The app type.'),
2164
+ enableDraftSyncHook: z
2165
+ .boolean()
2166
+ .describe('Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.'),
2167
+ enableIssuingSyncHook: z
2168
+ .boolean()
2169
+ .describe('Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.'),
2170
+ })
2171
+ .describe('AppExternalInvoicing update request.');
2172
+ export const installAppRequest = z
2173
+ .discriminatedUnion('type', [
2174
+ installAppStripeWithApiKey,
2175
+ installAppSandbox,
2176
+ installAppExternalInvoicing,
2177
+ ])
2178
+ .describe('Request to install an app from the catalog.');
2020
2179
  export const partyTaxIdentity = z
2021
2180
  .object({
2022
2181
  code: taxIdentificationCode.optional(),
@@ -2126,39 +2285,6 @@ export const listCurrenciesParamsFilter = z
2126
2285
  code: stringFieldFilter.optional(),
2127
2286
  })
2128
2287
  .describe('Filter options for listing currencies.');
2129
- export const currencyCustom = z
2130
- .object({
2131
- type: z.literal('custom').describe('The type of the currency.'),
2132
- name: z
2133
- .string()
2134
- .min(1)
2135
- .max(256)
2136
- .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".'),
2137
- symbol: z
2138
- .string()
2139
- .min(1)
2140
- .optional()
2141
- .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.'),
2142
- id: ulid,
2143
- code: currencyCodeCustom,
2144
- createdAt: dateTime,
2145
- })
2146
- .describe('Describes custom currency.');
2147
- export const createCurrencyCustomRequest = z
2148
- .object({
2149
- name: z
2150
- .string()
2151
- .min(1)
2152
- .max(256)
2153
- .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".'),
2154
- symbol: z
2155
- .string()
2156
- .min(1)
2157
- .optional()
2158
- .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.'),
2159
- code: currencyCodeCustom,
2160
- })
2161
- .describe('CurrencyCustom create request.');
2162
2288
  export const governanceQueryRequest = z
2163
2289
  .object({
2164
2290
  includeCredits: z
@@ -2567,6 +2693,44 @@ export const meterQueryResult = z
2567
2693
  .describe('The usage data. If no data is available, an empty array is returned.'),
2568
2694
  })
2569
2695
  .describe('Meter query result.');
2696
+ export const currencyCustom = z
2697
+ .object({
2698
+ type: z.literal('custom').describe('The type of the currency.'),
2699
+ name: z
2700
+ .string()
2701
+ .min(1)
2702
+ .max(256)
2703
+ .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".'),
2704
+ symbol: z
2705
+ .string()
2706
+ .min(1)
2707
+ .optional()
2708
+ .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.'),
2709
+ precision: z
2710
+ .number()
2711
+ .int()
2712
+ .nonnegative()
2713
+ .lte(4294967295)
2714
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
2715
+ decimalMark: z
2716
+ .string()
2717
+ .min(1)
2718
+ .max(1)
2719
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
2720
+ thousandSeparator: z
2721
+ .string()
2722
+ .min(1)
2723
+ .max(1)
2724
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
2725
+ id: ulid,
2726
+ code: currencyCodeCustom,
2727
+ createdAt: dateTime,
2728
+ costBasis: z
2729
+ .array(costBasis)
2730
+ .optional()
2731
+ .describe('The list of active and scheduled cost bases for the custom currency. Expired and deleted cost bases are excluded.'),
2732
+ })
2733
+ .describe('Describes custom currency.');
2570
2734
  export const featureCostQueryResult = z
2571
2735
  .object({
2572
2736
  from: dateTime.optional(),
@@ -2837,9 +3001,8 @@ export const invoiceUsageQuantityDetail = z
2837
3001
  appliedUnitConfig: unitConfig,
2838
3002
  })
2839
3003
  .describe('Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount.');
2840
- export const appStripe = z
3004
+ export const createTaxCodeRequest = z
2841
3005
  .object({
2842
- id: ulid,
2843
3006
  name: z
2844
3007
  .string()
2845
3008
  .min(1)
@@ -2851,24 +3014,13 @@ export const appStripe = z
2851
3014
  .optional()
2852
3015
  .describe('Optional description of the resource. Maximum 1024 characters.'),
2853
3016
  labels: labels.optional(),
2854
- createdAt: dateTime,
2855
- updatedAt: dateTime,
2856
- deletedAt: dateTime.optional(),
2857
- type: z.literal('stripe').describe('The app type.'),
2858
- definition: appCatalogItem,
2859
- status: appStatus,
2860
- accountId: z
2861
- .string()
2862
- .describe('The Stripe account ID associated with the connected Stripe account.'),
2863
- livemode: z
2864
- .boolean()
2865
- .describe('Indicates whether the app is connected to a live Stripe account.'),
2866
- maskedApiKey: z
2867
- .string()
2868
- .describe('The masked Stripe API key that only exposes the first and last few characters.'),
3017
+ key: resourceKey,
3018
+ appMappings: z
3019
+ .array(taxCodeAppMapping)
3020
+ .describe('Mapping of app types to tax codes.'),
2869
3021
  })
2870
- .describe('Stripe app.');
2871
- export const appSandbox = z
3022
+ .describe('TaxCode create request.');
3023
+ export const taxCode = z
2872
3024
  .object({
2873
3025
  id: ulid,
2874
3026
  name: z
@@ -2885,14 +3037,14 @@ export const appSandbox = z
2885
3037
  createdAt: dateTime,
2886
3038
  updatedAt: dateTime,
2887
3039
  deletedAt: dateTime.optional(),
2888
- type: z.literal('sandbox').describe('The app type.'),
2889
- definition: appCatalogItem,
2890
- status: appStatus,
3040
+ key: resourceKey,
3041
+ appMappings: z
3042
+ .array(taxCodeAppMapping)
3043
+ .describe('Mapping of app types to tax codes.'),
2891
3044
  })
2892
- .describe('Sandbox app can be used for testing billing features.');
2893
- export const appExternalInvoicing = z
3045
+ .describe('Tax codes by provider.');
3046
+ export const upsertTaxCodeRequest = z
2894
3047
  .object({
2895
- id: ulid,
2896
3048
  name: z
2897
3049
  .string()
2898
3050
  .min(1)
@@ -2904,80 +3056,29 @@ export const appExternalInvoicing = z
2904
3056
  .optional()
2905
3057
  .describe('Optional description of the resource. Maximum 1024 characters.'),
2906
3058
  labels: labels.optional(),
2907
- createdAt: dateTime,
2908
- updatedAt: dateTime,
2909
- deletedAt: dateTime.optional(),
2910
- type: z.literal('external_invoicing').describe('The app type.'),
2911
- definition: appCatalogItem,
2912
- status: appStatus,
2913
- enableDraftSyncHook: z
2914
- .boolean()
2915
- .describe('Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.'),
2916
- enableIssuingSyncHook: z
2917
- .boolean()
2918
- .describe('Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.'),
3059
+ appMappings: z
3060
+ .array(taxCodeAppMapping)
3061
+ .describe('Mapping of app types to tax codes.'),
2919
3062
  })
2920
- .describe('External Invoicing app enables integration with third-party invoicing or payment system. The app supports a bi-directional synchronization pattern where OpenMeter Billing manages the invoice lifecycle while the external system handles invoice presentation and payment collection. Integration workflow: 1. The billing system creates invoices and transitions them through lifecycle states (draft → issuing → issued) 2. The integration receives webhook notifications about invoice state changes 3. The integration calls back to provide external system IDs and metadata 4. The integration reports payment events back via the payment status API State synchronization is controlled by hooks that pause invoice progression until the external system confirms synchronization via API callbacks.');
2921
- export const createTaxCodeRequest = z
3063
+ .describe('TaxCode upsert request.');
3064
+ export const appCatalogItem = z
2922
3065
  .object({
2923
- name: z
2924
- .string()
2925
- .min(1)
2926
- .max(256)
2927
- .describe('Display name of the resource. Between 1 and 256 characters.'),
2928
- description: z
2929
- .string()
2930
- .max(1024)
2931
- .optional()
2932
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2933
- labels: labels.optional(),
2934
- key: resourceKey,
2935
- appMappings: z
2936
- .array(taxCodeAppMapping)
2937
- .describe('Mapping of app types to tax codes.'),
2938
- })
2939
- .describe('TaxCode create request.');
2940
- export const taxCode = z
2941
- .object({
2942
- id: ulid,
2943
- name: z
2944
- .string()
2945
- .min(1)
2946
- .max(256)
2947
- .describe('Display name of the resource. Between 1 and 256 characters.'),
2948
- description: z
2949
- .string()
2950
- .max(1024)
2951
- .optional()
2952
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2953
- labels: labels.optional(),
2954
- createdAt: dateTime,
2955
- updatedAt: dateTime,
2956
- deletedAt: dateTime.optional(),
2957
- key: resourceKey,
2958
- appMappings: z
2959
- .array(taxCodeAppMapping)
2960
- .describe('Mapping of app types to tax codes.'),
2961
- })
2962
- .describe('Tax codes by provider.');
2963
- export const upsertTaxCodeRequest = z
2964
- .object({
2965
- name: z
2966
- .string()
2967
- .min(1)
2968
- .max(256)
2969
- .describe('Display name of the resource. Between 1 and 256 characters.'),
2970
- description: z
2971
- .string()
2972
- .max(1024)
2973
- .optional()
2974
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2975
- labels: labels.optional(),
2976
- appMappings: z
2977
- .array(taxCodeAppMapping)
2978
- .describe('Mapping of app types to tax codes.'),
3066
+ type: appType,
3067
+ name: z.string().describe('Name of the app.'),
3068
+ description: z.string().describe('Description of the app.'),
3069
+ capabilities: z.array(appCapability).describe('Capabilities of the app.'),
3070
+ installMethods: z
3071
+ .array(appInstallMethods)
3072
+ .describe('Available install methods of the app.'),
2979
3073
  })
2980
- .describe('TaxCode upsert request.');
3074
+ .describe('Available apps for billing integrations to connect with third-party services. Apps can have various capabilities like syncing data from or to external systems, integrating with third-party services for tax calculation, delivery of invoices, collection of payments, etc.');
3075
+ export const updateAppRequest = z
3076
+ .discriminatedUnion('type', [
3077
+ updateAppStripeRequest,
3078
+ updateAppSandboxRequest,
3079
+ updateAppExternalInvoicingRequest,
3080
+ ])
3081
+ .describe('Request to update an installed app.');
2981
3082
  export const invoiceWorkflow = z
2982
3083
  .object({
2983
3084
  invoicing: invoiceWorkflowInvoicingSettings.optional(),
@@ -3014,9 +3115,6 @@ export const updateBillingInvoiceWorkflow = z
3014
3115
  payment: updateBillingWorkflowPaymentSettings.optional(),
3015
3116
  })
3016
3117
  .describe('Invoice-level snapshot of the workflow configuration. Contains only the settings that are meaningful for an already-created invoice: invoicing behaviour and payment settings. Collection alignment and tax policy are gather-time / profile-wide concerns and are not included.');
3017
- export const currency = z
3018
- .discriminatedUnion('type', [currencyFiat, currencyCustom])
3019
- .describe('Fiat or custom currency.');
3020
3118
  export const governanceFeatureAccess = z
3021
3119
  .object({
3022
3120
  hasAccess: z
@@ -3227,6 +3325,9 @@ export const ingestedEventPaginatedResponse = z
3227
3325
  meta: cursorMeta,
3228
3326
  })
3229
3327
  .describe('Cursor paginated response.');
3328
+ export const currency = z
3329
+ .discriminatedUnion('type', [currencyFiat, currencyCustom])
3330
+ .describe('Fiat or custom currency.');
3230
3331
  export const invalidParameters = z
3231
3332
  .array(invalidParameter)
3232
3333
  .min(1)
@@ -3343,15 +3444,99 @@ export const workflowCollectionAlignment = z
3343
3444
  workflowCollectionAlignmentAnchored,
3344
3445
  ])
3345
3446
  .describe('The alignment for collecting the pending line items into an invoice. Defaults to subscription, which means that we are to create a new invoice every time the a subscription period starts (for in advance items) or ends (for in arrears items).');
3346
- export const app = z
3347
- .discriminatedUnion('type', [appStripe, appSandbox, appExternalInvoicing])
3348
- .describe('Installed application.');
3349
3447
  export const taxCodePagePaginatedResponse = z
3350
3448
  .object({
3351
3449
  data: z.array(taxCode),
3352
3450
  meta: paginatedMeta,
3353
3451
  })
3354
3452
  .describe('Page paginated response.');
3453
+ export const appStripe = z
3454
+ .object({
3455
+ id: ulid,
3456
+ name: z
3457
+ .string()
3458
+ .min(1)
3459
+ .max(256)
3460
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3461
+ description: z
3462
+ .string()
3463
+ .max(1024)
3464
+ .optional()
3465
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3466
+ labels: labels.optional(),
3467
+ createdAt: dateTime,
3468
+ updatedAt: dateTime,
3469
+ deletedAt: dateTime.optional(),
3470
+ type: z.literal('stripe').describe('The app type.'),
3471
+ definition: appCatalogItem,
3472
+ status: appStatus,
3473
+ accountId: z
3474
+ .string()
3475
+ .describe('The Stripe account ID associated with the connected Stripe account.'),
3476
+ livemode: z
3477
+ .boolean()
3478
+ .describe('Indicates whether the app is connected to a live Stripe account.'),
3479
+ maskedApiKey: z
3480
+ .string()
3481
+ .describe('The masked Stripe API key that only exposes the first and last few characters.'),
3482
+ })
3483
+ .describe('Stripe app.');
3484
+ export const appSandbox = z
3485
+ .object({
3486
+ id: ulid,
3487
+ name: z
3488
+ .string()
3489
+ .min(1)
3490
+ .max(256)
3491
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3492
+ description: z
3493
+ .string()
3494
+ .max(1024)
3495
+ .optional()
3496
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3497
+ labels: labels.optional(),
3498
+ createdAt: dateTime,
3499
+ updatedAt: dateTime,
3500
+ deletedAt: dateTime.optional(),
3501
+ type: z.literal('sandbox').describe('The app type.'),
3502
+ definition: appCatalogItem,
3503
+ status: appStatus,
3504
+ })
3505
+ .describe('Sandbox app can be used for testing billing features.');
3506
+ export const appExternalInvoicing = z
3507
+ .object({
3508
+ id: ulid,
3509
+ name: z
3510
+ .string()
3511
+ .min(1)
3512
+ .max(256)
3513
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3514
+ description: z
3515
+ .string()
3516
+ .max(1024)
3517
+ .optional()
3518
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3519
+ labels: labels.optional(),
3520
+ createdAt: dateTime,
3521
+ updatedAt: dateTime,
3522
+ deletedAt: dateTime.optional(),
3523
+ type: z.literal('external_invoicing').describe('The app type.'),
3524
+ definition: appCatalogItem,
3525
+ status: appStatus,
3526
+ enableDraftSyncHook: z
3527
+ .boolean()
3528
+ .describe('Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.'),
3529
+ enableIssuingSyncHook: z
3530
+ .boolean()
3531
+ .describe('Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.'),
3532
+ })
3533
+ .describe('External Invoicing app enables integration with third-party invoicing or payment system. The app supports a bi-directional synchronization pattern where OpenMeter Billing manages the invoice lifecycle while the external system handles invoice presentation and payment collection. Integration workflow: 1. The billing system creates invoices and transitions them through lifecycle states (draft → issuing → issued) 2. The integration receives webhook notifications about invoice state changes 3. The integration calls back to provide external system IDs and metadata 4. The integration reports payment events back via the payment status API State synchronization is controlled by hooks that pause invoice progression until the external system confirms synchronization via API callbacks.');
3534
+ export const appCatalogItemPagePaginatedResponse = z
3535
+ .object({
3536
+ data: z.array(appCatalogItem),
3537
+ meta: paginatedMeta,
3538
+ })
3539
+ .describe('Page paginated response.');
3355
3540
  export const invoiceWorkflowSettings = z
3356
3541
  .object({
3357
3542
  apps: invoiceWorkflowAppsReferences.optional(),
@@ -3394,12 +3579,6 @@ export const updateInvoiceWorkflowSettings = z
3394
3579
  workflow: updateBillingInvoiceWorkflow,
3395
3580
  })
3396
3581
  .describe('Snapshot of the billing workflow configuration captured at invoice creation.');
3397
- export const currencyPagePaginatedResponse = z
3398
- .object({
3399
- data: z.array(currency),
3400
- meta: paginatedMeta,
3401
- })
3402
- .describe('Page paginated response.');
3403
3582
  export const governanceQueryResult = z
3404
3583
  .object({
3405
3584
  matched: z
@@ -3475,8 +3654,8 @@ export const createFeatureRequest = z
3475
3654
  .describe('Feature create request.');
3476
3655
  export const updateFeatureRequest = z
3477
3656
  .object({
3478
- unitCost: z
3479
- .union([featureUnitCost, z.null()])
3657
+ unitCost: featureUnitCost
3658
+ .nullable()
3480
3659
  .optional()
3481
3660
  .describe('Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or "llm" to look up cost from the LLM cost database based on meter group-by properties. Set to `null` to clear the existing unit cost; omit to leave it unchanged.'),
3482
3661
  })
@@ -3487,6 +3666,12 @@ export const creditGrantPagePaginatedResponse = z
3487
3666
  meta: paginatedMeta,
3488
3667
  })
3489
3668
  .describe('Page paginated response.');
3669
+ export const currencyPagePaginatedResponse = z
3670
+ .object({
3671
+ data: z.array(currency),
3672
+ meta: paginatedMeta,
3673
+ })
3674
+ .describe('Page paginated response.');
3490
3675
  export const badRequest = z
3491
3676
  .intersection(baseError, z.object({
3492
3677
  invalidParameters: invalidParameters,
@@ -3534,19 +3719,9 @@ export const workflowCollectionSettings = z
3534
3719
  .describe('This grace period can be used to delay the collection of the pending line items specified in alignment. This is useful, in case of multiple subscriptions having slightly different billing periods.'),
3535
3720
  })
3536
3721
  .describe('Workflow collection specifies how to collect the pending line items for an invoice.');
3537
- export const appPagePaginatedResponse = z
3538
- .object({
3539
- data: z.array(app),
3540
- meta: paginatedMeta,
3541
- })
3542
- .describe('Page paginated response.');
3543
- export const profileApps = z
3544
- .object({
3545
- tax: app,
3546
- invoicing: app,
3547
- payment: app,
3548
- })
3549
- .describe('Applications used by a billing profile.');
3722
+ export const app = z
3723
+ .discriminatedUnion('type', [appStripe, appSandbox, appExternalInvoicing])
3724
+ .describe('Installed application.');
3550
3725
  export const governanceQueryResponse = z
3551
3726
  .object({
3552
3727
  data: z
@@ -3671,6 +3846,7 @@ export const rateCard = z
3671
3846
  labels: labels.optional(),
3672
3847
  key: resourceKey,
3673
3848
  feature: featureReference.optional(),
3849
+ currency: billingCurrencyCode.optional(),
3674
3850
  billingCadence: iso8601Duration.optional(),
3675
3851
  price: price,
3676
3852
  unitConfig: unitConfig.optional(),
@@ -3687,6 +3863,7 @@ export const invoiceLineRateCard = z
3687
3863
  taxConfig: rateCardTaxConfig.optional(),
3688
3864
  featureKey: resourceKey.optional(),
3689
3865
  discounts: rateCardDiscounts.optional(),
3866
+ unitConfig: unitConfig.optional(),
3690
3867
  })
3691
3868
  .describe('Rate card configuration snapshot for a usage-based invoice line.');
3692
3869
  export const updateInvoiceLineRateCard = z
@@ -3711,6 +3888,25 @@ export const workflow = z
3711
3888
  tax: workflowTaxSettings.optional(),
3712
3889
  })
3713
3890
  .describe('Billing workflow settings.');
3891
+ export const appPagePaginatedResponse = z
3892
+ .object({
3893
+ data: z.array(app),
3894
+ meta: paginatedMeta,
3895
+ })
3896
+ .describe('Page paginated response.');
3897
+ export const billingInstallAppResponse = z
3898
+ .object({
3899
+ app: app,
3900
+ defaultForCapabilityTypes: z.array(appCapabilityType),
3901
+ })
3902
+ .describe('Response of the app install.');
3903
+ export const profileApps = z
3904
+ .object({
3905
+ tax: app,
3906
+ invoicing: app,
3907
+ payment: app,
3908
+ })
3909
+ .describe('Applications used by a billing profile.');
3714
3910
  export const chargeUsageBased = z
3715
3911
  .object({
3716
3912
  id: ulid,
@@ -4035,7 +4231,7 @@ export const plan = z
4035
4231
  .gte(1)
4036
4232
  .default(1)
4037
4233
  .describe('Plans are versioned to allow you to make changes without affecting running subscriptions.'),
4038
- currency: currencyCode,
4234
+ currency: billingCurrencyCode,
4039
4235
  billingCadence: iso8601Duration,
4040
4236
  proRatingEnabled: z
4041
4237
  .boolean()
@@ -4070,7 +4266,7 @@ export const createPlanRequest = z
4070
4266
  .describe('Optional description of the resource. Maximum 1024 characters.'),
4071
4267
  labels: labels.optional(),
4072
4268
  key: resourceKey,
4073
- currency: currencyCode,
4269
+ currency: billingCurrencyCode,
4074
4270
  billingCadence: iso8601Duration,
4075
4271
  proRatingEnabled: z
4076
4272
  .boolean()
@@ -4519,6 +4715,37 @@ export const getAppPathParams = z.object({
4519
4715
  appId: ulid,
4520
4716
  });
4521
4717
  export const getAppResponse = app;
4718
+ export const uninstallAppPathParams = z.object({
4719
+ appId: ulid,
4720
+ });
4721
+ export const updateAppPathParams = z.object({
4722
+ appId: ulid,
4723
+ });
4724
+ export const updateAppBody = updateAppRequest;
4725
+ export const updateAppResponse = app;
4726
+ export const listAppCatalogQueryParams = z.object({
4727
+ page: z
4728
+ .object({
4729
+ size: z.coerce
4730
+ .number()
4731
+ .int()
4732
+ .optional()
4733
+ .describe('The number of items to include per page.'),
4734
+ number: z.coerce.number().int().optional().describe('The page number.'),
4735
+ })
4736
+ .optional()
4737
+ .describe('Determines which page of the collection to retrieve.'),
4738
+ });
4739
+ export const listAppCatalogResponse = z.object({
4740
+ data: z.array(appCatalogItem),
4741
+ meta: paginatedMeta,
4742
+ });
4743
+ export const getAppCatalogItemPathParams = z.object({
4744
+ appType: appType,
4745
+ });
4746
+ export const getAppCatalogItemResponse = appCatalogItem;
4747
+ export const installAppBody = installAppRequest;
4748
+ export const installAppResponse = billingInstallAppResponse;
4522
4749
  export const listBillingProfilesQueryParams = z.object({
4523
4750
  page: z
4524
4751
  .object({
@@ -4581,6 +4808,22 @@ export const updateInvoiceResponse = invoice;
4581
4808
  export const deleteInvoicePathParams = z.object({
4582
4809
  invoiceId: ulid,
4583
4810
  });
4811
+ export const advanceInvoicePathParams = z.object({
4812
+ invoiceId: ulid,
4813
+ });
4814
+ export const advanceInvoiceResponse = invoice;
4815
+ export const approveInvoicePathParams = z.object({
4816
+ invoiceId: ulid,
4817
+ });
4818
+ export const approveInvoiceResponse = invoice;
4819
+ export const retryInvoicePathParams = z.object({
4820
+ invoiceId: ulid,
4821
+ });
4822
+ export const retryInvoiceResponse = invoice;
4823
+ export const snapshotQuantitiesInvoicePathParams = z.object({
4824
+ invoiceId: ulid,
4825
+ });
4826
+ export const snapshotQuantitiesInvoiceResponse = invoice;
4584
4827
  export const createTaxCodeBody = createTaxCodeRequest;
4585
4828
  export const createTaxCodeResponse = taxCode;
4586
4829
  export const getTaxCodePathParams = z.object({
@@ -4630,6 +4873,10 @@ export const listCurrenciesQueryParams = z.object({
4630
4873
  .describe('Determines which page of the collection to retrieve.'),
4631
4874
  sort: sortQuery.optional(),
4632
4875
  filter: listCurrenciesParamsFilter.optional(),
4876
+ expand: z
4877
+ .array(currencyExpand)
4878
+ .optional()
4879
+ .describe('Expand the currencies returned in the response. To include the active and scheduled cost basis add: expand=cost_basis'),
4633
4880
  });
4634
4881
  export const listCurrenciesResponse = z.object({
4635
4882
  data: z.array(currency),
@@ -4637,6 +4884,10 @@ export const listCurrenciesResponse = z.object({
4637
4884
  });
4638
4885
  export const createCustomCurrencyBody = createCurrencyCustomRequest;
4639
4886
  export const createCustomCurrencyResponse = currencyCustom;
4887
+ export const getCustomCurrencyPathParams = z.object({
4888
+ currencyId: ulid,
4889
+ });
4890
+ export const getCustomCurrencyResponse = currencyCustom;
4640
4891
  export const listCostBasesPathParams = z.object({
4641
4892
  currencyId: ulid,
4642
4893
  });
@@ -4886,6 +5137,11 @@ export const currencyCodeWire = z
4886
5137
  .max(3)
4887
5138
  .regex(new RegExp('^[A-Z]{3}$'))
4888
5139
  .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.');
5140
+ export const currencyCodeCustomWire = z
5141
+ .string()
5142
+ .min(4)
5143
+ .max(24)
5144
+ .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
4889
5145
  export const numericWire = z
4890
5146
  .string()
4891
5147
  .regex(new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$'))
@@ -4960,7 +5216,7 @@ export const ulidWire = z
4960
5216
  .describe('ULID (Universally Unique Lexicographically Sortable Identifier).');
4961
5217
  export const dateTimeWire = z
4962
5218
  .string()
4963
- .datetime()
5219
+ .datetime({ offset: true })
4964
5220
  .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.');
4965
5221
  export const sortQueryWire = z
4966
5222
  .strictObject({
@@ -4968,7 +5224,6 @@ export const sortQueryWire = z
4968
5224
  order: z
4969
5225
  .union([z.literal('asc'), z.literal('desc')])
4970
5226
  .optional()
4971
- .default('asc')
4972
5227
  .describe('The sort order. `asc` for ascending, `desc` for descending.'),
4973
5228
  })
4974
5229
  .describe('Sort query. The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.');
@@ -4988,9 +5243,9 @@ export const cursorMetaPageWire = z
4988
5243
  .strictObject({
4989
5244
  first: z.string().optional().describe('URI to the first page.'),
4990
5245
  last: z.string().optional().describe('URI to the last page.'),
4991
- next: z.string().optional().describe('URI to the next page.'),
4992
- previous: z.string().optional().describe('URI to the previous page.'),
4993
- size: z.number().int().optional().describe('Requested page size.'),
5246
+ next: z.string().nullable().describe('URI to the next page.'),
5247
+ previous: z.string().nullable().describe('URI to the previous page.'),
5248
+ size: z.number().int().describe('Requested page size.'),
4994
5249
  })
4995
5250
  .describe('Cursor pagination metadata.');
4996
5251
  export const invalidRulesWire = z
@@ -5043,7 +5298,6 @@ export const baseErrorWire = z
5043
5298
  .intersection(z.object({
5044
5299
  type: z
5045
5300
  .string()
5046
- .default('about:blank')
5047
5301
  .describe('Type contains a URI that identifies the problem type.'),
5048
5302
  status: z
5049
5303
  .number()
@@ -5374,9 +5628,52 @@ export const rateCardBooleanEntitlementWire = z
5374
5628
  export const appTypeWire = z
5375
5629
  .enum(['sandbox', 'stripe', 'external_invoicing'])
5376
5630
  .describe('The type of the app.');
5631
+ export const appCapabilityTypeWire = z
5632
+ .enum([
5633
+ 'report_usage',
5634
+ 'report_events',
5635
+ 'calculate_tax',
5636
+ 'invoice_customers',
5637
+ 'collect_payments',
5638
+ ])
5639
+ .describe('Supported capability types for an App. Each capability defines an integration function that an App can perform.');
5640
+ export const appInstallMethodsWire = z
5641
+ .enum(['with_oauth2', 'with_api_key', 'no_credentials_required'])
5642
+ .describe('Supported installation methods for an app.');
5377
5643
  export const appStatusWire = z
5378
5644
  .enum(['ready', 'unauthorized'])
5379
5645
  .describe('Connection status of an installed app.');
5646
+ export const updateLabelsWire = z
5647
+ .record(z.string(), z.string())
5648
+ .describe('Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".');
5649
+ export const installAppStripeWithApiKeyWire = z
5650
+ .strictObject({
5651
+ type: z.literal('stripe').describe('Type of the app.'),
5652
+ name: z.string().describe('Name of the app.'),
5653
+ create_billing_profile: z
5654
+ .boolean()
5655
+ .describe('If true, a billing profile will be created for the app. The Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5656
+ api_key: z.string().describe('API key for the app.'),
5657
+ })
5658
+ .describe('Model for installing an app from the catalog with an API key.');
5659
+ export const installAppSandboxWire = z
5660
+ .strictObject({
5661
+ type: z.literal('sandbox').describe('Type of the app.'),
5662
+ name: z.string().describe('Name of the app.'),
5663
+ create_billing_profile: z
5664
+ .boolean()
5665
+ .describe('If true, a billing profile will be created for the app. The Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5666
+ })
5667
+ .describe('Base model for installing an app from the catalog.');
5668
+ export const installAppExternalInvoicingWire = z
5669
+ .strictObject({
5670
+ type: z.literal('external_invoicing').describe('Type of the app.'),
5671
+ name: z.string().describe('Name of the app.'),
5672
+ create_billing_profile: z
5673
+ .boolean()
5674
+ .describe('If true, a billing profile will be created for the app. The Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5675
+ })
5676
+ .describe('Base model for installing an app from the catalog.');
5380
5677
  export const taxIdentificationCodeWire = z
5381
5678
  .string()
5382
5679
  .min(1)
@@ -5405,7 +5702,6 @@ export const workflowPaymentSendInvoiceSettingsWire = z
5405
5702
  due_after: z
5406
5703
  .string()
5407
5704
  .optional()
5408
- .default('P30D')
5409
5705
  .describe("The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method."),
5410
5706
  })
5411
5707
  .describe('Payment settings for a billing workflow when the collection method is send invoice.');
@@ -5453,12 +5749,10 @@ export const invoiceWorkflowInvoicingSettingsWire = z
5453
5749
  auto_advance: z
5454
5750
  .boolean()
5455
5751
  .optional()
5456
- .default(true)
5457
5752
  .describe('Whether to automatically issue the invoice after the draft_period has passed.'),
5458
5753
  draft_period: z
5459
5754
  .string()
5460
5755
  .optional()
5461
- .default('P0D')
5462
5756
  .describe('The period for the invoice to be kept in draft status for manual reviews.'),
5463
5757
  due_after: z
5464
5758
  .string()
@@ -5480,20 +5774,15 @@ export const invoiceLineExternalReferencesWire = z
5480
5774
  export const invoiceDetailedLineCostCategoryWire = z
5481
5775
  .enum(['regular', 'commitment'])
5482
5776
  .describe('Cost category of a detailed invoice line item.');
5483
- export const updateLabelsWire = z
5484
- .record(z.string(), z.string())
5485
- .describe('Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".');
5486
5777
  export const updateBillingInvoiceWorkflowInvoicingSettingsWire = z
5487
5778
  .strictObject({
5488
5779
  auto_advance: z
5489
5780
  .boolean()
5490
5781
  .optional()
5491
- .default(true)
5492
5782
  .describe('Whether to automatically issue the invoice after the draft_period has passed.'),
5493
5783
  draft_period: z
5494
5784
  .string()
5495
5785
  .optional()
5496
- .default('P0D')
5497
5786
  .describe('The period for the invoice to be kept in draft status for manual reviews.'),
5498
5787
  })
5499
5788
  .describe('Invoice-level invoicing settings. A subset of BillingWorkflowInvoicingSettings limited to fields that are meaningful per-invoice. progressive_billing is omitted as it is a gather-time / profile-level decision.');
@@ -5512,7 +5801,6 @@ export const updateBillingWorkflowPaymentSendInvoiceSettingsWire = z
5512
5801
  due_after: z
5513
5802
  .string()
5514
5803
  .optional()
5515
- .default('P30D')
5516
5804
  .describe("The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method."),
5517
5805
  })
5518
5806
  .describe('Payment settings for a billing workflow when the collection method is send invoice.');
@@ -5524,11 +5812,9 @@ export const updatePriceFreeWire = z
5524
5812
  export const currencyTypeWire = z
5525
5813
  .enum(['fiat', 'custom'])
5526
5814
  .describe('Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.');
5527
- export const currencyCodeCustomWire = z
5528
- .string()
5529
- .min(3)
5530
- .max(24)
5531
- .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
5815
+ export const currencyExpandWire = z
5816
+ .enum(['cost_basis'])
5817
+ .describe("Expands for currencies. Values: - `cost_basis`: The currency's active and scheduled cost basis.");
5532
5818
  export const featureLlmTokenTypeWire = z
5533
5819
  .enum([
5534
5820
  'input',
@@ -5856,12 +6142,6 @@ export const appCustomerDataExternalInvoicingWire = z
5856
6142
  labels: labelsWire.optional(),
5857
6143
  })
5858
6144
  .describe('External invoicing customer data.');
5859
- export const billingCurrencyCodeWire = z
5860
- .union([currencyCodeWire])
5861
- .describe('Fiat or custom currency code.');
5862
- export const createCurrencyCodeWire = z
5863
- .union([currencyCodeWire])
5864
- .describe('Fiat or custom currency code.');
5865
6145
  export const currencyFiatWire = z
5866
6146
  .strictObject({
5867
6147
  type: z.literal('fiat').describe('The type of the currency.'),
@@ -5875,6 +6155,22 @@ export const currencyFiatWire = z
5875
6155
  .min(1)
5876
6156
  .optional()
5877
6157
  .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.'),
6158
+ precision: z
6159
+ .number()
6160
+ .int()
6161
+ .nonnegative()
6162
+ .lte(4294967295)
6163
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
6164
+ decimal_mark: z
6165
+ .string()
6166
+ .min(1)
6167
+ .max(1)
6168
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
6169
+ thousand_separator: z
6170
+ .string()
6171
+ .min(1)
6172
+ .max(1)
6173
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
5878
6174
  code: currencyCodeWire,
5879
6175
  })
5880
6176
  .describe('Currency describes a currency supported by the billing system.');
@@ -5883,6 +6179,43 @@ export const listCostBasesParamsFilterWire = z
5883
6179
  fiat_code: currencyCodeWire.optional(),
5884
6180
  })
5885
6181
  .describe('Filter options for listing cost bases.');
6182
+ export const billingCurrencyCodeWire = z
6183
+ .union([currencyCodeWire, currencyCodeCustomWire])
6184
+ .describe('Fiat or custom currency code.');
6185
+ export const createCurrencyCodeWire = z
6186
+ .union([currencyCodeWire, currencyCodeCustomWire])
6187
+ .describe('Fiat or custom currency code.');
6188
+ export const createCurrencyCustomRequestWire = z
6189
+ .strictObject({
6190
+ name: z
6191
+ .string()
6192
+ .min(1)
6193
+ .max(256)
6194
+ .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".'),
6195
+ symbol: z
6196
+ .string()
6197
+ .min(1)
6198
+ .optional()
6199
+ .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.'),
6200
+ precision: z
6201
+ .number()
6202
+ .int()
6203
+ .nonnegative()
6204
+ .lte(4294967295)
6205
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
6206
+ decimal_mark: z
6207
+ .string()
6208
+ .min(1)
6209
+ .max(1)
6210
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
6211
+ thousand_separator: z
6212
+ .string()
6213
+ .min(1)
6214
+ .max(1)
6215
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
6216
+ code: currencyCodeCustomWire,
6217
+ })
6218
+ .describe('CurrencyCustom create request.');
5886
6219
  export const currencyAmountWire = z
5887
6220
  .strictObject({
5888
6221
  amount: numericWire,
@@ -6146,30 +6479,32 @@ export const eventWire = z
6146
6479
  specversion: z
6147
6480
  .string()
6148
6481
  .min(1)
6149
- .default('1.0')
6150
6482
  .describe('The version of the CloudEvents specification which the event uses.'),
6151
6483
  type: z
6152
6484
  .string()
6153
6485
  .min(1)
6154
6486
  .describe('Contains a value describing the type of event related to the originating occurrence.'),
6155
6487
  datacontenttype: z
6156
- .union([z.literal('application/json'), z.null()])
6488
+ .literal('application/json')
6489
+ .nullable()
6157
6490
  .optional()
6158
6491
  .describe('Content type of the CloudEvents data value. Only the value "application/json" is allowed over HTTP.'),
6159
6492
  dataschema: z
6160
- .union([z.string(), z.null()])
6493
+ .string()
6494
+ .nullable()
6161
6495
  .optional()
6162
6496
  .describe('Identifies the schema that data adheres to.'),
6163
6497
  subject: z
6164
6498
  .string()
6165
6499
  .min(1)
6166
6500
  .describe('Describes the subject of the event in the context of the event producer (identified by source).'),
6167
- time: z
6168
- .union([dateTimeWire, z.null()])
6501
+ time: dateTimeWire
6502
+ .nullable()
6169
6503
  .optional()
6170
6504
  .describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
6171
6505
  data: z
6172
- .union([z.record(z.string(), z.unknown()), z.null()])
6506
+ .record(z.string(), z.unknown())
6507
+ .nullable()
6173
6508
  .optional()
6174
6509
  .describe('The event payload. Optional, if present it must be a JSON object.'),
6175
6510
  })
@@ -6252,8 +6587,8 @@ export const createCostBasisRequestWire = z
6252
6587
  export const featureCostQueryRowWire = z
6253
6588
  .strictObject({
6254
6589
  usage: numericWire,
6255
- cost: z
6256
- .union([numericWire, z.null()])
6590
+ cost: numericWire
6591
+ .nullable()
6257
6592
  .describe('The computed cost amount (usage × unit cost). Null when pricing is not available for the given combination of dimensions.'),
6258
6593
  currency: currencyCodeWire,
6259
6594
  detail: z
@@ -6641,15 +6976,9 @@ export const updateAddressWire = z
6641
6976
  .describe('Address');
6642
6977
  export const appStripeCreateCheckoutSessionCustomerUpdateWire = z
6643
6978
  .strictObject({
6644
- address: appStripeCreateCheckoutSessionCustomerUpdateBehaviorWire
6645
- .optional()
6646
- .default('never'),
6647
- name: appStripeCreateCheckoutSessionCustomerUpdateBehaviorWire
6648
- .optional()
6649
- .default('never'),
6650
- shipping: appStripeCreateCheckoutSessionCustomerUpdateBehaviorWire
6651
- .optional()
6652
- .default('never'),
6979
+ address: appStripeCreateCheckoutSessionCustomerUpdateBehaviorWire.optional(),
6980
+ name: appStripeCreateCheckoutSessionCustomerUpdateBehaviorWire.optional(),
6981
+ shipping: appStripeCreateCheckoutSessionCustomerUpdateBehaviorWire.optional(),
6653
6982
  })
6654
6983
  .describe('Controls which customer fields can be updated by the checkout session.');
6655
6984
  export const appStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementWire = z
@@ -6662,11 +6991,8 @@ export const appStripeCreateCheckoutSessionTaxIdCollectionWire = z
6662
6991
  enabled: z
6663
6992
  .boolean()
6664
6993
  .optional()
6665
- .default(false)
6666
6994
  .describe('Enable tax ID collection during checkout. Defaults to false.'),
6667
- required: appStripeCreateCheckoutSessionTaxIdCollectionRequiredWire
6668
- .optional()
6669
- .default('never'),
6995
+ required: appStripeCreateCheckoutSessionTaxIdCollectionRequiredWire.optional(),
6670
6996
  })
6671
6997
  .describe('Tax ID collection configuration for checkout sessions.');
6672
6998
  export const appStripeCreateCheckoutSessionResultWire = z
@@ -6740,10 +7066,8 @@ export const entitlementAccessResultWire = z
6740
7066
  export const createCreditGrantPurchaseWire = z
6741
7067
  .strictObject({
6742
7068
  currency: currencyCodeWire,
6743
- per_unit_cost_basis: numericWire.optional().default('1.0'),
6744
- availability_policy: creditAvailabilityPolicyWire
6745
- .optional()
6746
- .default('on_creation'),
7069
+ per_unit_cost_basis: numericWire.optional(),
7070
+ availability_policy: creditAvailabilityPolicyWire.optional(),
6747
7071
  })
6748
7072
  .describe('Purchase and payment terms of the grant.');
6749
7073
  export const rateCardMeteredEntitlementWire = z
@@ -6754,7 +7078,6 @@ export const rateCardMeteredEntitlementWire = z
6754
7078
  is_soft_limit: z
6755
7079
  .boolean()
6756
7080
  .optional()
6757
- .default(false)
6758
7081
  .describe('If soft limit is true, the subject can use the feature even if the entitlement is exhausted; access remains granted.'),
6759
7082
  limit: z
6760
7083
  .number()
@@ -6773,11 +7096,9 @@ export const recurringPeriodWire = z
6773
7096
  export const creditGrantPurchaseWire = z
6774
7097
  .strictObject({
6775
7098
  currency: currencyCodeWire,
6776
- per_unit_cost_basis: numericWire.optional().default('1.0'),
7099
+ per_unit_cost_basis: numericWire.optional(),
6777
7100
  amount: numericWire,
6778
- availability_policy: creditAvailabilityPolicyWire
6779
- .optional()
6780
- .default('on_creation'),
7101
+ availability_policy: creditAvailabilityPolicyWire.optional(),
6781
7102
  settlement_status: creditPurchasePaymentSettlementStatusWire.optional(),
6782
7103
  })
6783
7104
  .describe('Purchase and payment terms of the grant.');
@@ -6814,9 +7135,7 @@ export const listPlansParamsFilterWire = z
6814
7135
  .describe('Filter options for listing plans.');
6815
7136
  export const voidCreditGrantRequestWire = z
6816
7137
  .strictObject({
6817
- payment_adjustment: creditGrantVoidPaymentAdjustmentWire
6818
- .optional()
6819
- .default('none'),
7138
+ payment_adjustment: creditGrantVoidPaymentAdjustmentWire.optional(),
6820
7139
  })
6821
7140
  .describe('Request body for voiding a credit grant.');
6822
7141
  export const subscriptionCreateWire = z
@@ -6869,12 +7188,11 @@ export const unitConfigWire = z
6869
7188
  .strictObject({
6870
7189
  operation: unitConfigOperationWire,
6871
7190
  conversion_factor: numericWire,
6872
- rounding: unitConfigRoundingModeWire.optional().default('none'),
7191
+ rounding: unitConfigRoundingModeWire.optional(),
6873
7192
  precision: z
6874
7193
  .number()
6875
7194
  .int()
6876
7195
  .optional()
6877
- .default(0)
6878
7196
  .describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
6879
7197
  display_unit: z
6880
7198
  .string()
@@ -6882,19 +7200,85 @@ export const unitConfigWire = z
6882
7200
  .describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
6883
7201
  })
6884
7202
  .describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
6885
- export const appCatalogItemWire = z
6886
- .strictObject({
6887
- type: appTypeWire,
6888
- name: z.string().describe('Name of the app.'),
6889
- description: z.string().describe('Description of the app.'),
6890
- })
6891
- .describe('Available apps for billing integrations to connect with third-party services. Apps can have various capabilities like syncing data from or to external systems, integrating with third-party services for tax calculation, delivery of invoices, collection of payments, etc.');
6892
7203
  export const taxCodeAppMappingWire = z
6893
7204
  .strictObject({
6894
7205
  app_type: appTypeWire,
6895
7206
  tax_code: z.string().describe('Tax code.'),
6896
7207
  })
6897
7208
  .describe('Mapping of app types to tax codes.');
7209
+ export const appCapabilityWire = z
7210
+ .strictObject({
7211
+ type: appCapabilityTypeWire,
7212
+ key: resourceKeyWire,
7213
+ name: z.string().describe('Name of the capability.'),
7214
+ description: z.string().describe('Description of the capability.'),
7215
+ })
7216
+ .describe('App capability describes a function that an App can perform.');
7217
+ export const updateAppStripeRequestWire = z
7218
+ .strictObject({
7219
+ name: z
7220
+ .string()
7221
+ .min(1)
7222
+ .max(256)
7223
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
7224
+ description: z
7225
+ .string()
7226
+ .max(1024)
7227
+ .optional()
7228
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
7229
+ labels: updateLabelsWire.optional(),
7230
+ type: z.literal('stripe').describe('The app type.'),
7231
+ secret_api_key: z
7232
+ .string()
7233
+ .optional()
7234
+ .describe('The Stripe secret API key used to authenticate API requests.'),
7235
+ })
7236
+ .describe('AppStripe update request.');
7237
+ export const updateAppSandboxRequestWire = z
7238
+ .strictObject({
7239
+ name: z
7240
+ .string()
7241
+ .min(1)
7242
+ .max(256)
7243
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
7244
+ description: z
7245
+ .string()
7246
+ .max(1024)
7247
+ .optional()
7248
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
7249
+ labels: updateLabelsWire.optional(),
7250
+ type: z.literal('sandbox').describe('The app type.'),
7251
+ })
7252
+ .describe('AppSandbox update request.');
7253
+ export const updateAppExternalInvoicingRequestWire = z
7254
+ .strictObject({
7255
+ name: z
7256
+ .string()
7257
+ .min(1)
7258
+ .max(256)
7259
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
7260
+ description: z
7261
+ .string()
7262
+ .max(1024)
7263
+ .optional()
7264
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
7265
+ labels: updateLabelsWire.optional(),
7266
+ type: z.literal('external_invoicing').describe('The app type.'),
7267
+ enable_draft_sync_hook: z
7268
+ .boolean()
7269
+ .describe('Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.'),
7270
+ enable_issuing_sync_hook: z
7271
+ .boolean()
7272
+ .describe('Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.'),
7273
+ })
7274
+ .describe('AppExternalInvoicing update request.');
7275
+ export const installAppRequestWire = z
7276
+ .discriminatedUnion('type', [
7277
+ installAppStripeWithApiKeyWire,
7278
+ installAppSandboxWire,
7279
+ installAppExternalInvoicingWire,
7280
+ ])
7281
+ .describe('Request to install an app from the catalog.');
6898
7282
  export const partyTaxIdentityWire = z
6899
7283
  .strictObject({
6900
7284
  code: taxIdentificationCodeWire.optional(),
@@ -6910,21 +7294,16 @@ export const workflowInvoicingSettingsWire = z
6910
7294
  auto_advance: z
6911
7295
  .boolean()
6912
7296
  .optional()
6913
- .default(true)
6914
7297
  .describe('Whether to automatically issue the invoice after the draftPeriod has passed.'),
6915
7298
  draft_period: z
6916
7299
  .string()
6917
7300
  .optional()
6918
- .default('P0D')
6919
7301
  .describe('The period for the invoice to be kept in draft status for manual reviews.'),
6920
7302
  progressive_billing: z
6921
7303
  .boolean()
6922
7304
  .optional()
6923
- .default(true)
6924
7305
  .describe('Should progressive billing be allowed for this workflow?'),
6925
- subscription_end_proration_mode: workflowInvoicingSubscriptionEndProrationModeWire
6926
- .optional()
6927
- .default('bill_actual_period'),
7306
+ subscription_end_proration_mode: workflowInvoicingSubscriptionEndProrationModeWire.optional(),
6928
7307
  })
6929
7308
  .describe('Invoice settings for a billing workflow.');
6930
7309
  export const workflowPaymentSettingsWire = z
@@ -7004,45 +7383,11 @@ export const listCurrenciesParamsFilterWire = z
7004
7383
  code: stringFieldFilterWire.optional(),
7005
7384
  })
7006
7385
  .describe('Filter options for listing currencies.');
7007
- export const currencyCustomWire = z
7008
- .strictObject({
7009
- type: z.literal('custom').describe('The type of the currency.'),
7010
- name: z
7011
- .string()
7012
- .min(1)
7013
- .max(256)
7014
- .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".'),
7015
- symbol: z
7016
- .string()
7017
- .min(1)
7018
- .optional()
7019
- .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.'),
7020
- id: ulidWire,
7021
- code: currencyCodeCustomWire,
7022
- created_at: dateTimeWire,
7023
- })
7024
- .describe('Describes custom currency.');
7025
- export const createCurrencyCustomRequestWire = z
7026
- .strictObject({
7027
- name: z
7028
- .string()
7029
- .min(1)
7030
- .max(256)
7031
- .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".'),
7032
- symbol: z
7033
- .string()
7034
- .min(1)
7035
- .optional()
7036
- .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.'),
7037
- code: currencyCodeCustomWire,
7038
- })
7039
- .describe('CurrencyCustom create request.');
7040
7386
  export const governanceQueryRequestWire = z
7041
7387
  .strictObject({
7042
7388
  include_credits: z
7043
7389
  .boolean()
7044
7390
  .optional()
7045
- .default(false)
7046
7391
  .describe('Whether to include credit balance availability for each resolved customer. When true, each feature evaluation includes credit balance checks. Defaults to `false`.'),
7047
7392
  customer: governanceQueryRequestCustomersWire,
7048
7393
  feature: governanceQueryRequestFeaturesWire.optional(),
@@ -7445,6 +7790,44 @@ export const meterQueryResultWire = z
7445
7790
  .describe('The usage data. If no data is available, an empty array is returned.'),
7446
7791
  })
7447
7792
  .describe('Meter query result.');
7793
+ export const currencyCustomWire = z
7794
+ .strictObject({
7795
+ type: z.literal('custom').describe('The type of the currency.'),
7796
+ name: z
7797
+ .string()
7798
+ .min(1)
7799
+ .max(256)
7800
+ .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".'),
7801
+ symbol: z
7802
+ .string()
7803
+ .min(1)
7804
+ .optional()
7805
+ .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.'),
7806
+ precision: z
7807
+ .number()
7808
+ .int()
7809
+ .nonnegative()
7810
+ .lte(4294967295)
7811
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
7812
+ decimal_mark: z
7813
+ .string()
7814
+ .min(1)
7815
+ .max(1)
7816
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
7817
+ thousand_separator: z
7818
+ .string()
7819
+ .min(1)
7820
+ .max(1)
7821
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
7822
+ id: ulidWire,
7823
+ code: currencyCodeCustomWire,
7824
+ created_at: dateTimeWire,
7825
+ cost_basis: z
7826
+ .array(costBasisWire)
7827
+ .optional()
7828
+ .describe('The list of active and scheduled cost bases for the custom currency. Expired and deleted cost bases are excluded.'),
7829
+ })
7830
+ .describe('Describes custom currency.');
7448
7831
  export const featureCostQueryResultWire = z
7449
7832
  .strictObject({
7450
7833
  from: dateTimeWire.optional(),
@@ -7663,7 +8046,7 @@ export const subscriptionChangeResponseWire = z
7663
8046
  .describe('Response for changing a subscription.');
7664
8047
  export const subscriptionCancelWire = z
7665
8048
  .strictObject({
7666
- timing: subscriptionEditTimingWire.optional().default('immediate'),
8049
+ timing: subscriptionEditTimingWire.optional(),
7667
8050
  })
7668
8051
  .describe('Request for canceling a subscription.');
7669
8052
  export const subscriptionChangeWire = z
@@ -7715,87 +8098,6 @@ export const invoiceUsageQuantityDetailWire = z
7715
8098
  applied_unit_config: unitConfigWire,
7716
8099
  })
7717
8100
  .describe('Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount.');
7718
- export const appStripeWire = z
7719
- .strictObject({
7720
- id: ulidWire,
7721
- name: z
7722
- .string()
7723
- .min(1)
7724
- .max(256)
7725
- .describe('Display name of the resource. Between 1 and 256 characters.'),
7726
- description: z
7727
- .string()
7728
- .max(1024)
7729
- .optional()
7730
- .describe('Optional description of the resource. Maximum 1024 characters.'),
7731
- labels: labelsWire.optional(),
7732
- created_at: dateTimeWire,
7733
- updated_at: dateTimeWire,
7734
- deleted_at: dateTimeWire.optional(),
7735
- type: z.literal('stripe').describe('The app type.'),
7736
- definition: appCatalogItemWire,
7737
- status: appStatusWire,
7738
- account_id: z
7739
- .string()
7740
- .describe('The Stripe account ID associated with the connected Stripe account.'),
7741
- livemode: z
7742
- .boolean()
7743
- .describe('Indicates whether the app is connected to a live Stripe account.'),
7744
- masked_api_key: z
7745
- .string()
7746
- .describe('The masked Stripe API key that only exposes the first and last few characters.'),
7747
- })
7748
- .describe('Stripe app.');
7749
- export const appSandboxWire = z
7750
- .strictObject({
7751
- id: ulidWire,
7752
- name: z
7753
- .string()
7754
- .min(1)
7755
- .max(256)
7756
- .describe('Display name of the resource. Between 1 and 256 characters.'),
7757
- description: z
7758
- .string()
7759
- .max(1024)
7760
- .optional()
7761
- .describe('Optional description of the resource. Maximum 1024 characters.'),
7762
- labels: labelsWire.optional(),
7763
- created_at: dateTimeWire,
7764
- updated_at: dateTimeWire,
7765
- deleted_at: dateTimeWire.optional(),
7766
- type: z.literal('sandbox').describe('The app type.'),
7767
- definition: appCatalogItemWire,
7768
- status: appStatusWire,
7769
- })
7770
- .describe('Sandbox app can be used for testing billing features.');
7771
- export const appExternalInvoicingWire = z
7772
- .strictObject({
7773
- id: ulidWire,
7774
- name: z
7775
- .string()
7776
- .min(1)
7777
- .max(256)
7778
- .describe('Display name of the resource. Between 1 and 256 characters.'),
7779
- description: z
7780
- .string()
7781
- .max(1024)
7782
- .optional()
7783
- .describe('Optional description of the resource. Maximum 1024 characters.'),
7784
- labels: labelsWire.optional(),
7785
- created_at: dateTimeWire,
7786
- updated_at: dateTimeWire,
7787
- deleted_at: dateTimeWire.optional(),
7788
- type: z.literal('external_invoicing').describe('The app type.'),
7789
- definition: appCatalogItemWire,
7790
- status: appStatusWire,
7791
- enable_draft_sync_hook: z
7792
- .boolean()
7793
- .describe('Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.'),
7794
- enable_issuing_sync_hook: z
7795
- .boolean()
7796
- .describe('Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.'),
7797
- })
7798
- .describe('External Invoicing app enables integration with third-party invoicing or payment system. The app supports a bi-directional synchronization pattern where OpenMeter Billing manages the invoice lifecycle while the external system handles invoice presentation and payment collection. Integration workflow: 1. The billing system creates invoices and transitions them through lifecycle states (draft → issuing → issued) 2. The integration receives webhook notifications about invoice state changes 3. The integration calls back to provide external system IDs and metadata 4. The integration reports payment events back via the payment status API State synchronization is controlled by hooks that pause invoice progression until the external system confirms synchronization via API callbacks.');
7799
8101
  export const createTaxCodeRequestWire = z
7800
8102
  .strictObject({
7801
8103
  name: z
@@ -7856,6 +8158,26 @@ export const upsertTaxCodeRequestWire = z
7856
8158
  .describe('Mapping of app types to tax codes.'),
7857
8159
  })
7858
8160
  .describe('TaxCode upsert request.');
8161
+ export const appCatalogItemWire = z
8162
+ .strictObject({
8163
+ type: appTypeWire,
8164
+ name: z.string().describe('Name of the app.'),
8165
+ description: z.string().describe('Description of the app.'),
8166
+ capabilities: z
8167
+ .array(appCapabilityWire)
8168
+ .describe('Capabilities of the app.'),
8169
+ install_methods: z
8170
+ .array(appInstallMethodsWire)
8171
+ .describe('Available install methods of the app.'),
8172
+ })
8173
+ .describe('Available apps for billing integrations to connect with third-party services. Apps can have various capabilities like syncing data from or to external systems, integrating with third-party services for tax calculation, delivery of invoices, collection of payments, etc.');
8174
+ export const updateAppRequestWire = z
8175
+ .discriminatedUnion('type', [
8176
+ updateAppStripeRequestWire,
8177
+ updateAppSandboxRequestWire,
8178
+ updateAppExternalInvoicingRequestWire,
8179
+ ])
8180
+ .describe('Request to update an installed app.');
7859
8181
  export const invoiceWorkflowWire = z
7860
8182
  .strictObject({
7861
8183
  invoicing: invoiceWorkflowInvoicingSettingsWire.optional(),
@@ -7892,9 +8214,6 @@ export const updateBillingInvoiceWorkflowWire = z
7892
8214
  payment: updateBillingWorkflowPaymentSettingsWire.optional(),
7893
8215
  })
7894
8216
  .describe('Invoice-level snapshot of the workflow configuration. Contains only the settings that are meaningful for an already-created invoice: invoicing behaviour and payment settings. Collection alignment and tax policy are gather-time / profile-wide concerns and are not included.');
7895
- export const currencyWire = z
7896
- .discriminatedUnion('type', [currencyFiatWire, currencyCustomWire])
7897
- .describe('Fiat or custom currency.');
7898
8217
  export const governanceFeatureAccessWire = z
7899
8218
  .strictObject({
7900
8219
  has_access: z
@@ -8002,7 +8321,6 @@ export const createCreditGrantRequestWire = z
8002
8321
  .gte(1)
8003
8322
  .lte(1000)
8004
8323
  .optional()
8005
- .default(10)
8006
8324
  .describe('Draw-down priority of the grant. Lower values have higher priority.'),
8007
8325
  effective_at: dateTimeWire.optional(),
8008
8326
  expires_after: iso8601DurationWire.optional(),
@@ -8039,7 +8357,6 @@ export const creditGrantWire = z
8039
8357
  .gte(1)
8040
8358
  .lte(1000)
8041
8359
  .optional()
8042
- .default(10)
8043
8360
  .describe('Draw-down priority of the grant. Lower values have higher priority.'),
8044
8361
  effective_at: dateTimeWire.optional(),
8045
8362
  key: externalResourceKeyWire.optional(),
@@ -8088,12 +8405,10 @@ export const workflowTaxSettingsWire = z
8088
8405
  enabled: z
8089
8406
  .boolean()
8090
8407
  .optional()
8091
- .default(true)
8092
8408
  .describe('Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
8093
8409
  enforced: z
8094
8410
  .boolean()
8095
8411
  .optional()
8096
- .default(false)
8097
8412
  .describe('Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription.'),
8098
8413
  default_tax_config: taxConfigWire.optional(),
8099
8414
  })
@@ -8110,6 +8425,9 @@ export const ingestedEventPaginatedResponseWire = z
8110
8425
  meta: cursorMetaWire,
8111
8426
  })
8112
8427
  .describe('Cursor paginated response.');
8428
+ export const currencyWire = z
8429
+ .discriminatedUnion('type', [currencyFiatWire, currencyCustomWire])
8430
+ .describe('Fiat or custom currency.');
8113
8431
  export const invalidParametersWire = z
8114
8432
  .array(invalidParameterWire)
8115
8433
  .min(1)
@@ -8122,7 +8440,6 @@ export const meterQueryRequestWire = z
8122
8440
  time_zone: z
8123
8441
  .string()
8124
8442
  .optional()
8125
- .default('UTC')
8126
8443
  .describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). The time zone is used to determine the start and end of the time buckets. If not specified, the UTC timezone will be used.'),
8127
8444
  group_by_dimensions: z
8128
8445
  .array(z.string())
@@ -8174,9 +8491,7 @@ export const updateSupplierWire = z
8174
8491
  .describe("Snapshot of the supplier's information at the time the invoice was issued. Structurally a read-only subset of `BillingParty` (the type configured on the billing profile), so the snapshot stays aligned with the source. `key` is omitted because it is not part of the snapshotted supplier data.");
8175
8492
  export const appStripeCreateCheckoutSessionRequestOptionsWire = z
8176
8493
  .strictObject({
8177
- billing_address_collection: appStripeCreateCheckoutSessionBillingAddressCollectionWire
8178
- .optional()
8179
- .default('auto'),
8494
+ billing_address_collection: appStripeCreateCheckoutSessionBillingAddressCollectionWire.optional(),
8180
8495
  cancel_url: z
8181
8496
  .string()
8182
8497
  .optional()
@@ -8211,7 +8526,7 @@ export const appStripeCreateCheckoutSessionRequestOptionsWire = z
8211
8526
  .string()
8212
8527
  .optional()
8213
8528
  .describe('Success URL to redirect customers after completing payment or setup. Not allowed when ui_mode is "embedded". See: https://docs.stripe.com/payments/checkout/custom-success-page'),
8214
- ui_mode: appStripeCheckoutSessionUiModeWire.optional().default('hosted'),
8529
+ ui_mode: appStripeCheckoutSessionUiModeWire.optional(),
8215
8530
  payment_method_types: z
8216
8531
  .array(z.string())
8217
8532
  .optional()
@@ -8226,19 +8541,99 @@ export const workflowCollectionAlignmentWire = z
8226
8541
  workflowCollectionAlignmentAnchoredWire,
8227
8542
  ])
8228
8543
  .describe('The alignment for collecting the pending line items into an invoice. Defaults to subscription, which means that we are to create a new invoice every time the a subscription period starts (for in advance items) or ends (for in arrears items).');
8229
- export const appWire = z
8230
- .discriminatedUnion('type', [
8231
- appStripeWire,
8232
- appSandboxWire,
8233
- appExternalInvoicingWire,
8234
- ])
8235
- .describe('Installed application.');
8236
8544
  export const taxCodePagePaginatedResponseWire = z
8237
8545
  .strictObject({
8238
8546
  data: z.array(taxCodeWire),
8239
8547
  meta: paginatedMetaWire,
8240
8548
  })
8241
8549
  .describe('Page paginated response.');
8550
+ export const appStripeWire = z
8551
+ .strictObject({
8552
+ id: ulidWire,
8553
+ name: z
8554
+ .string()
8555
+ .min(1)
8556
+ .max(256)
8557
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
8558
+ description: z
8559
+ .string()
8560
+ .max(1024)
8561
+ .optional()
8562
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
8563
+ labels: labelsWire.optional(),
8564
+ created_at: dateTimeWire,
8565
+ updated_at: dateTimeWire,
8566
+ deleted_at: dateTimeWire.optional(),
8567
+ type: z.literal('stripe').describe('The app type.'),
8568
+ definition: appCatalogItemWire,
8569
+ status: appStatusWire,
8570
+ account_id: z
8571
+ .string()
8572
+ .describe('The Stripe account ID associated with the connected Stripe account.'),
8573
+ livemode: z
8574
+ .boolean()
8575
+ .describe('Indicates whether the app is connected to a live Stripe account.'),
8576
+ masked_api_key: z
8577
+ .string()
8578
+ .describe('The masked Stripe API key that only exposes the first and last few characters.'),
8579
+ })
8580
+ .describe('Stripe app.');
8581
+ export const appSandboxWire = z
8582
+ .strictObject({
8583
+ id: ulidWire,
8584
+ name: z
8585
+ .string()
8586
+ .min(1)
8587
+ .max(256)
8588
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
8589
+ description: z
8590
+ .string()
8591
+ .max(1024)
8592
+ .optional()
8593
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
8594
+ labels: labelsWire.optional(),
8595
+ created_at: dateTimeWire,
8596
+ updated_at: dateTimeWire,
8597
+ deleted_at: dateTimeWire.optional(),
8598
+ type: z.literal('sandbox').describe('The app type.'),
8599
+ definition: appCatalogItemWire,
8600
+ status: appStatusWire,
8601
+ })
8602
+ .describe('Sandbox app can be used for testing billing features.');
8603
+ export const appExternalInvoicingWire = z
8604
+ .strictObject({
8605
+ id: ulidWire,
8606
+ name: z
8607
+ .string()
8608
+ .min(1)
8609
+ .max(256)
8610
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
8611
+ description: z
8612
+ .string()
8613
+ .max(1024)
8614
+ .optional()
8615
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
8616
+ labels: labelsWire.optional(),
8617
+ created_at: dateTimeWire,
8618
+ updated_at: dateTimeWire,
8619
+ deleted_at: dateTimeWire.optional(),
8620
+ type: z.literal('external_invoicing').describe('The app type.'),
8621
+ definition: appCatalogItemWire,
8622
+ status: appStatusWire,
8623
+ enable_draft_sync_hook: z
8624
+ .boolean()
8625
+ .describe('Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.'),
8626
+ enable_issuing_sync_hook: z
8627
+ .boolean()
8628
+ .describe('Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.'),
8629
+ })
8630
+ .describe('External Invoicing app enables integration with third-party invoicing or payment system. The app supports a bi-directional synchronization pattern where OpenMeter Billing manages the invoice lifecycle while the external system handles invoice presentation and payment collection. Integration workflow: 1. The billing system creates invoices and transitions them through lifecycle states (draft → issuing → issued) 2. The integration receives webhook notifications about invoice state changes 3. The integration calls back to provide external system IDs and metadata 4. The integration reports payment events back via the payment status API State synchronization is controlled by hooks that pause invoice progression until the external system confirms synchronization via API callbacks.');
8631
+ export const appCatalogItemPagePaginatedResponseWire = z
8632
+ .strictObject({
8633
+ data: z.array(appCatalogItemWire),
8634
+ meta: paginatedMetaWire,
8635
+ })
8636
+ .describe('Page paginated response.');
8242
8637
  export const invoiceWorkflowSettingsWire = z
8243
8638
  .strictObject({
8244
8639
  apps: invoiceWorkflowAppsReferencesWire.optional(),
@@ -8265,7 +8660,7 @@ export const invoiceDetailedLineWire = z
8265
8660
  deleted_at: dateTimeWire.optional(),
8266
8661
  service_period: closedPeriodWire,
8267
8662
  totals: totalsWire,
8268
- category: invoiceDetailedLineCostCategoryWire.default('regular'),
8663
+ category: invoiceDetailedLineCostCategoryWire,
8269
8664
  discounts: invoiceLineDiscountsWire.optional(),
8270
8665
  credits_applied: z
8271
8666
  .array(invoiceLineCreditsAppliedWire)
@@ -8281,12 +8676,6 @@ export const updateInvoiceWorkflowSettingsWire = z
8281
8676
  workflow: updateBillingInvoiceWorkflowWire,
8282
8677
  })
8283
8678
  .describe('Snapshot of the billing workflow configuration captured at invoice creation.');
8284
- export const currencyPagePaginatedResponseWire = z
8285
- .strictObject({
8286
- data: z.array(currencyWire),
8287
- meta: paginatedMetaWire,
8288
- })
8289
- .describe('Page paginated response.');
8290
8679
  export const governanceQueryResultWire = z
8291
8680
  .strictObject({
8292
8681
  matched: z
@@ -8366,8 +8755,8 @@ export const createFeatureRequestWire = z
8366
8755
  .describe('Feature create request.');
8367
8756
  export const updateFeatureRequestWire = z
8368
8757
  .strictObject({
8369
- unit_cost: z
8370
- .union([featureUnitCostWire, z.null()])
8758
+ unit_cost: featureUnitCostWire
8759
+ .nullable()
8371
8760
  .optional()
8372
8761
  .describe('Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or "llm" to look up cost from the LLM cost database based on meter group-by properties. Set to `null` to clear the existing unit cost; omit to leave it unchanged.'),
8373
8762
  })
@@ -8378,6 +8767,12 @@ export const creditGrantPagePaginatedResponseWire = z
8378
8767
  meta: paginatedMetaWire,
8379
8768
  })
8380
8769
  .describe('Page paginated response.');
8770
+ export const currencyPagePaginatedResponseWire = z
8771
+ .strictObject({
8772
+ data: z.array(currencyWire),
8773
+ meta: paginatedMetaWire,
8774
+ })
8775
+ .describe('Page paginated response.');
8381
8776
  export const badRequestWire = z
8382
8777
  .intersection(baseErrorWire, z.strictObject({
8383
8778
  invalid_parameters: invalidParametersWire,
@@ -8415,29 +8810,20 @@ export const customerStripeCreateCheckoutSessionRequestWire = z
8415
8810
  .describe('Request to create a Stripe Checkout Session for the customer. Checkout Sessions are used to collect payment method information from customers in a secure, Stripe-hosted interface. This integration uses setup mode to collect payment methods that can be charged later for subscription billing.');
8416
8811
  export const workflowCollectionSettingsWire = z
8417
8812
  .strictObject({
8418
- alignment: workflowCollectionAlignmentWire.optional().default({
8419
- type: 'subscription',
8420
- }),
8813
+ alignment: workflowCollectionAlignmentWire.optional(),
8421
8814
  interval: z
8422
8815
  .string()
8423
8816
  .optional()
8424
- .default('PT1H')
8425
8817
  .describe('This grace period can be used to delay the collection of the pending line items specified in alignment. This is useful, in case of multiple subscriptions having slightly different billing periods.'),
8426
8818
  })
8427
8819
  .describe('Workflow collection specifies how to collect the pending line items for an invoice.');
8428
- export const appPagePaginatedResponseWire = z
8429
- .strictObject({
8430
- data: z.array(appWire),
8431
- meta: paginatedMetaWire,
8432
- })
8433
- .describe('Page paginated response.');
8434
- export const profileAppsWire = z
8435
- .strictObject({
8436
- tax: appWire,
8437
- invoicing: appWire,
8438
- payment: appWire,
8439
- })
8440
- .describe('Applications used by a billing profile.');
8820
+ export const appWire = z
8821
+ .discriminatedUnion('type', [
8822
+ appStripeWire,
8823
+ appSandboxWire,
8824
+ appExternalInvoicingWire,
8825
+ ])
8826
+ .describe('Installed application.');
8441
8827
  export const governanceQueryResponseWire = z
8442
8828
  .strictObject({
8443
8829
  data: z
@@ -8562,10 +8948,11 @@ export const rateCardWire = z
8562
8948
  labels: labelsWire.optional(),
8563
8949
  key: resourceKeyWire,
8564
8950
  feature: featureReferenceWire.optional(),
8951
+ currency: billingCurrencyCodeWire.optional(),
8565
8952
  billing_cadence: iso8601DurationWire.optional(),
8566
8953
  price: priceWire,
8567
8954
  unit_config: unitConfigWire.optional(),
8568
- payment_term: pricePaymentTermWire.optional().default('in_arrears'),
8955
+ payment_term: pricePaymentTermWire.optional(),
8569
8956
  commitments: spendCommitmentsWire.optional(),
8570
8957
  discounts: rateCardDiscountsWire.optional(),
8571
8958
  tax_config: rateCardTaxConfigWire.optional(),
@@ -8578,6 +8965,7 @@ export const invoiceLineRateCardWire = z
8578
8965
  tax_config: rateCardTaxConfigWire.optional(),
8579
8966
  feature_key: resourceKeyWire.optional(),
8580
8967
  discounts: rateCardDiscountsWire.optional(),
8968
+ unit_config: unitConfigWire.optional(),
8581
8969
  })
8582
8970
  .describe('Rate card configuration snapshot for a usage-based invoice line.');
8583
8971
  export const updateInvoiceLineRateCardWire = z
@@ -8602,6 +8990,25 @@ export const workflowWire = z
8602
8990
  tax: workflowTaxSettingsWire.optional(),
8603
8991
  })
8604
8992
  .describe('Billing workflow settings.');
8993
+ export const appPagePaginatedResponseWire = z
8994
+ .strictObject({
8995
+ data: z.array(appWire),
8996
+ meta: paginatedMetaWire,
8997
+ })
8998
+ .describe('Page paginated response.');
8999
+ export const billingInstallAppResponseWire = z
9000
+ .strictObject({
9001
+ app: appWire,
9002
+ default_for_capability_types: z.array(appCapabilityTypeWire),
9003
+ })
9004
+ .describe('Response of the app install.');
9005
+ export const profileAppsWire = z
9006
+ .strictObject({
9007
+ tax: appWire,
9008
+ invoicing: appWire,
9009
+ payment: appWire,
9010
+ })
9011
+ .describe('Applications used by a billing profile.');
8605
9012
  export const chargeUsageBasedWire = z
8606
9013
  .strictObject({
8607
9014
  id: ulidWire,
@@ -8697,7 +9104,6 @@ export const addonWire = z
8697
9104
  .number()
8698
9105
  .int()
8699
9106
  .gte(1)
8700
- .default(1)
8701
9107
  .describe('Version of the add-on. Incremented when the add-on is updated.'),
8702
9108
  instance_type: addonInstanceTypeWire,
8703
9109
  currency: billingCurrencyCodeWire,
@@ -8924,14 +9330,12 @@ export const planWire = z
8924
9330
  .number()
8925
9331
  .int()
8926
9332
  .gte(1)
8927
- .default(1)
8928
9333
  .describe('Plans are versioned to allow you to make changes without affecting running subscriptions.'),
8929
- currency: currencyCodeWire,
9334
+ currency: billingCurrencyCodeWire,
8930
9335
  billing_cadence: iso8601DurationWire,
8931
9336
  pro_rating_enabled: z
8932
9337
  .boolean()
8933
9338
  .optional()
8934
- .default(true)
8935
9339
  .describe('Whether pro-rating is enabled for this plan.'),
8936
9340
  effective_from: dateTimeWire.optional(),
8937
9341
  effective_to: dateTimeWire.optional(),
@@ -8940,9 +9344,7 @@ export const planWire = z
8940
9344
  .array(planPhaseWire)
8941
9345
  .min(1)
8942
9346
  .describe('The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.'),
8943
- settlement_mode: settlementModeWire
8944
- .optional()
8945
- .default('credit_then_invoice'),
9347
+ settlement_mode: settlementModeWire.optional(),
8946
9348
  validation_errors: z
8947
9349
  .array(productCatalogValidationErrorWire)
8948
9350
  .optional()
@@ -8963,12 +9365,11 @@ export const createPlanRequestWire = z
8963
9365
  .describe('Optional description of the resource. Maximum 1024 characters.'),
8964
9366
  labels: labelsWire.optional(),
8965
9367
  key: resourceKeyWire,
8966
- currency: currencyCodeWire,
9368
+ currency: billingCurrencyCodeWire,
8967
9369
  billing_cadence: iso8601DurationWire,
8968
9370
  pro_rating_enabled: z
8969
9371
  .boolean()
8970
9372
  .optional()
8971
- .default(true)
8972
9373
  .describe('Whether pro-rating is enabled for this plan.'),
8973
9374
  phases: z
8974
9375
  .array(planPhaseWire)
@@ -8992,7 +9393,6 @@ export const upsertPlanRequestWire = z
8992
9393
  pro_rating_enabled: z
8993
9394
  .boolean()
8994
9395
  .optional()
8995
- .default(true)
8996
9396
  .describe('Whether pro-rating is enabled for this plan.'),
8997
9397
  phases: z
8998
9398
  .array(planPhaseWire)
@@ -9112,7 +9512,10 @@ export const invoicePagePaginatedResponseWire = z
9112
9512
  export const listMeteringEventsQueryParamsWire = z.object({
9113
9513
  page: cursorPaginationQueryPageWire.optional(),
9114
9514
  filter: listEventsParamsFilterWire.optional(),
9115
- sort: sortQueryWire.optional(),
9515
+ sort: z
9516
+ .string()
9517
+ .optional()
9518
+ .describe('Sort events returned in the response. Supported sort attributes are: - `time` (default) - `ingested_at` - `stored_at` When omitted, events are sorted by `time desc` (most recent first). When a sort field is provided without a suffix, it sorts descending. Append the `asc` suffix to sort ascending, or the `desc` suffix to sort descending.'),
9116
9519
  });
9117
9520
  export const listMeteringEventsResponseWire = z.strictObject({
9118
9521
  data: z.array(ingestedEventWire),
@@ -9140,7 +9543,10 @@ export const listMetersQueryParamsWire = z.object({
9140
9543
  })
9141
9544
  .optional()
9142
9545
  .describe('Determines which page of the collection to retrieve.'),
9143
- sort: sortQueryWire.optional(),
9546
+ sort: z
9547
+ .string()
9548
+ .optional()
9549
+ .describe('Sort meters returned in the response. Supported sort attributes are: - `key` - `name` - `aggregation` - `created_at` (default) - `updated_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9144
9550
  filter: listMetersParamsFilterWire.optional(),
9145
9551
  });
9146
9552
  export const listMetersResponseWire = z.strictObject({
@@ -9183,7 +9589,10 @@ export const listCustomersQueryParamsWire = z.object({
9183
9589
  })
9184
9590
  .optional()
9185
9591
  .describe('Determines which page of the collection to retrieve.'),
9186
- sort: sortQueryWire.optional(),
9592
+ sort: z
9593
+ .string()
9594
+ .optional()
9595
+ .describe('Sort customers returned in the response. Supported sort attributes are: - `id` - `name` (default) - `created_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9187
9596
  filter: listCustomersParamsFilterWire.optional(),
9188
9597
  });
9189
9598
  export const listCustomersResponseWire = z.strictObject({
@@ -9308,7 +9717,10 @@ export const listCustomerChargesQueryParamsWire = z.object({
9308
9717
  })
9309
9718
  .optional()
9310
9719
  .describe('Determines which page of the collection to retrieve.'),
9311
- sort: sortQueryWire.optional(),
9720
+ sort: z
9721
+ .string()
9722
+ .optional()
9723
+ .describe('Sort charges returned in the response. Supported sort attributes are: - `id` - `created_at` - `service_period.from` - `billing_period.from`'),
9312
9724
  filter: listChargesParamsFilterWire.optional(),
9313
9725
  expand: z
9314
9726
  .array(chargesExpandWire)
@@ -9338,7 +9750,10 @@ export const listSubscriptionsQueryParamsWire = z.object({
9338
9750
  })
9339
9751
  .optional()
9340
9752
  .describe('Determines which page of the collection to retrieve.'),
9341
- sort: sortQueryWire.optional(),
9753
+ sort: z
9754
+ .string()
9755
+ .optional()
9756
+ .describe('Sort subscriptions returned in the response. Supported sort attributes are: - `id` - `active_from` (default) - `active_to` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9342
9757
  filter: listSubscriptionsParamsFilterWire.optional(),
9343
9758
  });
9344
9759
  export const listSubscriptionsResponseWire = z.strictObject({
@@ -9383,7 +9798,10 @@ export const listSubscriptionAddonsQueryParamsWire = z.object({
9383
9798
  })
9384
9799
  .optional()
9385
9800
  .describe('Determines which page of the collection to retrieve.'),
9386
- sort: sortQueryWire.optional(),
9801
+ sort: z
9802
+ .string()
9803
+ .optional()
9804
+ .describe('Sort subscription addons returned in the response. Supported sort attributes are: - `id` - `created_at` (default) - `updated_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9387
9805
  });
9388
9806
  export const listSubscriptionAddonsResponseWire = z.strictObject({
9389
9807
  data: z.array(subscriptionAddonWire),
@@ -9415,6 +9833,37 @@ export const getAppPathParamsWire = z.object({
9415
9833
  appId: ulidWire,
9416
9834
  });
9417
9835
  export const getAppResponseWire = appWire;
9836
+ export const uninstallAppPathParamsWire = z.object({
9837
+ appId: ulidWire,
9838
+ });
9839
+ export const updateAppPathParamsWire = z.object({
9840
+ appId: ulidWire,
9841
+ });
9842
+ export const updateAppBodyWire = updateAppRequestWire;
9843
+ export const updateAppResponseWire = appWire;
9844
+ export const listAppCatalogQueryParamsWire = z.object({
9845
+ page: z
9846
+ .strictObject({
9847
+ size: z.coerce
9848
+ .number()
9849
+ .int()
9850
+ .optional()
9851
+ .describe('The number of items to include per page.'),
9852
+ number: z.coerce.number().int().optional().describe('The page number.'),
9853
+ })
9854
+ .optional()
9855
+ .describe('Determines which page of the collection to retrieve.'),
9856
+ });
9857
+ export const listAppCatalogResponseWire = z.strictObject({
9858
+ data: z.array(appCatalogItemWire),
9859
+ meta: paginatedMetaWire,
9860
+ });
9861
+ export const getAppCatalogItemPathParamsWire = z.object({
9862
+ appType: appTypeWire,
9863
+ });
9864
+ export const getAppCatalogItemResponseWire = appCatalogItemWire;
9865
+ export const installAppBodyWire = installAppRequestWire;
9866
+ export const installAppResponseWire = billingInstallAppResponseWire;
9418
9867
  export const listBillingProfilesQueryParamsWire = z.object({
9419
9868
  page: z
9420
9869
  .strictObject({
@@ -9458,7 +9907,10 @@ export const listInvoicesQueryParamsWire = z.object({
9458
9907
  })
9459
9908
  .optional()
9460
9909
  .describe('Determines which page of the collection to retrieve.'),
9461
- sort: sortQueryWire.optional(),
9910
+ sort: z
9911
+ .string()
9912
+ .optional()
9913
+ .describe('Sort invoices returned in the response. Supported sort attributes: - `issued_at` - `created_at` (default) - `service_period_start` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9462
9914
  filter: listInvoicesParamsFilterWire.optional(),
9463
9915
  });
9464
9916
  export const listInvoicesResponseWire = z.strictObject({
@@ -9477,6 +9929,22 @@ export const updateInvoiceResponseWire = invoiceWire;
9477
9929
  export const deleteInvoicePathParamsWire = z.object({
9478
9930
  invoiceId: ulidWire,
9479
9931
  });
9932
+ export const advanceInvoicePathParamsWire = z.object({
9933
+ invoiceId: ulidWire,
9934
+ });
9935
+ export const advanceInvoiceResponseWire = invoiceWire;
9936
+ export const approveInvoicePathParamsWire = z.object({
9937
+ invoiceId: ulidWire,
9938
+ });
9939
+ export const approveInvoiceResponseWire = invoiceWire;
9940
+ export const retryInvoicePathParamsWire = z.object({
9941
+ invoiceId: ulidWire,
9942
+ });
9943
+ export const retryInvoiceResponseWire = invoiceWire;
9944
+ export const snapshotQuantitiesInvoicePathParamsWire = z.object({
9945
+ invoiceId: ulidWire,
9946
+ });
9947
+ export const snapshotQuantitiesInvoiceResponseWire = invoiceWire;
9480
9948
  export const createTaxCodeBodyWire = createTaxCodeRequestWire;
9481
9949
  export const createTaxCodeResponseWire = taxCodeWire;
9482
9950
  export const getTaxCodePathParamsWire = z.object({
@@ -9524,8 +9992,15 @@ export const listCurrenciesQueryParamsWire = z.object({
9524
9992
  })
9525
9993
  .optional()
9526
9994
  .describe('Determines which page of the collection to retrieve.'),
9527
- sort: sortQueryWire.optional(),
9995
+ sort: z
9996
+ .string()
9997
+ .optional()
9998
+ .describe('Sort currencies returned in the response. Supported sort attributes are: - `code` (default) - `name` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9528
9999
  filter: listCurrenciesParamsFilterWire.optional(),
10000
+ expand: z
10001
+ .array(currencyExpandWire)
10002
+ .optional()
10003
+ .describe('Expand the currencies returned in the response. To include the active and scheduled cost basis add: expand=cost_basis'),
9529
10004
  });
9530
10005
  export const listCurrenciesResponseWire = z.strictObject({
9531
10006
  data: z.array(currencyWire),
@@ -9533,6 +10008,10 @@ export const listCurrenciesResponseWire = z.strictObject({
9533
10008
  });
9534
10009
  export const createCustomCurrencyBodyWire = createCurrencyCustomRequestWire;
9535
10010
  export const createCustomCurrencyResponseWire = currencyCustomWire;
10011
+ export const getCustomCurrencyPathParamsWire = z.object({
10012
+ currencyId: ulidWire,
10013
+ });
10014
+ export const getCustomCurrencyResponseWire = currencyCustomWire;
9536
10015
  export const listCostBasesPathParamsWire = z.object({
9537
10016
  currencyId: ulidWire,
9538
10017
  });
@@ -9571,7 +10050,10 @@ export const listFeaturesQueryParamsWire = z.object({
9571
10050
  })
9572
10051
  .optional()
9573
10052
  .describe('Determines which page of the collection to retrieve.'),
9574
- sort: sortQueryWire.optional(),
10053
+ sort: z
10054
+ .string()
10055
+ .optional()
10056
+ .describe('Sort features returned in the response. Supported sort attributes are: - `key` - `name` - `created_at` (default) - `updated_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9575
10057
  filter: listFeatureParamsFilterWire.optional(),
9576
10058
  });
9577
10059
  export const listFeaturesResponseWire = z.strictObject({
@@ -9599,7 +10081,10 @@ export const queryFeatureCostBodyWire = meterQueryRequestWire;
9599
10081
  export const queryFeatureCostResponseWire = featureCostQueryResultWire;
9600
10082
  export const listLlmCostPricesQueryParamsWire = z.object({
9601
10083
  filter: listLlmCostPricesParamsFilterWire.optional(),
9602
- sort: sortQueryWire.optional(),
10084
+ sort: z
10085
+ .string()
10086
+ .optional()
10087
+ .describe('Sort prices returned in the response. Supported sort attributes are: - `id` - `provider.id` - `model.id` (default) - `effective_from` - `effective_to` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9603
10088
  page: z
9604
10089
  .strictObject({
9605
10090
  size: z.coerce
@@ -9655,7 +10140,10 @@ export const listPlansQueryParamsWire = z.object({
9655
10140
  })
9656
10141
  .optional()
9657
10142
  .describe('Determines which page of the collection to retrieve.'),
9658
- sort: sortQueryWire.optional(),
10143
+ sort: z
10144
+ .string()
10145
+ .optional()
10146
+ .describe('Sort plans returned in the response. Supported sort attributes are: - `id` - `key` - `version` - `created_at` (default) - `updated_at`'),
9659
10147
  filter: listPlansParamsFilterWire.optional(),
9660
10148
  });
9661
10149
  export const listPlansResponseWire = z.strictObject({
@@ -9696,7 +10184,10 @@ export const listAddonsQueryParamsWire = z.object({
9696
10184
  })
9697
10185
  .optional()
9698
10186
  .describe('Determines which page of the collection to retrieve.'),
9699
- sort: sortQueryWire.optional(),
10187
+ sort: z
10188
+ .string()
10189
+ .optional()
10190
+ .describe('Sort add-ons returned in the response. Supported sort attributes are: - `id` - `key` - `name` - `created_at` (default) - `updated_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9700
10191
  filter: listAddonsParamsFilterWire.optional(),
9701
10192
  });
9702
10193
  export const listAddonsResponseWire = z.strictObject({