@stigg/typescript 0.1.0-beta.60 → 0.1.0-beta.62
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 +46 -0
- package/package.json +1 -1
- package/resources/v1/addons/addons.d.mts +1 -1
- package/resources/v1/addons/addons.d.ts +1 -1
- package/resources/v1/credits/credits.d.mts +77 -2
- package/resources/v1/credits/credits.d.mts.map +1 -1
- package/resources/v1/credits/credits.d.ts +77 -2
- package/resources/v1/credits/credits.d.ts.map +1 -1
- package/resources/v1/credits/credits.js +4 -0
- package/resources/v1/credits/credits.js.map +1 -1
- package/resources/v1/credits/credits.mjs +4 -0
- package/resources/v1/credits/credits.mjs.map +1 -1
- package/resources/v1/credits/index.d.mts +1 -0
- package/resources/v1/credits/index.d.mts.map +1 -1
- package/resources/v1/credits/index.d.ts +1 -0
- package/resources/v1/credits/index.d.ts.map +1 -1
- package/resources/v1/credits/index.js +3 -1
- package/resources/v1/credits/index.js.map +1 -1
- package/resources/v1/credits/index.mjs +1 -0
- package/resources/v1/credits/index.mjs.map +1 -1
- package/resources/v1/credits/reservations.d.mts +128 -0
- package/resources/v1/credits/reservations.d.mts.map +1 -0
- package/resources/v1/credits/reservations.d.ts +128 -0
- package/resources/v1/credits/reservations.d.ts.map +1 -0
- package/resources/v1/credits/reservations.js +30 -0
- package/resources/v1/credits/reservations.js.map +1 -0
- package/resources/v1/credits/reservations.mjs +26 -0
- package/resources/v1/credits/reservations.mjs.map +1 -0
- package/resources/v1/customers/customers.d.mts +103 -0
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +103 -0
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/plans/plans.d.mts +1 -1
- package/resources/v1/plans/plans.d.ts +1 -1
- package/resources/v1/subscriptions/subscriptions.d.mts +39 -0
- package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.d.ts +39 -0
- package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.js.map +1 -1
- package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
- package/resources/v1/usage.d.mts +8 -7
- package/resources/v1/usage.d.mts.map +1 -1
- package/resources/v1/usage.d.ts +8 -7
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1-beta/customers/entitlements.d.mts +39 -0
- package/resources/v1-beta/customers/entitlements.d.mts.map +1 -1
- package/resources/v1-beta/customers/entitlements.d.ts +39 -0
- package/resources/v1-beta/customers/entitlements.d.ts.map +1 -1
- package/resources/v2/usage.d.mts +4 -3
- package/resources/v2/usage.d.mts.map +1 -1
- package/resources/v2/usage.d.ts +4 -3
- package/resources/v2/usage.d.ts.map +1 -1
- package/src/resources/v1/addons/addons.ts +1 -1
- package/src/resources/v1/credits/credits.ts +109 -2
- package/src/resources/v1/credits/index.ts +1 -0
- package/src/resources/v1/credits/reservations.ts +172 -0
- package/src/resources/v1/customers/customers.ts +122 -0
- package/src/resources/v1/plans/plans.ts +1 -1
- package/src/resources/v1/subscriptions/subscriptions.ts +46 -0
- package/src/resources/v1/usage.ts +8 -7
- package/src/resources/v1-beta/customers/entitlements.ts +46 -0
- package/src/resources/v2/usage.ts +4 -3
- 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
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
4
|
+
export declare class Reservations extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Releases a credit reservation, consuming the given amount and returning the rest
|
|
7
|
+
* of the held credits to the balance. Retry a failed release with the same
|
|
8
|
+
* reservation ID; it is applied once.
|
|
9
|
+
*/
|
|
10
|
+
release(reservationID: string, params: ReservationReleaseParams, options?: RequestOptions): APIPromise<ReservationReleaseResponse>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Response object
|
|
14
|
+
*/
|
|
15
|
+
export interface ReservationReleaseResponse {
|
|
16
|
+
/**
|
|
17
|
+
* Result of releasing a credit reservation
|
|
18
|
+
*/
|
|
19
|
+
data: ReservationReleaseResponse.Data;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace ReservationReleaseResponse {
|
|
22
|
+
/**
|
|
23
|
+
* Result of releasing a credit reservation
|
|
24
|
+
*/
|
|
25
|
+
interface Data {
|
|
26
|
+
/**
|
|
27
|
+
* The optimistic credit balance after the release
|
|
28
|
+
*/
|
|
29
|
+
credit: Data.Credit | null;
|
|
30
|
+
/**
|
|
31
|
+
* The released reservation
|
|
32
|
+
*/
|
|
33
|
+
reservation: Data.Reservation;
|
|
34
|
+
}
|
|
35
|
+
namespace Data {
|
|
36
|
+
/**
|
|
37
|
+
* The optimistic credit balance after the release
|
|
38
|
+
*/
|
|
39
|
+
interface Credit {
|
|
40
|
+
/**
|
|
41
|
+
* The credit currency identifier
|
|
42
|
+
*/
|
|
43
|
+
currencyId: string;
|
|
44
|
+
/**
|
|
45
|
+
* The wallet's total consumed credits for this currency (optimistic — includes
|
|
46
|
+
* not-yet-reconciled usage), shared across every feature that draws on the
|
|
47
|
+
* currency. This is the running balance, not this call's deduction — see
|
|
48
|
+
* `consumed` for that.
|
|
49
|
+
*/
|
|
50
|
+
currentUsage: number;
|
|
51
|
+
/**
|
|
52
|
+
* The grant-version timestamp of this balance, used by the SDK for last-write-wins
|
|
53
|
+
* reconciliation
|
|
54
|
+
*/
|
|
55
|
+
timestamp: string;
|
|
56
|
+
/**
|
|
57
|
+
* The total credits granted
|
|
58
|
+
*/
|
|
59
|
+
usageLimit: number;
|
|
60
|
+
/**
|
|
61
|
+
* End of the current credit grant period (when recurring credits reset), if
|
|
62
|
+
* applicable
|
|
63
|
+
*/
|
|
64
|
+
usagePeriodEnd?: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The released reservation
|
|
68
|
+
*/
|
|
69
|
+
interface Reservation {
|
|
70
|
+
/**
|
|
71
|
+
* The client-provided reservation ID.
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
/**
|
|
75
|
+
* The amount of credits held.
|
|
76
|
+
*/
|
|
77
|
+
amount: number;
|
|
78
|
+
/**
|
|
79
|
+
* The amount consumed at release
|
|
80
|
+
*/
|
|
81
|
+
consumedAmount: number | null;
|
|
82
|
+
/**
|
|
83
|
+
* When the reservation expires. Unreleased credits return to the balance at this
|
|
84
|
+
* time.
|
|
85
|
+
*/
|
|
86
|
+
expiresAt: string;
|
|
87
|
+
/**
|
|
88
|
+
* The status of the reservation.
|
|
89
|
+
*/
|
|
90
|
+
status: 'ACTIVE' | 'RELEASED';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export interface ReservationReleaseParams {
|
|
95
|
+
/**
|
|
96
|
+
* Body param: The amount of credits to consume at release. Up to the reserved
|
|
97
|
+
* amount is charged to the credits that backed the reservation; the rest returns
|
|
98
|
+
* to the balance, and any amount above the reservation is consumed normally.
|
|
99
|
+
*/
|
|
100
|
+
consumedAmount: number;
|
|
101
|
+
/**
|
|
102
|
+
* Body param: The credit currency of the reservation
|
|
103
|
+
*/
|
|
104
|
+
currencyId: string;
|
|
105
|
+
/**
|
|
106
|
+
* Body param: The customer the reservation was made for
|
|
107
|
+
*/
|
|
108
|
+
customerId: string;
|
|
109
|
+
/**
|
|
110
|
+
* Body param: The resource the reservation was made for, if any
|
|
111
|
+
*/
|
|
112
|
+
resourceId?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Header param: Account ID — optional when authenticating with a user JWT (Bearer
|
|
115
|
+
* token); falls back to the user's first membership. Ignored for API-key auth.
|
|
116
|
+
*/
|
|
117
|
+
'X-ACCOUNT-ID'?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Header param: Environment ID — required when authenticating with a user JWT
|
|
120
|
+
* (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
|
|
121
|
+
* intrinsic to the key).
|
|
122
|
+
*/
|
|
123
|
+
'X-ENVIRONMENT-ID'?: string;
|
|
124
|
+
}
|
|
125
|
+
export declare namespace Reservations {
|
|
126
|
+
export { type ReservationReleaseResponse as ReservationReleaseResponse, type ReservationReleaseParams as ReservationReleaseParams, };
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=reservations.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservations.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/credits/reservations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,mCAA+B;AACrD,OAAO,EAAE,UAAU,EAAE,sCAAkC;AAEvD,OAAO,EAAE,cAAc,EAAE,8CAA0C;AAGnE,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;OAIG;IACH,OAAO,CACL,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,0BAA0B,CAAC;CAc1C;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,0BAA0B,CAAC,IAAI,CAAC;CACvC;AAED,yBAAiB,0BAA0B,CAAC;IAC1C;;OAEG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAE3B;;WAEG;QACH,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC;KAC/B;IAED,UAAiB,IAAI,CAAC;QACpB;;WAEG;QACH,UAAiB,MAAM;YACrB;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YAEnB;;;;;eAKG;YACH,YAAY,EAAE,MAAM,CAAC;YAErB;;;eAGG;YACH,SAAS,EAAE,MAAM,CAAC;YAElB;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YAEnB;;;eAGG;YACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SAChC;QAED;;WAEG;QACH,UAAiB,WAAW;YAC1B;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YAEX;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YAEf;;eAEG;YACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;YAE9B;;;eAGG;YACH,SAAS,EAAE,MAAM,CAAC;YAElB;;eAEG;YACH,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;SAC/B;KACF;CACF;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
4
|
+
export declare class Reservations extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Releases a credit reservation, consuming the given amount and returning the rest
|
|
7
|
+
* of the held credits to the balance. Retry a failed release with the same
|
|
8
|
+
* reservation ID; it is applied once.
|
|
9
|
+
*/
|
|
10
|
+
release(reservationID: string, params: ReservationReleaseParams, options?: RequestOptions): APIPromise<ReservationReleaseResponse>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Response object
|
|
14
|
+
*/
|
|
15
|
+
export interface ReservationReleaseResponse {
|
|
16
|
+
/**
|
|
17
|
+
* Result of releasing a credit reservation
|
|
18
|
+
*/
|
|
19
|
+
data: ReservationReleaseResponse.Data;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace ReservationReleaseResponse {
|
|
22
|
+
/**
|
|
23
|
+
* Result of releasing a credit reservation
|
|
24
|
+
*/
|
|
25
|
+
interface Data {
|
|
26
|
+
/**
|
|
27
|
+
* The optimistic credit balance after the release
|
|
28
|
+
*/
|
|
29
|
+
credit: Data.Credit | null;
|
|
30
|
+
/**
|
|
31
|
+
* The released reservation
|
|
32
|
+
*/
|
|
33
|
+
reservation: Data.Reservation;
|
|
34
|
+
}
|
|
35
|
+
namespace Data {
|
|
36
|
+
/**
|
|
37
|
+
* The optimistic credit balance after the release
|
|
38
|
+
*/
|
|
39
|
+
interface Credit {
|
|
40
|
+
/**
|
|
41
|
+
* The credit currency identifier
|
|
42
|
+
*/
|
|
43
|
+
currencyId: string;
|
|
44
|
+
/**
|
|
45
|
+
* The wallet's total consumed credits for this currency (optimistic — includes
|
|
46
|
+
* not-yet-reconciled usage), shared across every feature that draws on the
|
|
47
|
+
* currency. This is the running balance, not this call's deduction — see
|
|
48
|
+
* `consumed` for that.
|
|
49
|
+
*/
|
|
50
|
+
currentUsage: number;
|
|
51
|
+
/**
|
|
52
|
+
* The grant-version timestamp of this balance, used by the SDK for last-write-wins
|
|
53
|
+
* reconciliation
|
|
54
|
+
*/
|
|
55
|
+
timestamp: string;
|
|
56
|
+
/**
|
|
57
|
+
* The total credits granted
|
|
58
|
+
*/
|
|
59
|
+
usageLimit: number;
|
|
60
|
+
/**
|
|
61
|
+
* End of the current credit grant period (when recurring credits reset), if
|
|
62
|
+
* applicable
|
|
63
|
+
*/
|
|
64
|
+
usagePeriodEnd?: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The released reservation
|
|
68
|
+
*/
|
|
69
|
+
interface Reservation {
|
|
70
|
+
/**
|
|
71
|
+
* The client-provided reservation ID.
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
/**
|
|
75
|
+
* The amount of credits held.
|
|
76
|
+
*/
|
|
77
|
+
amount: number;
|
|
78
|
+
/**
|
|
79
|
+
* The amount consumed at release
|
|
80
|
+
*/
|
|
81
|
+
consumedAmount: number | null;
|
|
82
|
+
/**
|
|
83
|
+
* When the reservation expires. Unreleased credits return to the balance at this
|
|
84
|
+
* time.
|
|
85
|
+
*/
|
|
86
|
+
expiresAt: string;
|
|
87
|
+
/**
|
|
88
|
+
* The status of the reservation.
|
|
89
|
+
*/
|
|
90
|
+
status: 'ACTIVE' | 'RELEASED';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export interface ReservationReleaseParams {
|
|
95
|
+
/**
|
|
96
|
+
* Body param: The amount of credits to consume at release. Up to the reserved
|
|
97
|
+
* amount is charged to the credits that backed the reservation; the rest returns
|
|
98
|
+
* to the balance, and any amount above the reservation is consumed normally.
|
|
99
|
+
*/
|
|
100
|
+
consumedAmount: number;
|
|
101
|
+
/**
|
|
102
|
+
* Body param: The credit currency of the reservation
|
|
103
|
+
*/
|
|
104
|
+
currencyId: string;
|
|
105
|
+
/**
|
|
106
|
+
* Body param: The customer the reservation was made for
|
|
107
|
+
*/
|
|
108
|
+
customerId: string;
|
|
109
|
+
/**
|
|
110
|
+
* Body param: The resource the reservation was made for, if any
|
|
111
|
+
*/
|
|
112
|
+
resourceId?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Header param: Account ID — optional when authenticating with a user JWT (Bearer
|
|
115
|
+
* token); falls back to the user's first membership. Ignored for API-key auth.
|
|
116
|
+
*/
|
|
117
|
+
'X-ACCOUNT-ID'?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Header param: Environment ID — required when authenticating with a user JWT
|
|
120
|
+
* (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
|
|
121
|
+
* intrinsic to the key).
|
|
122
|
+
*/
|
|
123
|
+
'X-ENVIRONMENT-ID'?: string;
|
|
124
|
+
}
|
|
125
|
+
export declare namespace Reservations {
|
|
126
|
+
export { type ReservationReleaseResponse as ReservationReleaseResponse, type ReservationReleaseParams as ReservationReleaseParams, };
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=reservations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservations.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/credits/reservations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,kCAA+B;AACrD,OAAO,EAAE,UAAU,EAAE,qCAAkC;AAEvD,OAAO,EAAE,cAAc,EAAE,6CAA0C;AAGnE,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;OAIG;IACH,OAAO,CACL,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,0BAA0B,CAAC;CAc1C;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,0BAA0B,CAAC,IAAI,CAAC;CACvC;AAED,yBAAiB,0BAA0B,CAAC;IAC1C;;OAEG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAE3B;;WAEG;QACH,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC;KAC/B;IAED,UAAiB,IAAI,CAAC;QACpB;;WAEG;QACH,UAAiB,MAAM;YACrB;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YAEnB;;;;;eAKG;YACH,YAAY,EAAE,MAAM,CAAC;YAErB;;;eAGG;YACH,SAAS,EAAE,MAAM,CAAC;YAElB;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YAEnB;;;eAGG;YACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SAChC;QAED;;WAEG;QACH,UAAiB,WAAW;YAC1B;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YAEX;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YAEf;;eAEG;YACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;YAE9B;;;eAGG;YACH,SAAS,EAAE,MAAM,CAAC;YAElB;;eAEG;YACH,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;SAC/B;KACF;CACF;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Reservations = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../../internal/headers.js");
|
|
7
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
8
|
+
class Reservations extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Releases a credit reservation, consuming the given amount and returning the rest
|
|
11
|
+
* of the held credits to the balance. Retry a failed release with the same
|
|
12
|
+
* reservation ID; it is applied once.
|
|
13
|
+
*/
|
|
14
|
+
release(reservationID, params, options) {
|
|
15
|
+
const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
|
|
16
|
+
return this._client.post((0, path_1.path) `/api/v1/credits/reservations/${reservationID}/release`, {
|
|
17
|
+
body,
|
|
18
|
+
...options,
|
|
19
|
+
headers: (0, headers_1.buildHeaders)([
|
|
20
|
+
{
|
|
21
|
+
...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
|
|
22
|
+
...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
|
|
23
|
+
},
|
|
24
|
+
options?.headers,
|
|
25
|
+
]),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Reservations = Reservations;
|
|
30
|
+
//# sourceMappingURL=reservations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservations.js","sourceRoot":"","sources":["../../../src/resources/v1/credits/reservations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAErD,0DAAyD;AAEzD,0DAAoD;AAEpD,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;OAIG;IACH,OAAO,CACL,aAAqB,EACrB,MAAgC,EAChC,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC3F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gCAAgC,aAAa,UAAU,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBACpE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACjF;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AAxBD,oCAwBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../../internal/utils/path.mjs";
|
|
5
|
+
export class Reservations extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Releases a credit reservation, consuming the given amount and returning the rest
|
|
8
|
+
* of the held credits to the balance. Retry a failed release with the same
|
|
9
|
+
* reservation ID; it is applied once.
|
|
10
|
+
*/
|
|
11
|
+
release(reservationID, params, options) {
|
|
12
|
+
const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
|
|
13
|
+
return this._client.post(path `/api/v1/credits/reservations/${reservationID}/release`, {
|
|
14
|
+
body,
|
|
15
|
+
...options,
|
|
16
|
+
headers: buildHeaders([
|
|
17
|
+
{
|
|
18
|
+
...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
|
|
19
|
+
...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
|
|
20
|
+
},
|
|
21
|
+
options?.headers,
|
|
22
|
+
]),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=reservations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservations.mjs","sourceRoot":"","sources":["../../../src/resources/v1/credits/reservations.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,mCAA+B;AAErD,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAEzD,OAAO,EAAE,IAAI,EAAE,yCAAqC;AAEpD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;OAIG;IACH,OAAO,CACL,aAAqB,EACrB,MAAgC,EAChC,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC3F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gCAAgC,aAAa,UAAU,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB;oBACE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBACpE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACjF;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -882,6 +882,22 @@ export declare namespace CustomerCheckEntitlementResponse {
|
|
|
882
882
|
* Timestamp of the last update to the entitlement grant or configuration.
|
|
883
883
|
*/
|
|
884
884
|
entitlementUpdatedAt?: string;
|
|
885
|
+
/**
|
|
886
|
+
* The reservation created by this request, when it asked to reserve credits and
|
|
887
|
+
* was granted.
|
|
888
|
+
*/
|
|
889
|
+
reservation?: Credit.Reservation | null;
|
|
890
|
+
/**
|
|
891
|
+
* Credits held by open reservations on active grants. Already included in
|
|
892
|
+
* currentUsage, so usageLimit - currentUsage is the available balance.
|
|
893
|
+
*/
|
|
894
|
+
reserved?: number;
|
|
895
|
+
/**
|
|
896
|
+
* Credits still held by open reservations on grants that expired during the hold.
|
|
897
|
+
* They can still be released, but are not part of currentUsage or the balance and
|
|
898
|
+
* must not be subtracted from it.
|
|
899
|
+
*/
|
|
900
|
+
reservedOnExpiredGrants?: number;
|
|
885
901
|
/**
|
|
886
902
|
* The end date of the current billing period for recurring credit grants.
|
|
887
903
|
*/
|
|
@@ -923,6 +939,29 @@ export declare namespace CustomerCheckEntitlementResponse {
|
|
|
923
939
|
*/
|
|
924
940
|
unitSingular?: string | null;
|
|
925
941
|
}
|
|
942
|
+
/**
|
|
943
|
+
* The reservation created by this request, when it asked to reserve credits and
|
|
944
|
+
* was granted.
|
|
945
|
+
*/
|
|
946
|
+
interface Reservation {
|
|
947
|
+
/**
|
|
948
|
+
* The client-provided reservation ID.
|
|
949
|
+
*/
|
|
950
|
+
id: string;
|
|
951
|
+
/**
|
|
952
|
+
* The amount of credits held.
|
|
953
|
+
*/
|
|
954
|
+
amount: number;
|
|
955
|
+
/**
|
|
956
|
+
* When the reservation expires. Unreleased credits return to the balance at this
|
|
957
|
+
* time.
|
|
958
|
+
*/
|
|
959
|
+
expiresAt: string;
|
|
960
|
+
/**
|
|
961
|
+
* The status of the reservation.
|
|
962
|
+
*/
|
|
963
|
+
status: 'ACTIVE' | 'RELEASED';
|
|
964
|
+
}
|
|
926
965
|
}
|
|
927
966
|
}
|
|
928
967
|
/**
|
|
@@ -1340,6 +1379,22 @@ export declare namespace CustomerRetrieveEntitlementsResponse {
|
|
|
1340
1379
|
* Timestamp of the last update to the entitlement grant or configuration.
|
|
1341
1380
|
*/
|
|
1342
1381
|
entitlementUpdatedAt?: string;
|
|
1382
|
+
/**
|
|
1383
|
+
* The reservation created by this request, when it asked to reserve credits and
|
|
1384
|
+
* was granted.
|
|
1385
|
+
*/
|
|
1386
|
+
reservation?: Credit.Reservation | null;
|
|
1387
|
+
/**
|
|
1388
|
+
* Credits held by open reservations on active grants. Already included in
|
|
1389
|
+
* currentUsage, so usageLimit - currentUsage is the available balance.
|
|
1390
|
+
*/
|
|
1391
|
+
reserved?: number;
|
|
1392
|
+
/**
|
|
1393
|
+
* Credits still held by open reservations on grants that expired during the hold.
|
|
1394
|
+
* They can still be released, but are not part of currentUsage or the balance and
|
|
1395
|
+
* must not be subtracted from it.
|
|
1396
|
+
*/
|
|
1397
|
+
reservedOnExpiredGrants?: number;
|
|
1343
1398
|
/**
|
|
1344
1399
|
* The end date of the current billing period for recurring credit grants.
|
|
1345
1400
|
*/
|
|
@@ -1381,6 +1436,29 @@ export declare namespace CustomerRetrieveEntitlementsResponse {
|
|
|
1381
1436
|
*/
|
|
1382
1437
|
unitSingular?: string | null;
|
|
1383
1438
|
}
|
|
1439
|
+
/**
|
|
1440
|
+
* The reservation created by this request, when it asked to reserve credits and
|
|
1441
|
+
* was granted.
|
|
1442
|
+
*/
|
|
1443
|
+
interface Reservation {
|
|
1444
|
+
/**
|
|
1445
|
+
* The client-provided reservation ID.
|
|
1446
|
+
*/
|
|
1447
|
+
id: string;
|
|
1448
|
+
/**
|
|
1449
|
+
* The amount of credits held.
|
|
1450
|
+
*/
|
|
1451
|
+
amount: number;
|
|
1452
|
+
/**
|
|
1453
|
+
* When the reservation expires. Unreleased credits return to the balance at this
|
|
1454
|
+
* time.
|
|
1455
|
+
*/
|
|
1456
|
+
expiresAt: string;
|
|
1457
|
+
/**
|
|
1458
|
+
* The status of the reservation.
|
|
1459
|
+
*/
|
|
1460
|
+
status: 'ACTIVE' | 'RELEASED';
|
|
1461
|
+
}
|
|
1384
1462
|
}
|
|
1385
1463
|
}
|
|
1386
1464
|
}
|
|
@@ -1743,6 +1821,31 @@ export interface CustomerCheckEntitlementParams {
|
|
|
1743
1821
|
* only)
|
|
1744
1822
|
*/
|
|
1745
1823
|
requestedValues?: Array<string>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Query param: When the reservation expires (ISO 8601, at most 24 hours ahead).
|
|
1826
|
+
* Mutually exclusive with `reservationTtlSeconds`.
|
|
1827
|
+
*/
|
|
1828
|
+
reservationExpiresAt?: string;
|
|
1829
|
+
/**
|
|
1830
|
+
* Query param: Client-provided reservation ID, required with `reserveAmount`.
|
|
1831
|
+
* Retry with the same ID to get the same result; reuse with different parameters
|
|
1832
|
+
* is a conflict.
|
|
1833
|
+
*/
|
|
1834
|
+
reservationId?: string;
|
|
1835
|
+
/**
|
|
1836
|
+
* Query param: JSON-encoded object of string values to attach to the reservation.
|
|
1837
|
+
*/
|
|
1838
|
+
reservationMetadata?: string;
|
|
1839
|
+
/**
|
|
1840
|
+
* Query param: How long the reservation holds the credits, in seconds (1–86400,
|
|
1841
|
+
* default 3600). Mutually exclusive with `reservationExpiresAt`.
|
|
1842
|
+
*/
|
|
1843
|
+
reservationTtlSeconds?: number;
|
|
1844
|
+
/**
|
|
1845
|
+
* Query param: Credits to reserve (credit entitlements only). The check is decided
|
|
1846
|
+
* and the credits held atomically; `requestedUsage` is ignored.
|
|
1847
|
+
*/
|
|
1848
|
+
reserveAmount?: number;
|
|
1746
1849
|
/**
|
|
1747
1850
|
* Query param: Resource ID to scope the entitlement check to a specific resource
|
|
1748
1851
|
*/
|