@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
|
DiscountFixedOnceForeverDurationBase,
|
|
12
17
|
DiscountFixedOnceForeverDurationBase$inboundSchema,
|
|
@@ -99,13 +104,17 @@ export type Subscription = {
|
|
|
99
104
|
currentPeriodStart: Date;
|
|
100
105
|
currentPeriodEnd: Date | null;
|
|
101
106
|
cancelAtPeriodEnd: boolean;
|
|
107
|
+
canceledAt: Date | null;
|
|
102
108
|
startedAt: Date | null;
|
|
109
|
+
endsAt: Date | null;
|
|
103
110
|
endedAt: Date | null;
|
|
104
111
|
customerId: string;
|
|
105
112
|
productId: string;
|
|
106
113
|
priceId: string;
|
|
107
114
|
discountId: string | null;
|
|
108
115
|
checkoutId: string | null;
|
|
116
|
+
customerCancellationReason: CustomerCancellationReason | null;
|
|
117
|
+
customerCancellationComment: string | null;
|
|
109
118
|
metadata: { [k: string]: string | number | boolean };
|
|
110
119
|
/**
|
|
111
120
|
* Key-value object storing custom field values.
|
|
@@ -308,9 +317,15 @@ export const Subscription$inboundSchema: z.ZodType<
|
|
|
308
317
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
309
318
|
),
|
|
310
319
|
cancel_at_period_end: z.boolean(),
|
|
320
|
+
canceled_at: z.nullable(
|
|
321
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
322
|
+
),
|
|
311
323
|
started_at: z.nullable(
|
|
312
324
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
313
325
|
),
|
|
326
|
+
ends_at: z.nullable(
|
|
327
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
328
|
+
),
|
|
314
329
|
ended_at: z.nullable(
|
|
315
330
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
316
331
|
),
|
|
@@ -319,6 +334,10 @@ export const Subscription$inboundSchema: z.ZodType<
|
|
|
319
334
|
price_id: z.string(),
|
|
320
335
|
discount_id: z.nullable(z.string()),
|
|
321
336
|
checkout_id: z.nullable(z.string()),
|
|
337
|
+
customer_cancellation_reason: z.nullable(
|
|
338
|
+
CustomerCancellationReason$inboundSchema,
|
|
339
|
+
),
|
|
340
|
+
customer_cancellation_comment: z.nullable(z.string()),
|
|
322
341
|
metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
|
|
323
342
|
custom_field_data: z.lazy(() => SubscriptionCustomFieldData$inboundSchema)
|
|
324
343
|
.optional(),
|
|
@@ -343,13 +362,17 @@ export const Subscription$inboundSchema: z.ZodType<
|
|
|
343
362
|
"current_period_start": "currentPeriodStart",
|
|
344
363
|
"current_period_end": "currentPeriodEnd",
|
|
345
364
|
"cancel_at_period_end": "cancelAtPeriodEnd",
|
|
365
|
+
"canceled_at": "canceledAt",
|
|
346
366
|
"started_at": "startedAt",
|
|
367
|
+
"ends_at": "endsAt",
|
|
347
368
|
"ended_at": "endedAt",
|
|
348
369
|
"customer_id": "customerId",
|
|
349
370
|
"product_id": "productId",
|
|
350
371
|
"price_id": "priceId",
|
|
351
372
|
"discount_id": "discountId",
|
|
352
373
|
"checkout_id": "checkoutId",
|
|
374
|
+
"customer_cancellation_reason": "customerCancellationReason",
|
|
375
|
+
"customer_cancellation_comment": "customerCancellationComment",
|
|
353
376
|
"custom_field_data": "customFieldData",
|
|
354
377
|
"user_id": "userId",
|
|
355
378
|
});
|
|
@@ -367,13 +390,17 @@ export type Subscription$Outbound = {
|
|
|
367
390
|
current_period_start: string;
|
|
368
391
|
current_period_end: string | null;
|
|
369
392
|
cancel_at_period_end: boolean;
|
|
393
|
+
canceled_at: string | null;
|
|
370
394
|
started_at: string | null;
|
|
395
|
+
ends_at: string | null;
|
|
371
396
|
ended_at: string | null;
|
|
372
397
|
customer_id: string;
|
|
373
398
|
product_id: string;
|
|
374
399
|
price_id: string;
|
|
375
400
|
discount_id: string | null;
|
|
376
401
|
checkout_id: string | null;
|
|
402
|
+
customer_cancellation_reason: string | null;
|
|
403
|
+
customer_cancellation_comment: string | null;
|
|
377
404
|
metadata: { [k: string]: string | number | boolean };
|
|
378
405
|
custom_field_data?: SubscriptionCustomFieldData$Outbound | undefined;
|
|
379
406
|
customer: SubscriptionCustomer$Outbound;
|
|
@@ -405,13 +432,19 @@ export const Subscription$outboundSchema: z.ZodType<
|
|
|
405
432
|
currentPeriodStart: z.date().transform(v => v.toISOString()),
|
|
406
433
|
currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
|
|
407
434
|
cancelAtPeriodEnd: z.boolean(),
|
|
435
|
+
canceledAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
408
436
|
startedAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
437
|
+
endsAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
409
438
|
endedAt: z.nullable(z.date().transform(v => v.toISOString())),
|
|
410
439
|
customerId: z.string(),
|
|
411
440
|
productId: z.string(),
|
|
412
441
|
priceId: z.string(),
|
|
413
442
|
discountId: z.nullable(z.string()),
|
|
414
443
|
checkoutId: z.nullable(z.string()),
|
|
444
|
+
customerCancellationReason: z.nullable(
|
|
445
|
+
CustomerCancellationReason$outboundSchema,
|
|
446
|
+
),
|
|
447
|
+
customerCancellationComment: z.nullable(z.string()),
|
|
415
448
|
metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
|
|
416
449
|
customFieldData: z.lazy(() => SubscriptionCustomFieldData$outboundSchema)
|
|
417
450
|
.optional(),
|
|
@@ -436,13 +469,17 @@ export const Subscription$outboundSchema: z.ZodType<
|
|
|
436
469
|
currentPeriodStart: "current_period_start",
|
|
437
470
|
currentPeriodEnd: "current_period_end",
|
|
438
471
|
cancelAtPeriodEnd: "cancel_at_period_end",
|
|
472
|
+
canceledAt: "canceled_at",
|
|
439
473
|
startedAt: "started_at",
|
|
474
|
+
endsAt: "ends_at",
|
|
440
475
|
endedAt: "ended_at",
|
|
441
476
|
customerId: "customer_id",
|
|
442
477
|
productId: "product_id",
|
|
443
478
|
priceId: "price_id",
|
|
444
479
|
discountId: "discount_id",
|
|
445
480
|
checkoutId: "checkout_id",
|
|
481
|
+
customerCancellationReason: "customer_cancellation_reason",
|
|
482
|
+
customerCancellationComment: "customer_cancellation_comment",
|
|
446
483
|
customFieldData: "custom_field_data",
|
|
447
484
|
userId: "user_id",
|
|
448
485
|
});
|
|
@@ -0,0 +1,144 @@
|
|
|
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 SubscriptionCancel = {
|
|
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
|
+
* Cancel and revoke an active subscription immediately
|
|
27
|
+
*/
|
|
28
|
+
revoke?: true | null | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Customer reason for cancellation.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
*
|
|
34
|
+
* Helpful to monitor reasons behind churn for future improvements.
|
|
35
|
+
*
|
|
36
|
+
* Only set this in case your own service is requesting the reason from the
|
|
37
|
+
* customer. Or you know based on direct conversations, i.e support, with
|
|
38
|
+
* the customer.
|
|
39
|
+
*
|
|
40
|
+
* * `too_expensive`: Too expensive for the customer.
|
|
41
|
+
* * `missing_features`: Customer is missing certain features.
|
|
42
|
+
* * `switched_service`: Customer switched to another service.
|
|
43
|
+
* * `unused`: Customer is not using it enough.
|
|
44
|
+
* * `customer_service`: Customer is not satisfied with the customer service.
|
|
45
|
+
* * `low_quality`: Customer is unhappy with the quality.
|
|
46
|
+
* * `too_complex`: Customer considers the service too complicated.
|
|
47
|
+
* * `other`: Other reason(s).
|
|
48
|
+
*/
|
|
49
|
+
customerCancellationReason?: CustomerCancellationReason | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Customer feedback and why they decided to cancel.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
*
|
|
55
|
+
* **IMPORTANT:**
|
|
56
|
+
* Do not use this to store internal notes! It's intended to be input
|
|
57
|
+
* from the customer and is therefore also available in their Polar
|
|
58
|
+
* purchases library.
|
|
59
|
+
*
|
|
60
|
+
* Only set this in case your own service is requesting the reason from the
|
|
61
|
+
* customer. Or you copy a message directly from a customer
|
|
62
|
+
* conversation, i.e support.
|
|
63
|
+
*/
|
|
64
|
+
customerCancellationComment?: string | null | undefined;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** @internal */
|
|
68
|
+
export const SubscriptionCancel$inboundSchema: z.ZodType<
|
|
69
|
+
SubscriptionCancel,
|
|
70
|
+
z.ZodTypeDef,
|
|
71
|
+
unknown
|
|
72
|
+
> = z.object({
|
|
73
|
+
cancel_at_period_end: z.nullable(z.boolean()).optional(),
|
|
74
|
+
revoke: z.nullable(z.literal(true)).optional(),
|
|
75
|
+
customer_cancellation_reason: z.nullable(
|
|
76
|
+
CustomerCancellationReason$inboundSchema,
|
|
77
|
+
).optional(),
|
|
78
|
+
customer_cancellation_comment: z.nullable(z.string()).optional(),
|
|
79
|
+
}).transform((v) => {
|
|
80
|
+
return remap$(v, {
|
|
81
|
+
"cancel_at_period_end": "cancelAtPeriodEnd",
|
|
82
|
+
"customer_cancellation_reason": "customerCancellationReason",
|
|
83
|
+
"customer_cancellation_comment": "customerCancellationComment",
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
/** @internal */
|
|
88
|
+
export type SubscriptionCancel$Outbound = {
|
|
89
|
+
cancel_at_period_end?: boolean | null | undefined;
|
|
90
|
+
revoke: true | null;
|
|
91
|
+
customer_cancellation_reason?: string | null | undefined;
|
|
92
|
+
customer_cancellation_comment?: string | null | undefined;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** @internal */
|
|
96
|
+
export const SubscriptionCancel$outboundSchema: z.ZodType<
|
|
97
|
+
SubscriptionCancel$Outbound,
|
|
98
|
+
z.ZodTypeDef,
|
|
99
|
+
SubscriptionCancel
|
|
100
|
+
> = z.object({
|
|
101
|
+
cancelAtPeriodEnd: z.nullable(z.boolean()).optional(),
|
|
102
|
+
revoke: z.nullable(z.literal(true).default(true as const)),
|
|
103
|
+
customerCancellationReason: z.nullable(
|
|
104
|
+
CustomerCancellationReason$outboundSchema,
|
|
105
|
+
).optional(),
|
|
106
|
+
customerCancellationComment: z.nullable(z.string()).optional(),
|
|
107
|
+
}).transform((v) => {
|
|
108
|
+
return remap$(v, {
|
|
109
|
+
cancelAtPeriodEnd: "cancel_at_period_end",
|
|
110
|
+
customerCancellationReason: "customer_cancellation_reason",
|
|
111
|
+
customerCancellationComment: "customer_cancellation_comment",
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
118
|
+
*/
|
|
119
|
+
export namespace SubscriptionCancel$ {
|
|
120
|
+
/** @deprecated use `SubscriptionCancel$inboundSchema` instead. */
|
|
121
|
+
export const inboundSchema = SubscriptionCancel$inboundSchema;
|
|
122
|
+
/** @deprecated use `SubscriptionCancel$outboundSchema` instead. */
|
|
123
|
+
export const outboundSchema = SubscriptionCancel$outboundSchema;
|
|
124
|
+
/** @deprecated use `SubscriptionCancel$Outbound` instead. */
|
|
125
|
+
export type Outbound = SubscriptionCancel$Outbound;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function subscriptionCancelToJSON(
|
|
129
|
+
subscriptionCancel: SubscriptionCancel,
|
|
130
|
+
): string {
|
|
131
|
+
return JSON.stringify(
|
|
132
|
+
SubscriptionCancel$outboundSchema.parse(subscriptionCancel),
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function subscriptionCancelFromJSON(
|
|
137
|
+
jsonString: string,
|
|
138
|
+
): SafeParseResult<SubscriptionCancel, SDKValidationError> {
|
|
139
|
+
return safeParse(
|
|
140
|
+
jsonString,
|
|
141
|
+
(x) => SubscriptionCancel$inboundSchema.parse(JSON.parse(x)),
|
|
142
|
+
`Failed to parse 'SubscriptionCancel' from JSON`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
SubscriptionCancel,
|
|
11
|
+
SubscriptionCancel$inboundSchema,
|
|
12
|
+
SubscriptionCancel$Outbound,
|
|
13
|
+
SubscriptionCancel$outboundSchema,
|
|
14
|
+
} from "./subscriptioncancel.js";
|
|
15
|
+
import {
|
|
16
|
+
SubscriptionUpdatePrice,
|
|
17
|
+
SubscriptionUpdatePrice$inboundSchema,
|
|
18
|
+
SubscriptionUpdatePrice$Outbound,
|
|
19
|
+
SubscriptionUpdatePrice$outboundSchema,
|
|
20
|
+
} from "./subscriptionupdateprice.js";
|
|
21
|
+
|
|
22
|
+
export type SubscriptionUpdate = SubscriptionUpdatePrice | SubscriptionCancel;
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const SubscriptionUpdate$inboundSchema: z.ZodType<
|
|
26
|
+
SubscriptionUpdate,
|
|
27
|
+
z.ZodTypeDef,
|
|
28
|
+
unknown
|
|
29
|
+
> = z.union([
|
|
30
|
+
SubscriptionUpdatePrice$inboundSchema,
|
|
31
|
+
SubscriptionCancel$inboundSchema,
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export type SubscriptionUpdate$Outbound =
|
|
36
|
+
| SubscriptionUpdatePrice$Outbound
|
|
37
|
+
| SubscriptionCancel$Outbound;
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const SubscriptionUpdate$outboundSchema: z.ZodType<
|
|
41
|
+
SubscriptionUpdate$Outbound,
|
|
42
|
+
z.ZodTypeDef,
|
|
43
|
+
SubscriptionUpdate
|
|
44
|
+
> = z.union([
|
|
45
|
+
SubscriptionUpdatePrice$outboundSchema,
|
|
46
|
+
SubscriptionCancel$outboundSchema,
|
|
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 SubscriptionUpdate$ {
|
|
54
|
+
/** @deprecated use `SubscriptionUpdate$inboundSchema` instead. */
|
|
55
|
+
export const inboundSchema = SubscriptionUpdate$inboundSchema;
|
|
56
|
+
/** @deprecated use `SubscriptionUpdate$outboundSchema` instead. */
|
|
57
|
+
export const outboundSchema = SubscriptionUpdate$outboundSchema;
|
|
58
|
+
/** @deprecated use `SubscriptionUpdate$Outbound` instead. */
|
|
59
|
+
export type Outbound = SubscriptionUpdate$Outbound;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function subscriptionUpdateToJSON(
|
|
63
|
+
subscriptionUpdate: SubscriptionUpdate,
|
|
64
|
+
): string {
|
|
65
|
+
return JSON.stringify(
|
|
66
|
+
SubscriptionUpdate$outboundSchema.parse(subscriptionUpdate),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function subscriptionUpdateFromJSON(
|
|
71
|
+
jsonString: string,
|
|
72
|
+
): SafeParseResult<SubscriptionUpdate, SDKValidationError> {
|
|
73
|
+
return safeParse(
|
|
74
|
+
jsonString,
|
|
75
|
+
(x) => SubscriptionUpdate$inboundSchema.parse(JSON.parse(x)),
|
|
76
|
+
`Failed to parse 'SubscriptionUpdate' from JSON`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 SubscriptionUpdatePrice = {
|
|
12
|
+
/**
|
|
13
|
+
* Update subscription to another price.
|
|
14
|
+
*/
|
|
15
|
+
productPriceId: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const SubscriptionUpdatePrice$inboundSchema: z.ZodType<
|
|
20
|
+
SubscriptionUpdatePrice,
|
|
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 SubscriptionUpdatePrice$Outbound = {
|
|
33
|
+
product_price_id: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const SubscriptionUpdatePrice$outboundSchema: z.ZodType<
|
|
38
|
+
SubscriptionUpdatePrice$Outbound,
|
|
39
|
+
z.ZodTypeDef,
|
|
40
|
+
SubscriptionUpdatePrice
|
|
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 SubscriptionUpdatePrice$ {
|
|
54
|
+
/** @deprecated use `SubscriptionUpdatePrice$inboundSchema` instead. */
|
|
55
|
+
export const inboundSchema = SubscriptionUpdatePrice$inboundSchema;
|
|
56
|
+
/** @deprecated use `SubscriptionUpdatePrice$outboundSchema` instead. */
|
|
57
|
+
export const outboundSchema = SubscriptionUpdatePrice$outboundSchema;
|
|
58
|
+
/** @deprecated use `SubscriptionUpdatePrice$Outbound` instead. */
|
|
59
|
+
export type Outbound = SubscriptionUpdatePrice$Outbound;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function subscriptionUpdatePriceToJSON(
|
|
63
|
+
subscriptionUpdatePrice: SubscriptionUpdatePrice,
|
|
64
|
+
): string {
|
|
65
|
+
return JSON.stringify(
|
|
66
|
+
SubscriptionUpdatePrice$outboundSchema.parse(subscriptionUpdatePrice),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function subscriptionUpdatePriceFromJSON(
|
|
71
|
+
jsonString: string,
|
|
72
|
+
): SafeParseResult<SubscriptionUpdatePrice, SDKValidationError> {
|
|
73
|
+
return safeParse(
|
|
74
|
+
jsonString,
|
|
75
|
+
(x) => SubscriptionUpdatePrice$inboundSchema.parse(JSON.parse(x)),
|
|
76
|
+
`Failed to parse 'SubscriptionUpdatePrice' from JSON`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
} from "./subscription.js";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Sent when a subscription is canceled
|
|
17
|
+
* Sent when a subscription is canceled.
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
*
|
|
20
|
+
* Customers might still have access until the end of the current period.
|
|
21
21
|
*
|
|
22
22
|
* **Discord & Slack support:** Full
|
|
23
23
|
*/
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
Subscription,
|
|
11
|
+
Subscription$inboundSchema,
|
|
12
|
+
Subscription$Outbound,
|
|
13
|
+
Subscription$outboundSchema,
|
|
14
|
+
} from "./subscription.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Sent when a subscription is uncanceled.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*
|
|
21
|
+
* **Discord & Slack support:** Full
|
|
22
|
+
*/
|
|
23
|
+
export type WebhookSubscriptionUncanceledPayload = {
|
|
24
|
+
type?: "subscription.uncanceled" | undefined;
|
|
25
|
+
data: Subscription;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const WebhookSubscriptionUncanceledPayload$inboundSchema: z.ZodType<
|
|
30
|
+
WebhookSubscriptionUncanceledPayload,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
type: z.literal("subscription.uncanceled").optional(),
|
|
35
|
+
data: Subscription$inboundSchema,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export type WebhookSubscriptionUncanceledPayload$Outbound = {
|
|
40
|
+
type: "subscription.uncanceled";
|
|
41
|
+
data: Subscription$Outbound;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const WebhookSubscriptionUncanceledPayload$outboundSchema: z.ZodType<
|
|
46
|
+
WebhookSubscriptionUncanceledPayload$Outbound,
|
|
47
|
+
z.ZodTypeDef,
|
|
48
|
+
WebhookSubscriptionUncanceledPayload
|
|
49
|
+
> = z.object({
|
|
50
|
+
type: z.literal("subscription.uncanceled").default(
|
|
51
|
+
"subscription.uncanceled" as const,
|
|
52
|
+
),
|
|
53
|
+
data: Subscription$outboundSchema,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
59
|
+
*/
|
|
60
|
+
export namespace WebhookSubscriptionUncanceledPayload$ {
|
|
61
|
+
/** @deprecated use `WebhookSubscriptionUncanceledPayload$inboundSchema` instead. */
|
|
62
|
+
export const inboundSchema =
|
|
63
|
+
WebhookSubscriptionUncanceledPayload$inboundSchema;
|
|
64
|
+
/** @deprecated use `WebhookSubscriptionUncanceledPayload$outboundSchema` instead. */
|
|
65
|
+
export const outboundSchema =
|
|
66
|
+
WebhookSubscriptionUncanceledPayload$outboundSchema;
|
|
67
|
+
/** @deprecated use `WebhookSubscriptionUncanceledPayload$Outbound` instead. */
|
|
68
|
+
export type Outbound = WebhookSubscriptionUncanceledPayload$Outbound;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function webhookSubscriptionUncanceledPayloadToJSON(
|
|
72
|
+
webhookSubscriptionUncanceledPayload: WebhookSubscriptionUncanceledPayload,
|
|
73
|
+
): string {
|
|
74
|
+
return JSON.stringify(
|
|
75
|
+
WebhookSubscriptionUncanceledPayload$outboundSchema.parse(
|
|
76
|
+
webhookSubscriptionUncanceledPayload,
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function webhookSubscriptionUncanceledPayloadFromJSON(
|
|
82
|
+
jsonString: string,
|
|
83
|
+
): SafeParseResult<WebhookSubscriptionUncanceledPayload, SDKValidationError> {
|
|
84
|
+
return safeParse(
|
|
85
|
+
jsonString,
|
|
86
|
+
(x) =>
|
|
87
|
+
WebhookSubscriptionUncanceledPayload$inboundSchema.parse(JSON.parse(x)),
|
|
88
|
+
`Failed to parse 'WebhookSubscriptionUncanceledPayload' from JSON`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
@@ -11,7 +11,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
11
11
|
|
|
12
12
|
export type CustomerPortalSubscriptionsUpdateRequest = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Customer subscription ID.
|
|
15
15
|
*/
|
|
16
16
|
id: string;
|
|
17
17
|
customerSubscriptionUpdate: components.CustomerSubscriptionUpdate;
|
|
@@ -17,7 +17,7 @@ export type OrdersListQueryParamOrganizationIDFilter = string | Array<string>;
|
|
|
17
17
|
/**
|
|
18
18
|
* Filter by product ID.
|
|
19
19
|
*/
|
|
20
|
-
export type
|
|
20
|
+
export type OrdersListQueryParamProductIDFilter = string | Array<string>;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Filter by product price type. `recurring` will return orders corresponding to subscriptions creations or renewals. `one_time` will return orders corresponding to one-time purchases.
|
|
@@ -141,50 +141,57 @@ export function ordersListQueryParamOrganizationIDFilterFromJSON(
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/** @internal */
|
|
144
|
-
export const
|
|
145
|
-
|
|
144
|
+
export const OrdersListQueryParamProductIDFilter$inboundSchema: z.ZodType<
|
|
145
|
+
OrdersListQueryParamProductIDFilter,
|
|
146
146
|
z.ZodTypeDef,
|
|
147
147
|
unknown
|
|
148
148
|
> = z.union([z.string(), z.array(z.string())]);
|
|
149
149
|
|
|
150
150
|
/** @internal */
|
|
151
|
-
export type
|
|
151
|
+
export type OrdersListQueryParamProductIDFilter$Outbound =
|
|
152
|
+
| string
|
|
153
|
+
| Array<string>;
|
|
152
154
|
|
|
153
155
|
/** @internal */
|
|
154
|
-
export const
|
|
155
|
-
|
|
156
|
+
export const OrdersListQueryParamProductIDFilter$outboundSchema: z.ZodType<
|
|
157
|
+
OrdersListQueryParamProductIDFilter$Outbound,
|
|
156
158
|
z.ZodTypeDef,
|
|
157
|
-
|
|
159
|
+
OrdersListQueryParamProductIDFilter
|
|
158
160
|
> = z.union([z.string(), z.array(z.string())]);
|
|
159
161
|
|
|
160
162
|
/**
|
|
161
163
|
* @internal
|
|
162
164
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
163
165
|
*/
|
|
164
|
-
export namespace
|
|
165
|
-
/** @deprecated use `
|
|
166
|
-
export const inboundSchema =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
export namespace OrdersListQueryParamProductIDFilter$ {
|
|
167
|
+
/** @deprecated use `OrdersListQueryParamProductIDFilter$inboundSchema` instead. */
|
|
168
|
+
export const inboundSchema =
|
|
169
|
+
OrdersListQueryParamProductIDFilter$inboundSchema;
|
|
170
|
+
/** @deprecated use `OrdersListQueryParamProductIDFilter$outboundSchema` instead. */
|
|
171
|
+
export const outboundSchema =
|
|
172
|
+
OrdersListQueryParamProductIDFilter$outboundSchema;
|
|
173
|
+
/** @deprecated use `OrdersListQueryParamProductIDFilter$Outbound` instead. */
|
|
174
|
+
export type Outbound = OrdersListQueryParamProductIDFilter$Outbound;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
|
-
export function
|
|
174
|
-
|
|
177
|
+
export function ordersListQueryParamProductIDFilterToJSON(
|
|
178
|
+
ordersListQueryParamProductIDFilter: OrdersListQueryParamProductIDFilter,
|
|
175
179
|
): string {
|
|
176
180
|
return JSON.stringify(
|
|
177
|
-
|
|
181
|
+
OrdersListQueryParamProductIDFilter$outboundSchema.parse(
|
|
182
|
+
ordersListQueryParamProductIDFilter,
|
|
183
|
+
),
|
|
178
184
|
);
|
|
179
185
|
}
|
|
180
186
|
|
|
181
|
-
export function
|
|
187
|
+
export function ordersListQueryParamProductIDFilterFromJSON(
|
|
182
188
|
jsonString: string,
|
|
183
|
-
): SafeParseResult<
|
|
189
|
+
): SafeParseResult<OrdersListQueryParamProductIDFilter, SDKValidationError> {
|
|
184
190
|
return safeParse(
|
|
185
191
|
jsonString,
|
|
186
|
-
(x) =>
|
|
187
|
-
|
|
192
|
+
(x) =>
|
|
193
|
+
OrdersListQueryParamProductIDFilter$inboundSchema.parse(JSON.parse(x)),
|
|
194
|
+
`Failed to parse 'OrdersListQueryParamProductIDFilter' from JSON`,
|
|
188
195
|
);
|
|
189
196
|
}
|
|
190
197
|
|