@stigg/typescript 0.1.0-alpha.3 → 0.1.0-alpha.4
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 +8 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- 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 +6 -89
- package/resources/v1/coupons.d.mts.map +1 -1
- package/resources/v1/coupons.d.ts +6 -89
- package/resources/v1/coupons.d.ts.map +1 -1
- package/resources/v1/customers/customers.d.mts +106 -46
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +106 -46
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +16 -10
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +16 -10
- 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/promotional-entitlements.d.mts +350 -0
- package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
- package/resources/v1/customers/promotional-entitlements.d.ts +350 -0
- package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
- package/resources/v1/customers/promotional-entitlements.js +23 -0
- package/resources/v1/customers/promotional-entitlements.js.map +1 -0
- package/resources/v1/customers/promotional-entitlements.mjs +19 -0
- package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
- package/resources/v1/events.d.mts +62 -0
- package/resources/v1/events.d.mts.map +1 -0
- package/resources/v1/events.d.ts +62 -0
- package/resources/v1/events.d.ts.map +1 -0
- package/resources/v1/events.js +15 -0
- package/resources/v1/events.js.map +1 -0
- package/resources/v1/events.mjs +11 -0
- package/resources/v1/events.mjs.map +1 -0
- package/resources/v1/index.d.mts +6 -4
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +6 -4
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +5 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +3 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/subscriptions/future-update.d.mts +6 -20
- package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
- package/resources/v1/subscriptions/future-update.d.ts +6 -20
- package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
- package/resources/v1/subscriptions/future-update.js.map +1 -1
- 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 +963 -1049
- package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.d.ts +963 -1049
- package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.js +24 -6
- package/resources/v1/subscriptions/subscriptions.js.map +1 -1
- package/resources/v1/subscriptions/subscriptions.mjs +25 -7
- package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
- package/resources/v1/usage.d.mts +229 -0
- package/resources/v1/usage.d.mts.map +1 -0
- package/resources/v1/usage.d.ts +229 -0
- package/resources/v1/usage.d.ts.map +1 -0
- package/resources/v1/usage.js +23 -0
- package/resources/v1/usage.js.map +1 -0
- package/resources/v1/usage.mjs +19 -0
- package/resources/v1/usage.mjs.map +1 -0
- package/resources/v1/v1.d.mts +14 -172
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +14 -172
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +8 -12
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +8 -12
- package/resources/v1/v1.mjs.map +1 -1
- package/src/client.ts +2 -14
- package/src/resources/index.ts +1 -7
- package/src/resources/v1/coupons.ts +6 -222
- package/src/resources/v1/customers/customers.ts +142 -57
- package/src/resources/v1/customers/index.ts +10 -2
- package/src/resources/v1/customers/promotional-entitlements.ts +466 -0
- package/src/resources/v1/events.ts +73 -0
- package/src/resources/v1/index.ts +19 -15
- package/src/resources/v1/subscriptions/future-update.ts +6 -28
- package/src/resources/v1/subscriptions/index.ts +8 -11
- package/src/resources/v1/subscriptions/subscriptions.ts +2541 -2304
- package/src/resources/v1/usage.ts +283 -0
- package/src/resources/v1/v1.ts +50 -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,229 @@
|
|
|
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 Usage extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Get usage history
|
|
7
|
+
*/
|
|
8
|
+
history(featureID: string, params: UsageHistoryParams, options?: RequestOptions): APIPromise<UsageHistoryResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Report usage measurements
|
|
11
|
+
*/
|
|
12
|
+
report(body: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Response object
|
|
16
|
+
*/
|
|
17
|
+
export interface UsageHistoryResponse {
|
|
18
|
+
/**
|
|
19
|
+
* Historical usage time series
|
|
20
|
+
*/
|
|
21
|
+
data: UsageHistoryResponse.Data;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace UsageHistoryResponse {
|
|
24
|
+
/**
|
|
25
|
+
* Historical usage time series
|
|
26
|
+
*/
|
|
27
|
+
interface Data {
|
|
28
|
+
/**
|
|
29
|
+
* Markers for events that affecting feature usage
|
|
30
|
+
*/
|
|
31
|
+
markers: Array<Data.Marker>;
|
|
32
|
+
/**
|
|
33
|
+
* Series of usage history
|
|
34
|
+
*/
|
|
35
|
+
series: Array<Data.Series>;
|
|
36
|
+
}
|
|
37
|
+
namespace Data {
|
|
38
|
+
/**
|
|
39
|
+
* Usage reset or change marker
|
|
40
|
+
*/
|
|
41
|
+
interface Marker {
|
|
42
|
+
/**
|
|
43
|
+
* Timestamp of the marker
|
|
44
|
+
*/
|
|
45
|
+
timestamp: string;
|
|
46
|
+
/**
|
|
47
|
+
* Type of marker for a usage history point
|
|
48
|
+
*/
|
|
49
|
+
type: 'PERIODIC_RESET' | 'SUBSCRIPTION_CHANGE_RESET';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Usage data points with tags
|
|
53
|
+
*/
|
|
54
|
+
interface Series {
|
|
55
|
+
/**
|
|
56
|
+
* Points in the usage history series
|
|
57
|
+
*/
|
|
58
|
+
points: Array<Series.Point>;
|
|
59
|
+
/**
|
|
60
|
+
* Tags for the usage history series
|
|
61
|
+
*/
|
|
62
|
+
tags: Array<Series.Tag>;
|
|
63
|
+
}
|
|
64
|
+
namespace Series {
|
|
65
|
+
/**
|
|
66
|
+
* Single usage data point
|
|
67
|
+
*/
|
|
68
|
+
interface Point {
|
|
69
|
+
/**
|
|
70
|
+
* Indicates whether there was usage reset in this point, see `markers` for details
|
|
71
|
+
*/
|
|
72
|
+
isResetPoint: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Timestamp of the usage history point
|
|
75
|
+
*/
|
|
76
|
+
timestamp: string;
|
|
77
|
+
/**
|
|
78
|
+
* Value of the usage history point
|
|
79
|
+
*/
|
|
80
|
+
value: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Grouping tag key-value
|
|
84
|
+
*/
|
|
85
|
+
interface Tag {
|
|
86
|
+
/**
|
|
87
|
+
* Key of the tag
|
|
88
|
+
*/
|
|
89
|
+
key: string;
|
|
90
|
+
/**
|
|
91
|
+
* Value of the tag
|
|
92
|
+
*/
|
|
93
|
+
value: string;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Response containing reported usage measurements with current usage values,
|
|
100
|
+
* period information, and reset dates for each measurement.
|
|
101
|
+
*/
|
|
102
|
+
export interface UsageReportResponse {
|
|
103
|
+
/**
|
|
104
|
+
* Array of usage measurements with current values and period info
|
|
105
|
+
*/
|
|
106
|
+
data: Array<UsageReportResponse.Data>;
|
|
107
|
+
}
|
|
108
|
+
export declare namespace UsageReportResponse {
|
|
109
|
+
/**
|
|
110
|
+
* Recorded usage with period info
|
|
111
|
+
*/
|
|
112
|
+
interface Data {
|
|
113
|
+
/**
|
|
114
|
+
* Unique identifier for the entity
|
|
115
|
+
*/
|
|
116
|
+
id: string;
|
|
117
|
+
/**
|
|
118
|
+
* Timestamp of when the record was created
|
|
119
|
+
*/
|
|
120
|
+
createdAt: string;
|
|
121
|
+
/**
|
|
122
|
+
* Customer id
|
|
123
|
+
*/
|
|
124
|
+
customerId: string;
|
|
125
|
+
/**
|
|
126
|
+
* Feature id
|
|
127
|
+
*/
|
|
128
|
+
featureId: string;
|
|
129
|
+
/**
|
|
130
|
+
* Timestamp
|
|
131
|
+
*/
|
|
132
|
+
timestamp: string;
|
|
133
|
+
/**
|
|
134
|
+
* The usage measurement record
|
|
135
|
+
*/
|
|
136
|
+
value: number;
|
|
137
|
+
/**
|
|
138
|
+
* The current measured usage value
|
|
139
|
+
*/
|
|
140
|
+
currentUsage?: number | null;
|
|
141
|
+
/**
|
|
142
|
+
* The date when the next usage reset will occur
|
|
143
|
+
*/
|
|
144
|
+
nextResetDate?: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* Resource id
|
|
147
|
+
*/
|
|
148
|
+
resourceId?: string | null;
|
|
149
|
+
/**
|
|
150
|
+
* The end date of the usage period in which this measurement resides (for
|
|
151
|
+
* entitlements with a reset period)
|
|
152
|
+
*/
|
|
153
|
+
usagePeriodEnd?: string | null;
|
|
154
|
+
/**
|
|
155
|
+
* The start date of the usage period in which this measurement resides (for
|
|
156
|
+
* entitlements with a reset period)
|
|
157
|
+
*/
|
|
158
|
+
usagePeriodStart?: string | null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export interface UsageHistoryParams {
|
|
162
|
+
/**
|
|
163
|
+
* Path param: Customer id
|
|
164
|
+
*/
|
|
165
|
+
customerId: string;
|
|
166
|
+
/**
|
|
167
|
+
* Query param: The start date of the range
|
|
168
|
+
*/
|
|
169
|
+
startDate: string;
|
|
170
|
+
/**
|
|
171
|
+
* Query param: The end date of the range
|
|
172
|
+
*/
|
|
173
|
+
endDate?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Query param
|
|
176
|
+
*/
|
|
177
|
+
groupBy?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Query param: Resource id
|
|
180
|
+
*/
|
|
181
|
+
resourceId?: string | null;
|
|
182
|
+
}
|
|
183
|
+
export interface UsageReportParams {
|
|
184
|
+
/**
|
|
185
|
+
* A list of usage reports to be submitted in bulk
|
|
186
|
+
*/
|
|
187
|
+
usages: Array<UsageReportParams.Usage>;
|
|
188
|
+
}
|
|
189
|
+
export declare namespace UsageReportParams {
|
|
190
|
+
/**
|
|
191
|
+
* Single usage measurement
|
|
192
|
+
*/
|
|
193
|
+
interface Usage {
|
|
194
|
+
/**
|
|
195
|
+
* Customer id
|
|
196
|
+
*/
|
|
197
|
+
customerId: string;
|
|
198
|
+
/**
|
|
199
|
+
* Feature id
|
|
200
|
+
*/
|
|
201
|
+
featureId: string;
|
|
202
|
+
/**
|
|
203
|
+
* The value to report for usage
|
|
204
|
+
*/
|
|
205
|
+
value: number;
|
|
206
|
+
/**
|
|
207
|
+
* Timestamp of when the record was created
|
|
208
|
+
*/
|
|
209
|
+
createdAt?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Additional dimensions for the usage report
|
|
212
|
+
*/
|
|
213
|
+
dimensions?: {
|
|
214
|
+
[key: string]: string | number | boolean;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Resource id
|
|
218
|
+
*/
|
|
219
|
+
resourceId?: string | null;
|
|
220
|
+
/**
|
|
221
|
+
* The method by which the usage value should be updated
|
|
222
|
+
*/
|
|
223
|
+
updateBehavior?: 'DELTA' | 'SET';
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
export declare namespace Usage {
|
|
227
|
+
export { type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/resources/v1/usage.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AK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACxC;AAED,yBAAiB,iBAAiB,CAAC;IACjC;;OAEG;IACH,UAAiB,KAAK;QACpB;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,UAAU,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;QAE1D;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B;;WAEG;QACH,cAAc,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;KAClC;CACF;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
7
|
+
class Usage extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Get usage history
|
|
10
|
+
*/
|
|
11
|
+
history(featureID, params, options) {
|
|
12
|
+
const { customerId, ...query } = params;
|
|
13
|
+
return this._client.get((0, path_1.path) `/api/v1/usage/${customerId}/history/${featureID}`, { query, ...options });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Report usage measurements
|
|
17
|
+
*/
|
|
18
|
+
report(body, options) {
|
|
19
|
+
return this._client.post('/api/v1/usage', { body, ...options });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Usage = Usage;
|
|
23
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAiD;AAEjD,MAAa,KAAM,SAAQ,sBAAW;IACpC;;OAEG;IACH,OAAO,CACL,SAAiB,EACjB,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,YAAY,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AAnBD,sBAmBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
4
|
+
export class Usage extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Get usage history
|
|
7
|
+
*/
|
|
8
|
+
history(featureID, params, options) {
|
|
9
|
+
const { customerId, ...query } = params;
|
|
10
|
+
return this._client.get(path `/api/v1/usage/${customerId}/history/${featureID}`, { query, ...options });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Report usage measurements
|
|
14
|
+
*/
|
|
15
|
+
report(body, options) {
|
|
16
|
+
return this._client.post('/api/v1/usage', { body, ...options });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=usage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.mjs","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,OAAO,CACL,SAAiB,EACjB,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,iBAAiB,UAAU,YAAY,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF"}
|
package/resources/v1/v1.d.mts
CHANGED
|
@@ -1,184 +1,26 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.mjs";
|
|
2
2
|
import * as CouponsAPI from "./coupons.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { Coupon, CouponCreateParams, CouponListParams, CouponListResponse, CouponListResponsesMyCursorIDPage, Coupons } from "./coupons.mjs";
|
|
4
|
+
import * as EventsAPI from "./events.mjs";
|
|
5
|
+
import { EventReportParams, EventReportResponse, Events } from "./events.mjs";
|
|
6
|
+
import * as UsageAPI from "./usage.mjs";
|
|
7
|
+
import { Usage, UsageHistoryParams, UsageHistoryResponse, UsageReportParams, UsageReportResponse } from "./usage.mjs";
|
|
4
8
|
import * as CustomersAPI from "./customers/customers.mjs";
|
|
5
|
-
import {
|
|
9
|
+
import { CustomerImportParams, CustomerImportResponse, CustomerListParams, CustomerListResponse, CustomerListResponsesMyCursorIDPage, CustomerProvisionParams, CustomerResponse, CustomerUpdateParams, Customers } from "./customers/customers.mjs";
|
|
6
10
|
import * as SubscriptionsAPI from "./subscriptions/subscriptions.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { APIPromise } from "../../core/api-promise.mjs";
|
|
9
|
-
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
11
|
+
import { Subscription, SubscriptionCancelParams, SubscriptionDelegateParams, SubscriptionImportParams, SubscriptionImportResponse, SubscriptionListParams, SubscriptionListResponse, SubscriptionListResponsesMyCursorIDPage, SubscriptionMigrateParams, SubscriptionPreviewParams, SubscriptionPreviewResponse, SubscriptionProvisionParams, SubscriptionProvisionResponse, SubscriptionTransferParams, SubscriptionUpdateParams, Subscriptions } from "./subscriptions/subscriptions.mjs";
|
|
10
12
|
export declare class V1 extends APIResource {
|
|
11
13
|
customers: CustomersAPI.Customers;
|
|
12
14
|
subscriptions: SubscriptionsAPI.Subscriptions;
|
|
13
15
|
coupons: CouponsAPI.Coupons;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
createEvent(body: V1CreateEventParams, options?: RequestOptions): APIPromise<V1CreateEventResponse>;
|
|
18
|
-
/**
|
|
19
|
-
* Report usage measurements
|
|
20
|
-
*/
|
|
21
|
-
createUsage(body: V1CreateUsageParams, options?: RequestOptions): APIPromise<V1CreateUsageResponse>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Response object
|
|
25
|
-
*/
|
|
26
|
-
export interface V1CreateEventResponse {
|
|
27
|
-
/**
|
|
28
|
-
* Empty success response confirming that events were successfully ingested and
|
|
29
|
-
* queued for processing by Stigg's metering system.
|
|
30
|
-
*/
|
|
31
|
-
data: unknown;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Response containing reported usage measurements with current usage values,
|
|
35
|
-
* period information, and reset dates for each measurement.
|
|
36
|
-
*/
|
|
37
|
-
export interface V1CreateUsageResponse {
|
|
38
|
-
/**
|
|
39
|
-
* Array of usage measurements with current values and period info
|
|
40
|
-
*/
|
|
41
|
-
data: Array<V1CreateUsageResponse.Data>;
|
|
42
|
-
}
|
|
43
|
-
export declare namespace V1CreateUsageResponse {
|
|
44
|
-
/**
|
|
45
|
-
* Recorded usage with period info
|
|
46
|
-
*/
|
|
47
|
-
interface Data {
|
|
48
|
-
/**
|
|
49
|
-
* Unique identifier for the entity
|
|
50
|
-
*/
|
|
51
|
-
id: string;
|
|
52
|
-
/**
|
|
53
|
-
* Timestamp of when the record was created
|
|
54
|
-
*/
|
|
55
|
-
createdAt: string;
|
|
56
|
-
/**
|
|
57
|
-
* Customer id
|
|
58
|
-
*/
|
|
59
|
-
customerId: string;
|
|
60
|
-
/**
|
|
61
|
-
* Feature id
|
|
62
|
-
*/
|
|
63
|
-
featureId: string;
|
|
64
|
-
/**
|
|
65
|
-
* Timestamp
|
|
66
|
-
*/
|
|
67
|
-
timestamp: string;
|
|
68
|
-
/**
|
|
69
|
-
* The usage measurement record
|
|
70
|
-
*/
|
|
71
|
-
value: number;
|
|
72
|
-
/**
|
|
73
|
-
* The current measured usage value
|
|
74
|
-
*/
|
|
75
|
-
currentUsage?: number | null;
|
|
76
|
-
/**
|
|
77
|
-
* The date when the next usage reset will occur
|
|
78
|
-
*/
|
|
79
|
-
nextResetDate?: string | null;
|
|
80
|
-
/**
|
|
81
|
-
* Resource id
|
|
82
|
-
*/
|
|
83
|
-
resourceId?: string | null;
|
|
84
|
-
/**
|
|
85
|
-
* The end date of the usage period in which this measurement resides (for
|
|
86
|
-
* entitlements with a reset period)
|
|
87
|
-
*/
|
|
88
|
-
usagePeriodEnd?: string | null;
|
|
89
|
-
/**
|
|
90
|
-
* The start date of the usage period in which this measurement resides (for
|
|
91
|
-
* entitlements with a reset period)
|
|
92
|
-
*/
|
|
93
|
-
usagePeriodStart?: string | null;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export interface V1CreateEventParams {
|
|
97
|
-
/**
|
|
98
|
-
* A list of usage events to report
|
|
99
|
-
*/
|
|
100
|
-
events: Array<V1CreateEventParams.Event>;
|
|
101
|
-
}
|
|
102
|
-
export declare namespace V1CreateEventParams {
|
|
103
|
-
/**
|
|
104
|
-
* Raw usage event
|
|
105
|
-
*/
|
|
106
|
-
interface Event {
|
|
107
|
-
/**
|
|
108
|
-
* Customer id
|
|
109
|
-
*/
|
|
110
|
-
customerId: string;
|
|
111
|
-
/**
|
|
112
|
-
* The name of the usage event
|
|
113
|
-
*/
|
|
114
|
-
eventName: string;
|
|
115
|
-
/**
|
|
116
|
-
* Idempotency key
|
|
117
|
-
*/
|
|
118
|
-
idempotencyKey: string;
|
|
119
|
-
/**
|
|
120
|
-
* Dimensions associated with the usage event
|
|
121
|
-
*/
|
|
122
|
-
dimensions?: {
|
|
123
|
-
[key: string]: string | number | boolean;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Resource id
|
|
127
|
-
*/
|
|
128
|
-
resourceId?: string | null;
|
|
129
|
-
/**
|
|
130
|
-
* Timestamp
|
|
131
|
-
*/
|
|
132
|
-
timestamp?: string;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export interface V1CreateUsageParams {
|
|
136
|
-
/**
|
|
137
|
-
* A list of usage reports to be submitted in bulk
|
|
138
|
-
*/
|
|
139
|
-
usages: Array<V1CreateUsageParams.Usage>;
|
|
140
|
-
}
|
|
141
|
-
export declare namespace V1CreateUsageParams {
|
|
142
|
-
/**
|
|
143
|
-
* Single usage measurement
|
|
144
|
-
*/
|
|
145
|
-
interface Usage {
|
|
146
|
-
/**
|
|
147
|
-
* Customer id
|
|
148
|
-
*/
|
|
149
|
-
customerId: string;
|
|
150
|
-
/**
|
|
151
|
-
* Feature id
|
|
152
|
-
*/
|
|
153
|
-
featureId: string;
|
|
154
|
-
/**
|
|
155
|
-
* The value to report for usage
|
|
156
|
-
*/
|
|
157
|
-
value: number;
|
|
158
|
-
/**
|
|
159
|
-
* Timestamp of when the record was created
|
|
160
|
-
*/
|
|
161
|
-
createdAt?: string;
|
|
162
|
-
/**
|
|
163
|
-
* Additional dimensions for the usage report
|
|
164
|
-
*/
|
|
165
|
-
dimensions?: {
|
|
166
|
-
[key: string]: string | number | boolean;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Resource id
|
|
170
|
-
*/
|
|
171
|
-
resourceId?: string | null;
|
|
172
|
-
/**
|
|
173
|
-
* The method by which the usage value should be updated
|
|
174
|
-
*/
|
|
175
|
-
updateBehavior?: 'DELTA' | 'SET';
|
|
176
|
-
}
|
|
16
|
+
events: EventsAPI.Events;
|
|
17
|
+
usage: UsageAPI.Usage;
|
|
177
18
|
}
|
|
178
19
|
export declare namespace V1 {
|
|
179
|
-
export { type
|
|
180
|
-
export {
|
|
181
|
-
export {
|
|
182
|
-
export {
|
|
20
|
+
export { Customers as Customers, type CustomerResponse as CustomerResponse, type CustomerListResponse as CustomerListResponse, type CustomerImportResponse as CustomerImportResponse, type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerImportParams as CustomerImportParams, type CustomerProvisionParams as CustomerProvisionParams, };
|
|
21
|
+
export { Subscriptions as Subscriptions, type Subscription as Subscription, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionImportResponse as SubscriptionImportResponse, type SubscriptionPreviewResponse as SubscriptionPreviewResponse, type SubscriptionProvisionResponse as SubscriptionProvisionResponse, type SubscriptionListResponsesMyCursorIDPage as SubscriptionListResponsesMyCursorIDPage, type SubscriptionUpdateParams as SubscriptionUpdateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionCancelParams as SubscriptionCancelParams, type SubscriptionDelegateParams as SubscriptionDelegateParams, type SubscriptionImportParams as SubscriptionImportParams, type SubscriptionMigrateParams as SubscriptionMigrateParams, type SubscriptionPreviewParams as SubscriptionPreviewParams, type SubscriptionProvisionParams as SubscriptionProvisionParams, type SubscriptionTransferParams as SubscriptionTransferParams, };
|
|
22
|
+
export { Coupons as Coupons, type Coupon as Coupon, type CouponListResponse as CouponListResponse, type CouponListResponsesMyCursorIDPage as CouponListResponsesMyCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponListParams as CouponListParams, };
|
|
23
|
+
export { Events as Events, type EventReportResponse as EventReportResponse, type EventReportParams as EventReportParams, };
|
|
24
|
+
export { Usage as Usage, type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
|
|
183
25
|
}
|
|
184
26
|
//# sourceMappingURL=v1.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1.d.mts","sourceRoot":"","sources":["../../src/resources/v1/v1.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"v1.d.mts","sourceRoot":"","sources":["../../src/resources/v1/v1.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,iCAAiC,EACjC,OAAO,EACR;OACM,KAAK,SAAS;OACd,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,EAAE;OAClD,KAAK,QAAQ;OACb,EACL,KAAK,EACL,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACpB;OACM,KAAK,YAAY;OACjB,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,mCAAmC,E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