@openmeter/client 1.0.0-beta-7280f75db66f → 1.0.0-beta-05de7df7a13f

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.
@@ -2,7 +2,9 @@
2
2
  import { unwrap } from '../lib/types.js';
3
3
  import { paginatePages } from '../lib/paginate.js';
4
4
  import { createSubscriptionAddon } from '../funcs/subscriptions.js';
5
+ import { listInvoices, getInvoice, updateInvoice, deleteInvoice, } from '../funcs/invoices.js';
5
6
  import { listCurrencies, createCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
7
+ import { queryGovernanceAccess } from '../funcs/governance.js';
6
8
  /**
7
9
  * Operations marked internal in the API definition. They are not part of
8
10
  * the customer surface: they may require additional permissions, and they
@@ -17,10 +19,18 @@ export class Internal {
17
19
  get subscriptions() {
18
20
  return (this._subscriptions ??= new InternalSubscriptions(this._client));
19
21
  }
22
+ _invoices;
23
+ get invoices() {
24
+ return (this._invoices ??= new InternalInvoices(this._client));
25
+ }
20
26
  _currencies;
21
27
  get currencies() {
22
28
  return (this._currencies ??= new InternalCurrencies(this._client));
23
29
  }
30
+ _governance;
31
+ get governance() {
32
+ return (this._governance ??= new InternalGovernance(this._client));
33
+ }
24
34
  }
25
35
  export class InternalSubscriptions {
26
36
  _client;
@@ -38,6 +48,84 @@ export class InternalSubscriptions {
38
48
  return unwrap(await createSubscriptionAddon(this._client, request, options));
39
49
  }
40
50
  }
51
+ export class InternalInvoices {
52
+ _client;
53
+ constructor(_client) {
54
+ this._client = _client;
55
+ }
56
+ /**
57
+ * List billing invoices
58
+ *
59
+ * List billing invoices.
60
+ *
61
+ * Returns a page of invoices. Gathering invoices are never included. Use `filter`
62
+ * to narrow by status, customer, dates, or service period start. Use `sort` to
63
+ * control ordering.
64
+ *
65
+ * GET /openmeter/billing/invoices
66
+ */
67
+ async list(request, options) {
68
+ return unwrap(await listInvoices(this._client, request, options));
69
+ }
70
+ /**
71
+ * List billing invoices
72
+ *
73
+ * List billing invoices.
74
+ *
75
+ * Returns a page of invoices. Gathering invoices are never included. Use `filter`
76
+ * to narrow by status, customer, dates, or service period start. Use `sort` to
77
+ * control ordering.
78
+ *
79
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
80
+ *
81
+ * GET /openmeter/billing/invoices
82
+ */
83
+ listAll(request, options) {
84
+ return paginatePages((req, opts) => listInvoices(this._client, req, opts), request ?? {}, options);
85
+ }
86
+ /**
87
+ * Get a billing invoice
88
+ *
89
+ * Get a billing invoice by ID.
90
+ *
91
+ * Returns the full invoice resource including line items, status details, totals,
92
+ * and workflow configuration snapshot.
93
+ *
94
+ * GET /openmeter/billing/invoices/{invoiceId}
95
+ */
96
+ async get(request, options) {
97
+ return unwrap(await getInvoice(this._client, request, options));
98
+ }
99
+ /**
100
+ * Update a billing invoice
101
+ *
102
+ * Update a billing invoice.
103
+ *
104
+ * Only the mutable fields of the invoice can be edited: description, labels,
105
+ * supplier, customer, workflow settings, and top-level lines. Top-level lines are
106
+ * matched by `id`; lines without an `id` are created, and existing lines omitted
107
+ * from `lines` are deleted. Detailed (child) lines are always computed and cannot
108
+ * be edited directly. Only invoices in draft status can be updated.
109
+ *
110
+ * PUT /openmeter/billing/invoices/{invoiceId}
111
+ */
112
+ async update(request, options) {
113
+ return unwrap(await updateInvoice(this._client, request, options));
114
+ }
115
+ /**
116
+ * Delete a billing invoice
117
+ *
118
+ * Delete a billing invoice.
119
+ *
120
+ * Only standard invoices in draft status can be deleted. Deleting an invoice will
121
+ * also delete all associated line items and workflow configuration.
122
+ *
123
+ * DELETE /openmeter/billing/invoices/{invoiceId}
124
+ */
125
+ async delete(request, options) {
126
+ return unwrap(await deleteInvoice(this._client, request, options));
127
+ }
128
+ }
41
129
  export class InternalCurrencies {
42
130
  _client;
43
131
  constructor(_client) {
@@ -111,3 +199,26 @@ export class InternalCurrencies {
111
199
  return unwrap(await createCostBasis(this._client, request, options));
112
200
  }
113
201
  }
202
+ export class InternalGovernance {
203
+ _client;
204
+ constructor(_client) {
205
+ this._client = _client;
206
+ }
207
+ /**
208
+ * Query governance access
209
+ *
210
+ * Query feature access for a list of customers.
211
+ *
212
+ * The endpoint resolves each provided identifier to a customer and returns the
213
+ * access status for the requested features, plus optional credit balance
214
+ * availability.
215
+ *
216
+ * _Designed to be called on a fixed refresh interval and the query response is
217
+ * intended to be cached._
218
+ *
219
+ * POST /openmeter/governance/query
220
+ */
221
+ async queryAccess(request, options) {
222
+ return unwrap(await queryGovernanceAccess(this._client, request, options));
223
+ }
224
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-7280f75db66f",
3
+ "version": "1.0.0-beta-05de7df7a13f",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",