@stigg/typescript 0.1.0-alpha.17 → 0.1.0-alpha.19

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.
Files changed (135) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/client.d.mts.map +1 -1
  3. package/client.d.ts.map +1 -1
  4. package/client.js +6 -5
  5. package/client.js.map +1 -1
  6. package/client.mjs +6 -5
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/v1/addons/entitlements.d.mts +360 -247
  10. package/resources/v1/addons/entitlements.d.mts.map +1 -1
  11. package/resources/v1/addons/entitlements.d.ts +360 -247
  12. package/resources/v1/addons/entitlements.d.ts.map +1 -1
  13. package/resources/v1/coupons.d.mts +12 -0
  14. package/resources/v1/coupons.d.mts.map +1 -1
  15. package/resources/v1/coupons.d.ts +12 -0
  16. package/resources/v1/coupons.d.ts.map +1 -1
  17. package/resources/v1/customers/customers.d.mts +16 -0
  18. package/resources/v1/customers/customers.d.mts.map +1 -1
  19. package/resources/v1/customers/customers.d.ts +16 -0
  20. package/resources/v1/customers/customers.d.ts.map +1 -1
  21. package/resources/v1/customers/customers.js.map +1 -1
  22. package/resources/v1/customers/customers.mjs.map +1 -1
  23. package/resources/v1/events/credits/credits.d.mts +260 -0
  24. package/resources/v1/events/credits/credits.d.mts.map +1 -0
  25. package/resources/v1/events/credits/credits.d.ts +260 -0
  26. package/resources/v1/events/credits/credits.d.ts.map +1 -0
  27. package/resources/v1/events/credits/credits.js +41 -0
  28. package/resources/v1/events/credits/credits.js.map +1 -0
  29. package/resources/v1/events/credits/credits.mjs +36 -0
  30. package/resources/v1/events/credits/credits.mjs.map +1 -0
  31. package/resources/v1/events/credits/grants.d.mts +549 -0
  32. package/resources/v1/events/credits/grants.d.mts.map +1 -0
  33. package/resources/v1/events/credits/grants.d.ts +549 -0
  34. package/resources/v1/events/credits/grants.d.ts.map +1 -0
  35. package/resources/v1/events/credits/grants.js +37 -0
  36. package/resources/v1/events/credits/grants.js.map +1 -0
  37. package/resources/v1/events/credits/grants.mjs +33 -0
  38. package/resources/v1/events/credits/grants.mjs.map +1 -0
  39. package/resources/v1/events/credits/index.d.mts +3 -0
  40. package/resources/v1/events/credits/index.d.mts.map +1 -0
  41. package/resources/v1/events/credits/index.d.ts +3 -0
  42. package/resources/v1/events/credits/index.d.ts.map +1 -0
  43. package/resources/v1/events/credits/index.js +9 -0
  44. package/resources/v1/events/credits/index.js.map +1 -0
  45. package/resources/v1/events/credits/index.mjs +4 -0
  46. package/resources/v1/events/credits/index.mjs.map +1 -0
  47. package/resources/v1/events/credits.d.mts +2 -0
  48. package/resources/v1/events/credits.d.mts.map +1 -0
  49. package/resources/v1/events/credits.d.ts +2 -0
  50. package/resources/v1/events/credits.d.ts.map +1 -0
  51. package/resources/v1/events/credits.js +6 -0
  52. package/resources/v1/events/credits.js.map +1 -0
  53. package/resources/v1/events/credits.mjs +3 -0
  54. package/resources/v1/events/credits.mjs.map +1 -0
  55. package/resources/v1/events/events.d.mts +70 -0
  56. package/resources/v1/events/events.d.mts.map +1 -0
  57. package/resources/v1/events/events.d.ts +70 -0
  58. package/resources/v1/events/events.d.ts.map +1 -0
  59. package/resources/v1/events/events.js +27 -0
  60. package/resources/v1/events/events.js.map +1 -0
  61. package/resources/v1/events/events.mjs +22 -0
  62. package/resources/v1/events/events.mjs.map +1 -0
  63. package/resources/v1/events/index.d.mts +3 -0
  64. package/resources/v1/events/index.d.mts.map +1 -0
  65. package/resources/v1/events/index.d.ts +3 -0
  66. package/resources/v1/events/index.d.ts.map +1 -0
  67. package/resources/v1/events/index.js +9 -0
  68. package/resources/v1/events/index.js.map +1 -0
  69. package/resources/v1/events/index.mjs +4 -0
  70. package/resources/v1/events/index.mjs.map +1 -0
  71. package/resources/v1/events.d.mts +1 -65
  72. package/resources/v1/events.d.mts.map +1 -1
  73. package/resources/v1/events.d.ts +1 -65
  74. package/resources/v1/events.d.ts.map +1 -1
  75. package/resources/v1/events.js +2 -15
  76. package/resources/v1/events.js.map +1 -1
  77. package/resources/v1/events.mjs +1 -13
  78. package/resources/v1/events.mjs.map +1 -1
  79. package/resources/v1/index.d.mts +1 -1
  80. package/resources/v1/index.d.ts +1 -1
  81. package/resources/v1/index.js +6 -6
  82. package/resources/v1/index.js.map +1 -1
  83. package/resources/v1/index.mjs +1 -1
  84. package/resources/v1/plans/entitlements.d.mts +360 -247
  85. package/resources/v1/plans/entitlements.d.mts.map +1 -1
  86. package/resources/v1/plans/entitlements.d.ts +360 -247
  87. package/resources/v1/plans/entitlements.d.ts.map +1 -1
  88. package/resources/v1/products.d.mts +2 -2
  89. package/resources/v1/products.d.mts.map +1 -1
  90. package/resources/v1/products.d.ts +2 -2
  91. package/resources/v1/products.d.ts.map +1 -1
  92. package/resources/v1/products.js +2 -2
  93. package/resources/v1/products.js.map +1 -1
  94. package/resources/v1/products.mjs +2 -2
  95. package/resources/v1/products.mjs.map +1 -1
  96. package/resources/v1/subscriptions/subscriptions.d.mts +184 -32
  97. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  98. package/resources/v1/subscriptions/subscriptions.d.ts +184 -32
  99. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  100. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  101. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  102. package/resources/v1/usage.d.mts +1 -1
  103. package/resources/v1/usage.d.mts.map +1 -1
  104. package/resources/v1/usage.d.ts +1 -1
  105. package/resources/v1/usage.d.ts.map +1 -1
  106. package/resources/v1/v1.d.mts +2 -2
  107. package/resources/v1/v1.d.mts.map +1 -1
  108. package/resources/v1/v1.d.ts +2 -2
  109. package/resources/v1/v1.d.ts.map +1 -1
  110. package/resources/v1/v1.js +2 -2
  111. package/resources/v1/v1.js.map +1 -1
  112. package/resources/v1/v1.mjs +2 -2
  113. package/resources/v1/v1.mjs.map +1 -1
  114. package/src/client.ts +6 -5
  115. package/src/resources/v1/addons/entitlements.ts +431 -287
  116. package/src/resources/v1/coupons.ts +10 -0
  117. package/src/resources/v1/customers/customers.ts +20 -0
  118. package/src/resources/v1/events/credits/credits.ts +356 -0
  119. package/src/resources/v1/events/credits/grants.ts +795 -0
  120. package/src/resources/v1/events/credits/index.ts +20 -0
  121. package/src/resources/v1/events/credits.ts +3 -0
  122. package/src/resources/v1/events/events.ts +103 -0
  123. package/src/resources/v1/events/index.ts +13 -0
  124. package/src/resources/v1/events.ts +1 -75
  125. package/src/resources/v1/index.ts +1 -1
  126. package/src/resources/v1/plans/entitlements.ts +431 -287
  127. package/src/resources/v1/products.ts +3 -3
  128. package/src/resources/v1/subscriptions/subscriptions.ts +234 -57
  129. package/src/resources/v1/usage.ts +1 -1
  130. package/src/resources/v1/v1.ts +2 -2
  131. package/src/version.ts +1 -1
  132. package/version.d.mts +1 -1
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
  135. package/version.mjs +1 -1
