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

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 (66) hide show
  1. package/README.md +95 -54
  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 +170 -4
  6. package/dist/funcs/billing.js +40 -8
  7. package/dist/funcs/charges.d.ts +14 -0
  8. package/dist/funcs/charges.js +42 -0
  9. package/dist/funcs/currencies.d.ts +9 -1
  10. package/dist/funcs/currencies.js +62 -5
  11. package/dist/funcs/customers.js +214 -43
  12. package/dist/funcs/{governance.d.ts → entitlementAccess.d.ts} +4 -4
  13. package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
  14. package/dist/funcs/entitlements.d.ts +9 -1
  15. package/dist/funcs/entitlements.js +61 -3
  16. package/dist/funcs/events.js +3 -0
  17. package/dist/funcs/features.js +48 -9
  18. package/dist/funcs/index.d.ts +2 -1
  19. package/dist/funcs/index.js +2 -1
  20. package/dist/funcs/invoices.d.ts +58 -1
  21. package/dist/funcs/invoices.js +202 -7
  22. package/dist/funcs/llmCost.js +26 -5
  23. package/dist/funcs/meters.js +59 -11
  24. package/dist/funcs/planAddons.js +71 -18
  25. package/dist/funcs/plans.js +59 -11
  26. package/dist/funcs/subscriptions.d.ts +60 -1
  27. package/dist/funcs/subscriptions.js +291 -17
  28. package/dist/funcs/tax.js +34 -7
  29. package/dist/index.d.ts +3 -2
  30. package/dist/lib/config.d.ts +2 -2
  31. package/dist/lib/paginate.d.ts +1 -1
  32. package/dist/lib/version.d.ts +1 -1
  33. package/dist/lib/version.js +1 -1
  34. package/dist/lib/wire.d.ts +1 -0
  35. package/dist/lib/wire.js +88 -10
  36. package/dist/models/operations/apps.d.ts +41 -1
  37. package/dist/models/operations/billing.d.ts +19 -1
  38. package/dist/models/operations/charges.d.ts +54 -0
  39. package/dist/models/operations/currencies.d.ts +10 -0
  40. package/dist/models/operations/customers.d.ts +21 -6
  41. package/dist/models/operations/entitlementAccess.d.ts +9 -0
  42. package/dist/models/operations/entitlementAccess.js +2 -0
  43. package/dist/models/operations/entitlements.d.ts +18 -1
  44. package/dist/models/operations/invoices.d.ts +16 -0
  45. package/dist/models/operations/planAddons.d.ts +14 -1
  46. package/dist/models/operations/subscriptions.d.ts +27 -3
  47. package/dist/models/schemas.d.ts +52291 -22631
  48. package/dist/models/schemas.js +3981 -1823
  49. package/dist/models/types.d.ts +4481 -2018
  50. package/dist/sdk/apps.d.ts +1 -20
  51. package/dist/sdk/apps.js +1 -24
  52. package/dist/sdk/customers.d.ts +2 -56
  53. package/dist/sdk/customers.js +1 -67
  54. package/dist/sdk/entitlements.d.ts +9 -1
  55. package/dist/sdk/entitlements.js +11 -1
  56. package/dist/sdk/internal.d.ts +324 -15
  57. package/dist/sdk/internal.js +402 -17
  58. package/dist/sdk/invoices.d.ts +127 -0
  59. package/dist/sdk/invoices.js +147 -0
  60. package/dist/sdk/planAddons.d.ts +1 -20
  61. package/dist/sdk/planAddons.js +1 -24
  62. package/dist/sdk/subscriptions.d.ts +20 -1
  63. package/dist/sdk/subscriptions.js +24 -1
  64. package/package.json +3 -3
  65. package/dist/models/operations/governance.d.ts +0 -9
  66. /package/dist/models/operations/{governance.js → charges.js} +0 -0
