@openmeter/client 1.0.0-beta-98e130f2888d → 1.0.0-beta-0d94d28bccb3

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.
@@ -4581,6 +4581,22 @@ export const updateInvoiceResponse = invoice;
4581
4581
  export const deleteInvoicePathParams = z.object({
4582
4582
  invoiceId: ulid,
4583
4583
  });
4584
+ export const advanceInvoicePathParams = z.object({
4585
+ invoiceId: ulid,
4586
+ });
4587
+ export const advanceInvoiceResponse = invoice;
4588
+ export const approveInvoicePathParams = z.object({
4589
+ invoiceId: ulid,
4590
+ });
4591
+ export const approveInvoiceResponse = invoice;
4592
+ export const retryInvoicePathParams = z.object({
4593
+ invoiceId: ulid,
4594
+ });
4595
+ export const retryInvoiceResponse = invoice;
4596
+ export const snapshotQuantitiesInvoicePathParams = z.object({
4597
+ invoiceId: ulid,
4598
+ });
4599
+ export const snapshotQuantitiesInvoiceResponse = invoice;
4584
4600
  export const createTaxCodeBody = createTaxCodeRequest;
4585
4601
  export const createTaxCodeResponse = taxCode;
4586
4602
  export const getTaxCodePathParams = z.object({
@@ -9477,6 +9493,22 @@ export const updateInvoiceResponseWire = invoiceWire;
9477
9493
  export const deleteInvoicePathParamsWire = z.object({
9478
9494
  invoiceId: ulidWire,
9479
9495
  });
9496
+ export const advanceInvoicePathParamsWire = z.object({
9497
+ invoiceId: ulidWire,
9498
+ });
9499
+ export const advanceInvoiceResponseWire = invoiceWire;
9500
+ export const approveInvoicePathParamsWire = z.object({
9501
+ invoiceId: ulidWire,
9502
+ });
9503
+ export const approveInvoiceResponseWire = invoiceWire;
9504
+ export const retryInvoicePathParamsWire = z.object({
9505
+ invoiceId: ulidWire,
9506
+ });
9507
+ export const retryInvoiceResponseWire = invoiceWire;
9508
+ export const snapshotQuantitiesInvoicePathParamsWire = z.object({
9509
+ invoiceId: ulidWire,
9510
+ });
9511
+ export const snapshotQuantitiesInvoiceResponseWire = invoiceWire;
9480
9512
  export const createTaxCodeBodyWire = createTaxCodeRequestWire;
9481
9513
  export const createTaxCodeResponseWire = taxCodeWire;
9482
9514
  export const getTaxCodePathParamsWire = z.object({
@@ -1,7 +1,7 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
4
- import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.js';
4
+ import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
5
5
  import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
6
6
  import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse } from '../models/operations/governance.js';
7
7
  import type { CostBasis, Currency, Invoice } from '../models/types.js';
@@ -99,6 +99,63 @@ export declare class InternalInvoices {
99
99
  * DELETE /openmeter/billing/invoices/{invoiceId}
100
100
  */
101
101
  delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
102
+ /**
103
+ * Advance billing invoice's next status
104
+ *
105
+ * Advance a billing invoice.
106
+ *
107
+ * Advances the invoice to the next workflow state. The next state is determined by
108
+ * the invoice's current status and workflow configuration. Only invoices in draft
109
+ * or issued status can be advanced.
110
+ *
111
+ * POST /openmeter/billing/invoices/{invoiceId}/advance
112
+ */
113
+ advance(request: AdvanceInvoiceRequest, options?: RequestOptions): Promise<AdvanceInvoiceResponse>;
114
+ /**
115
+ * Send the invoice to the customer
116
+ *
117
+ * Approve a billing invoice.
118
+ *
119
+ * This call instantly sends the invoice to the customer using the configured
120
+ * billing profile app.
121
+ *
122
+ * This call is valid in two invoice statuses:
123
+ *
124
+ * - draft: the invoice will be sent to the customer, the invoice state becomes
125
+ * issued
126
+ * - manual_approval_needed: the invoice will be sent to the customer, the invoice
127
+ * state becomes issued
128
+ *
129
+ * POST /openmeter/billing/invoices/{invoiceId}/approve
130
+ */
131
+ approve(request: ApproveInvoiceRequest, options?: RequestOptions): Promise<ApproveInvoiceResponse>;
132
+ /**
133
+ * Retry advancing the invoice after a failed attempt
134
+ *
135
+ * Retry sending a billing invoice.
136
+ *
137
+ * Retry advancing the invoice after a failed attempt.
138
+ *
139
+ * The action can be called when the invoice's statusDetails' actions field contain
140
+ * the "retry" action.
141
+ *
142
+ * POST /openmeter/billing/invoices/{invoiceId}/retry
143
+ */
144
+ retry(request: RetryInvoiceRequest, options?: RequestOptions): Promise<RetryInvoiceResponse>;
145
+ /**
146
+ * Snapshot quantities for usage based line items
147
+ *
148
+ * Snapshot quantities for usage-based line items.
149
+ *
150
+ * This call will snapshot the quantities for all usage based line items in the
151
+ * invoice.
152
+ *
153
+ * This call is only valid in draft.waiting_for_collection status, where the
154
+ * collection period can be skipped using this action.
155
+ *
156
+ * POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
157
+ */
158
+ snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
102
159
  }
103
160
  export declare class InternalCurrencies {
104
161
  private readonly _client;
@@ -2,7 +2,7 @@
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
+ import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
6
6
  import { listCurrencies, createCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
7
7
  import { queryGovernanceAccess } from '../funcs/governance.js';
8
8
  /**
@@ -125,6 +125,71 @@ export class InternalInvoices {
125
125
  async delete(request, options) {
126
126
  return unwrap(await deleteInvoice(this._client, request, options));
127
127
  }
128
+ /**
129
+ * Advance billing invoice's next status
130
+ *
131
+ * Advance a billing invoice.
132
+ *
133
+ * Advances the invoice to the next workflow state. The next state is determined by
134
+ * the invoice's current status and workflow configuration. Only invoices in draft
135
+ * or issued status can be advanced.
136
+ *
137
+ * POST /openmeter/billing/invoices/{invoiceId}/advance
138
+ */
139
+ async advance(request, options) {
140
+ return unwrap(await advanceInvoice(this._client, request, options));
141
+ }
142
+ /**
143
+ * Send the invoice to the customer
144
+ *
145
+ * Approve a billing invoice.
146
+ *
147
+ * This call instantly sends the invoice to the customer using the configured
148
+ * billing profile app.
149
+ *
150
+ * This call is valid in two invoice statuses:
151
+ *
152
+ * - draft: the invoice will be sent to the customer, the invoice state becomes
153
+ * issued
154
+ * - manual_approval_needed: the invoice will be sent to the customer, the invoice
155
+ * state becomes issued
156
+ *
157
+ * POST /openmeter/billing/invoices/{invoiceId}/approve
158
+ */
159
+ async approve(request, options) {
160
+ return unwrap(await approveInvoice(this._client, request, options));
161
+ }
162
+ /**
163
+ * Retry advancing the invoice after a failed attempt
164
+ *
165
+ * Retry sending a billing invoice.
166
+ *
167
+ * Retry advancing the invoice after a failed attempt.
168
+ *
169
+ * The action can be called when the invoice's statusDetails' actions field contain
170
+ * the "retry" action.
171
+ *
172
+ * POST /openmeter/billing/invoices/{invoiceId}/retry
173
+ */
174
+ async retry(request, options) {
175
+ return unwrap(await retryInvoice(this._client, request, options));
176
+ }
177
+ /**
178
+ * Snapshot quantities for usage based line items
179
+ *
180
+ * Snapshot quantities for usage-based line items.
181
+ *
182
+ * This call will snapshot the quantities for all usage based line items in the
183
+ * invoice.
184
+ *
185
+ * This call is only valid in draft.waiting_for_collection status, where the
186
+ * collection period can be skipped using this action.
187
+ *
188
+ * POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
189
+ */
190
+ async snapshotQuantities(request, options) {
191
+ return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
192
+ }
128
193
  }
129
194
  export class InternalCurrencies {
130
195
  _client;
@@ -0,0 +1,15 @@
1
+ import { type Client } from '../core.js';
2
+ import { type RequestOptions } from '../lib/types.js';
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
+ export declare class Invoices {
5
+ private readonly _client;
6
+ constructor(_client: Client);
7
+ list(request?: ListInvoicesRequest, options?: RequestOptions): Promise<ListInvoicesResponse>;
8
+ get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
9
+ update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
10
+ delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
11
+ advance(request: AdvanceInvoiceRequest, options?: RequestOptions): Promise<AdvanceInvoiceResponse>;
12
+ approve(request: ApproveInvoiceRequest, options?: RequestOptions): Promise<ApproveInvoiceResponse>;
13
+ retry(request: RetryInvoiceRequest, options?: RequestOptions): Promise<RetryInvoiceResponse>;
14
+ snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
15
+ }
@@ -0,0 +1,32 @@
1
+ import { unwrap } from '../lib/types.js';
2
+ import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
3
+ export class Invoices {
4
+ _client;
5
+ constructor(_client) {
6
+ this._client = _client;
7
+ }
8
+ async list(request, options) {
9
+ return unwrap(await listInvoices(this._client, request, options));
10
+ }
11
+ async get(request, options) {
12
+ return unwrap(await getInvoice(this._client, request, options));
13
+ }
14
+ async update(request, options) {
15
+ return unwrap(await updateInvoice(this._client, request, options));
16
+ }
17
+ async delete(request, options) {
18
+ return unwrap(await deleteInvoice(this._client, request, options));
19
+ }
20
+ async advance(request, options) {
21
+ return unwrap(await advanceInvoice(this._client, request, options));
22
+ }
23
+ async approve(request, options) {
24
+ return unwrap(await approveInvoice(this._client, request, options));
25
+ }
26
+ async retry(request, options) {
27
+ return unwrap(await retryInvoice(this._client, request, options));
28
+ }
29
+ async snapshotQuantities(request, options) {
30
+ return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
31
+ }
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-98e130f2888d",
3
+ "version": "1.0.0-beta-0d94d28bccb3",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",