@openmeter/client 1.0.0-beta.232 → 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 (50) hide show
  1. package/README.md +76 -45
  2. package/dist/funcs/apps.js +7 -2
  3. package/dist/funcs/billing.js +7 -2
  4. package/dist/funcs/charges.d.ts +14 -0
  5. package/dist/funcs/charges.js +42 -0
  6. package/dist/funcs/{governance.d.ts → entitlementAccess.d.ts} +4 -4
  7. package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
  8. package/dist/funcs/entitlements.d.ts +9 -1
  9. package/dist/funcs/entitlements.js +50 -1
  10. package/dist/funcs/index.d.ts +2 -1
  11. package/dist/funcs/index.js +2 -1
  12. package/dist/funcs/planAddons.js +7 -2
  13. package/dist/funcs/subscriptions.d.ts +60 -1
  14. package/dist/funcs/subscriptions.js +204 -0
  15. package/dist/index.d.ts +4 -2
  16. package/dist/index.js +1 -0
  17. package/dist/lib/version.d.ts +1 -1
  18. package/dist/lib/version.js +1 -1
  19. package/dist/lib/wire.js +62 -6
  20. package/dist/models/operations/apps.d.ts +17 -1
  21. package/dist/models/operations/billing.d.ts +19 -1
  22. package/dist/models/operations/charges.d.ts +54 -0
  23. package/dist/models/operations/customers.d.ts +19 -5
  24. package/dist/models/operations/entitlementAccess.d.ts +9 -0
  25. package/dist/models/operations/entitlementAccess.js +2 -0
  26. package/dist/models/operations/entitlements.d.ts +18 -1
  27. package/dist/models/operations/planAddons.d.ts +14 -1
  28. package/dist/models/operations/subscriptions.d.ts +27 -3
  29. package/dist/models/schemas.d.ts +46830 -22570
  30. package/dist/models/schemas.js +3175 -1508
  31. package/dist/models/types.d.ts +4115 -1896
  32. package/dist/sdk/apps.d.ts +1 -62
  33. package/dist/sdk/apps.js +1 -76
  34. package/dist/sdk/customers.d.ts +2 -56
  35. package/dist/sdk/customers.js +1 -67
  36. package/dist/sdk/entitlements.d.ts +9 -1
  37. package/dist/sdk/entitlements.js +11 -1
  38. package/dist/sdk/internal.d.ts +183 -22
  39. package/dist/sdk/internal.js +231 -26
  40. package/dist/sdk/invoices.d.ts +112 -0
  41. package/dist/sdk/invoices.js +115 -0
  42. package/dist/sdk/planAddons.d.ts +1 -20
  43. package/dist/sdk/planAddons.js +1 -24
  44. package/dist/sdk/sdk.d.ts +3 -0
  45. package/dist/sdk/sdk.js +5 -0
  46. package/dist/sdk/subscriptions.d.ts +20 -1
  47. package/dist/sdk/subscriptions.js +24 -1
  48. package/package.json +1 -1
  49. package/dist/models/operations/governance.d.ts +0 -9
  50. /package/dist/models/operations/{governance.js → charges.js} +0 -0
@@ -1,11 +1,14 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { unwrap } from '../lib/types.js';
3
3
  import { paginatePages } from '../lib/paginate.js';