package/dist/lib/wire.js CHANGED
@@ -201,6 +201,9 @@ function walk(data, schema, dir, depth = 0) {
201
201
  const valueSchema = needsWalk(d.valueType) ? d.valueType : undefined;
202
202
  const out = Object.create(null);
203
203
  for (const [key, value] of Object.entries(record)) {
204
+ if (dir.omitUndefinedObjectEntries && value === undefined) {
205
+ continue;
206
+ }
204
207
  out[key] = valueSchema ? walk(value, valueSchema, dir, depth + 1) : value;
205
208
  }
206
209
  Object.setPrototypeOf(out, Object.prototype);
@@ -209,7 +212,13 @@ function walk(data, schema, dir, depth = 0) {
209
212
  if (d?.type === 'union') {
210
213
  const variant = selectVariant(record, s, dir);
211
214
  if (!variant) {
212
- // No confident match: leave keys untransformed rather than guess.
215
+ // No variant owns this data: a discriminated union whose discriminator
216
+ // value the SDK does not know (a variant added server-side after
217
+ // generation), or a union with no object-shaped variant at all reached
218
+ // with object data. Both mean the schema describes nothing about these
219
+ // keys, so leave them untransformed rather than guess. Note this is NOT
220
+ // the zero-key-coverage case — a non-discriminated union with any object
221
+ // variant always resolves one; see selectVariant.
213
222
  return data;
214
223
  }
215
224
  return walk(data, variant, dir, depth + 1);
@@ -223,6 +232,9 @@ function walk(data, schema, dir, depth = 0) {
223
232
  // loop reassigning `out`'s own prototype instead of adding a visible key.
224
233
  const out = Object.create(null);
225
234
  for (const [key, value] of Object.entries(record)) {
235
+ if (dir.omitUndefinedObjectEntries && value === undefined) {
236
+ continue;
237
+ }
226
238
  const fieldSchema = fieldFor(shape, key);
227
239
  // Keys the schema does not declare are dropped, so the result matches the
228
240
  // typed shape exactly (a server-added field has no place in the type).
@@ -273,11 +285,61 @@ function selectVariant(data, schema, dir) {
273
285
  const dataKey = dir.discriminatorKey(d.discriminator);
274
286
  return variantsByDiscriminator(schema, d).get(data[dataKey]);
275
287
  }
276
- // Non-discriminated union: the codegen gate guarantees at most one object
277
- // variant (it fails the build for a mapped union with two or more), so the single
278
- // object-shaped option is unambiguous. Other variants (scalars, arrays) reach the
279
- // walk through their own data-kind branches, not here.
280
- return options.find((option) => def(unwrap(option))?.type === 'object');
288
+ // Non-discriminated union: pick the object variant that best covers the data's
289
+ // keys. The codegen gate guarantees the object variants agree on every key they
290
+ // share (they differ only in WHICH keys they declare, e.g. a customer reference
291
+ // versus the full customer), so the pick can never change how a key is mapped —
292
+ // it only decides which keys the object branch keeps. Most keys matched
293
+ // therefore preserves a wider variant's extra fields, and the narrowest shape
294
+ // wins a tie so toWire does not materialize defaults for a field the value never
295
+ // carried. Other variants (scalars, arrays) reach the walk through their own
296
+ // data-kind branches, not here.
297
+ const dataKeys = Object.keys(data);
298
+ let best;
299
+ // Starting below zero means data that matches NO variant's keys still selects
300
+ // one — the narrowest, by the tie-break below — instead of falling through to
301
+ // the pass-through above. That is deliberate: the selected variant's object
302
+ // walk then drops the undeclared keys, exactly as the object branch does for a
303
+ // non-union field. Passing the keys through instead would put snake_case names
304
+ // into a value fromWire's return type declares to be camelCase.
305
+ let bestMatched = -1;
306
+ let bestWidth = 0;
307
+ for (const option of options) {
308
+ // A variant that is itself a union (`Invoice | InvoiceReference`, where
309
+ // `Invoice` is the discriminated union of its concrete types) resolves
310
+ // through its own selection first, so the nested union contributes the one
311
+ // variant its discriminator — or its own key coverage — identifies. Without
312
+ // this the nested union is no object and gets skipped, leaving the
313
+ // reference variant the only candidate and silently dropping every field
314
+ // of an expanded resource. A nested union that cannot resolve (reference
315
+ // data carries no discriminator) contributes nothing, which is what leaves
316
+ // the reference variant to win on its own merits. The gate verifies a
317
+ // nested union's variants against the outer siblings they compete with, so
318
+ // the agreement guarantee above covers them too. It does not verify two
319
+ // nested unions against each other; no union in the spec declares two
320
+ // union-typed variants.
321
+ const inner = unwrap(option);
322
+ const candidate = def(inner)?.type === 'union' ? selectVariant(data, inner, dir) : option;
323
+ const resolved = unwrap(candidate);
324
+ if (def(resolved)?.type !== 'object') {
325
+ continue;
326
+ }
327
+ const shape = shapeOf(resolved) ?? {};
328
+ const width = Object.keys(shape).length;
329
+ let matched = 0;
330
+ for (const key of dataKeys) {
331
+ if (fieldFor(shape, key) !== undefined) {
332
+ matched++;
333
+ }
334
+ }
335
+ if (matched > bestMatched ||
336
+ (matched === bestMatched && width < bestWidth)) {
337
+ best = candidate;
338
+ bestMatched = matched;
339
+ bestWidth = width;
340
+ }
341
+ }
342
+ return best;
281
343
  }
282
344
  // Memoized literal→variant map for a discriminated union, built once per schema.
283
345
  const variantMapCache = new WeakMap();
@@ -346,6 +408,14 @@ const toWireDirection = {
346
408
  return Number(value);
347
409
  },
348
410
  applyDefaults: true,
411
+ omitUndefinedObjectEntries: true,
412
+ };
413
+ // Path binding names are transport metadata, not JSON object member names, so
414
+ // they must remain exactly as declared while their values receive the same
415
+ // Date/bigint/default mapping used by request bodies and query parameters.
416
+ const toPathWireDirection = {
417
+ ...toWireDirection,
418
+ rename: (key) => key,
349
419
  };
350
420
  const fromWireDirection = {
351
421
  rename: toCamelCase,
@@ -355,18 +425,26 @@ const fromWireDirection = {
355
425
  ? BigInt(value)
356
426
  : value,
357
427
  applyDefaults: false,
428
+ omitUndefinedObjectEntries: false,
358
429
  };
359
430
  // Rewrite a request body or query object from the camelCase public shape to the
360
431
  // snake_case wire shape, driven by its schema. Record keys (label/dimension names)
361
432
  // are preserved; `Date` values serialize to RFC 3339 strings; `bigint` values
362
433
  // (int64 fields) become JSON numbers; omitted required-with-default fields are
363
- // filled with their declared default (see requiredDefault). The return is typed
364
- // as the input `T` so call sites stay cast-free (the runtime object has snake keys
365
- // and wire-encoded dates, but the value is write-only it flows straight into
366
- // `json:`/`toURLSearchParams`, both of which accept any object).
434
+ // filled with their declared default (see requiredDefault); explicit undefined
435
+ // object/record entries are omitted just as JSON.stringify would omit them. The
436
+ // return is typed as the input `T` so call sites stay cast-free (the runtime object
437
+ // has snake keys and wire-encoded dates, but the value is write-only — it flows
438
+ // straight into `json:`/`toURLSearchParams`, both of which accept any object).
367
439
  export function toWire(data, schema) {
368
440
  return walk(data, schema, toWireDirection);
369
441
  }
442
+ // Rewrite path-parameter values to their transport representation without
443
+ // renaming the path binding keys. The returned object is subsequently validated
444
+ // against the generated `…PathParamsWire` schema and URL-encoded by the func.
445
+ export function toPathWire(data, schema) {
446
+ return walk(data, schema, toPathWireDirection);
447
+ }
370
448
  // Rewrite a response body from the snake_case wire shape to the camelCase public
371
449
  // shape: renames keys and revives RFC 3339 strings into `Date`s at date-typed
372
450
  // nodes — never applies defaults or any other coercion. The result is the
@@ -1,11 +1,27 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { App, AppPagePaginatedResponse } from '../types.js';
2
+ import type { App, AppCatalogItem, AppCatalogItemPagePaginatedResponse, AppPagePaginatedResponse, BillingInstallAppResponse, InstallAppRequest as InstallAppRequestBody, ListAppsParamsFilter, SortQueryInput, UpdateAppRequest as UpdateAppRequestBody } from '../types.js';
3
3
  export interface ListAppsQuery {
4
4
  /** Determines which page of the collection to retrieve. */
5
5
  page?: {
6
6
  size?: number;
7
7
  number?: number;
8
8
  };
9
+ /**
10
+ * Sort apps returned in the response. Supported sort attributes are:
11
+ *
12
+ * - `id`
13
+ * - `created_at` (default)
14
+ *
15
+ * The `asc` suffix is optional as the default sort order is ascending. The `desc`
16
+ * suffix is used to specify a descending order.
17
+ */
18
+ sort?: SortQueryInput;
19
+ /**
20
+ * Filter apps returned in the response.
21
+ *
22
+ * To filter apps by name add the following query param: filter[name]=my-app
23
+ */
24
+ filter?: ListAppsParamsFilter;
9
25
  }
10
26
  export type ListAppsRequest = AcceptDateStrings<ListAppsQuery>;
11
27
  export type ListAppsResponse = AppPagePaginatedResponse;
@@ -13,3 +29,27 @@ export type GetAppRequest = {
13
29
  appId: string;
14
30
  };
15
31
  export type GetAppResponse = App;
32
+ export type UninstallAppRequest = {
33
+ appId: string;
34
+ };
35
+ export type UninstallAppResponse = void;
36
+ export type UpdateAppRequest = AcceptDateStrings<{
37
+ appId: string;
38
+ body: UpdateAppRequestBody;
39
+ }>;
40
+ export type UpdateAppResponse = App;
41
+ export interface ListAppCatalogQuery {
42
+ /** Determines which page of the collection to retrieve. */
43
+ page?: {
44
+ size?: number;
45
+ number?: number;
46
+ };
47
+ }
48
+ export type ListAppCatalogRequest = AcceptDateStrings<ListAppCatalogQuery>;
49
+ export type ListAppCatalogResponse = AppCatalogItemPagePaginatedResponse;
50
+ export type GetAppCatalogItemRequest = {
51
+ appType: string;
52
+ };
53
+ export type GetAppCatalogItemResponse = AppCatalogItem;
54
+ export type InstallAppRequest = AcceptDateStrings<InstallAppRequestBody>;
55
+ export type InstallAppResponse = BillingInstallAppResponse;
@@ -1,11 +1,29 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { CreateBillingProfileRequestInput, Profile, ProfilePagePaginatedResponse, UpsertBillingProfileRequestInput } from '../types.js';
2
+ import type { CreateBillingProfileRequestInput, ListBillingProfilesParamsFilter, Profile, ProfilePagePaginatedResponse, SortQueryInput, UpsertBillingProfileRequestInput } from '../types.js';
3
3
  export interface ListBillingProfilesQuery {
4
4
  /** Determines which page of the collection to retrieve. */
5
5
  page?: {
6
6
  size?: number;
7
7
  number?: number;
8
8
  };
9
+ /**
10
+ * Sort billing profiles returned in the response. Supported sort attributes are:
11
+ *
12
+ * - `id`
13
+ * - `name`
14
+ * - `created_at` (default)
15
+ *
16
+ * The `asc` suffix is optional as the default sort order is ascending. The `desc`
17
+ * suffix is used to specify a descending order.
18
+ */
19
+ sort?: SortQueryInput;
20
+ /**
21
+ * Filter billing profiles returned in the response.
22
+ *
23
+ * To filter billing profiles by name add the following query param:
24
+ * filter[name]=my-profile
25
+ */
26
+ filter?: ListBillingProfilesParamsFilter;
9
27
  }
10
28
  export type ListBillingProfilesRequest = AcceptDateStrings<ListBillingProfilesQuery>;
11
29
  export type ListBillingProfilesResponse = ProfilePagePaginatedResponse;
@@ -0,0 +1,54 @@
1
+ import type { AcceptDateStrings } from '../../lib/wire.js';
2
+ import type { ChargePagePaginatedResponse, ListChargesParamsFilter, SortQueryInput } from '../types.js';
3
+ export interface ListChargesQuery {
4
+ /** Determines which page of the collection to retrieve. */
5
+ page?: {
6
+ size?: number;
7
+ number?: number;
8
+ };
9
+ /**
10
+ * Sort charges returned in the response.
11
+ *
12
+ * Supported sort attributes are:
13
+ *
14
+ * - `id`
15
+ * - `created_at`
16
+ * - `service_period.from`
17
+ * - `billing_period.from`
18
+ */
19
+ sort?: SortQueryInput;
20
+ /**
21
+ * Filter charges.
22
+ *
23
+ * To filter charges by customer add the following query param:
24
+ * `filter[customer_id][eq]=<id>` or `filter[customer_id][oeq]=<id>,<id>`.
25
+ *
26
+ * To filter charges by status add the following query param:
27
+ * `filter[status][oeq]=created,active`
28
+ *
29
+ * To filter charges by feature, use `filter[feature_id][oeq]=<id>,<id>` or
30
+ * `filter[feature_key][oeq]=<key>,<key>`.
31
+ *
32
+ * See the `service_period_from` filter field for expressing a service-period
33
+ * window query.
34
+ */
35
+ filter?: ListChargesParamsFilter;
36
+ /**
37
+ * Expand full objects for referenced entities.
38
+ *
39
+ * Supported values are:
40
+ *
41
+ * - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage`
42
+ * and the `totals.realtime` fields.
43
+ * - `customer`: Expand the charge's customer to the complete entity.
44
+ * - `feature`: Expand the charge's feature to the complete entity.
45
+ * - `subscription`: Expand the charge's subscription to the complete entity.
46
+ * - `realization.invoice`: Expand each realization's invoice to the complete
47
+ * entity.
48
+ * - `realization.totals`: Expand each realization run's `totals`.
49
+ * - `realization.detailed_lines`: Expand each realization run's `detailed_lines`.
50
+ */
51
+ expand?: ('real_time_usage' | 'customer' | 'feature' | 'subscription' | 'realization.invoice' | 'realization.totals' | 'realization.detailed_lines')[];
52
+ }
53
+ export type ListChargesRequest = AcceptDateStrings<ListChargesQuery>;
54
+ export type ListChargesResponse = ChargePagePaginatedResponse;
@@ -22,11 +22,21 @@ export interface ListCurrenciesQuery {
22
22
  * To filter currencies by type add the following query param: filter[type]=custom
23
23
  */
24
24
  filter?: ListCurrenciesParamsFilter;
25
+ /**
26
+ * Expand the currencies returned in the response.
27
+ *
28
+ * To include the active and scheduled cost basis add: expand=cost_basis
29
+ */
30
+ expand?: 'cost_basis'[];
25
31
  }
26
32
  export type ListCurrenciesRequest = AcceptDateStrings<ListCurrenciesQuery>;
27
33
  export type ListCurrenciesResponse = CurrencyPagePaginatedResponse;
28
34
  export type CreateCustomCurrencyRequest = AcceptDateStrings<CreateCurrencyCustomRequest>;
29
35
  export type CreateCustomCurrencyResponse = CurrencyCustom;
36
+ export type GetCustomCurrencyRequest = {
37
+ currencyId: string;
38
+ };
39
+ export type GetCustomCurrencyResponse = CurrencyCustom;
30
40
  export interface ListCostBasesQuery {
31
41
  /**
32
42
  * Filter cost bases returned in the response.
@@ -1,5 +1,5 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { AppCustomerData, AppStripeCreateCheckoutSessionResult, AppStripeCreateCustomerPortalSessionResult, Charge, ChargePagePaginatedResponse, CreateChargeRequest, CreateCreditAdjustmentRequest as CreateCreditAdjustmentRequestBody, CreateCreditGrantRequestInput, CreateCustomerRequest as CreateCustomerRequestBody, CreditAdjustment, CreditBalances, CreditGrant, CreditGrantPagePaginatedResponse, CreditTransactionPaginatedResponse, CursorPaginationQueryPage, Customer, CustomerData, CustomerPagePaginatedResponse, CustomerStripeCreateCheckoutSessionRequestInput, CustomerStripeCreateCustomerPortalSessionRequest, GetCreditBalanceParamsFilter, ListChargesParamsFilter, ListCreditGrantsParamsFilter, ListCreditTransactionsParamsFilter, ListCustomersParamsFilter, SortQueryInput, UpdateCreditGrantExternalSettlementRequest as UpdateCreditGrantExternalSettlementRequestBody, UpsertAppCustomerDataRequest, UpsertCustomerBillingDataRequest, UpsertCustomerRequest as UpsertCustomerRequestBody, VoidCreditGrantRequestInput } from '../types.js';
2
+ import type { AppCustomerData, AppStripeCreateCheckoutSessionResult, AppStripeCreateCustomerPortalSessionResult, Charge, ChargePagePaginatedResponse, CreateChargeRequestInput, CreateCreditAdjustmentRequest as CreateCreditAdjustmentRequestBody, CreateCreditGrantRequestInput, CreateCustomerRequest as CreateCustomerRequestBody, CreditAdjustment, CreditBalances, CreditGrant, CreditGrantPagePaginatedResponse, CreditTransactionPaginatedResponse, CursorPaginationQueryPage, Customer, CustomerData, CustomerPagePaginatedResponse, CustomerStripeCreateCheckoutSessionRequestInput, CustomerStripeCreateCustomerPortalSessionRequest, GetCreditBalanceParamsFilter, ListCreditGrantsParamsFilter, ListCreditTransactionsParamsFilter, ListCustomerChargesParamsFilter, ListCustomersParamsFilter, SortQueryInput, UpdateCreditGrantExternalSettlementRequest as UpdateCreditGrantExternalSettlementRequestBody, UpsertAppCustomerDataRequest, UpsertCustomerBillingDataRequest, UpsertCustomerRequest as UpsertCustomerRequestBody, VoidCreditGrantRequestInput } from '../types.js';
3
3
  export type CreateCustomerRequest = AcceptDateStrings<CreateCustomerRequestBody>;
4
4
  export type CreateCustomerResponse = Customer;
5
5
  export type GetCustomerRequest = {
@@ -92,7 +92,8 @@ export interface GetCustomerCreditBalanceQuery {
92
92
  /**
93
93
  * Return the credit balance as of this timestamp.
94
94
  *
95
- * Defaults to the current time.
95
+ * Defaults to the current time. Historical responses return `live` as zero because
96
+ * live charge impacts are only available for current balances.
96
97
  */
97
98
  timestamp?: Date;
98
99
  filter?: GetCreditBalanceParamsFilter;
@@ -149,16 +150,30 @@ export interface ListCustomerChargesQuery {
149
150
  *
150
151
  * To filter charges by status add the following query param:
151
152
  * `filter[status][oeq]=created,active`
153
+ *
154
+ * To filter charges by feature, use `filter[feature_id][oeq]=<id>,<id>` or
155
+ * `filter[feature_key][oeq]=<key>,<key>`.
156
+ *
157
+ * See the `service_period_from` filter field for expressing a service-period
158
+ * window query.
152
159
  */
153
- filter?: ListChargesParamsFilter;
160
+ filter?: ListCustomerChargesParamsFilter;
154
161
  /**
155
162
  * Expand full objects for referenced entities.
156
163
  *
157
164
  * Supported values are:
158
165
  *
159
- * - `real_time_usage`: Expand the charge's real-time usage.
166
+ * - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage`
167
+ * and the `totals.realtime` fields.
168
+ * - `customer`: Expand the charge's customer to the complete entity.
169
+ * - `feature`: Expand the charge's feature to the complete entity.
170
+ * - `subscription`: Expand the charge's subscription to the complete entity.
171
+ * - `realization.invoice`: Expand each realization's invoice to the complete
172
+ * entity.
173
+ * - `realization.totals`: Expand each realization run's `totals`.
174
+ * - `realization.detailed_lines`: Expand each realization run's `detailed_lines`.
160
175
  */
161
- expand?: 'real_time_usage'[];
176
+ expand?: ('real_time_usage' | 'customer' | 'feature' | 'subscription' | 'realization.invoice' | 'realization.totals' | 'realization.detailed_lines')[];
162
177
  }
163
178
  export type ListCustomerChargesRequest = AcceptDateStrings<ListCustomerChargesQuery & {
164
179
  customerId: string;
@@ -166,6 +181,6 @@ export type ListCustomerChargesRequest = AcceptDateStrings<ListCustomerChargesQu
166
181
  export type ListCustomerChargesResponse = ChargePagePaginatedResponse;
167
182
  export type CreateCustomerChargesRequest = AcceptDateStrings<{
168
183
  customerId: string;
169
- body: CreateChargeRequest;
184
+ body: CreateChargeRequestInput;
170
185
  }>;
171
186
  export type CreateCustomerChargesResponse = Charge;
@@ -0,0 +1,9 @@
1
+ import type { AcceptDateStrings } from '../../lib/wire.js';
2
+ import type { CursorPaginationQueryPage, EntitlementAccessQueryRequestInput, EntitlementAccessQueryResponse } from '../types.js';
3
+ export interface QueryEntitlementAccessQuery {
4
+ page?: CursorPaginationQueryPage;
5
+ }
6
+ export type QueryEntitlementAccessRequest = AcceptDateStrings<{
7
+ body: EntitlementAccessQueryRequestInput;
8
+ } & QueryEntitlementAccessQuery>;
9
+ export type QueryEntitlementAccessResponse = EntitlementAccessQueryResponse;
@@ -0,0 +1,2 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
+ export {};
@@ -1,5 +1,22 @@
1
- import type { ListCustomerEntitlementAccessResponseData } from '../types.js';
1
+ import type { AcceptDateStrings } from '../../lib/wire.js';
2
+ import type { EntitlementAccessResult, ListCustomerEntitlementAccessResponseData } from '../types.js';
2
3
  export type ListCustomerEntitlementAccessRequest = {
3
4
  customerId: string;
4
5
  };
5
6
  export type ListCustomerEntitlementAccessResponse = ListCustomerEntitlementAccessResponseData;
7
+ export interface GetCustomerEntitlementAccessQuery {
8
+ /**
9
+ * Expand computed fields.
10
+ *
11
+ * Supported values are:
12
+ *
13
+ * - `value`: Expand the balance details of a metered entitlement; it sets the
14
+ * `value` field.
15
+ */
16
+ expand?: 'value'[];
17
+ }
18
+ export type GetCustomerEntitlementAccessRequest = AcceptDateStrings<GetCustomerEntitlementAccessQuery & {
19
+ customerId: string;
20
+ featureKey: string;
21
+ }>;
22
+ export type GetCustomerEntitlementAccessResponse = EntitlementAccessResult;
@@ -43,3 +43,19 @@ export type DeleteInvoiceRequest = {
43
43
  invoiceId: string;
44
44
  };
45
45
  export type DeleteInvoiceResponse = void;
46
+ export type AdvanceInvoiceRequest = {
47
+ invoiceId: string;
48
+ };
49
+ export type AdvanceInvoiceResponse = Invoice;
50
+ export type ApproveInvoiceRequest = {
51
+ invoiceId: string;
52
+ };
53
+ export type ApproveInvoiceResponse = Invoice;
54
+ export type RetryInvoiceRequest = {
55
+ invoiceId: string;
56
+ };
57
+ export type RetryInvoiceResponse = Invoice;
58
+ export type SnapshotQuantitiesInvoiceRequest = {
59
+ invoiceId: string;
60
+ };
61
+ export type SnapshotQuantitiesInvoiceResponse = Invoice;
@@ -1,11 +1,24 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { CreatePlanAddonRequest as CreatePlanAddonRequestBody, PlanAddon, PlanAddonPagePaginatedResponse, UpsertPlanAddonRequest } from '../types.js';
2
+ import type { CreatePlanAddonRequest as CreatePlanAddonRequestBody, ListPlanAddonsParamsFilter, PlanAddon, PlanAddonPagePaginatedResponse, SortQueryInput, UpsertPlanAddonRequest } from '../types.js';
3
3
  export interface ListPlanAddonsQuery {
4
4
  /** Determines which page of the collection to retrieve. */
5
5
  page?: {
6
6
  size?: number;
7
7
  number?: number;
8
8
  };
9
+ /**
10
+ * Sort plan add-ons returned in the response. Supported sort attributes are:
11
+ *
12
+ * - `id` (default)
13
+ * - `created_at`
14
+ * - `updated_at`
15
+ *
16
+ * The `asc` suffix is optional as the default sort order is ascending. The `desc`
17
+ * suffix is used to specify a descending order.
18
+ */
19
+ sort?: SortQueryInput;
20
+ /** Filter plan add-ons returned in the response. */
21
+ filter?: ListPlanAddonsParamsFilter;
9
22
  }
10
23
  export type ListPlanAddonsRequest = AcceptDateStrings<ListPlanAddonsQuery & {
11
24
  planId: string;
@@ -1,6 +1,6 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { CreateSubscriptionAddonRequest as CreateSubscriptionAddonRequestBody, ListSubscriptionsParamsFilter, SortQueryInput, Subscription, SubscriptionAddon, SubscriptionAddonPagePaginatedResponse, SubscriptionCancelInput, SubscriptionChange, SubscriptionChangeResponse, SubscriptionCreate, SubscriptionPagePaginatedResponse } from '../types.js';
3
- export type CreateSubscriptionRequest = AcceptDateStrings<SubscriptionCreate>;
2
+ import type { CreateSubscriptionAddonRequest as CreateSubscriptionAddonRequestBody, ListSubscriptionsParamsFilter, SortQueryInput, Subscription, SubscriptionAddon, SubscriptionAddonPagePaginatedResponse, SubscriptionAddonUpdate, SubscriptionCancelInput, SubscriptionChangeInput, SubscriptionChangeResponse, SubscriptionCreateInput, SubscriptionEditInput, SubscriptionMigrateInput, SubscriptionMigrateResponse, SubscriptionPagePaginatedResponse } from '../types.js';
3
+ export type CreateSubscriptionRequest = AcceptDateStrings<SubscriptionCreateInput>;
4
4
  export type CreateSubscriptionResponse = Subscription;
5
5
  export interface ListSubscriptionsQuery {
6
6
  /** Determines which page of the collection to retrieve. */
@@ -37,11 +37,29 @@ export type UnscheduleCancelationRequest = {
37
37
  subscriptionId: string;
38
38
  };
39
39
  export type UnscheduleCancelationResponse = Subscription;
40
+ export type UnscheduleSubscriptionRequest = {
41
+ subscriptionId: string;
42
+ };
43
+ export type UnscheduleSubscriptionResponse = void;
44
+ export type RestoreSubscriptionRequest = {
45
+ subscriptionId: string;
46
+ };
47
+ export type RestoreSubscriptionResponse = Subscription;
40
48
  export type ChangeSubscriptionRequest = AcceptDateStrings<{
41
49
  subscriptionId: string;
42
- body: SubscriptionChange;
50
+ body: SubscriptionChangeInput;
43
51
  }>;
44
52
  export type ChangeSubscriptionResponse = SubscriptionChangeResponse;
53
+ export type MigrateSubscriptionRequest = AcceptDateStrings<{
54
+ subscriptionId: string;
55
+ body: SubscriptionMigrateInput;
56
+ }>;
57
+ export type MigrateSubscriptionResponse = SubscriptionMigrateResponse;
58
+ export type EditSubscriptionRequest = AcceptDateStrings<{
59
+ subscriptionId: string;
60
+ body: SubscriptionEditInput;
61
+ }>;
62
+ export type EditSubscriptionResponse = Subscription;
45
63
  export type CreateSubscriptionAddonRequest = AcceptDateStrings<{
46
64
  subscriptionId: string;
47
65
  body: CreateSubscriptionAddonRequestBody;
@@ -75,3 +93,9 @@ export type GetSubscriptionAddonRequest = {
75
93
  subscriptionAddonId: string;
76
94
  };
77
95
  export type GetSubscriptionAddonResponse = SubscriptionAddon;
96
+ export type UpdateSubscriptionAddonRequest = AcceptDateStrings<{
97
+ subscriptionId: string;
98
+ subscriptionAddonId: string;
99
+ body: SubscriptionAddonUpdate;
100
+ }>;
101
+ export type UpdateSubscriptionAddonResponse = SubscriptionAddon;