@@ -105,6 +105,11 @@ export namespace Coupon {
105
105
  */
106
106
  durationInMonths: number | null;
107
107
 
108
+ /**
109
+ * Metadata associated with the entity
110
+ */
111
+ metadata: { [key: string]: string } | null;
112
+
108
113
  /**
109
114
  * Name of the coupon
110
115
  */
@@ -309,6 +314,11 @@ export interface CouponListResponse {
309
314
  */
310
315
  durationInMonths: number | null;
311
316
 
317
+ /**
318
+ * Metadata associated with the entity
319
+ */
320
+ metadata: { [key: string]: string } | null;
321
+
312
322
  /**
313
323
  * Name of the coupon
314
324
  */
@@ -139,6 +139,11 @@ export namespace CustomerResponse {
139
139
  */
140
140
  updatedAt: string;
141
141
 
142
+ /**
143
+ * The unique identifier for the entity in the billing provider
144
+ */
145
+ billingId?: string | null;
146
+
142
147
  /**
143
148
  * Customer level coupon
144
149
  */
@@ -257,6 +262,11 @@ export interface CustomerListResponse {
257
262
  */
258
263
  updatedAt: string;
259
264
 
265
+ /**
266
+ * The unique identifier for the entity in the billing provider
267
+ */
268
+ billingId?: string | null;
269
+
260
270
  /**
261
271
  * Customer level coupon
262
272
  */
@@ -393,6 +403,11 @@ export interface CustomerListResourcesResponse {
393
403
  }
394
404
 
395
405
  export interface CustomerUpdateParams {
406
+ /**
407
+ * The unique identifier for the entity in the billing provider
408
+ */
409
+ billingId?: string | null;
410
+
396
411
  /**
397
412
  * Customer level coupon
398
413
  */
@@ -544,6 +559,11 @@ export interface CustomerProvisionParams {
544
559
  */
545
560
  id: string;
546
561
 
562
+ /**
563
+ * The unique identifier for the entity in the billing provider
564
+ */
565
+ billingId?: string | null;
566
+
547
567
  /**
548
568
  * Customer level coupon
549
569
  */
@@ -0,0 +1,356 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import * as GrantsAPI from './grants';
5
+ import {
6
+ CreditGrantResponse,
7
+ GrantCreateParams,
8
+ GrantListParams,
9
+ GrantListResponse,
10
+ GrantListResponsesMyCursorIDPage,
11
+ Grants,
12
+ } from './grants';
13
+ import { APIPromise } from '../../../../core/api-promise';
14
+ import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../../core/pagination';
15
+ import { RequestOptions } from '../../../../internal/request-options';
16
+
17
+ export class Credits extends APIResource {
18
+ grants: GrantsAPI.Grants = new GrantsAPI.Grants(this._client);
19
+
20
+ /**
21
+ * Retrieves the automatic recharge configuration for a customer and currency.
22
+ * Returns default settings if no configuration exists.
23
+ */
24
+ getAutoRecharge(
25
+ query: CreditGetAutoRechargeParams,
26
+ options?: RequestOptions,
27
+ ): APIPromise<CreditGetAutoRechargeResponse> {
28
+ return this._client.get('/api/v1/credits/auto-recharge', { query, ...options });
29
+ }
30
+
31
+ /**
32
+ * Retrieves credit usage time-series data for a customer, grouped by feature, over
33
+ * a specified time range.
34
+ */
35
+ getUsage(query: CreditGetUsageParams, options?: RequestOptions): APIPromise<CreditGetUsageResponse> {
36
+ return this._client.get('/api/v1/credits/usage', { query, ...options });
37
+ }
38
+
39
+ /**
40
+ * Retrieves a paginated list of credit ledger events for a customer.
41
+ */
42
+ listLedger(
43
+ query: CreditListLedgerParams,
44
+ options?: RequestOptions,
45
+ ): PagePromise<CreditListLedgerResponsesMyCursorIDPage, CreditListLedgerResponse> {
46
+ return this._client.getAPIList('/api/v1/credits/ledger', MyCursorIDPage<CreditListLedgerResponse>, {
47
+ query,
48
+ ...options,
49
+ });
50
+ }
51
+ }
52
+
53
+ export type CreditListLedgerResponsesMyCursorIDPage = MyCursorIDPage<CreditListLedgerResponse>;
54
+
55
+ /**
56
+ * Response object
57
+ */
58
+ export interface CreditGetAutoRechargeResponse {
59
+ /**
60
+ * Automatic recharge configuration for a customer and currency
61
+ */
62
+ data: CreditGetAutoRechargeResponse.Data;
63
+ }
64
+
65
+ export namespace CreditGetAutoRechargeResponse {
66
+ /**
67
+ * Automatic recharge configuration for a customer and currency
68
+ */
69
+ export interface Data {
70
+ /**
71
+ * The unique configuration ID
72
+ */
73
+ id: string | null;
74
+
75
+ /**
76
+ * Timestamp of when the record was created
77
+ */
78
+ createdAt: string | null;
79
+
80
+ /**
81
+ * The currency ID for this configuration
82
+ */
83
+ currencyId: string;
84
+
85
+ /**
86
+ * The customer ID this configuration belongs to
87
+ */
88
+ customerId: string;
89
+
90
+ /**
91
+ * Expiration period for auto-recharge grants (1_MONTH or 1_YEAR)
92
+ */
93
+ grantExpirationPeriod: '1_MONTH' | '1_YEAR';
94
+
95
+ /**
96
+ * Whether automatic recharge is enabled
97
+ */
98
+ isEnabled: boolean;
99
+
100
+ /**
101
+ * Maximum monthly spend limit for automatic recharges
102
+ */
103
+ maxSpendLimit: number | null;
104
+
105
+ /**
106
+ * The target credit balance to recharge to
107
+ */
108
+ targetBalance: number;
109
+
110
+ /**
111
+ * The threshold type (CREDIT_AMOUNT or DOLLAR_AMOUNT)
112
+ */
113
+ thresholdType: 'CREDIT_AMOUNT' | 'DOLLAR_AMOUNT';
114
+
115
+ /**
116
+ * The threshold value that triggers a recharge
117
+ */
118
+ thresholdValue: number;
119
+
120
+ /**
121
+ * Timestamp of when the record was last updated
122
+ */
123
+ updatedAt: string | null;
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Response object
129
+ */
130
+ export interface CreditGetUsageResponse {
131
+ /**
132
+ * Credit usage data grouped by feature with time-series points
133
+ */
134
+ data: CreditGetUsageResponse.Data;
135
+ }
136
+
137
+ export namespace CreditGetUsageResponse {
138
+ /**
139
+ * Credit usage data grouped by feature with time-series points
140
+ */
141
+ export interface Data {
142
+ /**
143
+ * The custom currency used for credit measurement
144
+ */
145
+ currency: Data.Currency | null;
146
+
147
+ /**
148
+ * Credit usage series grouped by feature
149
+ */
150
+ series: Array<Data.Series>;
151
+ }
152
+
153
+ export namespace Data {
154
+ /**
155
+ * The custom currency used for credit measurement
156
+ */
157
+ export interface Currency {
158
+ /**
159
+ * The currency identifier
160
+ */
161
+ currencyId: string;
162
+
163
+ /**
164
+ * The display name of the currency
165
+ */
166
+ displayName: string;
167
+
168
+ /**
169
+ * Plural unit label
170
+ */
171
+ plural: string | null;
172
+
173
+ /**
174
+ * Singular unit label
175
+ */
176
+ singular: string | null;
177
+
178
+ /**
179
+ * The currency symbol
180
+ */
181
+ symbol: string | null;
182
+ }
183
+
184
+ /**
185
+ * Credit usage data for a single feature
186
+ */
187
+ export interface Series {
188
+ /**
189
+ * The feature ID
190
+ */
191
+ featureId: string;
192
+
193
+ /**
194
+ * The display name of the feature
195
+ */
196
+ featureName: string;
197
+
198
+ /**
199
+ * Time-series data points for this feature
200
+ */
201
+ points: Array<Series.Point>;
202
+
203
+ /**
204
+ * Total credits consumed by this feature in the time range
205
+ */
206
+ totalCredits: number;
207
+ }
208
+
209
+ export namespace Series {
210
+ /**
211
+ * A single data point in the credit usage time series
212
+ */
213
+ export interface Point {
214
+ /**
215
+ * The timestamp of the data point
216
+ */
217
+ timestamp: string;
218
+
219
+ /**
220
+ * The credit usage value at this point
221
+ */
222
+ value: number;
223
+ }
224
+ }
225
+ }
226
+ }
227
+
228
+ /**
229
+ * A credit ledger event representing a change to credit balance
230
+ */
231
+ export interface CreditListLedgerResponse {
232
+ /**
233
+ * The credit amount for this event
234
+ */
235
+ amount: number;
236
+
237
+ /**
238
+ * The credit currency ID
239
+ */
240
+ creditCurrencyId: string;
241
+
242
+ /**
243
+ * The credit grant ID associated with this event
244
+ */
245
+ creditGrantId: string;
246
+
247
+ /**
248
+ * The customer ID this event belongs to
249
+ */
250
+ customerId: string;
251
+
252
+ /**
253
+ * The unique event identifier
254
+ */
255
+ eventId: string | null;
256
+
257
+ /**
258
+ * The type of credit event
259
+ */
260
+ eventType:
261
+ | 'CREDITS_GRANTED'
262
+ | 'CREDITS_EXPIRED'
263
+ | 'CREDITS_CONSUMED'
264
+ | 'CREDITS_VOIDED'
265
+ | 'CREDITS_UPDATED';
266
+
267
+ /**
268
+ * The feature ID associated with this event
269
+ */
270
+ featureId: string | null;
271
+
272
+ /**
273
+ * The resource ID this event is scoped to
274
+ */
275
+ resourceId: string | null;
276
+
277
+ /**
278
+ * The timestamp when the event occurred
279
+ */
280
+ timestamp: string;
281
+ }
282
+
283
+ export interface CreditGetAutoRechargeParams {
284
+ /**
285
+ * Filter by currency ID (required)
286
+ */
287
+ currencyId: string;
288
+
289
+ /**
290
+ * Filter by customer ID (required)
291
+ */
292
+ customerId: string;
293
+ }
294
+
295
+ export interface CreditGetUsageParams {
296
+ /**
297
+ * Filter by customer ID (required)
298
+ */
299
+ customerId: string;
300
+
301
+ /**
302
+ * Filter by currency ID
303
+ */
304
+ currencyId?: string;
305
+
306
+ /**
307
+ * Filter by resource ID
308
+ */
309
+ resourceId?: string;
310
+
311
+ /**
312
+ * Time range for usage data (LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_YEAR). Defaults
313
+ * to LAST_MONTH
314
+ */
315
+ timeRange?: 'LAST_DAY' | 'LAST_WEEK' | 'LAST_MONTH' | 'LAST_YEAR';
316
+ }
317
+
318
+ export interface CreditListLedgerParams extends MyCursorIDPageParams {
319
+ /**
320
+ * Filter by customer ID (required)
321
+ */
322
+ customerId: string;
323
+
324
+ /**
325
+ * Filter by currency ID
326
+ */
327
+ currencyId?: string;
328
+
329
+ /**
330
+ * Filter by resource ID
331
+ */
332
+ resourceId?: string;
333
+ }
334
+
335
+ Credits.Grants = Grants;
336
+
337
+ export declare namespace Credits {
338
+ export {
339
+ type CreditGetAutoRechargeResponse as CreditGetAutoRechargeResponse,
340
+ type CreditGetUsageResponse as CreditGetUsageResponse,
341
+ type CreditListLedgerResponse as CreditListLedgerResponse,
342
+ type CreditListLedgerResponsesMyCursorIDPage as CreditListLedgerResponsesMyCursorIDPage,
343
+ type CreditGetAutoRechargeParams as CreditGetAutoRechargeParams,
344
+ type CreditGetUsageParams as CreditGetUsageParams,
345
+ type CreditListLedgerParams as CreditListLedgerParams,
346
+ };
347
+
348
+ export {
349
+ Grants as Grants,
350
+ type CreditGrantResponse as CreditGrantResponse,
351
+ type GrantListResponse as GrantListResponse,
352
+ type GrantListResponsesMyCursorIDPage as GrantListResponsesMyCursorIDPage,
353
+ type GrantCreateParams as GrantCreateParams,
354
+ type GrantListParams as GrantListParams,
355
+ };
356
+ }