@usehercules/sdk 1.2.0 → 1.4.0
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 +129 -0
- package/LICENSE +1 -1
- package/README.md +14 -20
- package/client.d.mts +6 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -3
- package/client.d.ts.map +1 -1
- package/client.js +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/beta/beta.d.mts +4 -4
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +4 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +4 -4
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.mts +1 -1
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +3 -3
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/pay/coupons.d.mts +156 -0
- package/resources/beta/pay/coupons.d.mts.map +1 -0
- package/resources/beta/pay/coupons.d.ts +156 -0
- package/resources/beta/pay/coupons.d.ts.map +1 -0
- package/resources/beta/pay/coupons.js +51 -0
- package/resources/beta/pay/coupons.js.map +1 -0
- package/resources/beta/pay/coupons.mjs +47 -0
- package/resources/beta/pay/coupons.mjs.map +1 -0
- package/resources/beta/pay/customers.d.mts +160 -0
- package/resources/beta/pay/customers.d.mts.map +1 -0
- package/resources/beta/pay/customers.d.ts +160 -0
- package/resources/beta/pay/customers.d.ts.map +1 -0
- package/resources/beta/pay/customers.js +60 -0
- package/resources/beta/pay/customers.js.map +1 -0
- package/resources/beta/pay/customers.mjs +56 -0
- package/resources/beta/pay/customers.mjs.map +1 -0
- package/resources/beta/{subscriptions → pay}/entitlements.d.mts +25 -19
- package/resources/beta/pay/entitlements.d.mts.map +1 -0
- package/resources/beta/{subscriptions → pay}/entitlements.d.ts +25 -19
- package/resources/beta/pay/entitlements.d.ts.map +1 -0
- package/resources/beta/pay/entitlements.js +41 -0
- package/resources/beta/pay/entitlements.js.map +1 -0
- package/resources/beta/pay/entitlements.mjs +37 -0
- package/resources/beta/pay/entitlements.mjs.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.d.mts +2 -2
- package/resources/beta/pay/index.d.mts.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.d.ts +2 -2
- package/resources/beta/pay/index.d.ts.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.js +5 -5
- package/resources/beta/pay/index.js.map +1 -0
- package/resources/beta/{subscriptions → pay}/index.mjs +2 -2
- package/resources/beta/pay/index.mjs.map +1 -0
- package/resources/beta/pay/pay.d.mts +206 -0
- package/resources/beta/pay/pay.d.mts.map +1 -0
- package/resources/beta/pay/pay.d.ts +206 -0
- package/resources/beta/pay/pay.d.ts.map +1 -0
- package/resources/beta/pay/pay.js +54 -0
- package/resources/beta/pay/pay.js.map +1 -0
- package/resources/beta/pay/pay.mjs +49 -0
- package/resources/beta/pay/pay.mjs.map +1 -0
- package/resources/beta/pay/products/entitlements.d.mts +53 -0
- package/resources/beta/pay/products/entitlements.d.mts.map +1 -0
- package/resources/beta/pay/products/entitlements.d.ts +53 -0
- package/resources/beta/pay/products/entitlements.d.ts.map +1 -0
- package/resources/beta/pay/products/entitlements.js +38 -0
- package/resources/beta/pay/products/entitlements.js.map +1 -0
- package/resources/beta/pay/products/entitlements.mjs +34 -0
- package/resources/beta/pay/products/entitlements.mjs.map +1 -0
- package/resources/beta/pay/products/index.d.mts +4 -0
- package/resources/beta/pay/products/index.d.mts.map +1 -0
- package/resources/beta/pay/products/index.d.ts +4 -0
- package/resources/beta/pay/products/index.d.ts.map +1 -0
- package/resources/beta/pay/products/index.js +11 -0
- package/resources/beta/pay/products/index.js.map +1 -0
- package/resources/beta/{subscriptions/plans → pay/products}/index.mjs +2 -1
- package/resources/beta/pay/products/index.mjs.map +1 -0
- package/resources/beta/pay/products/products.d.mts +183 -0
- package/resources/beta/pay/products/products.d.mts.map +1 -0
- package/resources/beta/pay/products/products.d.ts +183 -0
- package/resources/beta/pay/products/products.d.ts.map +1 -0
- package/resources/beta/pay/products/products.js +61 -0
- package/resources/beta/pay/products/products.js.map +1 -0
- package/resources/beta/pay/products/products.mjs +56 -0
- package/resources/beta/pay/products/products.mjs.map +1 -0
- package/resources/beta/pay/products/variants.d.mts +206 -0
- package/resources/beta/pay/products/variants.d.mts.map +1 -0
- package/resources/beta/pay/products/variants.d.ts +206 -0
- package/resources/beta/pay/products/variants.d.ts.map +1 -0
- package/resources/beta/pay/products/variants.js +56 -0
- package/resources/beta/pay/products/variants.js.map +1 -0
- package/resources/beta/pay/products/variants.mjs +52 -0
- package/resources/beta/pay/products/variants.mjs.map +1 -0
- package/resources/beta/pay/products.d.mts +2 -0
- package/resources/beta/pay/products.d.mts.map +1 -0
- package/resources/beta/pay/products.d.ts +2 -0
- package/resources/beta/pay/products.d.ts.map +1 -0
- package/resources/beta/{subscriptions/plans.js → pay/products.js} +2 -2
- package/resources/beta/pay/products.js.map +1 -0
- package/resources/beta/{subscriptions.mjs → pay/products.mjs} +2 -2
- package/resources/beta/pay/products.mjs.map +1 -0
- package/resources/beta/pay.d.mts +2 -0
- package/resources/beta/pay.d.mts.map +1 -0
- package/resources/beta/pay.d.ts +2 -0
- package/resources/beta/pay.d.ts.map +1 -0
- package/resources/beta/{subscriptions.js → pay.js} +2 -2
- package/resources/beta/pay.js.map +1 -0
- package/resources/beta/{subscriptions/plans.mjs → pay.mjs} +2 -2
- package/resources/beta/pay.mjs.map +1 -0
- package/src/client.ts +6 -4
- package/src/resources/beta/beta.ts +18 -18
- package/src/resources/beta/index.ts +8 -8
- package/src/resources/beta/pay/coupons.ts +218 -0
- package/src/resources/beta/pay/customers.ts +229 -0
- package/src/resources/beta/{subscriptions → pay}/entitlements.ts +29 -29
- package/src/resources/beta/{subscriptions → pay}/index.ts +15 -15
- package/src/resources/beta/pay/pay.ts +326 -0
- package/src/resources/beta/{subscriptions/plans → pay/products}/entitlements.ts +26 -21
- package/src/resources/beta/pay/products/index.ts +28 -0
- package/src/resources/beta/pay/products/products.ts +280 -0
- package/src/resources/beta/pay/products/variants.ts +279 -0
- package/src/resources/beta/{subscriptions.ts → pay/products.ts} +1 -1
- package/src/resources/beta/{subscriptions/plans.ts → pay.ts} +1 -1
- 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/beta/subscriptions/coupons.d.mts +0 -124
- package/resources/beta/subscriptions/coupons.d.mts.map +0 -1
- package/resources/beta/subscriptions/coupons.d.ts +0 -124
- package/resources/beta/subscriptions/coupons.d.ts.map +0 -1
- package/resources/beta/subscriptions/coupons.js +0 -45
- package/resources/beta/subscriptions/coupons.js.map +0 -1
- package/resources/beta/subscriptions/coupons.mjs +0 -41
- package/resources/beta/subscriptions/coupons.mjs.map +0 -1
- package/resources/beta/subscriptions/customers.d.mts +0 -93
- package/resources/beta/subscriptions/customers.d.mts.map +0 -1
- package/resources/beta/subscriptions/customers.d.ts +0 -93
- package/resources/beta/subscriptions/customers.d.ts.map +0 -1
- package/resources/beta/subscriptions/customers.js +0 -57
- package/resources/beta/subscriptions/customers.js.map +0 -1
- package/resources/beta/subscriptions/customers.mjs +0 -53
- package/resources/beta/subscriptions/customers.mjs.map +0 -1
- package/resources/beta/subscriptions/entitlements.d.mts.map +0 -1
- package/resources/beta/subscriptions/entitlements.d.ts.map +0 -1
- package/resources/beta/subscriptions/entitlements.js +0 -38
- package/resources/beta/subscriptions/entitlements.js.map +0 -1
- package/resources/beta/subscriptions/entitlements.mjs +0 -34
- package/resources/beta/subscriptions/entitlements.mjs.map +0 -1
- package/resources/beta/subscriptions/index.d.mts.map +0 -1
- package/resources/beta/subscriptions/index.d.ts.map +0 -1
- package/resources/beta/subscriptions/index.js.map +0 -1
- package/resources/beta/subscriptions/index.mjs.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.d.mts +0 -48
- package/resources/beta/subscriptions/plans/entitlements.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.d.ts +0 -48
- package/resources/beta/subscriptions/plans/entitlements.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.js +0 -34
- package/resources/beta/subscriptions/plans/entitlements.js.map +0 -1
- package/resources/beta/subscriptions/plans/entitlements.mjs +0 -30
- package/resources/beta/subscriptions/plans/entitlements.mjs.map +0 -1
- package/resources/beta/subscriptions/plans/index.d.mts +0 -3
- package/resources/beta/subscriptions/plans/index.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans/index.d.ts +0 -3
- package/resources/beta/subscriptions/plans/index.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans/index.js +0 -9
- package/resources/beta/subscriptions/plans/index.js.map +0 -1
- package/resources/beta/subscriptions/plans/index.mjs.map +0 -1
- package/resources/beta/subscriptions/plans/plans.d.mts +0 -87
- package/resources/beta/subscriptions/plans/plans.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans/plans.d.ts +0 -87
- package/resources/beta/subscriptions/plans/plans.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans/plans.js +0 -49
- package/resources/beta/subscriptions/plans/plans.js.map +0 -1
- package/resources/beta/subscriptions/plans/plans.mjs +0 -44
- package/resources/beta/subscriptions/plans/plans.mjs.map +0 -1
- package/resources/beta/subscriptions/plans.d.mts +0 -2
- package/resources/beta/subscriptions/plans.d.mts.map +0 -1
- package/resources/beta/subscriptions/plans.d.ts +0 -2
- package/resources/beta/subscriptions/plans.d.ts.map +0 -1
- package/resources/beta/subscriptions/plans.js.map +0 -1
- package/resources/beta/subscriptions/plans.mjs.map +0 -1
- package/resources/beta/subscriptions/subscriptions.d.mts +0 -130
- package/resources/beta/subscriptions/subscriptions.d.mts.map +0 -1
- package/resources/beta/subscriptions/subscriptions.d.ts +0 -130
- package/resources/beta/subscriptions/subscriptions.d.ts.map +0 -1
- package/resources/beta/subscriptions/subscriptions.js +0 -47
- package/resources/beta/subscriptions/subscriptions.js.map +0 -1
- package/resources/beta/subscriptions/subscriptions.mjs +0 -42
- package/resources/beta/subscriptions/subscriptions.mjs.map +0 -1
- package/resources/beta/subscriptions.d.mts +0 -2
- package/resources/beta/subscriptions.d.mts.map +0 -1
- package/resources/beta/subscriptions.d.ts +0 -2
- package/resources/beta/subscriptions.d.ts.map +0 -1
- package/resources/beta/subscriptions.js.map +0 -1
- package/resources/beta/subscriptions.mjs.map +0 -1
- package/src/resources/beta/subscriptions/coupons.ts +0 -185
- package/src/resources/beta/subscriptions/customers.ts +0 -168
- package/src/resources/beta/subscriptions/plans/index.ts +0 -18
- package/src/resources/beta/subscriptions/plans/plans.ts +0 -159
- package/src/resources/beta/subscriptions/subscriptions.ts +0 -241
|
@@ -1,168 +0,0 @@
|
|
|
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 { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../core/pagination';
|
|
6
|
-
import { buildHeaders } from '../../../internal/headers';
|
|
7
|
-
import { RequestOptions } from '../../../internal/request-options';
|
|
8
|
-
import { path } from '../../../internal/utils/path';
|
|
9
|
-
|
|
10
|
-
export class Customers extends APIResource {
|
|
11
|
-
/**
|
|
12
|
-
* Create Customer
|
|
13
|
-
*/
|
|
14
|
-
create(body: CustomerCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<Customer> {
|
|
15
|
-
return this._client.post('/v1/subscriptions/customers', { body, ...options });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Update Customer
|
|
20
|
-
*/
|
|
21
|
-
update(
|
|
22
|
-
customerID: string,
|
|
23
|
-
body: CustomerUpdateParams | null | undefined = {},
|
|
24
|
-
options?: RequestOptions,
|
|
25
|
-
): APIPromise<Customer> {
|
|
26
|
-
return this._client.patch(path`/v1/subscriptions/customers/${customerID}`, { body, ...options });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* List Customers
|
|
31
|
-
*/
|
|
32
|
-
list(
|
|
33
|
-
query: CustomerListParams | null | undefined = {},
|
|
34
|
-
options?: RequestOptions,
|
|
35
|
-
): PagePromise<CustomersCursorIDPage, Customer> {
|
|
36
|
-
return this._client.getAPIList('/v1/subscriptions/customers', CursorIDPage<Customer>, {
|
|
37
|
-
query,
|
|
38
|
-
...options,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Delete Customer
|
|
44
|
-
*/
|
|
45
|
-
delete(customerID: string, options?: RequestOptions): APIPromise<void> {
|
|
46
|
-
return this._client.delete(path`/v1/subscriptions/customers/${customerID}`, {
|
|
47
|
-
...options,
|
|
48
|
-
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Open Customer Portal
|
|
54
|
-
*/
|
|
55
|
-
billingPortal(
|
|
56
|
-
customerID: string,
|
|
57
|
-
body: CustomerBillingPortalParams | null | undefined = {},
|
|
58
|
-
options?: RequestOptions,
|
|
59
|
-
): APIPromise<CustomerBillingPortalResponse> {
|
|
60
|
-
return this._client.post(path`/v1/subscriptions/customers/${customerID}/billing_portal`, {
|
|
61
|
-
body,
|
|
62
|
-
...options,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Get Customer
|
|
68
|
-
*/
|
|
69
|
-
get(customerID: string, options?: RequestOptions): APIPromise<Customer> {
|
|
70
|
-
return this._client.get(path`/v1/subscriptions/customers/${customerID}`, options);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export type CustomersCursorIDPage = CursorIDPage<Customer>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* A subscription customer
|
|
78
|
-
*/
|
|
79
|
-
export interface Customer {
|
|
80
|
-
/**
|
|
81
|
-
* An id for a data item
|
|
82
|
-
*/
|
|
83
|
-
id: string;
|
|
84
|
-
|
|
85
|
-
created: string;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Customer billing address
|
|
89
|
-
*/
|
|
90
|
-
address?: CustomerAddress | null;
|
|
91
|
-
|
|
92
|
-
email?: string | null;
|
|
93
|
-
|
|
94
|
-
name?: string | null;
|
|
95
|
-
|
|
96
|
-
phone?: string | null;
|
|
97
|
-
|
|
98
|
-
stripe_id?: string | null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Customer billing address
|
|
103
|
-
*/
|
|
104
|
-
export interface CustomerAddress {
|
|
105
|
-
city?: string | null;
|
|
106
|
-
|
|
107
|
-
country?: string | null;
|
|
108
|
-
|
|
109
|
-
line1?: string | null;
|
|
110
|
-
|
|
111
|
-
line2?: string | null;
|
|
112
|
-
|
|
113
|
-
postal_code?: string | null;
|
|
114
|
-
|
|
115
|
-
state?: string | null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Billing portal session URL
|
|
120
|
-
*/
|
|
121
|
-
export interface CustomerBillingPortalResponse {
|
|
122
|
-
url: string;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface CustomerCreateParams {
|
|
126
|
-
/**
|
|
127
|
-
* Customer billing address
|
|
128
|
-
*/
|
|
129
|
-
address?: CustomerAddress;
|
|
130
|
-
|
|
131
|
-
email?: string;
|
|
132
|
-
|
|
133
|
-
name?: string;
|
|
134
|
-
|
|
135
|
-
phone?: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface CustomerUpdateParams {
|
|
139
|
-
/**
|
|
140
|
-
* Customer billing address
|
|
141
|
-
*/
|
|
142
|
-
address?: CustomerAddress;
|
|
143
|
-
|
|
144
|
-
email?: string;
|
|
145
|
-
|
|
146
|
-
name?: string;
|
|
147
|
-
|
|
148
|
-
phone?: string;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface CustomerListParams extends CursorIDPageParams {}
|
|
152
|
-
|
|
153
|
-
export interface CustomerBillingPortalParams {
|
|
154
|
-
return_url?: string;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export declare namespace Customers {
|
|
158
|
-
export {
|
|
159
|
-
type Customer as Customer,
|
|
160
|
-
type CustomerAddress as CustomerAddress,
|
|
161
|
-
type CustomerBillingPortalResponse as CustomerBillingPortalResponse,
|
|
162
|
-
type CustomersCursorIDPage as CustomersCursorIDPage,
|
|
163
|
-
type CustomerCreateParams as CustomerCreateParams,
|
|
164
|
-
type CustomerUpdateParams as CustomerUpdateParams,
|
|
165
|
-
type CustomerListParams as CustomerListParams,
|
|
166
|
-
type CustomerBillingPortalParams as CustomerBillingPortalParams,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
Entitlements,
|
|
5
|
-
type PlanEntitlement,
|
|
6
|
-
type EntitlementListParams,
|
|
7
|
-
type EntitlementAttachParams,
|
|
8
|
-
type EntitlementRemoveParams,
|
|
9
|
-
type PlanEntitlementsCursorIDPage,
|
|
10
|
-
} from './entitlements';
|
|
11
|
-
export {
|
|
12
|
-
Plans,
|
|
13
|
-
type Plan,
|
|
14
|
-
type PlanCreateParams,
|
|
15
|
-
type PlanUpdateParams,
|
|
16
|
-
type PlanListParams,
|
|
17
|
-
type PlansCursorIDPage,
|
|
18
|
-
} from './plans';
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../../../core/resource';
|
|
4
|
-
import * as EntitlementsAPI from './entitlements';
|
|
5
|
-
import {
|
|
6
|
-
EntitlementAttachParams,
|
|
7
|
-
EntitlementListParams,
|
|
8
|
-
EntitlementRemoveParams,
|
|
9
|
-
Entitlements,
|
|
10
|
-
PlanEntitlement,
|
|
11
|
-
PlanEntitlementsCursorIDPage,
|
|
12
|
-
} from './entitlements';
|
|
13
|
-
import { APIPromise } from '../../../../core/api-promise';
|
|
14
|
-
import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../../core/pagination';
|
|
15
|
-
import { RequestOptions } from '../../../../internal/request-options';
|
|
16
|
-
import { path } from '../../../../internal/utils/path';
|
|
17
|
-
|
|
18
|
-
export class Plans extends APIResource {
|
|
19
|
-
entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create Plan
|
|
23
|
-
*/
|
|
24
|
-
create(body: PlanCreateParams, options?: RequestOptions): APIPromise<Plan> {
|
|
25
|
-
return this._client.post('/v1/subscriptions/plans', { body, ...options });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Update Plan
|
|
30
|
-
*/
|
|
31
|
-
update(
|
|
32
|
-
planID: string,
|
|
33
|
-
body: PlanUpdateParams | null | undefined = {},
|
|
34
|
-
options?: RequestOptions,
|
|
35
|
-
): APIPromise<Plan> {
|
|
36
|
-
return this._client.patch(path`/v1/subscriptions/plans/${planID}`, { body, ...options });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* List Plans
|
|
41
|
-
*/
|
|
42
|
-
list(
|
|
43
|
-
query: PlanListParams | null | undefined = {},
|
|
44
|
-
options?: RequestOptions,
|
|
45
|
-
): PagePromise<PlansCursorIDPage, Plan> {
|
|
46
|
-
return this._client.getAPIList('/v1/subscriptions/plans', CursorIDPage<Plan>, { query, ...options });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Archive Plan
|
|
51
|
-
*/
|
|
52
|
-
archive(planID: string, options?: RequestOptions): APIPromise<Plan> {
|
|
53
|
-
return this._client.delete(path`/v1/subscriptions/plans/${planID}`, options);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Get Plan
|
|
58
|
-
*/
|
|
59
|
-
get(planID: string, options?: RequestOptions): APIPromise<Plan> {
|
|
60
|
-
return this._client.get(path`/v1/subscriptions/plans/${planID}`, options);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type PlansCursorIDPage = CursorIDPage<Plan>;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* A subscription plan
|
|
68
|
-
*/
|
|
69
|
-
export interface Plan {
|
|
70
|
-
/**
|
|
71
|
-
* An id for a data item
|
|
72
|
-
*/
|
|
73
|
-
id: string;
|
|
74
|
-
|
|
75
|
-
active: boolean;
|
|
76
|
-
|
|
77
|
-
created: string;
|
|
78
|
-
|
|
79
|
-
name: string;
|
|
80
|
-
|
|
81
|
-
stripe_product_id: string;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* A recurring price for a plan
|
|
85
|
-
*/
|
|
86
|
-
default_price?: Plan.DefaultPrice | null;
|
|
87
|
-
|
|
88
|
-
description?: string | null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export namespace Plan {
|
|
92
|
-
/**
|
|
93
|
-
* A recurring price for a plan
|
|
94
|
-
*/
|
|
95
|
-
export interface DefaultPrice {
|
|
96
|
-
/**
|
|
97
|
-
* An id for a data item
|
|
98
|
-
*/
|
|
99
|
-
id: string;
|
|
100
|
-
|
|
101
|
-
currency: string;
|
|
102
|
-
|
|
103
|
-
interval: 'day' | 'week' | 'month' | 'year';
|
|
104
|
-
|
|
105
|
-
interval_count: number;
|
|
106
|
-
|
|
107
|
-
unit_amount: number | null;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface PlanCreateParams {
|
|
112
|
-
name: string;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Amount in cents
|
|
116
|
-
*/
|
|
117
|
-
unit_amount: number;
|
|
118
|
-
|
|
119
|
-
currency?: string;
|
|
120
|
-
|
|
121
|
-
description?: string;
|
|
122
|
-
|
|
123
|
-
interval?: 'day' | 'week' | 'month' | 'year';
|
|
124
|
-
|
|
125
|
-
interval_count?: number;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface PlanUpdateParams {
|
|
129
|
-
active?: boolean;
|
|
130
|
-
|
|
131
|
-
description?: string;
|
|
132
|
-
|
|
133
|
-
name?: string;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface PlanListParams extends CursorIDPageParams {
|
|
137
|
-
active?: boolean;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
Plans.Entitlements = Entitlements;
|
|
141
|
-
|
|
142
|
-
export declare namespace Plans {
|
|
143
|
-
export {
|
|
144
|
-
type Plan as Plan,
|
|
145
|
-
type PlansCursorIDPage as PlansCursorIDPage,
|
|
146
|
-
type PlanCreateParams as PlanCreateParams,
|
|
147
|
-
type PlanUpdateParams as PlanUpdateParams,
|
|
148
|
-
type PlanListParams as PlanListParams,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export {
|
|
152
|
-
Entitlements as Entitlements,
|
|
153
|
-
type PlanEntitlement as PlanEntitlement,
|
|
154
|
-
type PlanEntitlementsCursorIDPage as PlanEntitlementsCursorIDPage,
|
|
155
|
-
type EntitlementListParams as EntitlementListParams,
|
|
156
|
-
type EntitlementAttachParams as EntitlementAttachParams,
|
|
157
|
-
type EntitlementRemoveParams as EntitlementRemoveParams,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../../core/resource';
|
|
4
|
-
import * as CouponsAPI from './coupons';
|
|
5
|
-
import {
|
|
6
|
-
Coupon,
|
|
7
|
-
CouponCreateParams,
|
|
8
|
-
CouponListParams,
|
|
9
|
-
CouponUpdateParams,
|
|
10
|
-
Coupons,
|
|
11
|
-
CouponsCursorIDPage,
|
|
12
|
-
} from './coupons';
|
|
13
|
-
import * as CustomersAPI from './customers';
|
|
14
|
-
import {
|
|
15
|
-
Customer,
|
|
16
|
-
CustomerAddress,
|
|
17
|
-
CustomerBillingPortalParams,
|
|
18
|
-
CustomerBillingPortalResponse,
|
|
19
|
-
CustomerCreateParams,
|
|
20
|
-
CustomerListParams,
|
|
21
|
-
CustomerUpdateParams,
|
|
22
|
-
Customers,
|
|
23
|
-
CustomersCursorIDPage,
|
|
24
|
-
} from './customers';
|
|
25
|
-
import * as EntitlementsAPI from './entitlements';
|
|
26
|
-
import {
|
|
27
|
-
Entitlement,
|
|
28
|
-
EntitlementCreateParams,
|
|
29
|
-
EntitlementListParams,
|
|
30
|
-
EntitlementUpdateParams,
|
|
31
|
-
Entitlements,
|
|
32
|
-
EntitlementsCursorIDPage,
|
|
33
|
-
} from './entitlements';
|
|
34
|
-
import * as PlansAPI from './plans/plans';
|
|
35
|
-
import {
|
|
36
|
-
Plan,
|
|
37
|
-
PlanCreateParams,
|
|
38
|
-
PlanListParams,
|
|
39
|
-
PlanUpdateParams,
|
|
40
|
-
Plans,
|
|
41
|
-
PlansCursorIDPage,
|
|
42
|
-
} from './plans/plans';
|
|
43
|
-
import { APIPromise } from '../../../core/api-promise';
|
|
44
|
-
import { RequestOptions } from '../../../internal/request-options';
|
|
45
|
-
|
|
46
|
-
export class Subscriptions extends APIResource {
|
|
47
|
-
customers: CustomersAPI.Customers = new CustomersAPI.Customers(this._client);
|
|
48
|
-
plans: PlansAPI.Plans = new PlansAPI.Plans(this._client);
|
|
49
|
-
entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
|
|
50
|
-
coupons: CouponsAPI.Coupons = new CouponsAPI.Coupons(this._client);
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Cancel Subscription
|
|
54
|
-
*/
|
|
55
|
-
cancel(body: SubscriptionCancelParams, options?: RequestOptions): APIPromise<SubscriptionCancelResponse> {
|
|
56
|
-
return this._client.post('/v1/subscriptions/cancel', { body, ...options });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Check Entitlement
|
|
61
|
-
*/
|
|
62
|
-
check(body: SubscriptionCheckParams, options?: RequestOptions): APIPromise<SubscriptionCheckResponse> {
|
|
63
|
-
return this._client.post('/v1/subscriptions/check', { body, ...options });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Create Checkout Session
|
|
68
|
-
*/
|
|
69
|
-
checkout(
|
|
70
|
-
body: SubscriptionCheckoutParams,
|
|
71
|
-
options?: RequestOptions,
|
|
72
|
-
): APIPromise<SubscriptionCheckoutResponse> {
|
|
73
|
-
return this._client.post('/v1/subscriptions/checkout', { body, ...options });
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Cancel subscription response
|
|
79
|
-
*/
|
|
80
|
-
export interface SubscriptionCancelResponse {
|
|
81
|
-
/**
|
|
82
|
-
* The subscription ID
|
|
83
|
-
*/
|
|
84
|
-
id: string;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Whether the subscription will cancel at period end
|
|
88
|
-
*/
|
|
89
|
-
cancel_at_period_end: boolean;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The subscription status
|
|
93
|
-
*/
|
|
94
|
-
status: string;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* When the subscription was canceled
|
|
98
|
-
*/
|
|
99
|
-
canceled_at?: string | null;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Check entitlement response
|
|
104
|
-
*/
|
|
105
|
-
export interface SubscriptionCheckResponse {
|
|
106
|
-
/**
|
|
107
|
-
* Whether the customer has the entitlement
|
|
108
|
-
*/
|
|
109
|
-
has_entitlement: boolean;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The entitlement lookup key that was checked
|
|
113
|
-
*/
|
|
114
|
-
lookup_key: string;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* The active entitlement ID if present
|
|
118
|
-
*/
|
|
119
|
-
entitlement_id?: string | null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Checkout session response
|
|
124
|
-
*/
|
|
125
|
-
export interface SubscriptionCheckoutResponse {
|
|
126
|
-
/**
|
|
127
|
-
* The checkout session ID
|
|
128
|
-
*/
|
|
129
|
-
id: string;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* The checkout URL to redirect the customer to
|
|
133
|
-
*/
|
|
134
|
-
url: string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface SubscriptionCancelParams {
|
|
138
|
-
/**
|
|
139
|
-
* The customer ID
|
|
140
|
-
*/
|
|
141
|
-
customer_id: string;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The subscription ID to cancel
|
|
145
|
-
*/
|
|
146
|
-
subscription_id: string;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Whether to cancel at period end or immediately
|
|
150
|
-
*/
|
|
151
|
-
cancel_at_period_end?: boolean;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface SubscriptionCheckParams {
|
|
155
|
-
/**
|
|
156
|
-
* The customer ID
|
|
157
|
-
*/
|
|
158
|
-
customer_id: string;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The entitlement feature lookup key to check
|
|
162
|
-
*/
|
|
163
|
-
entitlement_lookup_key: string;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export interface SubscriptionCheckoutParams {
|
|
167
|
-
/**
|
|
168
|
-
* The customer ID
|
|
169
|
-
*/
|
|
170
|
-
customer_id: string;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* The plan ID to subscribe to
|
|
174
|
-
*/
|
|
175
|
-
plan_id: string;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* URL to redirect on cancel
|
|
179
|
-
*/
|
|
180
|
-
cancel_url?: string;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* URL to redirect on success
|
|
184
|
-
*/
|
|
185
|
-
success_url?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
Subscriptions.Customers = Customers;
|
|
189
|
-
Subscriptions.Plans = Plans;
|
|
190
|
-
Subscriptions.Entitlements = Entitlements;
|
|
191
|
-
Subscriptions.Coupons = Coupons;
|
|
192
|
-
|
|
193
|
-
export declare namespace Subscriptions {
|
|
194
|
-
export {
|
|
195
|
-
type SubscriptionCancelResponse as SubscriptionCancelResponse,
|
|
196
|
-
type SubscriptionCheckResponse as SubscriptionCheckResponse,
|
|
197
|
-
type SubscriptionCheckoutResponse as SubscriptionCheckoutResponse,
|
|
198
|
-
type SubscriptionCancelParams as SubscriptionCancelParams,
|
|
199
|
-
type SubscriptionCheckParams as SubscriptionCheckParams,
|
|
200
|
-
type SubscriptionCheckoutParams as SubscriptionCheckoutParams,
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
export {
|
|
204
|
-
Customers as Customers,
|
|
205
|
-
type Customer as Customer,
|
|
206
|
-
type CustomerAddress as CustomerAddress,
|
|
207
|
-
type CustomerBillingPortalResponse as CustomerBillingPortalResponse,
|
|
208
|
-
type CustomersCursorIDPage as CustomersCursorIDPage,
|
|
209
|
-
type CustomerCreateParams as CustomerCreateParams,
|
|
210
|
-
type CustomerUpdateParams as CustomerUpdateParams,
|
|
211
|
-
type CustomerListParams as CustomerListParams,
|
|
212
|
-
type CustomerBillingPortalParams as CustomerBillingPortalParams,
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
export {
|
|
216
|
-
Plans as Plans,
|
|
217
|
-
type Plan as Plan,
|
|
218
|
-
type PlansCursorIDPage as PlansCursorIDPage,
|
|
219
|
-
type PlanCreateParams as PlanCreateParams,
|
|
220
|
-
type PlanUpdateParams as PlanUpdateParams,
|
|
221
|
-
type PlanListParams as PlanListParams,
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
export {
|
|
225
|
-
Entitlements as Entitlements,
|
|
226
|
-
type Entitlement as Entitlement,
|
|
227
|
-
type EntitlementsCursorIDPage as EntitlementsCursorIDPage,
|
|
228
|
-
type EntitlementCreateParams as EntitlementCreateParams,
|
|
229
|
-
type EntitlementUpdateParams as EntitlementUpdateParams,
|
|
230
|
-
type EntitlementListParams as EntitlementListParams,
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export {
|
|
234
|
-
Coupons as Coupons,
|
|
235
|
-
type Coupon as Coupon,
|
|
236
|
-
type CouponsCursorIDPage as CouponsCursorIDPage,
|
|
237
|
-
type CouponCreateParams as CouponCreateParams,
|
|
238
|
-
type CouponUpdateParams as CouponUpdateParams,
|
|
239
|
-
type CouponListParams as CouponListParams,
|
|
240
|
-
};
|
|
241
|
-
}
|