@openmeter/client 1.0.0-beta-9456faab81a4 → 1.0.0-beta-4aea250406fe
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.
- package/README.md +10 -6
- package/dist/funcs/invoices.d.ts +58 -1
- package/dist/funcs/invoices.js +129 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/invoices.d.ts +16 -0
- package/dist/models/schemas.d.ts +5531 -2859
- package/dist/models/schemas.js +32 -0
- package/dist/sdk/internal.d.ts +58 -1
- package/dist/sdk/internal.js +66 -1
- package/dist/sdk/invoices.d.ts +15 -0
- package/dist/sdk/invoices.js +32 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -425,12 +425,16 @@ they can change or be removed without notice or semver consideration.
|
|
|
425
425
|
|
|
426
426
|
### Internal Invoices
|
|
427
427
|
|
|
428
|
-
| Method
|
|
429
|
-
|
|
|
430
|
-
| `client.internal.invoices.list`
|
|
431
|
-
| `client.internal.invoices.get`
|
|
432
|
-
| `client.internal.invoices.update`
|
|
433
|
-
| `client.internal.invoices.delete`
|
|
428
|
+
| Method | HTTP | Description |
|
|
429
|
+
| --------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
430
|
+
| `client.internal.invoices.list` | `GET /openmeter/billing/invoices` | List billing invoices. Returns a page of invoices. Gathering invoices are never included. Use `filter` to narrow by status, customer, dates, or service period start. Use `sort` to control ordering. |
|
|
431
|
+
| `client.internal.invoices.get` | `GET /openmeter/billing/invoices/{invoiceId}` | Get a billing invoice by ID. Returns the full invoice resource including line items, status details, totals, and workflow configuration snapshot. |
|
|
432
|
+
| `client.internal.invoices.update` | `PUT /openmeter/billing/invoices/{invoiceId}` | Update a billing invoice. Only the mutable fields of the invoice can be edited: description, labels, supplier, customer, workflow settings, and top-level lines. Top-level lines are matched by `id`; lines without an `id` are created, and existing lines omitted from `lines` are deleted. Detailed (child) lines are always computed and cannot be edited directly. Only invoices in draft status can be updated. |
|
|
433
|
+
| `client.internal.invoices.delete` | `DELETE /openmeter/billing/invoices/{invoiceId}` | Delete a billing invoice. Only standard invoices in draft status can be deleted. Deleting an invoice will also delete all associated line items and workflow configuration. |
|
|
434
|
+
| `client.internal.invoices.advance` | `POST /openmeter/billing/invoices/{invoiceId}/advance` | Advance a billing invoice. Advances the invoice to the next workflow state. The next state is determined by the invoice's current status and workflow configuration. Only invoices in draft or issued status can be advanced. |
|
|
435
|
+
| `client.internal.invoices.approve` | `POST /openmeter/billing/invoices/{invoiceId}/approve` | Approve a billing invoice. This call instantly sends the invoice to the customer using the configured billing profile app. This call is valid in two invoice statuses: - draft: the invoice will be sent to the customer, the invoice state becomes issued - manual_approval_needed: the invoice will be sent to the customer, the invoice state becomes issued |
|
|
436
|
+
| `client.internal.invoices.retry` | `POST /openmeter/billing/invoices/{invoiceId}/retry` | Retry sending a billing invoice. Retry advancing the invoice after a failed attempt. The action can be called when the invoice's statusDetails' actions field contain the "retry" action. |
|
|
437
|
+
| `client.internal.invoices.snapshotQuantities` | `POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities` | Snapshot quantities for usage-based line items. This call will snapshot the quantities for all usage based line items in the invoice. This call is only valid in draft.waiting_for_collection status, where the collection period can be skipped using this action. |
|
|
434
438
|
|
|
435
439
|
### Internal Currencies
|
|
436
440
|
|
package/dist/funcs/invoices.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.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
4
|
/**
|
|
5
5
|
* List billing invoices
|
|
6
6
|
*
|
|
@@ -49,3 +49,60 @@ export declare function updateInvoice(client: Client, req: UpdateInvoiceRequest,
|
|
|
49
49
|
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
50
50
|
*/
|
|
51
51
|
export declare function deleteInvoice(client: Client, req: DeleteInvoiceRequest, options?: RequestOptions): Promise<Result<DeleteInvoiceResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Advance billing invoice's next status
|
|
54
|
+
*
|
|
55
|
+
* Advance a billing invoice.
|
|
56
|
+
*
|
|
57
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
58
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
59
|
+
* or issued status can be advanced.
|
|
60
|
+
*
|
|
61
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
62
|
+
*/
|
|
63
|
+
export declare function advanceInvoice(client: Client, req: AdvanceInvoiceRequest, options?: RequestOptions): Promise<Result<AdvanceInvoiceResponse>>;
|
|
64
|
+
/**
|
|
65
|
+
* Send the invoice to the customer
|
|
66
|
+
*
|
|
67
|
+
* Approve a billing invoice.
|
|
68
|
+
*
|
|
69
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
70
|
+
* billing profile app.
|
|
71
|
+
*
|
|
72
|
+
* This call is valid in two invoice statuses:
|
|
73
|
+
*
|
|
74
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
75
|
+
* issued
|
|
76
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
77
|
+
* state becomes issued
|
|
78
|
+
*
|
|
79
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
80
|
+
*/
|
|
81
|
+
export declare function approveInvoice(client: Client, req: ApproveInvoiceRequest, options?: RequestOptions): Promise<Result<ApproveInvoiceResponse>>;
|
|
82
|
+
/**
|
|
83
|
+
* Retry advancing the invoice after a failed attempt
|
|
84
|
+
*
|
|
85
|
+
* Retry sending a billing invoice.
|
|
86
|
+
*
|
|
87
|
+
* Retry advancing the invoice after a failed attempt.
|
|
88
|
+
*
|
|
89
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
90
|
+
* the "retry" action.
|
|
91
|
+
*
|
|
92
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
93
|
+
*/
|
|
94
|
+
export declare function retryInvoice(client: Client, req: RetryInvoiceRequest, options?: RequestOptions): Promise<Result<RetryInvoiceResponse>>;
|
|
95
|
+
/**
|
|
96
|
+
* Snapshot quantities for usage based line items
|
|
97
|
+
*
|
|
98
|
+
* Snapshot quantities for usage-based line items.
|
|
99
|
+
*
|
|
100
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
101
|
+
* invoice.
|
|
102
|
+
*
|
|
103
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
104
|
+
* collection period can be skipped using this action.
|
|
105
|
+
*
|
|
106
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
107
|
+
*/
|
|
108
|
+
export declare function snapshotQuantitiesInvoice(client: Client, req: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<Result<SnapshotQuantitiesInvoiceResponse>>;
|
package/dist/funcs/invoices.js
CHANGED
|
@@ -123,3 +123,132 @@ export function deleteInvoice(client, req, options) {
|
|
|
123
123
|
await http(client).delete(path, options);
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Advance billing invoice's next status
|
|
128
|
+
*
|
|
129
|
+
* Advance a billing invoice.
|
|
130
|
+
*
|
|
131
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
132
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
133
|
+
* or issued status can be advanced.
|
|
134
|
+
*
|
|
135
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
136
|
+
*/
|
|
137
|
+
export function advanceInvoice(client, req, options) {
|
|
138
|
+
return request(() => {
|
|
139
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
140
|
+
if (req.invoiceId === undefined) {
|
|
141
|
+
throw new Error('missing path parameter: invoiceId');
|
|
142
|
+
}
|
|
143
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
144
|
+
})()}/advance`;
|
|
145
|
+
return http(client)
|
|
146
|
+
.post(path, options)
|
|
147
|
+
.json()
|
|
148
|
+
.then((data) => {
|
|
149
|
+
if (client._options.validate) {
|
|
150
|
+
assertValid(schemas.advanceInvoiceResponseWire, data);
|
|
151
|
+
}
|
|
152
|
+
return fromWire(data, schemas.advanceInvoiceResponse);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Send the invoice to the customer
|
|
158
|
+
*
|
|
159
|
+
* Approve a billing invoice.
|
|
160
|
+
*
|
|
161
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
162
|
+
* billing profile app.
|
|
163
|
+
*
|
|
164
|
+
* This call is valid in two invoice statuses:
|
|
165
|
+
*
|
|
166
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
167
|
+
* issued
|
|
168
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
169
|
+
* state becomes issued
|
|
170
|
+
*
|
|
171
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
172
|
+
*/
|
|
173
|
+
export function approveInvoice(client, req, options) {
|
|
174
|
+
return request(() => {
|
|
175
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
176
|
+
if (req.invoiceId === undefined) {
|
|
177
|
+
throw new Error('missing path parameter: invoiceId');
|
|
178
|
+
}
|
|
179
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
180
|
+
})()}/approve`;
|
|
181
|
+
return http(client)
|
|
182
|
+
.post(path, options)
|
|
183
|
+
.json()
|
|
184
|
+
.then((data) => {
|
|
185
|
+
if (client._options.validate) {
|
|
186
|
+
assertValid(schemas.approveInvoiceResponseWire, data);
|
|
187
|
+
}
|
|
188
|
+
return fromWire(data, schemas.approveInvoiceResponse);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Retry advancing the invoice after a failed attempt
|
|
194
|
+
*
|
|
195
|
+
* Retry sending a billing invoice.
|
|
196
|
+
*
|
|
197
|
+
* Retry advancing the invoice after a failed attempt.
|
|
198
|
+
*
|
|
199
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
200
|
+
* the "retry" action.
|
|
201
|
+
*
|
|
202
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
203
|
+
*/
|
|
204
|
+
export function retryInvoice(client, req, options) {
|
|
205
|
+
return request(() => {
|
|
206
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
207
|
+
if (req.invoiceId === undefined) {
|
|
208
|
+
throw new Error('missing path parameter: invoiceId');
|
|
209
|
+
}
|
|
210
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
211
|
+
})()}/retry`;
|
|
212
|
+
return http(client)
|
|
213
|
+
.post(path, options)
|
|
214
|
+
.json()
|
|
215
|
+
.then((data) => {
|
|
216
|
+
if (client._options.validate) {
|
|
217
|
+
assertValid(schemas.retryInvoiceResponseWire, data);
|
|
218
|
+
}
|
|
219
|
+
return fromWire(data, schemas.retryInvoiceResponse);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Snapshot quantities for usage based line items
|
|
225
|
+
*
|
|
226
|
+
* Snapshot quantities for usage-based line items.
|
|
227
|
+
*
|
|
228
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
229
|
+
* invoice.
|
|
230
|
+
*
|
|
231
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
232
|
+
* collection period can be skipped using this action.
|
|
233
|
+
*
|
|
234
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
235
|
+
*/
|
|
236
|
+
export function snapshotQuantitiesInvoice(client, req, options) {
|
|
237
|
+
return request(() => {
|
|
238
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
239
|
+
if (req.invoiceId === undefined) {
|
|
240
|
+
throw new Error('missing path parameter: invoiceId');
|
|
241
|
+
}
|
|
242
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
243
|
+
})()}/snapshot-quantities`;
|
|
244
|
+
return http(client)
|
|
245
|
+
.post(path, options)
|
|
246
|
+
.json()
|
|
247
|
+
.then((data) => {
|
|
248
|
+
if (client._options.validate) {
|
|
249
|
+
assertValid(schemas.snapshotQuantitiesInvoiceResponseWire, data);
|
|
250
|
+
}
|
|
251
|
+
return fromWire(data, schemas.snapshotQuantitiesInvoiceResponse);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
}
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.0-beta-
|
|
1
|
+
export declare const SDK_VERSION = "1.0.0-beta-4aea250406fe";
|
package/dist/lib/version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
// The committed value is a dev placeholder. The publish flow
|
|
3
3
|
// (`make -C api/spec publish-aip-sdk`) stamps the real release version here
|
|
4
4
|
// before `pnpm publish`, after `pnpm version` updates package.json.
|
|
5
|
-
export const SDK_VERSION = '1.0.0-beta-
|
|
5
|
+
export const SDK_VERSION = '1.0.0-beta-4aea250406fe';
|
|
@@ -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;
|