@openmeter/client 1.0.0-beta-637770bdd2e8 → 1.0.0-beta-afebc8f9a2b9
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 +8 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/schemas.d.ts +820 -480
- package/dist/models/schemas.js +194 -12
- package/dist/models/types.d.ts +125 -5
- package/dist/sdk/apps.d.ts +2 -44
- package/dist/sdk/apps.js +1 -53
- package/dist/sdk/internal.d.ts +2 -28
- package/dist/sdk/internal.js +1 -33
- package/dist/sdk/invoices.d.ts +112 -0
- package/dist/sdk/invoices.js +115 -0
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/package.json +1 -1
package/dist/sdk/invoices.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/sdk/invoices.js
CHANGED
|
@@ -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
|
}
|
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?;
|
package/dist/sdk/sdk.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Meters } from './meters.js';
|
|
|
5
5
|
import { Customers } from './customers.js';
|
|
6
6
|
import { Entitlements } from './entitlements.js';
|
|
7
7
|
import { Subscriptions } from './subscriptions.js';
|
|
8
|
+
import { Apps } from './apps.js';
|
|
8
9
|
import { Billing } from './billing.js';
|
|
9
10
|
import { Tax } from './tax.js';
|
|
10
11
|
import { Features } from './features.js';
|
|
@@ -35,6 +36,10 @@ export class OpenMeter extends Client {
|
|
|
35
36
|
get subscriptions() {
|
|
36
37
|
return (this._subscriptions ??= new Subscriptions(this));
|
|
37
38
|
}
|
|
39
|
+
_apps;
|
|
40
|
+
get apps() {
|
|
41
|
+
return (this._apps ??= new Apps(this));
|
|
42
|
+
}
|
|
38
43
|
_billing;
|
|
39
44
|
get billing() {
|
|
40
45
|
return (this._billing ??= new Billing(this));
|