@polar-sh/sdk 0.20.0 → 0.20.2
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/README.md +4 -0
- package/docs/sdks/polarsubscriptions/README.md +6 -5
- package/docs/sdks/subscriptions/README.md +165 -1
- package/funcs/customerPortalSubscriptionsUpdate.d.ts +1 -1
- package/funcs/customerPortalSubscriptionsUpdate.d.ts.map +1 -1
- package/funcs/customerPortalSubscriptionsUpdate.js +2 -2
- package/funcs/customerPortalSubscriptionsUpdate.js.map +1 -1
- package/funcs/productsList.d.ts.map +1 -1
- package/funcs/productsList.js +1 -0
- package/funcs/productsList.js.map +1 -1
- package/funcs/subscriptionsRevoke.d.ts +17 -0
- package/funcs/subscriptionsRevoke.d.ts.map +1 -0
- package/funcs/subscriptionsRevoke.js +106 -0
- package/funcs/subscriptionsRevoke.js.map +1 -0
- package/funcs/subscriptionsUpdate.d.ts +17 -0
- package/funcs/subscriptionsUpdate.d.ts.map +1 -0
- package/funcs/subscriptionsUpdate.js +109 -0
- package/funcs/subscriptionsUpdate.js.map +1 -0
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/customercancellationreason.d.ts +46 -0
- package/models/components/customercancellationreason.d.ts.map +1 -0
- package/models/components/customercancellationreason.js +56 -0
- package/models/components/customercancellationreason.js.map +1 -0
- package/models/components/customerordersubscription.d.ts +9 -0
- package/models/components/customerordersubscription.d.ts.map +1 -1
- package/models/components/customerordersubscription.js +17 -0
- package/models/components/customerordersubscription.js.map +1 -1
- package/models/components/customersubscription.d.ts +9 -0
- package/models/components/customersubscription.d.ts.map +1 -1
- package/models/components/customersubscription.js +17 -0
- package/models/components/customersubscription.js.map +1 -1
- package/models/components/customersubscriptioncancel.d.ts +58 -0
- package/models/components/customersubscriptioncancel.d.ts.map +1 -0
- package/models/components/customersubscriptioncancel.js +79 -0
- package/models/components/customersubscriptioncancel.js.map +1 -0
- package/models/components/customersubscriptionupdate.d.ts +4 -6
- package/models/components/customersubscriptionupdate.d.ts.map +1 -1
- package/models/components/customersubscriptionupdate.js +10 -15
- package/models/components/customersubscriptionupdate.js.map +1 -1
- package/models/components/customersubscriptionupdateprice.d.ts +32 -0
- package/models/components/customersubscriptionupdateprice.d.ts.map +1 -0
- package/models/components/customersubscriptionupdateprice.js +68 -0
- package/models/components/customersubscriptionupdateprice.js.map +1 -0
- package/models/components/index.d.ts +7 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +7 -0
- package/models/components/index.js.map +1 -1
- package/models/components/ordersubscription.d.ts +9 -0
- package/models/components/ordersubscription.d.ts.map +1 -1
- package/models/components/ordersubscription.js +17 -0
- package/models/components/ordersubscription.js.map +1 -1
- package/models/components/subscription.d.ts +9 -0
- package/models/components/subscription.d.ts.map +1 -1
- package/models/components/subscription.js +17 -0
- package/models/components/subscription.js.map +1 -1
- package/models/components/subscriptioncancel.d.ts +80 -0
- package/models/components/subscriptioncancel.d.ts.map +1 -0
- package/models/components/subscriptioncancel.js +79 -0
- package/models/components/subscriptioncancel.js.map +1 -0
- package/models/components/subscriptionupdate.d.ts +27 -0
- package/models/components/subscriptionupdate.d.ts.map +1 -0
- package/models/components/subscriptionupdate.js +63 -0
- package/models/components/subscriptionupdate.js.map +1 -0
- package/models/components/subscriptionupdateprice.d.ts +32 -0
- package/models/components/subscriptionupdateprice.d.ts.map +1 -0
- package/models/components/subscriptionupdateprice.js +68 -0
- package/models/components/subscriptionupdateprice.js.map +1 -0
- package/models/components/webhooksubscriptioncanceledpayload.d.ts +2 -2
- package/models/components/webhooksubscriptionuncanceledpayload.d.ts +39 -0
- package/models/components/webhooksubscriptionuncanceledpayload.d.ts.map +1 -0
- package/models/components/webhooksubscriptionuncanceledpayload.js +62 -0
- package/models/components/webhooksubscriptionuncanceledpayload.js.map +1 -0
- package/models/operations/customerportalsubscriptionscancel.d.ts +1 -1
- package/models/operations/customerportalsubscriptionsget.d.ts +1 -1
- package/models/operations/customerportalsubscriptionsupdate.d.ts +1 -1
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/orderslist.d.ts +13 -13
- package/models/operations/orderslist.d.ts.map +1 -1
- package/models/operations/orderslist.js +16 -16
- package/models/operations/orderslist.js.map +1 -1
- package/models/operations/productslist.d.ts +29 -0
- package/models/operations/productslist.d.ts.map +1 -1
- package/models/operations/productslist.js +26 -1
- package/models/operations/productslist.js.map +1 -1
- package/models/operations/subscriptionsrevoke.d.ts +32 -0
- package/models/operations/subscriptionsrevoke.d.ts.map +1 -0
- package/models/operations/subscriptionsrevoke.js +59 -0
- package/models/operations/subscriptionsrevoke.js.map +1 -0
- package/models/operations/subscriptionsupdate.d.ts +35 -0
- package/models/operations/subscriptionsupdate.d.ts.map +1 -0
- package/models/operations/subscriptionsupdate.js +71 -0
- package/models/operations/subscriptionsupdate.js.map +1 -0
- package/package.json +1 -1
- package/sdk/subscriptions.d.ts +15 -0
- package/sdk/subscriptions.d.ts.map +1 -1
- package/sdk/subscriptions.js +20 -0
- package/sdk/subscriptions.js.map +1 -1
- package/src/funcs/customerPortalSubscriptionsUpdate.ts +4 -1
- package/src/funcs/productsList.ts +1 -0
- package/src/funcs/subscriptionsRevoke.ts +146 -0
- package/src/funcs/subscriptionsUpdate.ts +149 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/customercancellationreason.ts +41 -0
- package/src/models/components/customerordersubscription.ts +37 -0
- package/src/models/components/customersubscription.ts +37 -0
- package/src/models/components/customersubscriptioncancel.ts +118 -0
- package/src/models/components/customersubscriptionupdate.ts +26 -21
- package/src/models/components/customersubscriptionupdateprice.ts +80 -0
- package/src/models/components/index.ts +7 -0
- package/src/models/components/ordersubscription.ts +37 -0
- package/src/models/components/subscription.ts +37 -0
- package/src/models/components/subscriptioncancel.ts +144 -0
- package/src/models/components/subscriptionupdate.ts +78 -0
- package/src/models/components/subscriptionupdateprice.ts +78 -0
- package/src/models/components/webhooksubscriptioncanceledpayload.ts +2 -2
- package/src/models/components/webhooksubscriptionuncanceledpayload.ts +90 -0
- package/src/models/operations/customerportalsubscriptionscancel.ts +1 -1
- package/src/models/operations/customerportalsubscriptionsget.ts +1 -1
- package/src/models/operations/customerportalsubscriptionsupdate.ts +1 -1
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/orderslist.ts +28 -21
- package/src/models/operations/productslist.ts +60 -0
- package/src/models/operations/subscriptionsrevoke.ts +69 -0
- package/src/models/operations/subscriptionsupdate.ts +83 -0
- package/src/sdk/subscriptions.ts +37 -0
|
@@ -7,6 +7,11 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
CustomerCancellationReason,
|
|
12
|
+
CustomerCancellationReason$inboundSchema,
|
|
13
|
+
CustomerCancellationReason$outboundSchema,
|
|
14
|
+
} from "./customercancellationreason.js";
|
|
10
15
|
import {
|
|
11
16
|
CustomerSubscriptionProduct,
|
|
12
17
|
CustomerSubscriptionProduct$inboundSchema,
|
|
@@ -50,13 +55,17 @@ export type CustomerSubscription = {
|
|
|
50
55
|
currentPeriodStart: Date;
|
|
51
56
|
currentPeriodEnd: Date | null;
|
|
52
57
|
cancelAtPeriodEnd: boolean;
|
|
58
|
+
canceledAt: Date | null;
|
|
53
59
|
startedAt: Date | null;
|
|
60
|
+
endsAt: Date | null;
|
|
54
61
|
endedAt: Date | null;
|
|
55
62
|
customerId: string;
|
|
56
63
|
productId: string;
|
|
57
64
|
priceId: string;
|
|
58
65
|
discountId: string | null;
|
|
59
66
|
checkoutId: string | null;
|
|
67
|
+
customerCancellationReason: CustomerCancellationReason | null;
|
|
68
|
+
customerCancellationComment: string | null;
|
|
60
69
|
/**
|
|
61
70
|
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
62
71
|
*/
|
|
@@ -87,9 +96,15 @@ export const CustomerSubscription$inboundSchema: z.ZodType<
|
|
|
87
96
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
88
97
|
),
|
|
89
98
|
cancel_at_period_end: z.boolean(),
|
|
99
|
+
canceled_at: z.nullable(
|
|
100
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
101
|
+
),
|
|
90
102
|
started_at: z.nullable(
|
|
91
103
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
92
104
|
),
|
|
105
|
+
ends_at: z.nullable(
|
|
106
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
107
|
+
),
|
|
93
108
|
ended_at: z.nullable(
|
|
94
109
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
95
110
|
),
|
|
@@ -98,6 +113,10 @@ export const CustomerSubscription$inboundSchema: z.ZodType<
|
|
|
98
113
|
price_id: z.string(),
|
|
99
114
|
discount_id: z.nullable(z.string()),
|
|
100
115
|
checkout_id: z.nullable(z.string()),
|
|
116
|
+
customer_cancellation_reason: z.nullable(
|
|
117
|
+
CustomerCancellationReason$inboundSchema,
|
|
118
|
+
),
|
|
119
|
+
customer_cancellation_comment: z.nullable(z.string()),
|
|
101
120
|
user_id: z.string(),
|
|
102
121
|
product: CustomerSubscriptionProduct$inboundSchema,
|
|
103
122
|
price: ProductPrice$inboundSchema,
|
|
@@ -109,13 +128,17 @@ export const CustomerSubscription$inboundSchema: z.ZodType<
|
|
|
109
128
|
"current_period_start": "currentPeriodStart",
|
|
110
129
|
"current_period_end": "currentPeriodEnd",
|
|
111
130
|
"cancel_at_period_end": "cancelAtPeriodEnd",
|
|
131
|
+
"canceled_at": "canceledAt",
|
|
112
132
|
"started_at": "startedAt",
|
|
133
|
+
"ends_at": "endsAt",
|
|
113
134
|
"ended_at": "endedAt",
|
|
114
135
|
"customer_id": "customerId",
|
|
115
136
|
"product_id": "productId",
|
|
116
137
|
"price_id": "priceId",
|
|
117
138
|
"discount_id": "discountId",
|
|
118
139
|
"checkout_id": "checkoutId",
|
|
140
|
+
"customer_cancellation_reason": "customerCancellationReason",
|
|
141
|
+
"customer_cancellation_comment": "customerCancellationComment",
|
|
119
142
|
"user_id": "userId",
|
|
120
143
|
});
|
|
121
144
|
});
|
|
@@ -132,13 +155,17 @@ export type CustomerSubscription$Outbound = {
|
|
|
132
155
|
current_period_start: string;
|
|
133
156
|
current_period_end: string | null;
|
|
134
157
|
cancel_at_period_end: boolean;
|
|
158
|
+
canceled_at: string | null;
|
|
135
159
|
started_at: string | null;
|
|
160
|
+
ends_at: string | null;
|
|
136
161
|
ended_at: string | null;
|
|
137
162
|
customer_id: string;
|
|
138
163
|
product_id: string;
|
|
139
164
|
price_id: string;
|
|
140
165
|
discount_id: string | null;
|
|
141
166
|
checkout_id: string | null;
|
|
167
|
+
customer_cancellation_reason: string | null;
|
|
168
|
+
customer_cancellation_comment: string | null;
|
|
142
169
|
user_id: string;
|
|
143
170
|
product: CustomerSubscriptionProduct$Outbound;
|
|
144
171
|
price: ProductPrice$Outbound;
|
|
@@ -160,13 +187,19 @@ export const CustomerSubscription$outboundSchema: z.ZodType<
|
|
|
160
187
|
currentPeriodStart: z.date().transform(v => v.toISOString()),
|
|
161
188
|
currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
|
|
162
189
|
cancelAtPeriodEnd: z.boolean(),
|
|
190
|
+
canceledAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
163
191
|
startedAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
192
|
+
endsAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
164
193
|
endedAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
165
194
|
customerId: z.string(),
|
|
166
195
|
productId: z.string(),
|
|
167
196
|
priceId: z.string(),
|
|
168
197
|
discountId: z.nullable(z.string()),
|
|
169
198
|
checkoutId: z.nullable(z.string()),
|
|
199
|
+
customerCancellationReason: z.nullable(
|
|
200
|
+
CustomerCancellationReason$outboundSchema,
|
|
201
|
+
),
|
|
202
|
+
customerCancellationComment: z.nullable(z.string()),
|
|
170
203
|
userId: z.string(),
|
|
171
204
|
product: CustomerSubscriptionProduct$outboundSchema,
|
|
172
205
|
price: ProductPrice$outboundSchema,
|
|
@@ -178,13 +211,17 @@ export const CustomerSubscription$outboundSchema: z.ZodType<
|
|
|
178
211
|
currentPeriodStart: "current_period_start",
|
|
179
212
|
currentPeriodEnd: "current_period_end",
|
|
180
213
|
cancelAtPeriodEnd: "cancel_at_period_end",
|
|
214
|
+
canceledAt: "canceled_at",
|
|
181
215
|
startedAt: "started_at",
|
|
216
|
+
endsAt: "ends_at",
|
|
182
217
|
endedAt: "ended_at",
|
|
183
218
|
customerId: "customer_id",
|
|
184
219
|
productId: "product_id",
|
|
185
220
|
priceId: "price_id",
|
|
186
221
|
discountId: "discount_id",
|
|
187
222
|
checkoutId: "checkout_id",
|
|
223
|
+
customerCancellationReason: "customer_cancellation_reason",
|
|
224
|
+
customerCancellationComment: "customer_cancellation_comment",
|
|
188
225
|
userId: "user_id",
|
|
189
226
|
});
|
|
190
227
|
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
CustomerCancellationReason,
|
|
12
|
+
CustomerCancellationReason$inboundSchema,
|
|
13
|
+
CustomerCancellationReason$outboundSchema,
|
|
14
|
+
} from "./customercancellationreason.js";
|
|
15
|
+
|
|
16
|
+
export type CustomerSubscriptionCancel = {
|
|
17
|
+
/**
|
|
18
|
+
* Cancel an active subscription once the current period ends.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
*
|
|
22
|
+
* Or uncancel a subscription currently set to be revoked at period end.
|
|
23
|
+
*/
|
|
24
|
+
cancelAtPeriodEnd?: boolean | null | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Customers reason for cancellation.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
*
|
|
30
|
+
* * `too_expensive`: Too expensive for the customer.
|
|
31
|
+
* * `missing_features`: Customer is missing certain features.
|
|
32
|
+
* * `switched_service`: Customer switched to another service.
|
|
33
|
+
* * `unused`: Customer is not using it enough.
|
|
34
|
+
* * `customer_service`: Customer is not satisfied with the customer service.
|
|
35
|
+
* * `low_quality`: Customer is unhappy with the quality.
|
|
36
|
+
* * `too_complex`: Customer considers the service too complicated.
|
|
37
|
+
* * `other`: Other reason(s).
|
|
38
|
+
*/
|
|
39
|
+
cancellationReason?: CustomerCancellationReason | null | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Customer feedback and why they decided to cancel.
|
|
42
|
+
*/
|
|
43
|
+
cancellationComment?: string | null | undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const CustomerSubscriptionCancel$inboundSchema: z.ZodType<
|
|
48
|
+
CustomerSubscriptionCancel,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
unknown
|
|
51
|
+
> = z.object({
|
|
52
|
+
cancel_at_period_end: z.nullable(z.boolean()).optional(),
|
|
53
|
+
cancellation_reason: z.nullable(CustomerCancellationReason$inboundSchema)
|
|
54
|
+
.optional(),
|
|
55
|
+
cancellation_comment: z.nullable(z.string()).optional(),
|
|
56
|
+
}).transform((v) => {
|
|
57
|
+
return remap$(v, {
|
|
58
|
+
"cancel_at_period_end": "cancelAtPeriodEnd",
|
|
59
|
+
"cancellation_reason": "cancellationReason",
|
|
60
|
+
"cancellation_comment": "cancellationComment",
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/** @internal */
|
|
65
|
+
export type CustomerSubscriptionCancel$Outbound = {
|
|
66
|
+
cancel_at_period_end?: boolean | null | undefined;
|
|
67
|
+
cancellation_reason?: string | null | undefined;
|
|
68
|
+
cancellation_comment?: string | null | undefined;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const CustomerSubscriptionCancel$outboundSchema: z.ZodType<
|
|
73
|
+
CustomerSubscriptionCancel$Outbound,
|
|
74
|
+
z.ZodTypeDef,
|
|
75
|
+
CustomerSubscriptionCancel
|
|
76
|
+
> = z.object({
|
|
77
|
+
cancelAtPeriodEnd: z.nullable(z.boolean()).optional(),
|
|
78
|
+
cancellationReason: z.nullable(CustomerCancellationReason$outboundSchema)
|
|
79
|
+
.optional(),
|
|
80
|
+
cancellationComment: z.nullable(z.string()).optional(),
|
|
81
|
+
}).transform((v) => {
|
|
82
|
+
return remap$(v, {
|
|
83
|
+
cancelAtPeriodEnd: "cancel_at_period_end",
|
|
84
|
+
cancellationReason: "cancellation_reason",
|
|
85
|
+
cancellationComment: "cancellation_comment",
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
92
|
+
*/
|
|
93
|
+
export namespace CustomerSubscriptionCancel$ {
|
|
94
|
+
/** @deprecated use `CustomerSubscriptionCancel$inboundSchema` instead. */
|
|
95
|
+
export const inboundSchema = CustomerSubscriptionCancel$inboundSchema;
|
|
96
|
+
/** @deprecated use `CustomerSubscriptionCancel$outboundSchema` instead. */
|
|
97
|
+
export const outboundSchema = CustomerSubscriptionCancel$outboundSchema;
|
|
98
|
+
/** @deprecated use `CustomerSubscriptionCancel$Outbound` instead. */
|
|
99
|
+
export type Outbound = CustomerSubscriptionCancel$Outbound;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function customerSubscriptionCancelToJSON(
|
|
103
|
+
customerSubscriptionCancel: CustomerSubscriptionCancel,
|
|
104
|
+
): string {
|
|
105
|
+
return JSON.stringify(
|
|
106
|
+
CustomerSubscriptionCancel$outboundSchema.parse(customerSubscriptionCancel),
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function customerSubscriptionCancelFromJSON(
|
|
111
|
+
jsonString: string,
|
|
112
|
+
): SafeParseResult<CustomerSubscriptionCancel, SDKValidationError> {
|
|
113
|
+
return safeParse(
|
|
114
|
+
jsonString,
|
|
115
|
+
(x) => CustomerSubscriptionCancel$inboundSchema.parse(JSON.parse(x)),
|
|
116
|
+
`Failed to parse 'CustomerSubscriptionCancel' from JSON`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -3,45 +3,50 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
CustomerSubscriptionCancel,
|
|
11
|
+
CustomerSubscriptionCancel$inboundSchema,
|
|
12
|
+
CustomerSubscriptionCancel$Outbound,
|
|
13
|
+
CustomerSubscriptionCancel$outboundSchema,
|
|
14
|
+
} from "./customersubscriptioncancel.js";
|
|
15
|
+
import {
|
|
16
|
+
CustomerSubscriptionUpdatePrice,
|
|
17
|
+
CustomerSubscriptionUpdatePrice$inboundSchema,
|
|
18
|
+
CustomerSubscriptionUpdatePrice$Outbound,
|
|
19
|
+
CustomerSubscriptionUpdatePrice$outboundSchema,
|
|
20
|
+
} from "./customersubscriptionupdateprice.js";
|
|
10
21
|
|
|
11
|
-
export type CustomerSubscriptionUpdate =
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
export type CustomerSubscriptionUpdate =
|
|
23
|
+
| CustomerSubscriptionUpdatePrice
|
|
24
|
+
| CustomerSubscriptionCancel;
|
|
14
25
|
|
|
15
26
|
/** @internal */
|
|
16
27
|
export const CustomerSubscriptionUpdate$inboundSchema: z.ZodType<
|
|
17
28
|
CustomerSubscriptionUpdate,
|
|
18
29
|
z.ZodTypeDef,
|
|
19
30
|
unknown
|
|
20
|
-
> = z.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"product_price_id": "productPriceId",
|
|
25
|
-
});
|
|
26
|
-
});
|
|
31
|
+
> = z.union([
|
|
32
|
+
CustomerSubscriptionUpdatePrice$inboundSchema,
|
|
33
|
+
CustomerSubscriptionCancel$inboundSchema,
|
|
34
|
+
]);
|
|
27
35
|
|
|
28
36
|
/** @internal */
|
|
29
|
-
export type CustomerSubscriptionUpdate$Outbound =
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
export type CustomerSubscriptionUpdate$Outbound =
|
|
38
|
+
| CustomerSubscriptionUpdatePrice$Outbound
|
|
39
|
+
| CustomerSubscriptionCancel$Outbound;
|
|
32
40
|
|
|
33
41
|
/** @internal */
|
|
34
42
|
export const CustomerSubscriptionUpdate$outboundSchema: z.ZodType<
|
|
35
43
|
CustomerSubscriptionUpdate$Outbound,
|
|
36
44
|
z.ZodTypeDef,
|
|
37
45
|
CustomerSubscriptionUpdate
|
|
38
|
-
> = z.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
productPriceId: "product_price_id",
|
|
43
|
-
});
|
|
44
|
-
});
|
|
46
|
+
> = z.union([
|
|
47
|
+
CustomerSubscriptionUpdatePrice$outboundSchema,
|
|
48
|
+
CustomerSubscriptionCancel$outboundSchema,
|
|
49
|
+
]);
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* @internal
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type CustomerSubscriptionUpdatePrice = {
|
|
12
|
+
/**
|
|
13
|
+
* Update subscription to another price.
|
|
14
|
+
*/
|
|
15
|
+
productPriceId: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const CustomerSubscriptionUpdatePrice$inboundSchema: z.ZodType<
|
|
20
|
+
CustomerSubscriptionUpdatePrice,
|
|
21
|
+
z.ZodTypeDef,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.object({
|
|
24
|
+
product_price_id: z.string(),
|
|
25
|
+
}).transform((v) => {
|
|
26
|
+
return remap$(v, {
|
|
27
|
+
"product_price_id": "productPriceId",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export type CustomerSubscriptionUpdatePrice$Outbound = {
|
|
33
|
+
product_price_id: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const CustomerSubscriptionUpdatePrice$outboundSchema: z.ZodType<
|
|
38
|
+
CustomerSubscriptionUpdatePrice$Outbound,
|
|
39
|
+
z.ZodTypeDef,
|
|
40
|
+
CustomerSubscriptionUpdatePrice
|
|
41
|
+
> = z.object({
|
|
42
|
+
productPriceId: z.string(),
|
|
43
|
+
}).transform((v) => {
|
|
44
|
+
return remap$(v, {
|
|
45
|
+
productPriceId: "product_price_id",
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
52
|
+
*/
|
|
53
|
+
export namespace CustomerSubscriptionUpdatePrice$ {
|
|
54
|
+
/** @deprecated use `CustomerSubscriptionUpdatePrice$inboundSchema` instead. */
|
|
55
|
+
export const inboundSchema = CustomerSubscriptionUpdatePrice$inboundSchema;
|
|
56
|
+
/** @deprecated use `CustomerSubscriptionUpdatePrice$outboundSchema` instead. */
|
|
57
|
+
export const outboundSchema = CustomerSubscriptionUpdatePrice$outboundSchema;
|
|
58
|
+
/** @deprecated use `CustomerSubscriptionUpdatePrice$Outbound` instead. */
|
|
59
|
+
export type Outbound = CustomerSubscriptionUpdatePrice$Outbound;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function customerSubscriptionUpdatePriceToJSON(
|
|
63
|
+
customerSubscriptionUpdatePrice: CustomerSubscriptionUpdatePrice,
|
|
64
|
+
): string {
|
|
65
|
+
return JSON.stringify(
|
|
66
|
+
CustomerSubscriptionUpdatePrice$outboundSchema.parse(
|
|
67
|
+
customerSubscriptionUpdatePrice,
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function customerSubscriptionUpdatePriceFromJSON(
|
|
73
|
+
jsonString: string,
|
|
74
|
+
): SafeParseResult<CustomerSubscriptionUpdatePrice, SDKValidationError> {
|
|
75
|
+
return safeParse(
|
|
76
|
+
jsonString,
|
|
77
|
+
(x) => CustomerSubscriptionUpdatePrice$inboundSchema.parse(JSON.parse(x)),
|
|
78
|
+
`Failed to parse 'CustomerSubscriptionUpdatePrice' from JSON`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -112,6 +112,7 @@ export * from "./customerbenefitgrantlicensekeys.js";
|
|
|
112
112
|
export * from "./customerbenefitgrantlicensekeysupdate.js";
|
|
113
113
|
export * from "./customerbenefitgrantsortproperty.js";
|
|
114
114
|
export * from "./customerbenefitgrantupdate.js";
|
|
115
|
+
export * from "./customercancellationreason.js";
|
|
115
116
|
export * from "./customercreate.js";
|
|
116
117
|
export * from "./customerorder.js";
|
|
117
118
|
export * from "./customerorderinvoice.js";
|
|
@@ -124,9 +125,11 @@ export * from "./customersession.js";
|
|
|
124
125
|
export * from "./customersessioncreate.js";
|
|
125
126
|
export * from "./customersortproperty.js";
|
|
126
127
|
export * from "./customersubscription.js";
|
|
128
|
+
export * from "./customersubscriptioncancel.js";
|
|
127
129
|
export * from "./customersubscriptionproduct.js";
|
|
128
130
|
export * from "./customersubscriptionsortproperty.js";
|
|
129
131
|
export * from "./customersubscriptionupdate.js";
|
|
132
|
+
export * from "./customersubscriptionupdateprice.js";
|
|
130
133
|
export * from "./customerupdate.js";
|
|
131
134
|
export * from "./customfield.js";
|
|
132
135
|
export * from "./customfieldcheckbox.js";
|
|
@@ -300,10 +303,13 @@ export * from "./scope.js";
|
|
|
300
303
|
export * from "./security.js";
|
|
301
304
|
export * from "./state.js";
|
|
302
305
|
export * from "./subscription.js";
|
|
306
|
+
export * from "./subscriptioncancel.js";
|
|
303
307
|
export * from "./subscriptioncustomer.js";
|
|
304
308
|
export * from "./subscriptionrecurringinterval.js";
|
|
305
309
|
export * from "./subscriptionsortproperty.js";
|
|
306
310
|
export * from "./subscriptionstatus.js";
|
|
311
|
+
export * from "./subscriptionupdate.js";
|
|
312
|
+
export * from "./subscriptionupdateprice.js";
|
|
307
313
|
export * from "./subscriptionuser.js";
|
|
308
314
|
export * from "./subtype.js";
|
|
309
315
|
export * from "./taxidformat.js";
|
|
@@ -329,4 +335,5 @@ export * from "./webhooksubscriptionactivepayload.js";
|
|
|
329
335
|
export * from "./webhooksubscriptioncanceledpayload.js";
|
|
330
336
|
export * from "./webhooksubscriptioncreatedpayload.js";
|
|
331
337
|
export * from "./webhooksubscriptionrevokedpayload.js";
|
|
338
|
+
export * from "./webhooksubscriptionuncanceledpayload.js";
|
|
332
339
|
export * from "./webhooksubscriptionupdatedpayload.js";
|
|
@@ -7,6 +7,11 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
CustomerCancellationReason,
|
|
12
|
+
CustomerCancellationReason$inboundSchema,
|
|
13
|
+
CustomerCancellationReason$outboundSchema,
|
|
14
|
+
} from "./customercancellationreason.js";
|
|
10
15
|
import {
|
|
11
16
|
SubscriptionRecurringInterval,
|
|
12
17
|
SubscriptionRecurringInterval$inboundSchema,
|
|
@@ -41,13 +46,17 @@ export type OrderSubscription = {
|
|
|
41
46
|
currentPeriodStart: Date;
|
|
42
47
|
currentPeriodEnd: Date | null;
|
|
43
48
|
cancelAtPeriodEnd: boolean;
|
|
49
|
+
canceledAt: Date | null;
|
|
44
50
|
startedAt: Date | null;
|
|
51
|
+
endsAt: Date | null;
|
|
45
52
|
endedAt: Date | null;
|
|
46
53
|
customerId: string;
|
|
47
54
|
productId: string;
|
|
48
55
|
priceId: string;
|
|
49
56
|
discountId: string | null;
|
|
50
57
|
checkoutId: string | null;
|
|
58
|
+
customerCancellationReason: CustomerCancellationReason | null;
|
|
59
|
+
customerCancellationComment: string | null;
|
|
51
60
|
/**
|
|
52
61
|
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
53
62
|
*/
|
|
@@ -125,9 +134,15 @@ export const OrderSubscription$inboundSchema: z.ZodType<
|
|
|
125
134
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
126
135
|
),
|
|
127
136
|
cancel_at_period_end: z.boolean(),
|
|
137
|
+
canceled_at: z.nullable(
|
|
138
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
139
|
+
),
|
|
128
140
|
started_at: z.nullable(
|
|
129
141
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
130
142
|
),
|
|
143
|
+
ends_at: z.nullable(
|
|
144
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
145
|
+
),
|
|
131
146
|
ended_at: z.nullable(
|
|
132
147
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
133
148
|
),
|
|
@@ -136,6 +151,10 @@ export const OrderSubscription$inboundSchema: z.ZodType<
|
|
|
136
151
|
price_id: z.string(),
|
|
137
152
|
discount_id: z.nullable(z.string()),
|
|
138
153
|
checkout_id: z.nullable(z.string()),
|
|
154
|
+
customer_cancellation_reason: z.nullable(
|
|
155
|
+
CustomerCancellationReason$inboundSchema,
|
|
156
|
+
),
|
|
157
|
+
customer_cancellation_comment: z.nullable(z.string()),
|
|
139
158
|
user_id: z.string(),
|
|
140
159
|
}).transform((v) => {
|
|
141
160
|
return remap$(v, {
|
|
@@ -145,13 +164,17 @@ export const OrderSubscription$inboundSchema: z.ZodType<
|
|
|
145
164
|
"current_period_start": "currentPeriodStart",
|
|
146
165
|
"current_period_end": "currentPeriodEnd",
|
|
147
166
|
"cancel_at_period_end": "cancelAtPeriodEnd",
|
|
167
|
+
"canceled_at": "canceledAt",
|
|
148
168
|
"started_at": "startedAt",
|
|
169
|
+
"ends_at": "endsAt",
|
|
149
170
|
"ended_at": "endedAt",
|
|
150
171
|
"customer_id": "customerId",
|
|
151
172
|
"product_id": "productId",
|
|
152
173
|
"price_id": "priceId",
|
|
153
174
|
"discount_id": "discountId",
|
|
154
175
|
"checkout_id": "checkoutId",
|
|
176
|
+
"customer_cancellation_reason": "customerCancellationReason",
|
|
177
|
+
"customer_cancellation_comment": "customerCancellationComment",
|
|
155
178
|
"user_id": "userId",
|
|
156
179
|
});
|
|
157
180
|
});
|
|
@@ -169,13 +192,17 @@ export type OrderSubscription$Outbound = {
|
|
|
169
192
|
current_period_start: string;
|
|
170
193
|
current_period_end: string | null;
|
|
171
194
|
cancel_at_period_end: boolean;
|
|
195
|
+
canceled_at: string | null;
|
|
172
196
|
started_at: string | null;
|
|
197
|
+
ends_at: string | null;
|
|
173
198
|
ended_at: string | null;
|
|
174
199
|
customer_id: string;
|
|
175
200
|
product_id: string;
|
|
176
201
|
price_id: string;
|
|
177
202
|
discount_id: string | null;
|
|
178
203
|
checkout_id: string | null;
|
|
204
|
+
customer_cancellation_reason: string | null;
|
|
205
|
+
customer_cancellation_comment: string | null;
|
|
179
206
|
user_id: string;
|
|
180
207
|
};
|
|
181
208
|
|
|
@@ -196,13 +223,19 @@ export const OrderSubscription$outboundSchema: z.ZodType<
|
|
|
196
223
|
currentPeriodStart: z.date().transform(v => v.toISOString()),
|
|
197
224
|
currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
|
|
198
225
|
cancelAtPeriodEnd: z.boolean(),
|
|
226
|
+
canceledAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
199
227
|
startedAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
228
|
+
endsAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
200
229
|
endedAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
201
230
|
customerId: z.string(),
|
|
202
231
|
productId: z.string(),
|
|
203
232
|
priceId: z.string(),
|
|
204
233
|
discountId: z.nullable(z.string()),
|
|
205
234
|
checkoutId: z.nullable(z.string()),
|
|
235
|
+
customerCancellationReason: z.nullable(
|
|
236
|
+
CustomerCancellationReason$outboundSchema,
|
|
237
|
+
),
|
|
238
|
+
customerCancellationComment: z.nullable(z.string()),
|
|
206
239
|
userId: z.string(),
|
|
207
240
|
}).transform((v) => {
|
|
208
241
|
return remap$(v, {
|
|
@@ -212,13 +245,17 @@ export const OrderSubscription$outboundSchema: z.ZodType<
|
|
|
212
245
|
currentPeriodStart: "current_period_start",
|
|
213
246
|
currentPeriodEnd: "current_period_end",
|
|
214
247
|
cancelAtPeriodEnd: "cancel_at_period_end",
|
|
248
|
+
canceledAt: "canceled_at",
|
|
215
249
|
startedAt: "started_at",
|
|
250
|
+
endsAt: "ends_at",
|
|
216
251
|
endedAt: "ended_at",
|
|
217
252
|
customerId: "customer_id",
|
|
218
253
|
productId: "product_id",
|
|
219
254
|
priceId: "price_id",
|
|
220
255
|
discountId: "discount_id",
|
|
221
256
|
checkoutId: "checkout_id",
|
|
257
|
+
customerCancellationReason: "customer_cancellation_reason",
|
|
258
|
+
customerCancellationComment: "customer_cancellation_comment",
|
|
222
259
|
userId: "user_id",
|
|
223
260
|
});
|
|
224
261
|
});
|