4
- import { createSubscriptionAddon } from '../funcs/subscriptions.js';
5
- import { listApps, getApp, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
4
+ import { voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
5
+ import { unscheduleSubscription, restoreSubscription, migrateSubscription, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
6
+ import { listApps, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
6
7
  import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
8
+ import { listCharges } from '../funcs/charges.js';
7
9
  import { listCurrencies, createCustomCurrency, getCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
8
- import { queryGovernanceAccess } from '../funcs/governance.js';
10
+ import { listPlanAddons } from '../funcs/planAddons.js';
11
+ import { queryEntitlementAccess } from '../funcs/entitlementAccess.js';
9
12
  /**
10
13
  * Operations marked internal in the API definition. They are not part of
11
14
  * the customer surface: they may require additional permissions, and they
@@ -16,6 +19,10 @@ export class Internal {
16
19
  constructor(_client) {
17
20
  this._client = _client;
18
21
  }
22
+ _customers;
23
+ get customers() {
24
+ return (this._customers ??= new InternalCustomers(this._client));
25
+ }
19
26
  _subscriptions;
20
27
  get subscriptions() {
21
28
  return (this._subscriptions ??= new InternalSubscriptions(this._client));
@@ -28,13 +35,113 @@ export class Internal {
28
35
  get invoices() {
29
36
  return (this._invoices ??= new InternalInvoices(this._client));
30
37
  }
38
+ _charges;
39
+ get charges() {
40
+ return (this._charges ??= new InternalCharges(this._client));
41
+ }
31
42
  _currencies;
32
43
  get currencies() {
33
44
  return (this._currencies ??= new InternalCurrencies(this._client));
34
45
  }
35
- _governance;
36
- get governance() {
37
- return (this._governance ??= new InternalGovernance(this._client));
46
+ _planAddons;
47
+ get planAddons() {
48
+ return (this._planAddons ??= new InternalPlanAddons(this._client));
49
+ }
50
+ _entitlementAccess;
51
+ get entitlementAccess() {
52
+ return (this._entitlementAccess ??= new InternalEntitlementAccess(this._client));
53
+ }
54
+ }
55
+ export class InternalCustomers {
56
+ _client;
57
+ constructor(_client) {
58
+ this._client = _client;
59
+ }
60
+ _credits;
61
+ get credits() {
62
+ return (this._credits ??= new InternalCustomersCredits(this._client));
63
+ }
64
+ _charges;
65
+ get charges() {
66
+ return (this._charges ??= new InternalCustomersCharges(this._client));
67
+ }
68
+ }
69
+ export class InternalCustomersCredits {
70
+ _client;
71
+ constructor(_client) {
72
+ this._client = _client;
73
+ }
74
+ _grants;
75
+ get grants() {
76
+ return (this._grants ??= new InternalCustomersCreditsGrants(this._client));
77
+ }
78
+ }
79
+ export class InternalCustomersCreditsGrants {
80
+ _client;
81
+ constructor(_client) {
82
+ this._client = _client;
83
+ }
84
+ /**
85
+ * Void credit grant
86
+ *
87
+ * Void a credit grant, forfeiting the remaining unused balance.
88
+ *
89
+ * Voiding is a forward-looking, irreversible operation. Credits already consumed
90
+ * by usage remain unaffected — only the remaining balance is forfeited. The grant
91
+ * reads as `voided` status afterwards. Payment state is not adjusted when
92
+ * `payment_adjustment` is `none`, so invoice-backed or externally collected
93
+ * payments may still collect the original amount. Only `active` grants can be
94
+ * voided; voiding a pending, expired, or fully consumed grant returns a conflict.
95
+ * Retrying a successful void is an idempotent success.
96
+ *
97
+ * POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
98
+ */
99
+ async void(request, options) {
100
+ return unwrap(await voidCreditGrant(this._client, request, options));
101
+ }
102
+ }
103
+ export class InternalCustomersCharges {
104
+ _client;
105
+ constructor(_client) {
106
+ this._client = _client;
107
+ }
108
+ /**
109
+ * List customer charges
110
+ *
111
+ * List customer charges.
112
+ *
113
+ * Returns the customer's charges that are represented as either flat fee or
114
+ * usage-based charges.
115
+ *
116
+ * GET /openmeter/customers/{customerId}/charges
117
+ */
118
+ async list(request, options) {
119
+ return unwrap(await listCustomerCharges(this._client, request, options));
120
+ }
121
+ /**
122
+ * List customer charges
123
+ *
124
+ * List customer charges.
125
+ *
126
+ * Returns the customer's charges that are represented as either flat fee or
127
+ * usage-based charges.
128
+ *
129
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
130
+ *
131
+ * GET /openmeter/customers/{customerId}/charges
132
+ */
133
+ listAll(request, options) {
134
+ return paginatePages((req, opts) => listCustomerCharges(this._client, req, opts), request, options);
135
+ }
136
+ /**
137
+ * Create customer charge
138
+ *
139
+ * Create customer charge.
140
+ *
141
+ * POST /openmeter/customers/{customerId}/charges
142
+ */
143
+ async create(request, options) {
144
+ return unwrap(await createCustomerCharges(this._client, request, options));
38
145
  }
39
146
  }
40
147
  export class InternalSubscriptions {
@@ -43,14 +150,60 @@ export class InternalSubscriptions {
43
150
  this._client = _client;
44
151
  }
45
152
  /**
46
- * Create a new subscription add-on
153
+ * Unschedule subscription
154
+ *
155
+ * Deletes a scheduled subscription that has not yet become active, removing it and
156
+ * resolving any scheduling conflict it was holding. This is distinct from
157
+ * canceling: cancel ends a running subscription, whereas unscheduling removes a
158
+ * not-yet-active one. Only scheduled subscriptions can be unscheduled;
159
+ * unscheduling an active or already-started subscription is rejected.
160
+ *
161
+ * POST /openmeter/subscriptions/{subscriptionId}/unschedule
162
+ */
163
+ async unschedule(request, options) {
164
+ return unwrap(await unscheduleSubscription(this._client, request, options));
165
+ }
166
+ /**
167
+ * Restore subscription
168
+ *
169
+ * Restores the subscription by deleting any later-scheduled successor
170
+ * subscriptions and continuing this one indefinitely. This is the inverse of a
171
+ * future-dated change, which schedules a successor. Restore is not available when
172
+ * multi-subscription is enabled.
173
+ *
174
+ * POST /openmeter/subscriptions/{subscriptionId}/restore
175
+ */
176
+ async restore(request, options) {
177
+ return unwrap(await restoreSubscription(this._client, request, options));
178
+ }
179
+ /**
180
+ * Migrate subscription
181
+ *
182
+ * Migrates to a later version of the current plan. With starting_phase omitted and
183
+ * billing_anchor omitted or unchanged, migration amends the subscription in place:
184
+ * unchanged items retain their service periods and both response entries have the
185
+ * same ID. Existing addons must remain compatible with the target plan.
186
+ * Incompatible phase timelines or billing settings return an error. Providing
187
+ * starting_phase or a different billing_anchor explicitly requests replacement,
188
+ * which resets the phase timeline, may produce billing adjustments, and does not
189
+ * transfer addons. Custom subscriptions cannot be migrated.
190
+ *
191
+ * POST /openmeter/subscriptions/{subscriptionId}/migrate
192
+ */
193
+ async migrate(request, options) {
194
+ return unwrap(await migrateSubscription(this._client, request, options));
195
+ }
196
+ /**
197
+ * Update subscription addon
47
198
  *
48
- * Add add-on to a subscription.
199
+ * Update a subscription add-on. Only the quantity is mutable; the timing controls
200
+ * when the new quantity takes effect. A new entry is appended to the add-on's
201
+ * timeline.
49
202
  *
50
- * POST /openmeter/subscriptions/{subscriptionId}/addons
203
+ * PATCH /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
51
204
  */
52
- async createAddon(request, options) {
53
- return unwrap(await createSubscriptionAddon(this._client, request, options));
205
+ async updateAddon(request, options) {
206
+ return unwrap(await updateSubscriptionAddon(this._client, request, options));
54
207
  }
55
208
  }
56
209
  export class InternalApps {
@@ -80,16 +233,6 @@ export class InternalApps {
80
233
  listAll(request, options) {
81
234
  return paginatePages((req, opts) => listApps(this._client, req, opts), request ?? {}, options);
82
235
  }
83
- /**
84
- * Get app
85
- *
86
- * Get an installed app.
87
- *
88
- * GET /openmeter/apps/{appId}
89
- */
90
- async get(request, options) {
91
- return unwrap(await getApp(this._client, request, options));
92
- }
93
236
  /**
94
237
  * Uninstall app
95
238
  *
@@ -296,6 +439,40 @@ export class InternalInvoices {
296
439
  return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
297
440
  }
298
441
  }
442
+ export class InternalCharges {
443
+ _client;
444
+ constructor(_client) {
445
+ this._client = _client;
446
+ }
447
+ /**
448
+ * List charges
449
+ *
450
+ * List charges.
451
+ *
452
+ * Returns the charges of every customer that are represented as either flat fee or
453
+ * usage-based charges.
454
+ *
455
+ * GET /openmeter/charges
456
+ */
457
+ async list(request, options) {
458
+ return unwrap(await listCharges(this._client, request, options));
459
+ }
460
+ /**
461
+ * List charges
462
+ *
463
+ * List charges.
464
+ *
465
+ * Returns the charges of every customer that are represented as either flat fee or
466
+ * usage-based charges.
467
+ *
468
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
469
+ *
470
+ * GET /openmeter/charges
471
+ */
472
+ listAll(request, options) {
473
+ return paginatePages((req, opts) => listCharges(this._client, req, opts), request ?? {}, options);
474
+ }
475
+ }
299
476
  export class InternalCurrencies {
300
477
  _client;
301
478
  constructor(_client) {
@@ -379,13 +556,41 @@ export class InternalCurrencies {
379
556
  return unwrap(await createCostBasis(this._client, request, options));
380
557
  }
381
558
  }
382
- export class InternalGovernance {
559
+ export class InternalPlanAddons {
560
+ _client;
561
+ constructor(_client) {
562
+ this._client = _client;
563
+ }
564
+ /**
565
+ * List add-ons for plan
566
+ *
567
+ * List add-ons associated with a plan.
568
+ *
569
+ * GET /openmeter/plans/{planId}/addons
570
+ */
571
+ async list(request, options) {
572
+ return unwrap(await listPlanAddons(this._client, request, options));
573
+ }
574
+ /**
575
+ * List add-ons for plan
576
+ *
577
+ * List add-ons associated with a plan.
578
+ *
579
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
580
+ *
581
+ * GET /openmeter/plans/{planId}/addons
582
+ */
583
+ listAll(request, options) {
584
+ return paginatePages((req, opts) => listPlanAddons(this._client, req, opts), request, options);
585
+ }
586
+ }
587
+ export class InternalEntitlementAccess {
383
588
  _client;
384
589
  constructor(_client) {
385
590
  this._client = _client;
386
591
  }
387
592
  /**
388
- * Query governance access
593
+ * Query entitlement access
389
594
  *
390
595
  * Query feature access for a list of customers.
391
596
  *
@@ -396,9 +601,9 @@ export class InternalGovernance {
396
601
  * _Designed to be called on a fixed refresh interval and the query response is
397
602
  * intended to be cached._
398
603
  *
399
- * POST /openmeter/governance/query
604
+ * POST /openmeter/entitlement-access/query
400
605
  */
401
- async queryAccess(request, options) {
402
- return unwrap(await queryGovernanceAccess(this._client, request, options));
606
+ async query(request, options) {
607
+ return unwrap(await queryEntitlementAccess(this._client, request, options));
403
608
  }
404
609
  }
@@ -1,15 +1,127 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
4
+ import type { Invoice } from '../models/types.js';
4
5
  export declare class Invoices {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List billing invoices
10
+ *
11
+ * List billing invoices.
12
+ *
13
+ * Returns a page of invoices. Gathering invoices are never included. Use `filter`
14
+ * to narrow by status, customer, dates, or service period start. Use `sort` to
15
+ * control ordering.
16
+ *
17
+ * GET /openmeter/billing/invoices
18
+ */
7
19
  list(request?: ListInvoicesRequest, options?: RequestOptions): Promise<ListInvoicesResponse>;
20
+ /**
21
+ * List billing invoices
22
+ *
23
+ * List billing invoices.
24
+ *
25
+ * Returns a page of invoices. Gathering invoices are never included. Use `filter`
26
+ * to narrow by status, customer, dates, or service period start. Use `sort` to
27
+ * control ordering.
28
+ *
29
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
30
+ *
31
+ * GET /openmeter/billing/invoices
32
+ */
33
+ listAll(request?: ListInvoicesRequest, options?: RequestOptions): AsyncIterable<Invoice>;
34
+ /**
35
+ * Get a billing invoice
36
+ *
37
+ * Get a billing invoice by ID.
38
+ *
39
+ * Returns the full invoice resource including line items, status details, totals,
40
+ * and workflow configuration snapshot.
41
+ *
42
+ * GET /openmeter/billing/invoices/{invoiceId}
43
+ */
8
44
  get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
45
+ /**
46
+ * Update a billing invoice
47
+ *
48
+ * Update a billing invoice.
49
+ *
50
+ * Only the mutable fields of the invoice can be edited: description, labels,
51
+ * supplier, customer, workflow settings, and top-level lines. Top-level lines are
52
+ * matched by `id`; lines without an `id` are created, and existing lines omitted
53
+ * from `lines` are deleted. Detailed (child) lines are always computed and cannot
54
+ * be edited directly. Only invoices in draft status can be updated.
55
+ *
56
+ * PUT /openmeter/billing/invoices/{invoiceId}
57
+ */
9
58
  update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
59
+ /**
60
+ * Delete a billing invoice
61
+ *
62
+ * Delete a billing invoice.
63
+ *
64
+ * Only standard invoices in draft status can be deleted. Deleting an invoice will
65
+ * also delete all associated line items and workflow configuration.
66
+ *
67
+ * DELETE /openmeter/billing/invoices/{invoiceId}
68
+ */
10
69
  delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
70
+ /**
71
+ * Advance billing invoice's next status
72
+ *
73
+ * Advance a billing invoice.
74
+ *
75
+ * Advances the invoice to the next workflow state. The next state is determined by
76
+ * the invoice's current status and workflow configuration. Only invoices in draft
77
+ * or issued status can be advanced.
78
+ *
79
+ * POST /openmeter/billing/invoices/{invoiceId}/advance
80
+ */
11
81
  advance(request: AdvanceInvoiceRequest, options?: RequestOptions): Promise<AdvanceInvoiceResponse>;
82
+ /**
83
+ * Send the invoice to the customer
84
+ *
85
+ * Approve a billing invoice.
86
+ *
87
+ * This call instantly sends the invoice to the customer using the configured
88
+ * billing profile app.
89
+ *
90
+ * This call is valid in two invoice statuses:
91
+ *
92
+ * - draft: the invoice will be sent to the customer, the invoice state becomes
93
+ * issued
94
+ * - manual_approval_needed: the invoice will be sent to the customer, the invoice
95
+ * state becomes issued
96
+ *
97
+ * POST /openmeter/billing/invoices/{invoiceId}/approve
98
+ */
12
99
  approve(request: ApproveInvoiceRequest, options?: RequestOptions): Promise<ApproveInvoiceResponse>;
100
+ /**
101
+ * Retry advancing the invoice after a failed attempt
102
+ *
103
+ * Retry sending a billing invoice.
104
+ *
105
+ * Retry advancing the invoice after a failed attempt.
106
+ *
107
+ * The action can be called when the invoice's statusDetails' actions field contain
108
+ * the "retry" action.
109
+ *
110
+ * POST /openmeter/billing/invoices/{invoiceId}/retry
111
+ */
13
112
  retry(request: RetryInvoiceRequest, options?: RequestOptions): Promise<RetryInvoiceResponse>;
113
+ /**
114
+ * Snapshot quantities for usage based line items
115
+ *
116
+ * Snapshot quantities for usage-based line items.
117
+ *
118
+ * This call will snapshot the quantities for all usage based line items in the
119
+ * invoice.
120
+ *
121
+ * This call is only valid in draft.waiting_for_collection status, where the
122
+ * collection period can be skipped using this action.
123
+ *
124
+ * POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
125
+ */
14
126
  snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
15
127
  }
@@ -1,31 +1,146 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
3
+ import { paginatePages } from '../lib/paginate.js';
2
4
  import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
3
5
  export class Invoices {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List billing invoices
12
+ *
13
+ * List billing invoices.
14
+ *
15
+ * Returns a page of invoices. Gathering invoices are never included. Use `filter`
16
+ * to narrow by status, customer, dates, or service period start. Use `sort` to
17
+ * control ordering.
18
+ *
19
+ * GET /openmeter/billing/invoices
20
+ */
8
21
  async list(request, options) {
9
22
  return unwrap(await listInvoices(this._client, request, options));
10
23
  }
24
+ /**
25
+ * List billing invoices
26
+ *
27
+ * List billing invoices.
28
+ *
29
+ * Returns a page of invoices. Gathering invoices are never included. Use `filter`
30
+ * to narrow by status, customer, dates, or service period start. Use `sort` to
31
+ * control ordering.
32
+ *
33
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
34
+ *
35
+ * GET /openmeter/billing/invoices
36
+ */
37
+ listAll(request, options) {
38
+ return paginatePages((req, opts) => listInvoices(this._client, req, opts), request ?? {}, options);
39
+ }
40
+ /**
41
+ * Get a billing invoice
42
+ *
43
+ * Get a billing invoice by ID.
44
+ *
45
+ * Returns the full invoice resource including line items, status details, totals,
46
+ * and workflow configuration snapshot.
47
+ *
48
+ * GET /openmeter/billing/invoices/{invoiceId}
49
+ */
11
50
  async get(request, options) {
12
51
  return unwrap(await getInvoice(this._client, request, options));
13
52
  }
53
+ /**
54
+ * Update a billing invoice
55
+ *
56
+ * Update a billing invoice.
57
+ *
58
+ * Only the mutable fields of the invoice can be edited: description, labels,
59
+ * supplier, customer, workflow settings, and top-level lines. Top-level lines are
60
+ * matched by `id`; lines without an `id` are created, and existing lines omitted
61
+ * from `lines` are deleted. Detailed (child) lines are always computed and cannot
62
+ * be edited directly. Only invoices in draft status can be updated.
63
+ *
64
+ * PUT /openmeter/billing/invoices/{invoiceId}
65
+ */
14
66
  async update(request, options) {
15
67
  return unwrap(await updateInvoice(this._client, request, options));
16
68
  }
69
+ /**
70
+ * Delete a billing invoice
71
+ *
72
+ * Delete a billing invoice.
73
+ *
74
+ * Only standard invoices in draft status can be deleted. Deleting an invoice will
75
+ * also delete all associated line items and workflow configuration.
76
+ *
77
+ * DELETE /openmeter/billing/invoices/{invoiceId}
78
+ */
17
79
  async delete(request, options) {
18
80
  return unwrap(await deleteInvoice(this._client, request, options));
19
81
  }
82
+ /**
83
+ * Advance billing invoice's next status
84
+ *
85
+ * Advance a billing invoice.
86
+ *
87
+ * Advances the invoice to the next workflow state. The next state is determined by
88
+ * the invoice's current status and workflow configuration. Only invoices in draft
89
+ * or issued status can be advanced.
90
+ *
91
+ * POST /openmeter/billing/invoices/{invoiceId}/advance
92
+ */
20
93
  async advance(request, options) {
21
94
  return unwrap(await advanceInvoice(this._client, request, options));
22
95
  }
96
+ /**
97
+ * Send the invoice to the customer
98
+ *
99
+ * Approve a billing invoice.
100
+ *
101
+ * This call instantly sends the invoice to the customer using the configured
102
+ * billing profile app.
103
+ *
104
+ * This call is valid in two invoice statuses:
105
+ *
106
+ * - draft: the invoice will be sent to the customer, the invoice state becomes
107
+ * issued
108
+ * - manual_approval_needed: the invoice will be sent to the customer, the invoice
109
+ * state becomes issued
110
+ *
111
+ * POST /openmeter/billing/invoices/{invoiceId}/approve
112
+ */
23
113
  async approve(request, options) {
24
114
  return unwrap(await approveInvoice(this._client, request, options));
25
115
  }
116
+ /**
117
+ * Retry advancing the invoice after a failed attempt
118
+ *
119
+ * Retry sending a billing invoice.
120
+ *
121
+ * Retry advancing the invoice after a failed attempt.
122
+ *
123
+ * The action can be called when the invoice's statusDetails' actions field contain
124
+ * the "retry" action.
125
+ *
126
+ * POST /openmeter/billing/invoices/{invoiceId}/retry
127
+ */
26
128
  async retry(request, options) {
27
129
  return unwrap(await retryInvoice(this._client, request, options));
28
130
  }
131
+ /**
132
+ * Snapshot quantities for usage based line items
133
+ *
134
+ * Snapshot quantities for usage-based line items.
135
+ *
136
+ * This call will snapshot the quantities for all usage based line items in the
137
+ * invoice.
138
+ *
139
+ * This call is only valid in draft.waiting_for_collection status, where the
140
+ * collection period can be skipped using this action.
141
+ *
142
+ * POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
143
+ */
29
144
  async snapshotQuantities(request, options) {
30
145
  return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
31
146
  }
@@ -1,28 +1,9 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { ListPlanAddonsRequest, ListPlanAddonsResponse, CreatePlanAddonRequest, CreatePlanAddonResponse, GetPlanAddonRequest, GetPlanAddonResponse, UpdatePlanAddonRequest, UpdatePlanAddonResponse, DeletePlanAddonRequest, DeletePlanAddonResponse } from '../models/operations/planAddons.js';
4
- import type { PlanAddon } from '../models/types.js';
3
+ import type { CreatePlanAddonRequest, CreatePlanAddonResponse, GetPlanAddonRequest, GetPlanAddonResponse, UpdatePlanAddonRequest, UpdatePlanAddonResponse, DeletePlanAddonRequest, DeletePlanAddonResponse } from '../models/operations/planAddons.js';
5
4
  export declare class PlanAddons {
6
5
  private readonly _client;
7
6
  constructor(_client: Client);
8
- /**
9
- * List add-ons for plan
10
- *
11
- * List add-ons associated with a plan.
12
- *
13
- * GET /openmeter/plans/{planId}/addons
14
- */
15
- list(request: ListPlanAddonsRequest, options?: RequestOptions): Promise<ListPlanAddonsResponse>;
16
- /**
17
- * List add-ons for plan
18
- *
19
- * List add-ons associated with a plan.
20
- *
21
- * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
- *
23
- * GET /openmeter/plans/{planId}/addons
24
- */
25
- listAll(request: ListPlanAddonsRequest, options?: RequestOptions): AsyncIterable<PlanAddon>;
26
7
  /**
27
8
  * Add add-on to plan
28
9
  *
@@ -1,34 +1,11 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { unwrap } from '../lib/types.js';
3
- import { paginatePages } from '../lib/paginate.js';
4
- import { listPlanAddons, createPlanAddon, getPlanAddon, updatePlanAddon, deletePlanAddon, } from '../funcs/planAddons.js';
3
+ import { createPlanAddon, getPlanAddon, updatePlanAddon, deletePlanAddon, } from '../funcs/planAddons.js';
5
4
  export class PlanAddons {
6
5
  _client;
7
6
  constructor(_client) {
8
7
  this._client = _client;
9
8
  }
10
- /**
11
- * List add-ons for plan
12
- *
13
- * List add-ons associated with a plan.
14
- *
15
- * GET /openmeter/plans/{planId}/addons
16
- */
17
- async list(request, options) {
18
- return unwrap(await listPlanAddons(this._client, request, options));
19
- }
20
- /**
21
- * List add-ons for plan
22
- *
23
- * List add-ons associated with a plan.
24
- *
25
- * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
- *
27
- * GET /openmeter/plans/{planId}/addons
28
- */
29
- listAll(request, options) {
30
- return paginatePages((req, opts) => listPlanAddons(this._client, req, opts), request, options);
31
- }
32
9
  /**
33
10
  * Add add-on to plan
34
11
  *
package/dist/sdk/sdk.d.ts CHANGED
@@ -4,6 +4,7 @@ import { Meters } from './meters.js';
4
4
  import { Customers } from './customers.js';
5
5
  import { Entitlements } from './entitlements.js';
6
6
  import { Subscriptions } from './subscriptions.js';
7
+ import { Apps } from './apps.js';
7
8
  import { Billing } from './billing.js';
8
9
  import { Tax } from './tax.js';
9
10
  import { Features } from './features.js';
@@ -24,6 +25,8 @@ export declare class OpenMeter extends Client {
24
25
  get entitlements(): Entitlements;
25
26
  private _subscriptions?;
26
27
  get subscriptions(): Subscriptions;
28
+ private _apps?;
29
+ get apps(): Apps;
27
30
  private _billing?;
28
31
  get billing(): Billing;
29
32
  private _tax?;