@stigg/typescript 0.1.0-beta.34 → 0.1.0-beta.36

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 (58) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +1 -1
  3. package/client.d.ts +1 -1
  4. package/client.js +3 -3
  5. package/client.js.map +1 -1
  6. package/client.mjs +3 -3
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/v1/credits/consumption.d.mts +196 -0
  10. package/resources/v1/credits/consumption.d.mts.map +1 -0
  11. package/resources/v1/credits/consumption.d.ts +196 -0
  12. package/resources/v1/credits/consumption.d.ts.map +1 -0
  13. package/resources/v1/credits/consumption.js +46 -0
  14. package/resources/v1/credits/consumption.js.map +1 -0
  15. package/resources/v1/credits/consumption.mjs +42 -0
  16. package/resources/v1/credits/consumption.mjs.map +1 -0
  17. package/resources/v1/credits/credits.d.mts +4 -0
  18. package/resources/v1/credits/credits.d.mts.map +1 -1
  19. package/resources/v1/credits/credits.d.ts +4 -0
  20. package/resources/v1/credits/credits.d.ts.map +1 -1
  21. package/resources/v1/credits/credits.js +4 -0
  22. package/resources/v1/credits/credits.js.map +1 -1
  23. package/resources/v1/credits/credits.mjs +4 -0
  24. package/resources/v1/credits/credits.mjs.map +1 -1
  25. package/resources/v1/credits/index.d.mts +1 -0
  26. package/resources/v1/credits/index.d.mts.map +1 -1
  27. package/resources/v1/credits/index.d.ts +1 -0
  28. package/resources/v1/credits/index.d.ts.map +1 -1
  29. package/resources/v1/credits/index.js +3 -1
  30. package/resources/v1/credits/index.js.map +1 -1
  31. package/resources/v1/credits/index.mjs +1 -0
  32. package/resources/v1/credits/index.mjs.map +1 -1
  33. package/resources/v1/customers/customers.d.mts +5 -5
  34. package/resources/v1/customers/customers.d.mts.map +1 -1
  35. package/resources/v1/customers/customers.d.ts +5 -5
  36. package/resources/v1/customers/customers.d.ts.map +1 -1
  37. package/resources/v1/customers/customers.js.map +1 -1
  38. package/resources/v1/customers/customers.mjs.map +1 -1
  39. package/resources/v1/customers/integrations.d.mts +3 -3
  40. package/resources/v1/customers/integrations.d.mts.map +1 -1
  41. package/resources/v1/customers/integrations.d.ts +3 -3
  42. package/resources/v1/customers/integrations.d.ts.map +1 -1
  43. package/resources/v1/customers/payment-method.d.mts +1 -1
  44. package/resources/v1/customers/payment-method.d.mts.map +1 -1
  45. package/resources/v1/customers/payment-method.d.ts +1 -1
  46. package/resources/v1/customers/payment-method.d.ts.map +1 -1
  47. package/src/client.ts +3 -3
  48. package/src/resources/v1/credits/consumption.ts +266 -0
  49. package/src/resources/v1/credits/credits.ts +18 -0
  50. package/src/resources/v1/credits/index.ts +7 -0
  51. package/src/resources/v1/customers/customers.ts +10 -5
  52. package/src/resources/v1/customers/integrations.ts +5 -2
  53. package/src/resources/v1/customers/payment-method.ts +2 -1
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -131,7 +131,7 @@ export class Stigg {
131
131
  * API Client for interfacing with the Stigg API.
132
132
  *
133
133
  * @param {string | undefined} [opts.apiKey=process.env['STIGG_API_KEY'] ?? undefined]
134
- * @param {string} [opts.baseURL=process.env['STIGG_BASE_URL'] ?? https://edge.api.stigg.io] - Override the default base URL for the API.
134
+ * @param {string} [opts.baseURL=process.env['STIGG_BASE_URL'] ?? https://api.stigg.io] - Override the default base URL for the API.
135
135
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
136
136
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
137
137
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -153,7 +153,7 @@ export class Stigg {
153
153
  const options: ClientOptions = {
154
154
  apiKey,
155
155
  ...opts,
156
- baseURL: baseURL || `https://edge.api.stigg.io`,
156
+ baseURL: baseURL || `https://api.stigg.io`,
157
157
  };
158
158
 
159
159
  this.baseURL = options.baseURL!;
@@ -211,7 +211,7 @@ export class Stigg {
211
211
  * Check whether the base URL is set to its default.
212
212
  */
213
213
  #baseURLOverridden(): boolean {
214
- return this.baseURL !== 'https://edge.api.stigg.io';
214
+ return this.baseURL !== 'https://api.stigg.io';
215
215
  }
216
216
 
217
217
  protected defaultQuery(): Record<string, string | undefined> | undefined {
@@ -0,0 +1,266 @@
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 { buildHeaders } from '../../../internal/headers';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+
8
+ export class Consumption extends APIResource {
9
+ /**
10
+ * Consumes a specified amount of credits directly from a customer wallet, with no
11
+ * feature mapping. Returns the optimistic balance.
12
+ */
13
+ consume(
14
+ params: ConsumptionConsumeParams,
15
+ options?: RequestOptions,
16
+ ): APIPromise<ConsumptionConsumeResponse> {
17
+ const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
18
+ return this._client.post('/api/v1/credits/consumption', {
19
+ body,
20
+ ...options,
21
+ headers: buildHeaders([
22
+ {
23
+ ...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
24
+ ...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
25
+ },
26
+ options?.headers,
27
+ ]),
28
+ });
29
+ }
30
+
31
+ /**
32
+ * Consumes credits directly from customer wallets asynchronously. Consumptions are
33
+ * reconciled asynchronously into the credit balances.
34
+ */
35
+ consumeAsync(
36
+ params: ConsumptionConsumeAsyncParams,
37
+ options?: RequestOptions,
38
+ ): APIPromise<ConsumptionConsumeAsyncResponse> {
39
+ const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
40
+ return this._client.post('/api/v1/credits/consumption/async', {
41
+ body,
42
+ ...options,
43
+ headers: buildHeaders([
44
+ {
45
+ ...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
46
+ ...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
47
+ },
48
+ options?.headers,
49
+ ]),
50
+ });
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Response object
56
+ */
57
+ export interface ConsumptionConsumeResponse {
58
+ /**
59
+ * Result of a synchronous direct credit consumption
60
+ */
61
+ data: ConsumptionConsumeResponse.Data;
62
+ }
63
+
64
+ export namespace ConsumptionConsumeResponse {
65
+ /**
66
+ * Result of a synchronous direct credit consumption
67
+ */
68
+ export interface Data {
69
+ /**
70
+ * The amount of credits consumed
71
+ */
72
+ amount: number;
73
+
74
+ /**
75
+ * The credit currency the credits were consumed from
76
+ */
77
+ currencyId: string;
78
+
79
+ /**
80
+ * The customer the credits were consumed from
81
+ */
82
+ customerId: string;
83
+
84
+ /**
85
+ * The timestamp the consumption was attributed to
86
+ */
87
+ timestamp: string;
88
+
89
+ /**
90
+ * The optimistic credit balance after consumption (when sync credit consumption is
91
+ * enabled)
92
+ */
93
+ credit?: Data.Credit | null;
94
+
95
+ /**
96
+ * The resource the consumption was attributed to
97
+ */
98
+ resourceId?: string | null;
99
+ }
100
+
101
+ export namespace Data {
102
+ /**
103
+ * The optimistic credit balance after consumption (when sync credit consumption is
104
+ * enabled)
105
+ */
106
+ export interface Credit {
107
+ /**
108
+ * The credit currency identifier
109
+ */
110
+ currencyId: string;
111
+
112
+ /**
113
+ * The credits consumed (optimistic — includes not-yet-reconciled usage)
114
+ */
115
+ currentUsage: number;
116
+
117
+ /**
118
+ * The grant-version timestamp of this balance, used by the SDK for last-write-wins
119
+ * reconciliation
120
+ */
121
+ timestamp: string;
122
+
123
+ /**
124
+ * The total credits granted
125
+ */
126
+ usageLimit: number;
127
+
128
+ /**
129
+ * End of the current credit grant period (when recurring credits reset), if
130
+ * applicable
131
+ */
132
+ usagePeriodEnd?: string | null;
133
+ }
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Response object
139
+ */
140
+ export interface ConsumptionConsumeAsyncResponse {
141
+ /**
142
+ * Confirmation that the credit consumptions were accepted for processing
143
+ */
144
+ data: unknown;
145
+ }
146
+
147
+ export interface ConsumptionConsumeParams {
148
+ /**
149
+ * Body param: The amount of credits to consume
150
+ */
151
+ amount: number;
152
+
153
+ /**
154
+ * Body param: The credit currency to consume from (required)
155
+ */
156
+ currencyId: string;
157
+
158
+ /**
159
+ * Body param: The customer to consume credits from (required)
160
+ */
161
+ customerId: string;
162
+
163
+ /**
164
+ * Body param: A unique key used to deduplicate the consumption (required)
165
+ */
166
+ idempotencyKey: string;
167
+
168
+ /**
169
+ * Body param: Optional timestamp the consumption is attributed to
170
+ */
171
+ createdAt?: string;
172
+
173
+ /**
174
+ * Body param: Optional dimensions describing the consumption
175
+ */
176
+ dimensions?: { [key: string]: string | number | boolean };
177
+
178
+ /**
179
+ * Body param: Optional resource the consumption is attributed to
180
+ */
181
+ resourceId?: string;
182
+
183
+ /**
184
+ * Header param: Account ID — optional when authenticating with a user JWT (Bearer
185
+ * token); falls back to the user's first membership. Ignored for API-key auth.
186
+ */
187
+ 'X-ACCOUNT-ID'?: string;
188
+
189
+ /**
190
+ * Header param: Environment ID — required when authenticating with a user JWT
191
+ * (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
192
+ * intrinsic to the key).
193
+ */
194
+ 'X-ENVIRONMENT-ID'?: string;
195
+ }
196
+
197
+ export interface ConsumptionConsumeAsyncParams {
198
+ /**
199
+ * Body param: The credit consumptions to report (up to 1000)
200
+ */
201
+ consumptions: Array<ConsumptionConsumeAsyncParams.Consumption>;
202
+
203
+ /**
204
+ * Header param: Account ID — optional when authenticating with a user JWT (Bearer
205
+ * token); falls back to the user's first membership. Ignored for API-key auth.
206
+ */
207
+ 'X-ACCOUNT-ID'?: string;
208
+
209
+ /**
210
+ * Header param: Environment ID — required when authenticating with a user JWT
211
+ * (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
212
+ * intrinsic to the key).
213
+ */
214
+ 'X-ENVIRONMENT-ID'?: string;
215
+ }
216
+
217
+ export namespace ConsumptionConsumeAsyncParams {
218
+ /**
219
+ * Request body for consuming credits directly from a wallet
220
+ */
221
+ export interface Consumption {
222
+ /**
223
+ * The amount of credits to consume
224
+ */
225
+ amount: number;
226
+
227
+ /**
228
+ * The credit currency to consume from (required)
229
+ */
230
+ currencyId: string;
231
+
232
+ /**
233
+ * The customer to consume credits from (required)
234
+ */
235
+ customerId: string;
236
+
237
+ /**
238
+ * A unique key used to deduplicate the consumption (required)
239
+ */
240
+ idempotencyKey: string;
241
+
242
+ /**
243
+ * Optional timestamp the consumption is attributed to
244
+ */
245
+ createdAt?: string;
246
+
247
+ /**
248
+ * Optional dimensions describing the consumption
249
+ */
250
+ dimensions?: { [key: string]: string | number | boolean };
251
+
252
+ /**
253
+ * Optional resource the consumption is attributed to
254
+ */
255
+ resourceId?: string;
256
+ }
257
+ }
258
+
259
+ export declare namespace Consumption {
260
+ export {
261
+ type ConsumptionConsumeResponse as ConsumptionConsumeResponse,
262
+ type ConsumptionConsumeAsyncResponse as ConsumptionConsumeAsyncResponse,
263
+ type ConsumptionConsumeParams as ConsumptionConsumeParams,
264
+ type ConsumptionConsumeAsyncParams as ConsumptionConsumeAsyncParams,
265
+ };
266
+ }
@@ -1,6 +1,14 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
+ import * as ConsumptionAPI from './consumption';
5
+ import {
6
+ Consumption,
7
+ ConsumptionConsumeAsyncParams,
8
+ ConsumptionConsumeAsyncResponse,
9
+ ConsumptionConsumeParams,
10
+ ConsumptionConsumeResponse,
11
+ } from './consumption';
4
12
  import * as CustomCurrenciesAPI from './custom-currencies';
5
13
  import {
6
14
  CustomCurrencies,
@@ -35,6 +43,7 @@ export class Credits extends APIResource {
35
43
  customCurrencies: CustomCurrenciesAPI.CustomCurrencies = new CustomCurrenciesAPI.CustomCurrencies(
36
44
  this._client,
37
45
  );
46
+ consumption: ConsumptionAPI.Consumption = new ConsumptionAPI.Consumption(this._client);
38
47
 
39
48
  /**
40
49
  * Retrieves the automatic recharge configuration for a customer and currency.
@@ -502,6 +511,7 @@ export interface CreditListLedgerParams extends MyCursorIDPageParams {
502
511
 
503
512
  Credits.Grants = Grants;
504
513
  Credits.CustomCurrencies = CustomCurrencies;
514
+ Credits.Consumption = Consumption;
505
515
 
506
516
  export declare namespace Credits {
507
517
  export {
@@ -537,4 +547,12 @@ export declare namespace Credits {
537
547
  type CustomCurrencyListAssociatedEntitiesParams as CustomCurrencyListAssociatedEntitiesParams,
538
548
  type CustomCurrencyUnarchiveParams as CustomCurrencyUnarchiveParams,
539
549
  };
550
+
551
+ export {
552
+ Consumption as Consumption,
553
+ type ConsumptionConsumeResponse as ConsumptionConsumeResponse,
554
+ type ConsumptionConsumeAsyncResponse as ConsumptionConsumeAsyncResponse,
555
+ type ConsumptionConsumeParams as ConsumptionConsumeParams,
556
+ type ConsumptionConsumeAsyncParams as ConsumptionConsumeAsyncParams,
557
+ };
540
558
  }
@@ -1,5 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ Consumption,
5
+ type ConsumptionConsumeResponse,
6
+ type ConsumptionConsumeAsyncResponse,
7
+ type ConsumptionConsumeParams,
8
+ type ConsumptionConsumeAsyncParams,
9
+ } from './consumption';
3
10
  export {
4
11
  Credits,
5
12
  type CreditGetAutoRechargeResponse,
@@ -308,7 +308,8 @@ export namespace CustomerIntegrationResponse {
308
308
  | 'OPEN_FGA'
309
309
  | 'APP_STORE'
310
310
  | 'RECEIVED'
311
- | 'PREQUEL';
311
+ | 'PREQUEL'
312
+ | 'AIRWALLEX';
312
313
 
313
314
  /**
314
315
  * Price billing sync revision data containing billing ID, link URL, and price
@@ -638,7 +639,8 @@ export namespace CustomerResponse {
638
639
  | 'OPEN_FGA'
639
640
  | 'APP_STORE'
640
641
  | 'RECEIVED'
641
- | 'PREQUEL';
642
+ | 'PREQUEL'
643
+ | 'AIRWALLEX';
642
644
  }
643
645
 
644
646
  /**
@@ -1222,7 +1224,8 @@ export namespace CustomerListResponse {
1222
1224
  | 'OPEN_FGA'
1223
1225
  | 'APP_STORE'
1224
1226
  | 'RECEIVED'
1225
- | 'PREQUEL';
1227
+ | 'PREQUEL'
1228
+ | 'AIRWALLEX';
1226
1229
  }
1227
1230
 
1228
1231
  /**
@@ -2203,7 +2206,8 @@ export namespace CustomerUpdateParams {
2203
2206
  | 'OPEN_FGA'
2204
2207
  | 'APP_STORE'
2205
2208
  | 'RECEIVED'
2206
- | 'PREQUEL';
2209
+ | 'PREQUEL'
2210
+ | 'AIRWALLEX';
2207
2211
  }
2208
2212
 
2209
2213
  /**
@@ -2980,7 +2984,8 @@ export namespace CustomerProvisionParams {
2980
2984
  | 'OPEN_FGA'
2981
2985
  | 'APP_STORE'
2982
2986
  | 'RECEIVED'
2983
- | 'PREQUEL';
2987
+ | 'PREQUEL'
2988
+ | 'AIRWALLEX';
2984
2989
  }
2985
2990
 
2986
2991
  /**
@@ -156,7 +156,8 @@ export interface IntegrationListResponse {
156
156
  | 'OPEN_FGA'
157
157
  | 'APP_STORE'
158
158
  | 'RECEIVED'
159
- | 'PREQUEL';
159
+ | 'PREQUEL'
160
+ | 'AIRWALLEX';
160
161
 
161
162
  /**
162
163
  * Price billing sync revision data containing billing ID, link URL, and price
@@ -280,6 +281,7 @@ export interface IntegrationListParams extends MyCursorIDPageParams {
280
281
  | 'APP_STORE'
281
282
  | 'RECEIVED'
282
283
  | 'PREQUEL'
284
+ | 'AIRWALLEX'
283
285
  >;
284
286
 
285
287
  /**
@@ -322,7 +324,8 @@ export interface IntegrationLinkParams {
322
324
  | 'OPEN_FGA'
323
325
  | 'APP_STORE'
324
326
  | 'RECEIVED'
325
- | 'PREQUEL';
327
+ | 'PREQUEL'
328
+ | 'AIRWALLEX';
326
329
 
327
330
  /**
328
331
  * Header param: Account ID — optional when authenticating with a user JWT (Bearer
@@ -83,7 +83,8 @@ export interface PaymentMethodAttachParams {
83
83
  | 'OPEN_FGA'
84
84
  | 'APP_STORE'
85
85
  | 'RECEIVED'
86
- | 'PREQUEL';
86
+ | 'PREQUEL'
87
+ | 'AIRWALLEX';
87
88
 
88
89
  /**
89
90
  * Body param: Customers selected currency
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-beta.34'; // x-release-please-version
1
+ export const VERSION = '0.1.0-beta.36'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-beta.34";
1
+ export declare const VERSION = "0.1.0-beta.36";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-beta.34";
1
+ export declare const VERSION = "0.1.0-beta.36";
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-beta.34'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-beta.36'; // 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-beta.34'; // x-release-please-version
1
+ export const VERSION = '0.1.0-beta.36'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map