@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
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
4
|
import * as PaymentMethodAPI from './payment-method';
|
|
5
5
|
import { PaymentMethod, PaymentMethodAttachParams } from './payment-method';
|
|
6
|
-
import * as
|
|
7
|
-
import {
|
|
6
|
+
import * as PromotionalEntitlementsAPI from './promotional-entitlements';
|
|
7
|
+
import {
|
|
8
|
+
PromotionalEntitlementGrantParams,
|
|
9
|
+
PromotionalEntitlementGrantResponse,
|
|
10
|
+
PromotionalEntitlementRevokeParams,
|
|
11
|
+
PromotionalEntitlementRevokeResponse,
|
|
12
|
+
PromotionalEntitlements,
|
|
13
|
+
} from './promotional-entitlements';
|
|
8
14
|
import { APIPromise } from '../../../core/api-promise';
|
|
9
15
|
import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../core/pagination';
|
|
10
16
|
import { RequestOptions } from '../../../internal/request-options';
|
|
@@ -12,31 +18,27 @@ import { path } from '../../../internal/utils/path';
|
|
|
12
18
|
|
|
13
19
|
export class Customers extends APIResource {
|
|
14
20
|
paymentMethod: PaymentMethodAPI.PaymentMethod = new PaymentMethodAPI.PaymentMethod(this._client);
|
|
15
|
-
|
|
21
|
+
promotionalEntitlements: PromotionalEntitlementsAPI.PromotionalEntitlements =
|
|
22
|
+
new PromotionalEntitlementsAPI.PromotionalEntitlements(this._client);
|
|
16
23
|
|
|
17
24
|
/**
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
create(body: CustomerCreateParams, options?: RequestOptions): APIPromise<CustomerResponse> {
|
|
21
|
-
return this._client.post('/api/v1/customers', { body, ...options });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get a single customer by ID
|
|
25
|
+
* Retrieves a customer by their unique identifier, including billing information
|
|
26
|
+
* and subscription status.
|
|
26
27
|
*/
|
|
27
28
|
retrieve(id: string, options?: RequestOptions): APIPromise<CustomerResponse> {
|
|
28
29
|
return this._client.get(path`/api/v1/customers/${id}`, options);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Updates an existing customer's properties such as name, email, and billing
|
|
34
|
+
* information.
|
|
33
35
|
*/
|
|
34
36
|
update(id: string, body: CustomerUpdateParams, options?: RequestOptions): APIPromise<CustomerResponse> {
|
|
35
37
|
return this._client.patch(path`/api/v1/customers/${id}`, { body, ...options });
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* Retrieves a paginated list of customers in the environment.
|
|
40
42
|
*/
|
|
41
43
|
list(
|
|
42
44
|
query: CustomerListParams | null | undefined = {},
|
|
@@ -49,14 +51,46 @@ export class Customers extends APIResource {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
|
-
*
|
|
54
|
+
* Archives a customer, preventing new subscriptions. Optionally cancels existing
|
|
55
|
+
* subscriptions.
|
|
53
56
|
*/
|
|
54
57
|
archive(id: string, options?: RequestOptions): APIPromise<CustomerResponse> {
|
|
55
58
|
return this._client.post(path`/api/v1/customers/${id}/archive`, options);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
/**
|
|
59
|
-
*
|
|
62
|
+
* Imports multiple customers in bulk. Used for migrating customer data from
|
|
63
|
+
* external systems.
|
|
64
|
+
*/
|
|
65
|
+
import(body: CustomerImportParams, options?: RequestOptions): APIPromise<CustomerImportResponse> {
|
|
66
|
+
return this._client.post('/api/v1/customers/import', { body, ...options });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get a list of customerresources
|
|
71
|
+
*/
|
|
72
|
+
listResources(
|
|
73
|
+
id: string,
|
|
74
|
+
query: CustomerListResourcesParams | null | undefined = {},
|
|
75
|
+
options?: RequestOptions,
|
|
76
|
+
): PagePromise<CustomerListResourcesResponsesMyCursorIDPage, CustomerListResourcesResponse> {
|
|
77
|
+
return this._client.getAPIList(
|
|
78
|
+
path`/api/v1/customers/${id}/resources`,
|
|
79
|
+
MyCursorIDPage<CustomerListResourcesResponse>,
|
|
80
|
+
{ query, ...options },
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new customer and optionally provisions an initial subscription in a
|
|
86
|
+
* single operation.
|
|
87
|
+
*/
|
|
88
|
+
provision(body: CustomerProvisionParams, options?: RequestOptions): APIPromise<CustomerResponse> {
|
|
89
|
+
return this._client.post('/api/v1/customers', { body, ...options });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Restores an archived customer, allowing them to create new subscriptions again.
|
|
60
94
|
*/
|
|
61
95
|
unarchive(id: string, options?: RequestOptions): APIPromise<CustomerResponse> {
|
|
62
96
|
return this._client.post(path`/api/v1/customers/${id}/unarchive`, options);
|
|
@@ -65,6 +99,8 @@ export class Customers extends APIResource {
|
|
|
65
99
|
|
|
66
100
|
export type CustomerListResponsesMyCursorIDPage = MyCursorIDPage<CustomerListResponse>;
|
|
67
101
|
|
|
102
|
+
export type CustomerListResourcesResponsesMyCursorIDPage = MyCursorIDPage<CustomerListResourcesResponse>;
|
|
103
|
+
|
|
68
104
|
/**
|
|
69
105
|
* Response object
|
|
70
106
|
*/
|
|
@@ -311,21 +347,53 @@ export namespace CustomerListResponse {
|
|
|
311
347
|
}
|
|
312
348
|
}
|
|
313
349
|
|
|
314
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Response object
|
|
352
|
+
*/
|
|
353
|
+
export interface CustomerImportResponse {
|
|
315
354
|
/**
|
|
316
|
-
*
|
|
355
|
+
* List of newly created customer IDs from the import operation.
|
|
356
|
+
*/
|
|
357
|
+
data: CustomerImportResponse.Data;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export namespace CustomerImportResponse {
|
|
361
|
+
/**
|
|
362
|
+
* List of newly created customer IDs from the import operation.
|
|
363
|
+
*/
|
|
364
|
+
export interface Data {
|
|
365
|
+
/**
|
|
366
|
+
* Customer IDs created during import
|
|
367
|
+
*/
|
|
368
|
+
newCustomers: Array<string>;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Resource object that belongs to a customer
|
|
374
|
+
*/
|
|
375
|
+
export interface CustomerListResourcesResponse {
|
|
376
|
+
/**
|
|
377
|
+
* Resource slug
|
|
317
378
|
*/
|
|
318
379
|
id: string;
|
|
319
380
|
|
|
320
381
|
/**
|
|
321
|
-
*
|
|
382
|
+
* Timestamp of when the record was created
|
|
322
383
|
*/
|
|
323
|
-
|
|
384
|
+
createdAt: string;
|
|
324
385
|
|
|
325
386
|
/**
|
|
326
|
-
*
|
|
387
|
+
* Timestamp of when the record was last updated
|
|
327
388
|
*/
|
|
328
|
-
|
|
389
|
+
updatedAt: string;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface CustomerUpdateParams {
|
|
393
|
+
/**
|
|
394
|
+
* Customer level coupon
|
|
395
|
+
*/
|
|
396
|
+
couponId?: string | null;
|
|
329
397
|
|
|
330
398
|
/**
|
|
331
399
|
* The email of the customer
|
|
@@ -335,7 +403,7 @@ export interface CustomerCreateParams {
|
|
|
335
403
|
/**
|
|
336
404
|
* List of integrations
|
|
337
405
|
*/
|
|
338
|
-
integrations?: Array<
|
|
406
|
+
integrations?: Array<CustomerUpdateParams.Integration>;
|
|
339
407
|
|
|
340
408
|
/**
|
|
341
409
|
* Additional metadata
|
|
@@ -348,74 +416,141 @@ export interface CustomerCreateParams {
|
|
|
348
416
|
name?: string | null;
|
|
349
417
|
}
|
|
350
418
|
|
|
351
|
-
export namespace
|
|
419
|
+
export namespace CustomerUpdateParams {
|
|
352
420
|
/**
|
|
353
|
-
*
|
|
421
|
+
* External billing or CRM integration link
|
|
354
422
|
*/
|
|
355
|
-
export interface
|
|
423
|
+
export interface Integration {
|
|
356
424
|
/**
|
|
357
|
-
*
|
|
425
|
+
* Integration details
|
|
358
426
|
*/
|
|
359
|
-
|
|
427
|
+
id: string;
|
|
360
428
|
|
|
361
429
|
/**
|
|
362
|
-
*
|
|
430
|
+
* Synced entity id
|
|
363
431
|
*/
|
|
364
|
-
|
|
432
|
+
syncedEntityId: string | null;
|
|
365
433
|
|
|
366
434
|
/**
|
|
367
|
-
* The
|
|
435
|
+
* The vendor identifier of integration
|
|
368
436
|
*/
|
|
369
|
-
|
|
437
|
+
vendorIdentifier:
|
|
438
|
+
| 'AUTH0'
|
|
439
|
+
| 'ZUORA'
|
|
440
|
+
| 'STRIPE'
|
|
441
|
+
| 'HUBSPOT'
|
|
442
|
+
| 'AWS_MARKETPLACE'
|
|
443
|
+
| 'SNOWFLAKE'
|
|
444
|
+
| 'SALESFORCE'
|
|
445
|
+
| 'BIG_QUERY'
|
|
446
|
+
| 'OPEN_FGA'
|
|
447
|
+
| 'APP_STORE';
|
|
448
|
+
}
|
|
449
|
+
}
|
|
370
450
|
|
|
451
|
+
export interface CustomerListParams extends MyCursorIDPageParams {
|
|
452
|
+
/**
|
|
453
|
+
* Filter by creation date using range operators: gt, gte, lt, lte
|
|
454
|
+
*/
|
|
455
|
+
createdAt?: CustomerListParams.CreatedAt;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Filter by exact customer email address
|
|
459
|
+
*/
|
|
460
|
+
email?: string;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Filter by exact customer name
|
|
464
|
+
*/
|
|
465
|
+
name?: string;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export namespace CustomerListParams {
|
|
469
|
+
/**
|
|
470
|
+
* Filter by creation date using range operators: gt, gte, lt, lte
|
|
471
|
+
*/
|
|
472
|
+
export interface CreatedAt {
|
|
371
473
|
/**
|
|
372
|
-
*
|
|
474
|
+
* Greater than the specified createdAt value
|
|
373
475
|
*/
|
|
374
|
-
|
|
476
|
+
gt?: string;
|
|
375
477
|
|
|
376
478
|
/**
|
|
377
|
-
*
|
|
479
|
+
* Greater than or equal to the specified createdAt value
|
|
378
480
|
*/
|
|
379
|
-
|
|
481
|
+
gte?: string;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Less than the specified createdAt value
|
|
485
|
+
*/
|
|
486
|
+
lt?: string;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Less than or equal to the specified createdAt value
|
|
490
|
+
*/
|
|
491
|
+
lte?: string;
|
|
380
492
|
}
|
|
493
|
+
}
|
|
381
494
|
|
|
495
|
+
export interface CustomerImportParams {
|
|
382
496
|
/**
|
|
383
|
-
*
|
|
497
|
+
* List of customer objects to import
|
|
384
498
|
*/
|
|
385
|
-
|
|
499
|
+
customers: Array<CustomerImportParams.Customer>;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export namespace CustomerImportParams {
|
|
503
|
+
export interface Customer {
|
|
386
504
|
/**
|
|
387
|
-
*
|
|
505
|
+
* Customer slug
|
|
388
506
|
*/
|
|
389
507
|
id: string;
|
|
390
508
|
|
|
391
509
|
/**
|
|
392
|
-
*
|
|
510
|
+
* The email of the customer
|
|
393
511
|
*/
|
|
394
|
-
|
|
512
|
+
email: string | null;
|
|
395
513
|
|
|
396
514
|
/**
|
|
397
|
-
* The
|
|
515
|
+
* The name of the customer
|
|
398
516
|
*/
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
517
|
+
name: string | null;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Additional metadata
|
|
521
|
+
*/
|
|
522
|
+
metadata?: { [key: string]: string };
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Billing provider payment method id
|
|
526
|
+
*/
|
|
527
|
+
paymentMethodId?: string;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Timestamp of when the record was last updated
|
|
531
|
+
*/
|
|
532
|
+
updatedAt?: string;
|
|
410
533
|
}
|
|
411
534
|
}
|
|
412
535
|
|
|
413
|
-
export interface
|
|
536
|
+
export interface CustomerListResourcesParams extends MyCursorIDPageParams {}
|
|
537
|
+
|
|
538
|
+
export interface CustomerProvisionParams {
|
|
539
|
+
/**
|
|
540
|
+
* Customer slug
|
|
541
|
+
*/
|
|
542
|
+
id: string;
|
|
543
|
+
|
|
414
544
|
/**
|
|
415
545
|
* Customer level coupon
|
|
416
546
|
*/
|
|
417
547
|
couponId?: string | null;
|
|
418
548
|
|
|
549
|
+
/**
|
|
550
|
+
* The default payment method details
|
|
551
|
+
*/
|
|
552
|
+
defaultPaymentMethod?: CustomerProvisionParams.DefaultPaymentMethod | null;
|
|
553
|
+
|
|
419
554
|
/**
|
|
420
555
|
* The email of the customer
|
|
421
556
|
*/
|
|
@@ -424,7 +559,7 @@ export interface CustomerUpdateParams {
|
|
|
424
559
|
/**
|
|
425
560
|
* List of integrations
|
|
426
561
|
*/
|
|
427
|
-
integrations?: Array<
|
|
562
|
+
integrations?: Array<CustomerProvisionParams.Integration>;
|
|
428
563
|
|
|
429
564
|
/**
|
|
430
565
|
* Additional metadata
|
|
@@ -437,7 +572,37 @@ export interface CustomerUpdateParams {
|
|
|
437
572
|
name?: string | null;
|
|
438
573
|
}
|
|
439
574
|
|
|
440
|
-
export namespace
|
|
575
|
+
export namespace CustomerProvisionParams {
|
|
576
|
+
/**
|
|
577
|
+
* The default payment method details
|
|
578
|
+
*/
|
|
579
|
+
export interface DefaultPaymentMethod {
|
|
580
|
+
/**
|
|
581
|
+
* The default payment method id
|
|
582
|
+
*/
|
|
583
|
+
billingId: string | null;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* The expiration month of the default payment method
|
|
587
|
+
*/
|
|
588
|
+
cardExpiryMonth: number | null;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* The expiration year of the default payment method
|
|
592
|
+
*/
|
|
593
|
+
cardExpiryYear: number | null;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* The last 4 digits of the default payment method
|
|
597
|
+
*/
|
|
598
|
+
cardLast4Digits: string | null;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* The default payment method type
|
|
602
|
+
*/
|
|
603
|
+
type: 'CARD' | 'BANK' | 'CASH_APP';
|
|
604
|
+
}
|
|
605
|
+
|
|
441
606
|
/**
|
|
442
607
|
* External billing or CRM integration link
|
|
443
608
|
*/
|
|
@@ -469,22 +634,31 @@ export namespace CustomerUpdateParams {
|
|
|
469
634
|
}
|
|
470
635
|
}
|
|
471
636
|
|
|
472
|
-
export interface CustomerListParams extends MyCursorIDPageParams {}
|
|
473
|
-
|
|
474
637
|
Customers.PaymentMethod = PaymentMethod;
|
|
475
|
-
Customers.
|
|
638
|
+
Customers.PromotionalEntitlements = PromotionalEntitlements;
|
|
476
639
|
|
|
477
640
|
export declare namespace Customers {
|
|
478
641
|
export {
|
|
479
642
|
type CustomerResponse as CustomerResponse,
|
|
480
643
|
type CustomerListResponse as CustomerListResponse,
|
|
644
|
+
type CustomerImportResponse as CustomerImportResponse,
|
|
645
|
+
type CustomerListResourcesResponse as CustomerListResourcesResponse,
|
|
481
646
|
type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage,
|
|
482
|
-
type
|
|
647
|
+
type CustomerListResourcesResponsesMyCursorIDPage as CustomerListResourcesResponsesMyCursorIDPage,
|
|
483
648
|
type CustomerUpdateParams as CustomerUpdateParams,
|
|
484
649
|
type CustomerListParams as CustomerListParams,
|
|
650
|
+
type CustomerImportParams as CustomerImportParams,
|
|
651
|
+
type CustomerListResourcesParams as CustomerListResourcesParams,
|
|
652
|
+
type CustomerProvisionParams as CustomerProvisionParams,
|
|
485
653
|
};
|
|
486
654
|
|
|
487
655
|
export { PaymentMethod as PaymentMethod, type PaymentMethodAttachParams as PaymentMethodAttachParams };
|
|
488
656
|
|
|
489
|
-
export {
|
|
657
|
+
export {
|
|
658
|
+
PromotionalEntitlements as PromotionalEntitlements,
|
|
659
|
+
type PromotionalEntitlementGrantResponse as PromotionalEntitlementGrantResponse,
|
|
660
|
+
type PromotionalEntitlementRevokeResponse as PromotionalEntitlementRevokeResponse,
|
|
661
|
+
type PromotionalEntitlementGrantParams as PromotionalEntitlementGrantParams,
|
|
662
|
+
type PromotionalEntitlementRevokeParams as PromotionalEntitlementRevokeParams,
|
|
663
|
+
};
|
|
490
664
|
}
|
|
@@ -4,10 +4,21 @@ export {
|
|
|
4
4
|
Customers,
|
|
5
5
|
type CustomerResponse,
|
|
6
6
|
type CustomerListResponse,
|
|
7
|
-
type
|
|
7
|
+
type CustomerImportResponse,
|
|
8
|
+
type CustomerListResourcesResponse,
|
|
8
9
|
type CustomerUpdateParams,
|
|
9
10
|
type CustomerListParams,
|
|
11
|
+
type CustomerImportParams,
|
|
12
|
+
type CustomerListResourcesParams,
|
|
13
|
+
type CustomerProvisionParams,
|
|
10
14
|
type CustomerListResponsesMyCursorIDPage,
|
|
15
|
+
type CustomerListResourcesResponsesMyCursorIDPage,
|
|
11
16
|
} from './customers';
|
|
12
17
|
export { PaymentMethod, type PaymentMethodAttachParams } from './payment-method';
|
|
13
|
-
export {
|
|
18
|
+
export {
|
|
19
|
+
PromotionalEntitlements,
|
|
20
|
+
type PromotionalEntitlementGrantResponse,
|
|
21
|
+
type PromotionalEntitlementRevokeResponse,
|
|
22
|
+
type PromotionalEntitlementGrantParams,
|
|
23
|
+
type PromotionalEntitlementRevokeParams,
|
|
24
|
+
} from './promotional-entitlements';
|
|
@@ -8,7 +8,8 @@ import { path } from '../../../internal/utils/path';
|
|
|
8
8
|
|
|
9
9
|
export class PaymentMethod extends APIResource {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Attaches a payment method to a customer for billing. Required for paid
|
|
12
|
+
* subscriptions when integrated with a billing provider.
|
|
12
13
|
*/
|
|
13
14
|
attach(
|
|
14
15
|
id: string,
|
|
@@ -19,7 +20,8 @@ export class PaymentMethod extends APIResource {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Removes the payment method from a customer. Ensure active paid subscriptions
|
|
24
|
+
* have an alternative payment method.
|
|
23
25
|
*/
|
|
24
26
|
detach(id: string, options?: RequestOptions): APIPromise<CustomersAPI.CustomerResponse> {
|
|
25
27
|
return this._client.delete(path`/api/v1/customers/${id}/payment-method`, options);
|