@stigg/typescript 0.1.0-alpha.4 → 0.1.0-alpha.8
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 +86 -0
- package/README.md +9 -0
- package/client.d.mts +4 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -6
- package/client.d.ts.map +1 -1
- package/client.js +23 -21
- package/client.js.map +1 -1
- package/client.mjs +23 -21
- 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/v1/coupons.d.mts +74 -8
- package/resources/v1/coupons.d.mts.map +1 -1
- package/resources/v1/coupons.d.ts +74 -8
- package/resources/v1/coupons.d.ts.map +1 -1
- package/resources/v1/coupons.js +16 -3
- package/resources/v1/coupons.js.map +1 -1
- package/resources/v1/coupons.mjs +16 -3
- package/resources/v1/coupons.mjs.map +1 -1
- package/resources/v1/customers/customers.d.mts +74 -10
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +74 -10
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +18 -7
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +18 -7
- 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.map +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 +159 -11
- package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -1
- package/resources/v1/customers/promotional-entitlements.d.ts +159 -11
- package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -1
- package/resources/v1/customers/promotional-entitlements.js +15 -6
- package/resources/v1/customers/promotional-entitlements.js.map +1 -1
- package/resources/v1/customers/promotional-entitlements.mjs +15 -6
- package/resources/v1/customers/promotional-entitlements.mjs.map +1 -1
- package/resources/v1/events/addons/addons.d.mts +605 -0
- package/resources/v1/events/addons/addons.d.mts.map +1 -0
- package/resources/v1/events/addons/addons.d.ts +605 -0
- package/resources/v1/events/addons/addons.d.ts.map +1 -0
- package/resources/v1/events/addons/addons.js +60 -0
- package/resources/v1/events/addons/addons.js.map +1 -0
- package/resources/v1/events/addons/addons.mjs +55 -0
- package/resources/v1/events/addons/addons.mjs.map +1 -0
- package/resources/v1/events/addons/draft.d.mts +121 -0
- package/resources/v1/events/addons/draft.d.mts.map +1 -0
- package/resources/v1/events/addons/draft.d.ts +121 -0
- package/resources/v1/events/addons/draft.d.ts.map +1 -0
- package/resources/v1/events/addons/draft.js +22 -0
- package/resources/v1/events/addons/draft.js.map +1 -0
- package/resources/v1/events/addons/draft.mjs +18 -0
- package/resources/v1/events/addons/draft.mjs.map +1 -0
- package/resources/v1/events/addons/index.d.mts +3 -0
- package/resources/v1/events/addons/index.d.mts.map +1 -0
- package/resources/v1/events/addons/index.d.ts +3 -0
- package/resources/v1/events/addons/index.d.ts.map +1 -0
- package/resources/v1/events/addons/index.js +9 -0
- package/resources/v1/events/addons/index.js.map +1 -0
- package/resources/v1/events/addons/index.mjs +4 -0
- package/resources/v1/events/addons/index.mjs.map +1 -0
- package/resources/v1/events/addons.d.mts +2 -0
- package/resources/v1/events/addons.d.mts.map +1 -0
- package/resources/v1/events/addons.d.ts +2 -0
- package/resources/v1/events/addons.d.ts.map +1 -0
- package/resources/v1/events/addons.js +6 -0
- package/resources/v1/events/addons.js.map +1 -0
- package/resources/v1/events/addons.mjs +3 -0
- package/resources/v1/events/addons.mjs.map +1 -0
- package/resources/v1/events/events.d.mts +75 -0
- package/resources/v1/events/events.d.mts.map +1 -0
- package/resources/v1/events/events.d.ts +75 -0
- package/resources/v1/events/events.d.ts.map +1 -0
- package/resources/v1/events/events.js +32 -0
- package/resources/v1/events/events.js.map +1 -0
- package/resources/v1/events/events.mjs +27 -0
- package/resources/v1/events/events.mjs.map +1 -0
- package/resources/v1/events/features.d.mts +856 -0
- package/resources/v1/events/features.d.mts.map +1 -0
- package/resources/v1/events/features.d.ts +856 -0
- package/resources/v1/events/features.d.ts.map +1 -0
- package/resources/v1/events/features.js +51 -0
- package/resources/v1/events/features.js.map +1 -0
- package/resources/v1/events/features.mjs +47 -0
- package/resources/v1/events/features.mjs.map +1 -0
- package/resources/v1/events/index.d.mts +5 -0
- package/resources/v1/events/index.d.mts.map +1 -0
- package/resources/v1/events/index.d.ts +5 -0
- package/resources/v1/events/index.d.ts.map +1 -0
- package/resources/v1/events/index.js +13 -0
- package/resources/v1/events/index.js.map +1 -0
- package/resources/v1/events/index.mjs +6 -0
- package/resources/v1/events/index.mjs.map +1 -0
- package/resources/v1/events/plans.d.mts +348 -0
- package/resources/v1/events/plans.d.mts.map +1 -0
- package/resources/v1/events/plans.d.ts +348 -0
- package/resources/v1/events/plans.d.ts.map +1 -0
- package/resources/v1/events/plans.js +30 -0
- package/resources/v1/events/plans.js.map +1 -0
- package/resources/v1/events/plans.mjs +26 -0
- package/resources/v1/events/plans.mjs.map +1 -0
- package/resources/v1/events.d.mts +1 -61
- package/resources/v1/events.d.mts.map +1 -1
- package/resources/v1/events.d.ts +1 -61
- package/resources/v1/events.d.ts.map +1 -1
- package/resources/v1/events.js +2 -11
- package/resources/v1/events.js.map +1 -1
- package/resources/v1/events.mjs +1 -9
- package/resources/v1/events.mjs.map +1 -1
- package/resources/v1/index.d.mts +4 -3
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +4 -3
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +7 -5
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +2 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/products.d.mts +672 -0
- package/resources/v1/products.d.mts.map +1 -0
- package/resources/v1/products.d.ts +672 -0
- package/resources/v1/products.d.ts.map +1 -0
- package/resources/v1/products.js +52 -0
- package/resources/v1/products.js.map +1 -0
- package/resources/v1/products.mjs +48 -0
- package/resources/v1/products.mjs.map +1 -0
- package/resources/v1/subscriptions/future-update.d.mts +3 -2
- package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
- package/resources/v1/subscriptions/future-update.d.ts +3 -2
- 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 -0
- package/resources/v1/subscriptions/index.d.mts.map +1 -1
- package/resources/v1/subscriptions/index.d.ts +2 -0
- package/resources/v1/subscriptions/index.d.ts.map +1 -1
- package/resources/v1/subscriptions/index.js +5 -1
- package/resources/v1/subscriptions/index.js.map +1 -1
- package/resources/v1/subscriptions/index.mjs +2 -0
- package/resources/v1/subscriptions/index.mjs.map +1 -1
- package/resources/v1/subscriptions/invoice.d.mts +34 -0
- package/resources/v1/subscriptions/invoice.d.mts.map +1 -0
- package/resources/v1/subscriptions/invoice.d.ts +34 -0
- package/resources/v1/subscriptions/invoice.d.ts.map +1 -0
- package/resources/v1/subscriptions/invoice.js +17 -0
- package/resources/v1/subscriptions/invoice.js.map +1 -0
- package/resources/v1/subscriptions/invoice.mjs +13 -0
- package/resources/v1/subscriptions/invoice.mjs.map +1 -0
- package/resources/v1/subscriptions/subscriptions.d.mts +166 -34
- package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.d.ts +166 -34
- package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.js +28 -10
- package/resources/v1/subscriptions/subscriptions.js.map +1 -1
- package/resources/v1/subscriptions/subscriptions.mjs +28 -10
- package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
- package/resources/v1/subscriptions/usage.d.mts +98 -0
- package/resources/v1/subscriptions/usage.d.mts.map +1 -0
- package/resources/v1/subscriptions/usage.d.ts +98 -0
- package/resources/v1/subscriptions/usage.d.ts.map +1 -0
- package/resources/v1/subscriptions/usage.js +24 -0
- package/resources/v1/subscriptions/usage.js.map +1 -0
- package/resources/v1/subscriptions/usage.mjs +20 -0
- package/resources/v1/subscriptions/usage.mjs.map +1 -0
- package/resources/v1/usage.d.mts +3 -2
- package/resources/v1/usage.d.mts.map +1 -1
- package/resources/v1/usage.d.ts +3 -2
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/usage.js +3 -2
- package/resources/v1/usage.js.map +1 -1
- package/resources/v1/usage.mjs +3 -2
- package/resources/v1/usage.mjs.map +1 -1
- package/resources/v1/v1.d.mts +10 -6
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +10 -6
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +6 -2
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +6 -2
- package/resources/v1/v1.mjs.map +1 -1
- package/src/client.ts +31 -26
- 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/v1/coupons.ts +89 -9
- package/src/resources/v1/customers/customers.ts +107 -12
- package/src/resources/v1/customers/index.ts +8 -2
- package/src/resources/v1/customers/payment-method.ts +4 -2
- package/src/resources/v1/customers/promotional-entitlements.ts +221 -18
- package/src/resources/v1/events/addons/addons.ts +761 -0
- package/src/resources/v1/events/addons/draft.ts +151 -0
- package/src/resources/v1/events/addons/index.ts +17 -0
- package/src/resources/v1/events/addons.ts +3 -0
- package/src/resources/v1/events/events.ts +160 -0
- package/src/resources/v1/events/features.ts +1066 -0
- package/src/resources/v1/events/index.ts +39 -0
- package/src/resources/v1/events/plans.ts +429 -0
- package/src/resources/v1/events.ts +1 -71
- package/src/resources/v1/index.ts +19 -1
- package/src/resources/v1/products.ts +829 -0
- package/src/resources/v1/subscriptions/future-update.ts +3 -2
- package/src/resources/v1/subscriptions/index.ts +7 -0
- package/src/resources/v1/subscriptions/invoice.ts +42 -0
- package/src/resources/v1/subscriptions/subscriptions.ts +235 -36
- package/src/resources/v1/subscriptions/usage.ts +126 -0
- package/src/resources/v1/usage.ts +3 -2
- package/src/resources/v1/v1.ts +42 -2
- 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
|
@@ -7,14 +7,15 @@ import { path } from '../../../internal/utils/path';
|
|
|
7
7
|
|
|
8
8
|
export class FutureUpdate extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Cancels a subscription update that is pending payment completion.
|
|
11
11
|
*/
|
|
12
12
|
cancelPendingPayment(id: string, options?: RequestOptions): APIPromise<CancelSubscription> {
|
|
13
13
|
return this._client.delete(path`/api/v1/subscriptions/${id}/future-update/pending-payment`, options);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Cancels a scheduled subscription update, such as a future downgrade or plan
|
|
18
|
+
* change.
|
|
18
19
|
*/
|
|
19
20
|
cancelSchedule(id: string, options?: RequestOptions): APIPromise<CancelSubscription> {
|
|
20
21
|
return this._client.delete(path`/api/v1/subscriptions/${id}/future-update/schedule`, options);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export { FutureUpdate, type CancelSubscription } from './future-update';
|
|
4
|
+
export { Invoice, type InvoiceMarkAsPaidResponse } from './invoice';
|
|
4
5
|
export {
|
|
5
6
|
Subscriptions,
|
|
6
7
|
type Subscription,
|
|
@@ -19,3 +20,9 @@ export {
|
|
|
19
20
|
type SubscriptionTransferParams,
|
|
20
21
|
type SubscriptionListResponsesMyCursorIDPage,
|
|
21
22
|
} from './subscriptions';
|
|
23
|
+
export {
|
|
24
|
+
Usage,
|
|
25
|
+
type UsageChargeUsageResponse,
|
|
26
|
+
type UsageSyncResponse,
|
|
27
|
+
type UsageChargeUsageParams,
|
|
28
|
+
} from './usage';
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { RequestOptions } from '../../../internal/request-options';
|
|
6
|
+
import { path } from '../../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Invoice extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Marks the latest invoice of a subscription as paid in the billing provider. The
|
|
11
|
+
* invoice must exist and have an OPEN status.
|
|
12
|
+
*/
|
|
13
|
+
markAsPaid(id: string, options?: RequestOptions): APIPromise<InvoiceMarkAsPaidResponse> {
|
|
14
|
+
return this._client.post(path`/api/v1/subscriptions/${id}/invoice/paid`, options);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Response object
|
|
20
|
+
*/
|
|
21
|
+
export interface InvoiceMarkAsPaidResponse {
|
|
22
|
+
/**
|
|
23
|
+
* Result of marking a subscription invoice as paid.
|
|
24
|
+
*/
|
|
25
|
+
data: InvoiceMarkAsPaidResponse.Data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export namespace InvoiceMarkAsPaidResponse {
|
|
29
|
+
/**
|
|
30
|
+
* Result of marking a subscription invoice as paid.
|
|
31
|
+
*/
|
|
32
|
+
export interface Data {
|
|
33
|
+
/**
|
|
34
|
+
* The subscription ID whose invoice was marked as paid
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export declare namespace Invoice {
|
|
41
|
+
export { type InvoiceMarkAsPaidResponse as InvoiceMarkAsPaidResponse };
|
|
42
|
+
}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
4
|
import * as FutureUpdateAPI from './future-update';
|
|
5
5
|
import { CancelSubscription, FutureUpdate } from './future-update';
|
|
6
|
+
import * as InvoiceAPI from './invoice';
|
|
7
|
+
import { Invoice, InvoiceMarkAsPaidResponse } from './invoice';
|
|
8
|
+
import * as UsageAPI from './usage';
|
|
9
|
+
import { Usage, UsageChargeUsageParams, UsageChargeUsageResponse, UsageSyncResponse } from './usage';
|
|
6
10
|
import { APIPromise } from '../../../core/api-promise';
|
|
7
11
|
import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../core/pagination';
|
|
8
12
|
import { RequestOptions } from '../../../internal/request-options';
|
|
@@ -10,23 +14,28 @@ import { path } from '../../../internal/utils/path';
|
|
|
10
14
|
|
|
11
15
|
export class Subscriptions extends APIResource {
|
|
12
16
|
futureUpdate: FutureUpdateAPI.FutureUpdate = new FutureUpdateAPI.FutureUpdate(this._client);
|
|
17
|
+
usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
|
|
18
|
+
invoice: InvoiceAPI.Invoice = new InvoiceAPI.Invoice(this._client);
|
|
13
19
|
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
21
|
+
* Retrieves a subscription by its unique identifier, including plan details,
|
|
22
|
+
* billing period, status, and add-ons.
|
|
16
23
|
*/
|
|
17
24
|
retrieve(id: string, options?: RequestOptions): APIPromise<Subscription> {
|
|
18
25
|
return this._client.get(path`/api/v1/subscriptions/${id}`, options);
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
/**
|
|
22
|
-
*
|
|
29
|
+
* Updates an active subscription's properties including billing period, add-ons,
|
|
30
|
+
* unit quantities, and discounts.
|
|
23
31
|
*/
|
|
24
32
|
update(id: string, body: SubscriptionUpdateParams, options?: RequestOptions): APIPromise<Subscription> {
|
|
25
33
|
return this._client.patch(path`/api/v1/subscriptions/${id}`, { body, ...options });
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
|
-
*
|
|
37
|
+
* Retrieves a paginated list of subscriptions, with optional filters for customer,
|
|
38
|
+
* status, and plan.
|
|
30
39
|
*/
|
|
31
40
|
list(
|
|
32
41
|
query: SubscriptionListParams | null | undefined = {},
|
|
@@ -39,35 +48,40 @@ export class Subscriptions extends APIResource {
|
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
/**
|
|
42
|
-
*
|
|
51
|
+
* Cancels an active subscription, either immediately or at a specified time such
|
|
52
|
+
* as end of billing period.
|
|
43
53
|
*/
|
|
44
54
|
cancel(id: string, body: SubscriptionCancelParams, options?: RequestOptions): APIPromise<Subscription> {
|
|
45
55
|
return this._client.post(path`/api/v1/subscriptions/${id}/cancel`, { body, ...options });
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
/**
|
|
49
|
-
*
|
|
59
|
+
* Delegates the payment responsibility of a subscription to a different customer.
|
|
60
|
+
* The delegated customer will be billed for this subscription.
|
|
50
61
|
*/
|
|
51
62
|
delegate(id: string, body: SubscriptionDelegateParams, options?: RequestOptions): APIPromise<Subscription> {
|
|
52
63
|
return this._client.post(path`/api/v1/subscriptions/${id}/delegate`, { body, ...options });
|
|
53
64
|
}
|
|
54
65
|
|
|
55
66
|
/**
|
|
56
|
-
*
|
|
67
|
+
* Imports multiple subscriptions in bulk. Used for migrating subscription data
|
|
68
|
+
* from external systems.
|
|
57
69
|
*/
|
|
58
70
|
import(body: SubscriptionImportParams, options?: RequestOptions): APIPromise<SubscriptionImportResponse> {
|
|
59
71
|
return this._client.post('/api/v1/subscriptions/import', { body, ...options });
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
/**
|
|
63
|
-
*
|
|
75
|
+
* Migrates a subscription to the latest published version of its plan or add-ons.
|
|
76
|
+
* Handles prorated charges or credits automatically.
|
|
64
77
|
*/
|
|
65
78
|
migrate(id: string, body: SubscriptionMigrateParams, options?: RequestOptions): APIPromise<Subscription> {
|
|
66
79
|
return this._client.post(path`/api/v1/subscriptions/${id}/migrate`, { body, ...options });
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
/**
|
|
70
|
-
*
|
|
83
|
+
* Previews the pricing impact of creating or updating a subscription without
|
|
84
|
+
* making changes. Returns estimated costs, taxes, and proration details.
|
|
71
85
|
*/
|
|
72
86
|
preview(
|
|
73
87
|
body: SubscriptionPreviewParams,
|
|
@@ -77,7 +91,8 @@ export class Subscriptions extends APIResource {
|
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
/**
|
|
80
|
-
*
|
|
94
|
+
* Creates a new subscription for an existing customer. When payment is required
|
|
95
|
+
* and no payment method exists, returns a checkout URL.
|
|
81
96
|
*/
|
|
82
97
|
provision(
|
|
83
98
|
body: SubscriptionProvisionParams,
|
|
@@ -87,7 +102,8 @@ export class Subscriptions extends APIResource {
|
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
/**
|
|
90
|
-
*
|
|
105
|
+
* Transfers a subscription to a different resource ID. Used for multi-resource
|
|
106
|
+
* products where subscriptions apply to specific entities like websites or apps.
|
|
91
107
|
*/
|
|
92
108
|
transfer(id: string, body: SubscriptionTransferParams, options?: RequestOptions): APIPromise<Subscription> {
|
|
93
109
|
return this._client.post(path`/api/v1/subscriptions/${id}/transfer`, { body, ...options });
|
|
@@ -777,80 +793,184 @@ export namespace SubscriptionProvisionResponse {
|
|
|
777
793
|
*/
|
|
778
794
|
id: string;
|
|
779
795
|
|
|
780
|
-
entitlements: Array<Data.
|
|
796
|
+
entitlements: Array<Data.UnionObjectVariant0 | Data.UnionObjectVariant1> | null;
|
|
781
797
|
|
|
782
798
|
/**
|
|
783
799
|
* Provision status: SUCCESS or PAYMENT_REQUIRED
|
|
784
800
|
*/
|
|
785
801
|
status: 'SUCCESS' | 'PAYMENT_REQUIRED';
|
|
786
802
|
|
|
803
|
+
/**
|
|
804
|
+
* Created subscription (when status is SUCCESS)
|
|
805
|
+
*/
|
|
806
|
+
subscription: Data.Subscription | null;
|
|
807
|
+
|
|
787
808
|
/**
|
|
788
809
|
* Checkout billing ID when payment is required
|
|
789
810
|
*/
|
|
790
|
-
checkoutBillingId?: string
|
|
811
|
+
checkoutBillingId?: string;
|
|
791
812
|
|
|
792
813
|
/**
|
|
793
814
|
* URL to complete payment when PAYMENT_REQUIRED
|
|
794
815
|
*/
|
|
795
|
-
checkoutUrl?: string
|
|
816
|
+
checkoutUrl?: string;
|
|
796
817
|
|
|
797
818
|
/**
|
|
798
819
|
* Whether the subscription is scheduled for future activation
|
|
799
820
|
*/
|
|
800
821
|
isScheduled?: boolean;
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Created subscription (when status is SUCCESS)
|
|
804
|
-
*/
|
|
805
|
-
subscription?: Data.Subscription;
|
|
806
822
|
}
|
|
807
823
|
|
|
808
824
|
export namespace Data {
|
|
809
|
-
export interface
|
|
810
|
-
accessDeniedReason
|
|
825
|
+
export interface UnionObjectVariant0 {
|
|
826
|
+
accessDeniedReason:
|
|
827
|
+
| 'FeatureNotFound'
|
|
828
|
+
| 'CustomerNotFound'
|
|
829
|
+
| 'CustomerIsArchived'
|
|
830
|
+
| 'CustomerResourceNotFound'
|
|
831
|
+
| 'NoActiveSubscription'
|
|
832
|
+
| 'NoFeatureEntitlementInSubscription'
|
|
833
|
+
| 'RequestedUsageExceedingLimit'
|
|
834
|
+
| 'RequestedValuesMismatch'
|
|
835
|
+
| 'BudgetExceeded'
|
|
836
|
+
| 'Unknown'
|
|
837
|
+
| 'FeatureTypeMismatch'
|
|
838
|
+
| 'Revoked'
|
|
839
|
+
| 'InsufficientCredits'
|
|
840
|
+
| 'EntitlementNotFound'
|
|
841
|
+
| null;
|
|
842
|
+
|
|
843
|
+
isGranted: boolean;
|
|
844
|
+
|
|
845
|
+
type: 'FEATURE';
|
|
811
846
|
|
|
812
847
|
currentUsage?: number;
|
|
813
848
|
|
|
814
849
|
/**
|
|
815
|
-
* entitlement
|
|
850
|
+
* Timestamp of the last update to the entitlement grant or configuration.
|
|
816
851
|
*/
|
|
817
|
-
entitlementUpdatedAt?: string
|
|
818
|
-
|
|
819
|
-
feature?: Entitlement.Feature | null;
|
|
852
|
+
entitlementUpdatedAt?: string;
|
|
820
853
|
|
|
821
|
-
|
|
854
|
+
feature?: UnionObjectVariant0.Feature;
|
|
822
855
|
|
|
823
|
-
|
|
856
|
+
hasUnlimitedUsage?: boolean;
|
|
824
857
|
|
|
825
858
|
resetPeriod?: 'YEAR' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | null;
|
|
826
859
|
|
|
827
860
|
usageLimit?: number | null;
|
|
828
861
|
|
|
829
862
|
/**
|
|
830
|
-
* usage period
|
|
863
|
+
* The anchor for calculating the usage period for metered entitlements with a
|
|
864
|
+
* reset period configured
|
|
865
|
+
*/
|
|
866
|
+
usagePeriodAnchor?: string;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* The end date of the usage period for metered entitlements with a reset period
|
|
870
|
+
* configured
|
|
831
871
|
*/
|
|
832
|
-
|
|
872
|
+
usagePeriodEnd?: string;
|
|
833
873
|
|
|
834
874
|
/**
|
|
835
|
-
* usage period
|
|
875
|
+
* The start date of the usage period for metered entitlements with a reset period
|
|
876
|
+
* configured
|
|
836
877
|
*/
|
|
837
|
-
|
|
878
|
+
usagePeriodStart?: string;
|
|
838
879
|
|
|
839
880
|
/**
|
|
840
|
-
*
|
|
881
|
+
* The next time the entitlement should be recalculated
|
|
841
882
|
*/
|
|
842
|
-
|
|
883
|
+
validUntil?: string;
|
|
843
884
|
}
|
|
844
885
|
|
|
845
|
-
export namespace
|
|
886
|
+
export namespace UnionObjectVariant0 {
|
|
846
887
|
export interface Feature {
|
|
847
888
|
/**
|
|
848
|
-
*
|
|
889
|
+
* The human-readable name of the entitlement, shown in UI elements.
|
|
890
|
+
*/
|
|
891
|
+
displayName: string;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* The current status of the feature.
|
|
895
|
+
*/
|
|
896
|
+
featureStatus: 'NEW' | 'SUSPENDED' | 'ACTIVE';
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* The type of feature associated with the entitlement.
|
|
900
|
+
*/
|
|
901
|
+
featureType: 'BOOLEAN' | 'NUMBER' | 'ENUM';
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* The unique reference ID of the entitlement.
|
|
849
905
|
*/
|
|
850
906
|
refId: string;
|
|
851
907
|
}
|
|
852
908
|
}
|
|
853
909
|
|
|
910
|
+
export interface UnionObjectVariant1 {
|
|
911
|
+
accessDeniedReason:
|
|
912
|
+
| 'FeatureNotFound'
|
|
913
|
+
| 'CustomerNotFound'
|
|
914
|
+
| 'CustomerIsArchived'
|
|
915
|
+
| 'CustomerResourceNotFound'
|
|
916
|
+
| 'NoActiveSubscription'
|
|
917
|
+
| 'NoFeatureEntitlementInSubscription'
|
|
918
|
+
| 'RequestedUsageExceedingLimit'
|
|
919
|
+
| 'RequestedValuesMismatch'
|
|
920
|
+
| 'BudgetExceeded'
|
|
921
|
+
| 'Unknown'
|
|
922
|
+
| 'FeatureTypeMismatch'
|
|
923
|
+
| 'Revoked'
|
|
924
|
+
| 'InsufficientCredits'
|
|
925
|
+
| 'EntitlementNotFound'
|
|
926
|
+
| null;
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* The currency associated with a credit entitlement.
|
|
930
|
+
*/
|
|
931
|
+
currency: UnionObjectVariant1.Currency;
|
|
932
|
+
|
|
933
|
+
currentUsage: number;
|
|
934
|
+
|
|
935
|
+
isGranted: boolean;
|
|
936
|
+
|
|
937
|
+
type: 'CREDIT';
|
|
938
|
+
|
|
939
|
+
usageLimit: number;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Timestamp of the last update to the credit usage.
|
|
943
|
+
*/
|
|
944
|
+
usageUpdatedAt: string;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Timestamp of the last update to the entitlement grant or configuration.
|
|
948
|
+
*/
|
|
949
|
+
entitlementUpdatedAt?: string;
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* The end date of the current billing period for recurring credit grants.
|
|
953
|
+
*/
|
|
954
|
+
usagePeriodEnd?: string;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* The next time the entitlement should be recalculated
|
|
958
|
+
*/
|
|
959
|
+
validUntil?: string;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export namespace UnionObjectVariant1 {
|
|
963
|
+
/**
|
|
964
|
+
* The currency associated with a credit entitlement.
|
|
965
|
+
*/
|
|
966
|
+
export interface Currency {
|
|
967
|
+
/**
|
|
968
|
+
* The unique identifier of the custom currency.
|
|
969
|
+
*/
|
|
970
|
+
currencyId: string;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
854
974
|
/**
|
|
855
975
|
* Created subscription (when status is SUCCESS)
|
|
856
976
|
*/
|
|
@@ -1859,10 +1979,25 @@ export namespace SubscriptionUpdateParams {
|
|
|
1859
1979
|
}
|
|
1860
1980
|
|
|
1861
1981
|
export interface PriceOverride {
|
|
1982
|
+
/**
|
|
1983
|
+
* Addon ID
|
|
1984
|
+
*/
|
|
1985
|
+
addonId?: string;
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Whether this is a base charge override
|
|
1989
|
+
*/
|
|
1990
|
+
baseCharge?: boolean;
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* The corresponding custom currency id of the recurring credits price
|
|
1994
|
+
*/
|
|
1995
|
+
currencyId?: string;
|
|
1996
|
+
|
|
1862
1997
|
/**
|
|
1863
1998
|
* Feature ID
|
|
1864
1999
|
*/
|
|
1865
|
-
featureId
|
|
2000
|
+
featureId?: string;
|
|
1866
2001
|
|
|
1867
2002
|
price?: PriceOverride.Price;
|
|
1868
2003
|
}
|
|
@@ -2035,17 +2170,65 @@ export namespace SubscriptionUpdateParams {
|
|
|
2035
2170
|
}
|
|
2036
2171
|
|
|
2037
2172
|
export interface SubscriptionListParams extends MyCursorIDPageParams {
|
|
2173
|
+
/**
|
|
2174
|
+
* Filter by creation date using range operators: gt, gte, lt, lte
|
|
2175
|
+
*/
|
|
2176
|
+
createdAt?: SubscriptionListParams.CreatedAt;
|
|
2177
|
+
|
|
2038
2178
|
/**
|
|
2039
2179
|
* Filter by customer ID
|
|
2040
2180
|
*/
|
|
2041
2181
|
customerId?: string;
|
|
2042
2182
|
|
|
2043
2183
|
/**
|
|
2044
|
-
* Filter by
|
|
2184
|
+
* Filter by plan ID
|
|
2185
|
+
*/
|
|
2186
|
+
planId?: string;
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* Filter by pricing type. Supports comma-separated values for multiple types
|
|
2190
|
+
*/
|
|
2191
|
+
pricingType?: string;
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* Filter by resource ID
|
|
2195
|
+
*/
|
|
2196
|
+
resourceId?: string;
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* Filter by subscription status. Supports comma-separated values for multiple
|
|
2200
|
+
* statuses
|
|
2045
2201
|
*/
|
|
2046
2202
|
status?: string;
|
|
2047
2203
|
}
|
|
2048
2204
|
|
|
2205
|
+
export namespace SubscriptionListParams {
|
|
2206
|
+
/**
|
|
2207
|
+
* Filter by creation date using range operators: gt, gte, lt, lte
|
|
2208
|
+
*/
|
|
2209
|
+
export interface CreatedAt {
|
|
2210
|
+
/**
|
|
2211
|
+
* Greater than the specified createdAt value
|
|
2212
|
+
*/
|
|
2213
|
+
gt?: string;
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Greater than or equal to the specified createdAt value
|
|
2217
|
+
*/
|
|
2218
|
+
gte?: string;
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
* Less than the specified createdAt value
|
|
2222
|
+
*/
|
|
2223
|
+
lt?: string;
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* Less than or equal to the specified createdAt value
|
|
2227
|
+
*/
|
|
2228
|
+
lte?: string;
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2049
2232
|
export interface SubscriptionCancelParams {
|
|
2050
2233
|
/**
|
|
2051
2234
|
* Action on cancellation (downgrade or revoke)
|
|
@@ -2082,6 +2265,11 @@ export interface SubscriptionImportParams {
|
|
|
2082
2265
|
* List of subscription objects to import
|
|
2083
2266
|
*/
|
|
2084
2267
|
subscriptions: Array<SubscriptionImportParams.Subscription>;
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* Integration ID to use for importing subscriptions
|
|
2271
|
+
*/
|
|
2272
|
+
integrationId?: string | null;
|
|
2085
2273
|
}
|
|
2086
2274
|
|
|
2087
2275
|
export namespace SubscriptionImportParams {
|
|
@@ -3725,6 +3913,8 @@ export interface SubscriptionTransferParams {
|
|
|
3725
3913
|
}
|
|
3726
3914
|
|
|
3727
3915
|
Subscriptions.FutureUpdate = FutureUpdate;
|
|
3916
|
+
Subscriptions.Usage = Usage;
|
|
3917
|
+
Subscriptions.Invoice = Invoice;
|
|
3728
3918
|
|
|
3729
3919
|
export declare namespace Subscriptions {
|
|
3730
3920
|
export {
|
|
@@ -3746,4 +3936,13 @@ export declare namespace Subscriptions {
|
|
|
3746
3936
|
};
|
|
3747
3937
|
|
|
3748
3938
|
export { FutureUpdate as FutureUpdate, type CancelSubscription as CancelSubscription };
|
|
3939
|
+
|
|
3940
|
+
export {
|
|
3941
|
+
Usage as Usage,
|
|
3942
|
+
type UsageChargeUsageResponse as UsageChargeUsageResponse,
|
|
3943
|
+
type UsageSyncResponse as UsageSyncResponse,
|
|
3944
|
+
type UsageChargeUsageParams as UsageChargeUsageParams,
|
|
3945
|
+
};
|
|
3946
|
+
|
|
3947
|
+
export { Invoice as Invoice, type InvoiceMarkAsPaidResponse as InvoiceMarkAsPaidResponse };
|
|
3749
3948
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 { RequestOptions } from '../../../internal/request-options';
|
|
6
|
+
import { path } from '../../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Usage extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Immediately charges usage for a subscription via the billing integration.
|
|
11
|
+
* Calculates usage since the last charge and creates an invoice.
|
|
12
|
+
*/
|
|
13
|
+
chargeUsage(
|
|
14
|
+
id: string,
|
|
15
|
+
body: UsageChargeUsageParams,
|
|
16
|
+
options?: RequestOptions,
|
|
17
|
+
): APIPromise<UsageChargeUsageResponse> {
|
|
18
|
+
return this._client.post(path`/api/v1/subscriptions/${id}/usage/charge`, { body, ...options });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Triggers a usage sync for a subscription, reporting current usage to the billing
|
|
23
|
+
* provider.
|
|
24
|
+
*/
|
|
25
|
+
sync(id: string, options?: RequestOptions): APIPromise<UsageSyncResponse> {
|
|
26
|
+
return this._client.post(path`/api/v1/subscriptions/${id}/usage/sync`, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Response object
|
|
32
|
+
*/
|
|
33
|
+
export interface UsageChargeUsageResponse {
|
|
34
|
+
/**
|
|
35
|
+
* Result of charging subscription usage including the billing period and charged
|
|
36
|
+
* items.
|
|
37
|
+
*/
|
|
38
|
+
data: UsageChargeUsageResponse.Data;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export namespace UsageChargeUsageResponse {
|
|
42
|
+
/**
|
|
43
|
+
* Result of charging subscription usage including the billing period and charged
|
|
44
|
+
* items.
|
|
45
|
+
*/
|
|
46
|
+
export interface Data {
|
|
47
|
+
/**
|
|
48
|
+
* The invoice ID in the billing integration
|
|
49
|
+
*/
|
|
50
|
+
invoiceBillingId: string | null;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* End of the usage billing period
|
|
54
|
+
*/
|
|
55
|
+
periodEnd: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Start of the usage billing period
|
|
59
|
+
*/
|
|
60
|
+
periodStart: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The subscription ID for which usage was charged
|
|
64
|
+
*/
|
|
65
|
+
subscriptionId: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Usage items that were charged
|
|
69
|
+
*/
|
|
70
|
+
usageCharged: Array<Data.UsageCharged>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export namespace Data {
|
|
74
|
+
/**
|
|
75
|
+
* A single usage item that was charged.
|
|
76
|
+
*/
|
|
77
|
+
export interface UsageCharged {
|
|
78
|
+
/**
|
|
79
|
+
* The feature ID for which usage was charged
|
|
80
|
+
*/
|
|
81
|
+
featureId: string | null;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The number of units charged
|
|
85
|
+
*/
|
|
86
|
+
usageAmount: number;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Response object
|
|
93
|
+
*/
|
|
94
|
+
export interface UsageSyncResponse {
|
|
95
|
+
/**
|
|
96
|
+
* Result of triggering a subscription usage sync.
|
|
97
|
+
*/
|
|
98
|
+
data: UsageSyncResponse.Data;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export namespace UsageSyncResponse {
|
|
102
|
+
/**
|
|
103
|
+
* Result of triggering a subscription usage sync.
|
|
104
|
+
*/
|
|
105
|
+
export interface Data {
|
|
106
|
+
/**
|
|
107
|
+
* Whether usage was synced to the billing provider
|
|
108
|
+
*/
|
|
109
|
+
triggered: boolean;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface UsageChargeUsageParams {
|
|
114
|
+
/**
|
|
115
|
+
* Cutoff date for usage calculation. If not provided, the current time is used.
|
|
116
|
+
*/
|
|
117
|
+
untilDate?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export declare namespace Usage {
|
|
121
|
+
export {
|
|
122
|
+
type UsageChargeUsageResponse as UsageChargeUsageResponse,
|
|
123
|
+
type UsageSyncResponse as UsageSyncResponse,
|
|
124
|
+
type UsageChargeUsageParams as UsageChargeUsageParams,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -7,7 +7,7 @@ import { path } from '../../internal/utils/path';
|
|
|
7
7
|
|
|
8
8
|
export class Usage extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Retrieves historical usage data for a customer's metered feature over time.
|
|
11
11
|
*/
|
|
12
12
|
history(
|
|
13
13
|
featureID: string,
|
|
@@ -19,7 +19,8 @@ export class Usage extends APIResource {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Reports usage measurements for metered features. The reported usage is used to
|
|
23
|
+
* track, limit, and bill customer consumption.
|
|
23
24
|
*/
|
|
24
25
|
report(body: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse> {
|
|
25
26
|
return this._client.post('/api/v1/usage', { body, ...options });
|