@stigg/typescript 0.1.0-alpha.3 → 0.1.0-alpha.7
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 +61 -0
- package/README.md +9 -0
- package/client.d.mts +6 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -8
- package/client.d.ts.map +1 -1
- package/client.js +16 -21
- package/client.js.map +1 -1
- package/client.mjs +17 -22
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/v1/coupons.d.mts +55 -96
- package/resources/v1/coupons.d.mts.map +1 -1
- package/resources/v1/coupons.d.ts +55 -96
- package/resources/v1/coupons.d.ts.map +1 -1
- package/resources/v1/coupons.js +4 -3
- package/resources/v1/coupons.js.map +1 -1
- package/resources/v1/coupons.mjs +4 -3
- package/resources/v1/coupons.mjs.map +1 -1
- package/resources/v1/customers/customers.d.mts +170 -46
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +170 -46
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +32 -15
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +32 -15
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/index.d.mts +2 -2
- package/resources/v1/customers/index.d.mts.map +1 -1
- package/resources/v1/customers/index.d.ts +2 -2
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js +3 -3
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs +1 -1
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/payment-method.d.mts +4 -2
- package/resources/v1/customers/payment-method.d.mts.map +1 -1
- package/resources/v1/customers/payment-method.d.ts +4 -2
- package/resources/v1/customers/payment-method.d.ts.map +1 -1
- package/resources/v1/customers/payment-method.js +4 -2
- package/resources/v1/customers/payment-method.js.map +1 -1
- package/resources/v1/customers/payment-method.mjs +4 -2
- package/resources/v1/customers/payment-method.mjs.map +1 -1
- package/resources/v1/customers/promotional-entitlements.d.mts +352 -0
- package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
- package/resources/v1/customers/promotional-entitlements.d.ts +352 -0
- package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
- package/resources/v1/customers/promotional-entitlements.js +25 -0
- package/resources/v1/customers/promotional-entitlements.js.map +1 -0
- package/resources/v1/customers/promotional-entitlements.mjs +21 -0
- package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
- package/resources/v1/events.d.mts +63 -0
- package/resources/v1/events.d.mts.map +1 -0
- package/resources/v1/events.d.ts +63 -0
- package/resources/v1/events.d.ts.map +1 -0
- package/resources/v1/events.js +16 -0
- package/resources/v1/events.js.map +1 -0
- package/resources/v1/events.mjs +12 -0
- package/resources/v1/events.mjs.map +1 -0
- package/resources/v1/index.d.mts +7 -4
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +7 -4
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +7 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +4 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/products.d.mts +126 -0
- package/resources/v1/products.d.mts.map +1 -0
- package/resources/v1/products.d.ts +126 -0
- package/resources/v1/products.d.ts.map +1 -0
- package/resources/v1/products.js +19 -0
- package/resources/v1/products.js.map +1 -0
- package/resources/v1/products.mjs +15 -0
- package/resources/v1/products.mjs.map +1 -0
- package/resources/v1/subscriptions/future-update.d.mts +9 -22
- package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
- package/resources/v1/subscriptions/future-update.d.ts +9 -22
- package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
- package/resources/v1/subscriptions/future-update.js +3 -2
- package/resources/v1/subscriptions/future-update.js.map +1 -1
- package/resources/v1/subscriptions/future-update.mjs +3 -2
- package/resources/v1/subscriptions/future-update.mjs.map +1 -1
- package/resources/v1/subscriptions/index.d.mts +2 -2
- package/resources/v1/subscriptions/index.d.mts.map +1 -1
- package/resources/v1/subscriptions/index.d.ts +2 -2
- package/resources/v1/subscriptions/index.d.ts.map +1 -1
- package/resources/v1/subscriptions/index.js.map +1 -1
- package/resources/v1/subscriptions/index.mjs +1 -1
- package/resources/v1/subscriptions/index.mjs.map +1 -1
- package/resources/v1/subscriptions/subscriptions.d.mts +987 -949
- package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.d.ts +987 -949
- package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.js +39 -11
- package/resources/v1/subscriptions/subscriptions.js.map +1 -1
- package/resources/v1/subscriptions/subscriptions.mjs +40 -12
- package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
- package/resources/v1/usage.d.mts +230 -0
- package/resources/v1/usage.d.mts.map +1 -0
- package/resources/v1/usage.d.ts +230 -0
- package/resources/v1/usage.d.ts.map +1 -0
- package/resources/v1/usage.js +24 -0
- package/resources/v1/usage.js.map +1 -0
- package/resources/v1/usage.mjs +20 -0
- package/resources/v1/usage.mjs.map +1 -0
- package/resources/v1/v1.d.mts +18 -172
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +18 -172
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +12 -12
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +12 -12
- package/resources/v1/v1.mjs.map +1 -1
- package/src/client.ts +25 -40
- package/src/internal/parse.ts +6 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/resources/index.ts +1 -7
- package/src/resources/v1/coupons.ts +63 -231
- package/src/resources/v1/customers/customers.ts +234 -60
- package/src/resources/v1/customers/index.ts +13 -2
- package/src/resources/v1/customers/payment-method.ts +4 -2
- package/src/resources/v1/customers/promotional-entitlements.ts +468 -0
- package/src/resources/v1/events.ts +74 -0
- package/src/resources/v1/index.ts +28 -15
- package/src/resources/v1/products.ts +162 -0
- package/src/resources/v1/subscriptions/future-update.ts +9 -30
- package/src/resources/v1/subscriptions/index.ts +8 -11
- package/src/resources/v1/subscriptions/subscriptions.ts +2699 -2280
- package/src/resources/v1/usage.ts +284 -0
- package/src/resources/v1/v1.ts +72 -220
- 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
- package/resources/v1/customers/usage.d.mts +0 -4
- package/resources/v1/customers/usage.d.mts.map +0 -1
- package/resources/v1/customers/usage.d.ts +0 -4
- package/resources/v1/customers/usage.d.ts.map +0 -1
- package/resources/v1/customers/usage.js +0 -9
- package/resources/v1/customers/usage.js.map +0 -1
- package/resources/v1/customers/usage.mjs +0 -5
- package/resources/v1/customers/usage.mjs.map +0 -1
- package/src/resources/v1/customers/usage.ts +0 -5
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
6
|
+
import { path } from '../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Usage extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves historical usage data for a customer's metered feature over time.
|
|
11
|
+
*/
|
|
12
|
+
history(
|
|
13
|
+
featureID: string,
|
|
14
|
+
params: UsageHistoryParams,
|
|
15
|
+
options?: RequestOptions,
|
|
16
|
+
): APIPromise<UsageHistoryResponse> {
|
|
17
|
+
const { customerId, ...query } = params;
|
|
18
|
+
return this._client.get(path`/api/v1/usage/${customerId}/history/${featureID}`, { query, ...options });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reports usage measurements for metered features. The reported usage is used to
|
|
23
|
+
* track, limit, and bill customer consumption.
|
|
24
|
+
*/
|
|
25
|
+
report(body: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse> {
|
|
26
|
+
return this._client.post('/api/v1/usage', { body, ...options });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Response object
|
|
32
|
+
*/
|
|
33
|
+
export interface UsageHistoryResponse {
|
|
34
|
+
/**
|
|
35
|
+
* Historical usage time series
|
|
36
|
+
*/
|
|
37
|
+
data: UsageHistoryResponse.Data;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export namespace UsageHistoryResponse {
|
|
41
|
+
/**
|
|
42
|
+
* Historical usage time series
|
|
43
|
+
*/
|
|
44
|
+
export interface Data {
|
|
45
|
+
/**
|
|
46
|
+
* Markers for events that affecting feature usage
|
|
47
|
+
*/
|
|
48
|
+
markers: Array<Data.Marker>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Series of usage history
|
|
52
|
+
*/
|
|
53
|
+
series: Array<Data.Series>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export namespace Data {
|
|
57
|
+
/**
|
|
58
|
+
* Usage reset or change marker
|
|
59
|
+
*/
|
|
60
|
+
export interface Marker {
|
|
61
|
+
/**
|
|
62
|
+
* Timestamp of the marker
|
|
63
|
+
*/
|
|
64
|
+
timestamp: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Type of marker for a usage history point
|
|
68
|
+
*/
|
|
69
|
+
type: 'PERIODIC_RESET' | 'SUBSCRIPTION_CHANGE_RESET';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Usage data points with tags
|
|
74
|
+
*/
|
|
75
|
+
export interface Series {
|
|
76
|
+
/**
|
|
77
|
+
* Points in the usage history series
|
|
78
|
+
*/
|
|
79
|
+
points: Array<Series.Point>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Tags for the usage history series
|
|
83
|
+
*/
|
|
84
|
+
tags: Array<Series.Tag>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export namespace Series {
|
|
88
|
+
/**
|
|
89
|
+
* Single usage data point
|
|
90
|
+
*/
|
|
91
|
+
export interface Point {
|
|
92
|
+
/**
|
|
93
|
+
* Indicates whether there was usage reset in this point, see `markers` for details
|
|
94
|
+
*/
|
|
95
|
+
isResetPoint: boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Timestamp of the usage history point
|
|
99
|
+
*/
|
|
100
|
+
timestamp: string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Value of the usage history point
|
|
104
|
+
*/
|
|
105
|
+
value: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Grouping tag key-value
|
|
110
|
+
*/
|
|
111
|
+
export interface Tag {
|
|
112
|
+
/**
|
|
113
|
+
* Key of the tag
|
|
114
|
+
*/
|
|
115
|
+
key: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Value of the tag
|
|
119
|
+
*/
|
|
120
|
+
value: string;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Response containing reported usage measurements with current usage values,
|
|
128
|
+
* period information, and reset dates for each measurement.
|
|
129
|
+
*/
|
|
130
|
+
export interface UsageReportResponse {
|
|
131
|
+
/**
|
|
132
|
+
* Array of usage measurements with current values and period info
|
|
133
|
+
*/
|
|
134
|
+
data: Array<UsageReportResponse.Data>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export namespace UsageReportResponse {
|
|
138
|
+
/**
|
|
139
|
+
* Recorded usage with period info
|
|
140
|
+
*/
|
|
141
|
+
export interface Data {
|
|
142
|
+
/**
|
|
143
|
+
* Unique identifier for the entity
|
|
144
|
+
*/
|
|
145
|
+
id: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Timestamp of when the record was created
|
|
149
|
+
*/
|
|
150
|
+
createdAt: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Customer id
|
|
154
|
+
*/
|
|
155
|
+
customerId: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Feature id
|
|
159
|
+
*/
|
|
160
|
+
featureId: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Timestamp
|
|
164
|
+
*/
|
|
165
|
+
timestamp: string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The usage measurement record
|
|
169
|
+
*/
|
|
170
|
+
value: number;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The current measured usage value
|
|
174
|
+
*/
|
|
175
|
+
currentUsage?: number | null;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The date when the next usage reset will occur
|
|
179
|
+
*/
|
|
180
|
+
nextResetDate?: string | null;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Resource id
|
|
184
|
+
*/
|
|
185
|
+
resourceId?: string | null;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The end date of the usage period in which this measurement resides (for
|
|
189
|
+
* entitlements with a reset period)
|
|
190
|
+
*/
|
|
191
|
+
usagePeriodEnd?: string | null;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The start date of the usage period in which this measurement resides (for
|
|
195
|
+
* entitlements with a reset period)
|
|
196
|
+
*/
|
|
197
|
+
usagePeriodStart?: string | null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface UsageHistoryParams {
|
|
202
|
+
/**
|
|
203
|
+
* Path param: Customer id
|
|
204
|
+
*/
|
|
205
|
+
customerId: string;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Query param: The start date of the range
|
|
209
|
+
*/
|
|
210
|
+
startDate: string;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Query param: The end date of the range
|
|
214
|
+
*/
|
|
215
|
+
endDate?: string;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Query param
|
|
219
|
+
*/
|
|
220
|
+
groupBy?: string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Query param: Resource id
|
|
224
|
+
*/
|
|
225
|
+
resourceId?: string | null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface UsageReportParams {
|
|
229
|
+
/**
|
|
230
|
+
* A list of usage reports to be submitted in bulk
|
|
231
|
+
*/
|
|
232
|
+
usages: Array<UsageReportParams.Usage>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export namespace UsageReportParams {
|
|
236
|
+
/**
|
|
237
|
+
* Single usage measurement
|
|
238
|
+
*/
|
|
239
|
+
export interface Usage {
|
|
240
|
+
/**
|
|
241
|
+
* Customer id
|
|
242
|
+
*/
|
|
243
|
+
customerId: string;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Feature id
|
|
247
|
+
*/
|
|
248
|
+
featureId: string;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The value to report for usage
|
|
252
|
+
*/
|
|
253
|
+
value: number;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Timestamp of when the record was created
|
|
257
|
+
*/
|
|
258
|
+
createdAt?: string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Additional dimensions for the usage report
|
|
262
|
+
*/
|
|
263
|
+
dimensions?: { [key: string]: string | number | boolean };
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Resource id
|
|
267
|
+
*/
|
|
268
|
+
resourceId?: string | null;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* The method by which the usage value should be updated
|
|
272
|
+
*/
|
|
273
|
+
updateBehavior?: 'DELTA' | 'SET';
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export declare namespace Usage {
|
|
278
|
+
export {
|
|
279
|
+
type UsageHistoryResponse as UsageHistoryResponse,
|
|
280
|
+
type UsageReportResponse as UsageReportResponse,
|
|
281
|
+
type UsageHistoryParams as UsageHistoryParams,
|
|
282
|
+
type UsageReportParams as UsageReportParams,
|
|
283
|
+
};
|
|
284
|
+
}
|
package/src/resources/v1/v1.ts
CHANGED
|
@@ -3,291 +3,143 @@
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as CouponsAPI from './coupons';
|
|
5
5
|
import {
|
|
6
|
+
Coupon,
|
|
6
7
|
CouponCreateParams,
|
|
7
|
-
CouponCreateResponse,
|
|
8
8
|
CouponListParams,
|
|
9
9
|
CouponListResponse,
|
|
10
10
|
CouponListResponsesMyCursorIDPage,
|
|
11
|
-
CouponRetrieveResponse,
|
|
12
11
|
Coupons,
|
|
13
12
|
} from './coupons';
|
|
13
|
+
import * as EventsAPI from './events';
|
|
14
|
+
import { EventReportParams, EventReportResponse, Events } from './events';
|
|
15
|
+
import * as ProductsAPI from './products';
|
|
16
|
+
import {
|
|
17
|
+
ProductListProductsParams,
|
|
18
|
+
ProductListProductsResponse,
|
|
19
|
+
ProductListProductsResponsesMyCursorIDPage,
|
|
20
|
+
Products,
|
|
21
|
+
} from './products';
|
|
22
|
+
import * as UsageAPI from './usage';
|
|
23
|
+
import {
|
|
24
|
+
Usage,
|
|
25
|
+
UsageHistoryParams,
|
|
26
|
+
UsageHistoryResponse,
|
|
27
|
+
UsageReportParams,
|
|
28
|
+
UsageReportResponse,
|
|
29
|
+
} from './usage';
|
|
14
30
|
import * as CustomersAPI from './customers/customers';
|
|
15
31
|
import {
|
|
16
|
-
|
|
32
|
+
CustomerImportParams,
|
|
33
|
+
CustomerImportResponse,
|
|
17
34
|
CustomerListParams,
|
|
35
|
+
CustomerListResourcesParams,
|
|
36
|
+
CustomerListResourcesResponse,
|
|
37
|
+
CustomerListResourcesResponsesMyCursorIDPage,
|
|
18
38
|
CustomerListResponse,
|
|
19
39
|
CustomerListResponsesMyCursorIDPage,
|
|
40
|
+
CustomerProvisionParams,
|
|
20
41
|
CustomerResponse,
|
|
21
42
|
CustomerUpdateParams,
|
|
22
43
|
Customers,
|
|
23
44
|
} from './customers/customers';
|
|
24
45
|
import * as SubscriptionsAPI from './subscriptions/subscriptions';
|
|
25
46
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
Subscription,
|
|
48
|
+
SubscriptionCancelParams,
|
|
28
49
|
SubscriptionDelegateParams,
|
|
29
|
-
|
|
50
|
+
SubscriptionImportParams,
|
|
51
|
+
SubscriptionImportResponse,
|
|
30
52
|
SubscriptionListParams,
|
|
31
53
|
SubscriptionListResponse,
|
|
32
54
|
SubscriptionListResponsesMyCursorIDPage,
|
|
33
55
|
SubscriptionMigrateParams,
|
|
34
|
-
SubscriptionMigrateResponse,
|
|
35
56
|
SubscriptionPreviewParams,
|
|
36
57
|
SubscriptionPreviewResponse,
|
|
37
|
-
|
|
58
|
+
SubscriptionProvisionParams,
|
|
59
|
+
SubscriptionProvisionResponse,
|
|
38
60
|
SubscriptionTransferParams,
|
|
39
|
-
|
|
61
|
+
SubscriptionUpdateParams,
|
|
40
62
|
Subscriptions,
|
|
41
63
|
} from './subscriptions/subscriptions';
|
|
42
|
-
import { APIPromise } from '../../core/api-promise';
|
|
43
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
44
64
|
|
|
45
65
|
export class V1 extends APIResource {
|
|
46
66
|
customers: CustomersAPI.Customers = new CustomersAPI.Customers(this._client);
|
|
47
67
|
subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
|
|
48
68
|
coupons: CouponsAPI.Coupons = new CouponsAPI.Coupons(this._client);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
createEvent(body: V1CreateEventParams, options?: RequestOptions): APIPromise<V1CreateEventResponse> {
|
|
54
|
-
return this._client.post('/api/v1/events', { body, ...options });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Report usage measurements
|
|
59
|
-
*/
|
|
60
|
-
createUsage(body: V1CreateUsageParams, options?: RequestOptions): APIPromise<V1CreateUsageResponse> {
|
|
61
|
-
return this._client.post('/api/v1/usage', { body, ...options });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Response object
|
|
67
|
-
*/
|
|
68
|
-
export interface V1CreateEventResponse {
|
|
69
|
-
/**
|
|
70
|
-
* Empty success response confirming that events were successfully ingested and
|
|
71
|
-
* queued for processing by Stigg's metering system.
|
|
72
|
-
*/
|
|
73
|
-
data: unknown;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Response containing reported usage measurements with current usage values,
|
|
78
|
-
* period information, and reset dates for each measurement.
|
|
79
|
-
*/
|
|
80
|
-
export interface V1CreateUsageResponse {
|
|
81
|
-
/**
|
|
82
|
-
* Array of usage measurements with current values and period info
|
|
83
|
-
*/
|
|
84
|
-
data: Array<V1CreateUsageResponse.Data>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export namespace V1CreateUsageResponse {
|
|
88
|
-
/**
|
|
89
|
-
* Recorded usage with period info
|
|
90
|
-
*/
|
|
91
|
-
export interface Data {
|
|
92
|
-
/**
|
|
93
|
-
* Unique identifier for the entity
|
|
94
|
-
*/
|
|
95
|
-
id: string;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Timestamp of when the record was created
|
|
99
|
-
*/
|
|
100
|
-
createdAt: string;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Customer id
|
|
104
|
-
*/
|
|
105
|
-
customerId: string;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Feature id
|
|
109
|
-
*/
|
|
110
|
-
featureId: string;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Timestamp
|
|
114
|
-
*/
|
|
115
|
-
timestamp: string;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* The usage measurement record
|
|
119
|
-
*/
|
|
120
|
-
value: number;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The current measured usage value
|
|
124
|
-
*/
|
|
125
|
-
currentUsage?: number | null;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* The date when the next usage reset will occur
|
|
129
|
-
*/
|
|
130
|
-
nextResetDate?: string | null;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Resource id
|
|
134
|
-
*/
|
|
135
|
-
resourceId?: string | null;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* The end date of the usage period in which this measurement resides (for
|
|
139
|
-
* entitlements with a reset period)
|
|
140
|
-
*/
|
|
141
|
-
usagePeriodEnd?: string | null;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The start date of the usage period in which this measurement resides (for
|
|
145
|
-
* entitlements with a reset period)
|
|
146
|
-
*/
|
|
147
|
-
usagePeriodStart?: string | null;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface V1CreateEventParams {
|
|
152
|
-
/**
|
|
153
|
-
* A list of usage events to report
|
|
154
|
-
*/
|
|
155
|
-
events: Array<V1CreateEventParams.Event>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export namespace V1CreateEventParams {
|
|
159
|
-
/**
|
|
160
|
-
* Raw usage event
|
|
161
|
-
*/
|
|
162
|
-
export interface Event {
|
|
163
|
-
/**
|
|
164
|
-
* Customer id
|
|
165
|
-
*/
|
|
166
|
-
customerId: string;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* The name of the usage event
|
|
170
|
-
*/
|
|
171
|
-
eventName: string;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Idempotency key
|
|
175
|
-
*/
|
|
176
|
-
idempotencyKey: string;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Dimensions associated with the usage event
|
|
180
|
-
*/
|
|
181
|
-
dimensions?: { [key: string]: string | number | boolean };
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Resource id
|
|
185
|
-
*/
|
|
186
|
-
resourceId?: string | null;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Timestamp
|
|
190
|
-
*/
|
|
191
|
-
timestamp?: string;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface V1CreateUsageParams {
|
|
196
|
-
/**
|
|
197
|
-
* A list of usage reports to be submitted in bulk
|
|
198
|
-
*/
|
|
199
|
-
usages: Array<V1CreateUsageParams.Usage>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export namespace V1CreateUsageParams {
|
|
203
|
-
/**
|
|
204
|
-
* Single usage measurement
|
|
205
|
-
*/
|
|
206
|
-
export interface Usage {
|
|
207
|
-
/**
|
|
208
|
-
* Customer id
|
|
209
|
-
*/
|
|
210
|
-
customerId: string;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Feature id
|
|
214
|
-
*/
|
|
215
|
-
featureId: string;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The value to report for usage
|
|
219
|
-
*/
|
|
220
|
-
value: number;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Timestamp of when the record was created
|
|
224
|
-
*/
|
|
225
|
-
createdAt?: string;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Additional dimensions for the usage report
|
|
229
|
-
*/
|
|
230
|
-
dimensions?: { [key: string]: string | number | boolean };
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Resource id
|
|
234
|
-
*/
|
|
235
|
-
resourceId?: string | null;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* The method by which the usage value should be updated
|
|
239
|
-
*/
|
|
240
|
-
updateBehavior?: 'DELTA' | 'SET';
|
|
241
|
-
}
|
|
69
|
+
events: EventsAPI.Events = new EventsAPI.Events(this._client);
|
|
70
|
+
usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
|
|
71
|
+
products: ProductsAPI.Products = new ProductsAPI.Products(this._client);
|
|
242
72
|
}
|
|
243
73
|
|
|
244
74
|
V1.Customers = Customers;
|
|
245
75
|
V1.Subscriptions = Subscriptions;
|
|
246
76
|
V1.Coupons = Coupons;
|
|
77
|
+
V1.Events = Events;
|
|
78
|
+
V1.Usage = Usage;
|
|
79
|
+
V1.Products = Products;
|
|
247
80
|
|
|
248
81
|
export declare namespace V1 {
|
|
249
|
-
export {
|
|
250
|
-
type V1CreateEventResponse as V1CreateEventResponse,
|
|
251
|
-
type V1CreateUsageResponse as V1CreateUsageResponse,
|
|
252
|
-
type V1CreateEventParams as V1CreateEventParams,
|
|
253
|
-
type V1CreateUsageParams as V1CreateUsageParams,
|
|
254
|
-
};
|
|
255
|
-
|
|
256
82
|
export {
|
|
257
83
|
Customers as Customers,
|
|
258
84
|
type CustomerResponse as CustomerResponse,
|
|
259
85
|
type CustomerListResponse as CustomerListResponse,
|
|
86
|
+
type CustomerImportResponse as CustomerImportResponse,
|
|
87
|
+
type CustomerListResourcesResponse as CustomerListResourcesResponse,
|
|
260
88
|
type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage,
|
|
261
|
-
type
|
|
89
|
+
type CustomerListResourcesResponsesMyCursorIDPage as CustomerListResourcesResponsesMyCursorIDPage,
|
|
262
90
|
type CustomerUpdateParams as CustomerUpdateParams,
|
|
263
91
|
type CustomerListParams as CustomerListParams,
|
|
92
|
+
type CustomerImportParams as CustomerImportParams,
|
|
93
|
+
type CustomerListResourcesParams as CustomerListResourcesParams,
|
|
94
|
+
type CustomerProvisionParams as CustomerProvisionParams,
|
|
264
95
|
};
|
|
265
96
|
|
|
266
97
|
export {
|
|
267
98
|
Subscriptions as Subscriptions,
|
|
268
|
-
type
|
|
269
|
-
type SubscriptionRetrieveResponse as SubscriptionRetrieveResponse,
|
|
99
|
+
type Subscription as Subscription,
|
|
270
100
|
type SubscriptionListResponse as SubscriptionListResponse,
|
|
271
|
-
type
|
|
272
|
-
type SubscriptionMigrateResponse as SubscriptionMigrateResponse,
|
|
101
|
+
type SubscriptionImportResponse as SubscriptionImportResponse,
|
|
273
102
|
type SubscriptionPreviewResponse as SubscriptionPreviewResponse,
|
|
274
|
-
type
|
|
103
|
+
type SubscriptionProvisionResponse as SubscriptionProvisionResponse,
|
|
275
104
|
type SubscriptionListResponsesMyCursorIDPage as SubscriptionListResponsesMyCursorIDPage,
|
|
276
|
-
type
|
|
105
|
+
type SubscriptionUpdateParams as SubscriptionUpdateParams,
|
|
277
106
|
type SubscriptionListParams as SubscriptionListParams,
|
|
107
|
+
type SubscriptionCancelParams as SubscriptionCancelParams,
|
|
278
108
|
type SubscriptionDelegateParams as SubscriptionDelegateParams,
|
|
109
|
+
type SubscriptionImportParams as SubscriptionImportParams,
|
|
279
110
|
type SubscriptionMigrateParams as SubscriptionMigrateParams,
|
|
280
111
|
type SubscriptionPreviewParams as SubscriptionPreviewParams,
|
|
112
|
+
type SubscriptionProvisionParams as SubscriptionProvisionParams,
|
|
281
113
|
type SubscriptionTransferParams as SubscriptionTransferParams,
|
|
282
114
|
};
|
|
283
115
|
|
|
284
116
|
export {
|
|
285
117
|
Coupons as Coupons,
|
|
286
|
-
type
|
|
287
|
-
type CouponRetrieveResponse as CouponRetrieveResponse,
|
|
118
|
+
type Coupon as Coupon,
|
|
288
119
|
type CouponListResponse as CouponListResponse,
|
|
289
120
|
type CouponListResponsesMyCursorIDPage as CouponListResponsesMyCursorIDPage,
|
|
290
121
|
type CouponCreateParams as CouponCreateParams,
|
|
291
122
|
type CouponListParams as CouponListParams,
|
|
292
123
|
};
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
Events as Events,
|
|
127
|
+
type EventReportResponse as EventReportResponse,
|
|
128
|
+
type EventReportParams as EventReportParams,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export {
|
|
132
|
+
Usage as Usage,
|
|
133
|
+
type UsageHistoryResponse as UsageHistoryResponse,
|
|
134
|
+
type UsageReportResponse as UsageReportResponse,
|
|
135
|
+
type UsageHistoryParams as UsageHistoryParams,
|
|
136
|
+
type UsageReportParams as UsageReportParams,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
Products as Products,
|
|
141
|
+
type ProductListProductsResponse as ProductListProductsResponse,
|
|
142
|
+
type ProductListProductsResponsesMyCursorIDPage as ProductListProductsResponsesMyCursorIDPage,
|
|
143
|
+
type ProductListProductsParams as ProductListProductsParams,
|
|
144
|
+
};
|
|
293
145
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-alpha.
|
|
1
|
+
export const VERSION = '0.1.0-alpha.7'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.7";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.7";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '0.1.0-alpha.
|
|
4
|
+
exports.VERSION = '0.1.0-alpha.7'; // x-release-please-version
|
|
5
5
|
//# sourceMappingURL=version.js.map
|
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-alpha.
|
|
1
|
+
export const VERSION = '0.1.0-alpha.7'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/customers/usage.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;AAEtB,qBAAa,KAAM,SAAQ,WAAW;CAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/customers/usage.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;AAEtB,qBAAa,KAAM,SAAQ,WAAW;CAAG"}
|
|
@@ -1,9 +0,0 @@
|
|
|
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.Usage = void 0;
|
|
5
|
-
const resource_1 = require("../../../core/resource.js");
|
|
6
|
-
class Usage extends resource_1.APIResource {
|
|
7
|
-
}
|
|
8
|
-
exports.Usage = Usage;
|
|
9
|
-
//# sourceMappingURL=usage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/resources/v1/customers/usage.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAErD,MAAa,KAAM,SAAQ,sBAAW;CAAG;AAAzC,sBAAyC"}
|