@nirvana-labs/nirvana 1.95.3 → 1.96.0
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/resources/organizations/billing/billing.d.mts +208 -0
- package/resources/organizations/billing/billing.d.mts.map +1 -0
- package/resources/organizations/billing/billing.d.ts +208 -0
- package/resources/organizations/billing/billing.d.ts.map +1 -0
- package/resources/organizations/billing/billing.js +112 -0
- package/resources/organizations/billing/billing.js.map +1 -0
- package/resources/organizations/billing/billing.mjs +107 -0
- package/resources/organizations/billing/billing.mjs.map +1 -0
- package/resources/organizations/billing/index.d.mts +3 -0
- package/resources/organizations/billing/index.d.mts.map +1 -0
- package/resources/organizations/billing/index.d.ts +3 -0
- package/resources/organizations/billing/index.d.ts.map +1 -0
- package/resources/organizations/billing/index.js +9 -0
- package/resources/organizations/billing/index.js.map +1 -0
- package/resources/organizations/billing/index.mjs +4 -0
- package/resources/organizations/billing/index.mjs.map +1 -0
- package/resources/organizations/billing/recharge-policy.d.mts +81 -0
- package/resources/organizations/billing/recharge-policy.d.mts.map +1 -0
- package/resources/organizations/billing/recharge-policy.d.ts +81 -0
- package/resources/organizations/billing/recharge-policy.d.ts.map +1 -0
- package/resources/organizations/billing/recharge-policy.js +45 -0
- package/resources/organizations/billing/recharge-policy.js.map +1 -0
- package/resources/organizations/billing/recharge-policy.mjs +41 -0
- package/resources/organizations/billing/recharge-policy.mjs.map +1 -0
- package/resources/organizations/billing.d.mts +1 -203
- package/resources/organizations/billing.d.mts.map +1 -1
- package/resources/organizations/billing.d.ts +1 -203
- package/resources/organizations/billing.d.ts.map +1 -1
- package/resources/organizations/billing.js +2 -100
- package/resources/organizations/billing.js.map +1 -1
- package/resources/organizations/billing.mjs +1 -98
- package/resources/organizations/billing.mjs.map +1 -1
- package/resources/organizations/index.d.mts +1 -1
- package/resources/organizations/index.d.mts.map +1 -1
- package/resources/organizations/index.d.ts +1 -1
- package/resources/organizations/index.d.ts.map +1 -1
- package/resources/organizations/index.js +2 -2
- package/resources/organizations/index.js.map +1 -1
- package/resources/organizations/index.mjs +1 -1
- package/resources/organizations/index.mjs.map +1 -1
- package/resources/organizations/organizations.d.mts +2 -2
- package/resources/organizations/organizations.d.mts.map +1 -1
- package/resources/organizations/organizations.d.ts +2 -2
- package/resources/organizations/organizations.d.ts.map +1 -1
- package/resources/organizations/organizations.js +2 -2
- package/resources/organizations/organizations.js.map +1 -1
- package/resources/organizations/organizations.mjs +2 -2
- package/resources/organizations/organizations.mjs.map +1 -1
- package/src/resources/organizations/api.md +23 -10
- package/src/resources/organizations/billing/billing.ts +301 -0
- package/src/resources/organizations/billing/index.ts +21 -0
- package/src/resources/organizations/billing/recharge-policy.ts +109 -0
- package/src/resources/organizations/billing.ts +1 -279
- package/src/resources/organizations/index.ts +1 -1
- package/src/resources/organizations/organizations.ts +11 -11
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1,281 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import * as Shared from '../shared';
|
|
5
|
-
import { APIPromise } from '../../core/api-promise';
|
|
6
|
-
import { buildHeaders } from '../../internal/headers';
|
|
7
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
8
|
-
import { path } from '../../internal/utils/path';
|
|
9
|
-
|
|
10
|
-
export class Billing extends APIResource {
|
|
11
|
-
/**
|
|
12
|
-
* Get the organization's billing summary: effective balance, monthly and daily
|
|
13
|
-
* run-rate cost, runway, and the projected next-recharge date. Costs are run-rate
|
|
14
|
-
* projections.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* const organizationBillingSummary =
|
|
19
|
-
* await client.organizations.billing.summary(
|
|
20
|
-
* 'organization_id',
|
|
21
|
-
* );
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
summary(organizationID: string, options?: RequestOptions): APIPromise<Shared.OrganizationBillingSummary> {
|
|
25
|
-
return this._client.get(path`/v1/organizations/${organizationID}/billing/summary`, options);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Get the organization's total usage cost per UTC day over a date range (max 90
|
|
30
|
-
* days), summing open and closed resources. One entry per day, oldest first.
|
|
31
|
-
* Defaults to the last 30 days.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* const organizationDailyCost =
|
|
36
|
-
* await client.organizations.billing.cost(
|
|
37
|
-
* 'organization_id',
|
|
38
|
-
* );
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
cost(
|
|
42
|
-
organizationID: string,
|
|
43
|
-
query: BillingCostParams | null | undefined = {},
|
|
44
|
-
options?: RequestOptions,
|
|
45
|
-
): APIPromise<OrganizationDailyCost> {
|
|
46
|
-
return this._client.get(path`/v1/organizations/${organizationID}/billing/cost`, { query, ...options });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* List the organization's billing history: prepaid credits, top-ups, and manual
|
|
51
|
-
* adjustments, newest first. Paginated with an opaque cursor.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
* const billingHistoryEntryList =
|
|
56
|
-
* await client.organizations.billing.history(
|
|
57
|
-
* 'organization_id',
|
|
58
|
-
* );
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
history(
|
|
62
|
-
organizationID: string,
|
|
63
|
-
query: BillingHistoryParams | null | undefined = {},
|
|
64
|
-
options?: RequestOptions,
|
|
65
|
-
): APIPromise<BillingHistoryEntryList> {
|
|
66
|
-
return this._client.get(path`/v1/organizations/${organizationID}/billing/history`, { query, ...options });
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Charge the card on file and credit the prepaid balance. A unique Idempotency-Key
|
|
71
|
-
* header is required; reuse it across retries so a timed-out top-up is not charged
|
|
72
|
-
* twice.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* const organizationBillingSummary =
|
|
77
|
-
* await client.organizations.billing.topUp(
|
|
78
|
-
* 'organization_id',
|
|
79
|
-
* {
|
|
80
|
-
* amount: '50.00',
|
|
81
|
-
* 'Idempotency-Key': 'Idempotency-Key',
|
|
82
|
-
* },
|
|
83
|
-
* );
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
topUp(
|
|
87
|
-
organizationID: string,
|
|
88
|
-
params: BillingTopUpParams,
|
|
89
|
-
options?: RequestOptions,
|
|
90
|
-
): APIPromise<Shared.OrganizationBillingSummary> {
|
|
91
|
-
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
92
|
-
return this._client.post(path`/v1/organizations/${organizationID}/billing/topup`, {
|
|
93
|
-
body,
|
|
94
|
-
...options,
|
|
95
|
-
headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Charge the card on file up to the recharge target now instead of waiting for the
|
|
101
|
-
* scheduled retry. Automatic-policy prepaid organizations only. Idempotency-Key
|
|
102
|
-
* header required.
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```ts
|
|
106
|
-
* const organizationBillingSummary =
|
|
107
|
-
* await client.organizations.billing.recharge(
|
|
108
|
-
* 'organization_id',
|
|
109
|
-
* { 'Idempotency-Key': 'Idempotency-Key' },
|
|
110
|
-
* );
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
recharge(
|
|
114
|
-
organizationID: string,
|
|
115
|
-
params: BillingRechargeParams,
|
|
116
|
-
options?: RequestOptions,
|
|
117
|
-
): APIPromise<Shared.OrganizationBillingSummary> {
|
|
118
|
-
const { 'Idempotency-Key': idempotencyKey } = params;
|
|
119
|
-
return this._client.post(path`/v1/organizations/${organizationID}/billing/recharge`, {
|
|
120
|
-
...options,
|
|
121
|
-
headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* A single billing history line item: a prepaid credit or a manual adjustment.
|
|
128
|
-
*/
|
|
129
|
-
export interface BillingHistoryEntry {
|
|
130
|
-
/**
|
|
131
|
-
* Unique identifier for the entry.
|
|
132
|
-
*/
|
|
133
|
-
id: string;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Arbitrary-precision decimal serialized as a string (e.g. "58.40").
|
|
137
|
-
*/
|
|
138
|
-
amount: string;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* When the entry was recorded.
|
|
142
|
-
*/
|
|
143
|
-
created_at: string;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* ISO 4217 currency code.
|
|
147
|
-
*/
|
|
148
|
-
currency: string;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Kind of entry.
|
|
152
|
-
*/
|
|
153
|
-
type: BillingHistoryEntryType;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Human-readable note describing the entry, when available.
|
|
157
|
-
*/
|
|
158
|
-
description?: string | null;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Link to the hosted receipt for the payment behind this entry, when one is
|
|
162
|
-
* available. Present for prepaid credits funded by a card charge; absent for
|
|
163
|
-
* manual adjustments and while a payment's receipt is still being finalized.
|
|
164
|
-
*/
|
|
165
|
-
receipt_url?: string | null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface BillingHistoryEntryList {
|
|
169
|
-
items: Array<BillingHistoryEntry>;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Pagination response details.
|
|
173
|
-
*/
|
|
174
|
-
pagination: Shared.Pagination;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Kind of entry.
|
|
179
|
-
*/
|
|
180
|
-
export type BillingHistoryEntryType = 'grant' | 'adjustment';
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Total usage cost for a single UTC day.
|
|
184
|
-
*/
|
|
185
|
-
export interface DailyCostPoint {
|
|
186
|
-
/**
|
|
187
|
-
* Arbitrary-precision decimal serialized as a string (e.g. "58.40").
|
|
188
|
-
*/
|
|
189
|
-
cost: string;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* UTC calendar day (YYYY-MM-DD).
|
|
193
|
-
*/
|
|
194
|
-
date: string;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Daily usage cost over a date range: one entry per UTC day (zero on idle days),
|
|
199
|
-
* summing open and closed resources. Suitable for a daily cost bar chart.
|
|
200
|
-
*/
|
|
201
|
-
export interface OrganizationDailyCost {
|
|
202
|
-
/**
|
|
203
|
-
* ISO 4217 currency code.
|
|
204
|
-
*/
|
|
205
|
-
currency: string;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* One entry per UTC day in the range, oldest first.
|
|
209
|
-
*/
|
|
210
|
-
days: Array<DailyCostPoint>;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Inclusive start of the range, as a UTC calendar day (YYYY-MM-DD).
|
|
214
|
-
*/
|
|
215
|
-
from: string;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Inclusive end of the range, as a UTC calendar day (YYYY-MM-DD).
|
|
219
|
-
*/
|
|
220
|
-
to: string;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface BillingCostParams {
|
|
224
|
-
/**
|
|
225
|
-
* Inclusive start day, YYYY-MM-DD (UTC). Defaults to 30 days before to.
|
|
226
|
-
*/
|
|
227
|
-
from?: string;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Inclusive end day, YYYY-MM-DD (UTC). Defaults to today.
|
|
231
|
-
*/
|
|
232
|
-
to?: string;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export interface BillingHistoryParams {
|
|
236
|
-
/**
|
|
237
|
-
* Pagination cursor returned by a previous request
|
|
238
|
-
*/
|
|
239
|
-
cursor?: string;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Maximum number of items to return
|
|
243
|
-
*/
|
|
244
|
-
limit?: number;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface BillingTopUpParams {
|
|
248
|
-
/**
|
|
249
|
-
* Body param: Amount to charge and credit, in USD. Must be greater than 0, at most
|
|
250
|
-
* two decimal places, and at most 10000.
|
|
251
|
-
*/
|
|
252
|
-
amount: string;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Header param: Unique idempotency key scoping the charge; reuse the same value
|
|
256
|
-
* across retries so a timed-out top-up is not charged twice
|
|
257
|
-
*/
|
|
258
|
-
'Idempotency-Key': string;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export interface BillingRechargeParams {
|
|
262
|
-
/**
|
|
263
|
-
* Idempotency key scoping one charge attempt; reuse to retry it, but use a fresh
|
|
264
|
-
* key for a new attempt (e.g. after updating a declined card)
|
|
265
|
-
*/
|
|
266
|
-
'Idempotency-Key': string;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export declare namespace Billing {
|
|
270
|
-
export {
|
|
271
|
-
type BillingHistoryEntry as BillingHistoryEntry,
|
|
272
|
-
type BillingHistoryEntryList as BillingHistoryEntryList,
|
|
273
|
-
type BillingHistoryEntryType as BillingHistoryEntryType,
|
|
274
|
-
type DailyCostPoint as DailyCostPoint,
|
|
275
|
-
type OrganizationDailyCost as OrganizationDailyCost,
|
|
276
|
-
type BillingCostParams as BillingCostParams,
|
|
277
|
-
type BillingHistoryParams as BillingHistoryParams,
|
|
278
|
-
type BillingTopUpParams as BillingTopUpParams,
|
|
279
|
-
type BillingRechargeParams as BillingRechargeParams,
|
|
280
|
-
};
|
|
281
|
-
}
|
|
3
|
+
export * from './billing/index';
|
|
@@ -4,7 +4,16 @@ import { APIResource } from '../../core/resource';
|
|
|
4
4
|
import * as Shared from '../shared';
|
|
5
5
|
import * as AddressAPI from './address';
|
|
6
6
|
import { Address, AddressCreateParams, AddressUpdateParams, OrganizationAddress } from './address';
|
|
7
|
-
import * as
|
|
7
|
+
import * as MembershipsAPI from './memberships';
|
|
8
|
+
import {
|
|
9
|
+
MembershipGetParams,
|
|
10
|
+
MembershipListParams,
|
|
11
|
+
Memberships,
|
|
12
|
+
OrganizationMembership,
|
|
13
|
+
OrganizationMembershipList,
|
|
14
|
+
OrganizationMembershipsCursor,
|
|
15
|
+
} from './memberships';
|
|
16
|
+
import * as BillingAPI from './billing/billing';
|
|
8
17
|
import {
|
|
9
18
|
Billing,
|
|
10
19
|
BillingCostParams,
|
|
@@ -16,16 +25,7 @@ import {
|
|
|
16
25
|
BillingTopUpParams,
|
|
17
26
|
DailyCostPoint,
|
|
18
27
|
OrganizationDailyCost,
|
|
19
|
-
} from './billing';
|
|
20
|
-
import * as MembershipsAPI from './memberships';
|
|
21
|
-
import {
|
|
22
|
-
MembershipGetParams,
|
|
23
|
-
MembershipListParams,
|
|
24
|
-
Memberships,
|
|
25
|
-
OrganizationMembership,
|
|
26
|
-
OrganizationMembershipList,
|
|
27
|
-
OrganizationMembershipsCursor,
|
|
28
|
-
} from './memberships';
|
|
28
|
+
} from './billing/billing';
|
|
29
29
|
import { APIPromise } from '../../core/api-promise';
|
|
30
30
|
import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
|
|
31
31
|
import { buildHeaders } from '../../internal/headers';
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.96.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.96.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.96.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.96.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|