@polar-sh/sdk 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +7 -6
  2. package/docs/sdks/products/README.md +2 -2
  3. package/funcs/advertisementsList.js +2 -2
  4. package/funcs/advertisementsList.js.map +1 -1
  5. package/funcs/articlesList.js +2 -2
  6. package/funcs/articlesList.js.map +1 -1
  7. package/funcs/benefitsGrants.js +2 -2
  8. package/funcs/benefitsGrants.js.map +1 -1
  9. package/funcs/benefitsList.js +2 -2
  10. package/funcs/benefitsList.js.map +1 -1
  11. package/funcs/externalOrganizationsList.js +2 -2
  12. package/funcs/externalOrganizationsList.js.map +1 -1
  13. package/funcs/filesList.js +2 -2
  14. package/funcs/filesList.js.map +1 -1
  15. package/funcs/licenseKeysList.js +2 -2
  16. package/funcs/licenseKeysList.js.map +1 -1
  17. package/funcs/oauth2ClientsList.js +2 -2
  18. package/funcs/oauth2ClientsList.js.map +1 -1
  19. package/funcs/ordersList.js +2 -2
  20. package/funcs/ordersList.js.map +1 -1
  21. package/funcs/organizationsList.js +2 -2
  22. package/funcs/organizationsList.js.map +1 -1
  23. package/funcs/productsList.js +2 -2
  24. package/funcs/productsList.js.map +1 -1
  25. package/funcs/repositoriesList.js +2 -2
  26. package/funcs/repositoriesList.js.map +1 -1
  27. package/funcs/subscriptionsList.js +2 -2
  28. package/funcs/subscriptionsList.js.map +1 -1
  29. package/funcs/usersAdvertisementsList.js +2 -2
  30. package/funcs/usersAdvertisementsList.js.map +1 -1
  31. package/funcs/usersBenefitsList.js +2 -2
  32. package/funcs/usersBenefitsList.js.map +1 -1
  33. package/funcs/usersDownloadablesList.js +2 -2
  34. package/funcs/usersDownloadablesList.js.map +1 -1
  35. package/funcs/usersLicenseKeysList.js +2 -2
  36. package/funcs/usersLicenseKeysList.js.map +1 -1
  37. package/funcs/usersOrdersList.js +2 -2
  38. package/funcs/usersOrdersList.js.map +1 -1
  39. package/funcs/usersSubscriptionsList.js +2 -2
  40. package/funcs/usersSubscriptionsList.js.map +1 -1
  41. package/lib/config.d.ts +16 -5
  42. package/lib/config.d.ts.map +1 -1
  43. package/lib/config.js +18 -12
  44. package/lib/config.js.map +1 -1
  45. package/models/components/bodysubscriptionsimport.d.ts +2 -2
  46. package/models/components/bodysubscriptionsimport.d.ts.map +1 -1
  47. package/models/components/bodysubscriptionsimport.js +2 -0
  48. package/models/components/bodysubscriptionsimport.js.map +1 -1
  49. package/models/components/index.d.ts +9 -3
  50. package/models/components/index.d.ts.map +1 -1
  51. package/models/components/index.js +9 -3
  52. package/models/components/index.js.map +1 -1
  53. package/models/components/ordersubscription.d.ts +7 -0
  54. package/models/components/ordersubscription.d.ts.map +1 -1
  55. package/models/components/ordersubscription.js +9 -0
  56. package/models/components/ordersubscription.js.map +1 -1
  57. package/models/components/organizationfeaturesettings.d.ts +0 -5
  58. package/models/components/organizationfeaturesettings.d.ts.map +1 -1
  59. package/models/components/organizationfeaturesettings.js +0 -4
  60. package/models/components/organizationfeaturesettings.js.map +1 -1
  61. package/models/components/organizationprofilesettings.d.ts +10 -0
  62. package/models/components/organizationprofilesettings.d.ts.map +1 -1
  63. package/models/components/organizationprofilesettings.js +6 -0
  64. package/models/components/organizationprofilesettings.js.map +1 -1
  65. package/models/components/productonetimecreate.d.ts +23 -3
  66. package/models/components/productonetimecreate.d.ts.map +1 -1
  67. package/models/components/productonetimecreate.js +33 -4
  68. package/models/components/productonetimecreate.js.map +1 -1
  69. package/models/components/productpriceinput.d.ts +3 -11
  70. package/models/components/productpriceinput.d.ts.map +1 -1
  71. package/models/components/productpriceinput.js +5 -13
  72. package/models/components/productpriceinput.js.map +1 -1
  73. package/models/components/productpriceonetime.d.ts +4 -71
  74. package/models/components/productpriceonetime.d.ts.map +1 -1
  75. package/models/components/productpriceonetime.js +11 -57
  76. package/models/components/productpriceonetime.js.map +1 -1
  77. package/models/components/productpriceonetimecustom.d.ts +124 -0
  78. package/models/components/productpriceonetimecustom.d.ts.map +1 -0
  79. package/models/components/productpriceonetimecustom.js +130 -0
  80. package/models/components/productpriceonetimecustom.js.map +1 -0
  81. package/models/components/productpriceonetimecustomcreate.d.ts +71 -0
  82. package/models/components/productpriceonetimecustomcreate.d.ts.map +1 -0
  83. package/models/components/productpriceonetimecustomcreate.js +91 -0
  84. package/models/components/productpriceonetimecustomcreate.js.map +1 -0
  85. package/models/components/productpriceonetimefixed.d.ts +114 -0
  86. package/models/components/productpriceonetimefixed.d.ts.map +1 -0
  87. package/models/components/productpriceonetimefixed.js +122 -0
  88. package/models/components/productpriceonetimefixed.js.map +1 -0
  89. package/models/components/productpriceonetimefixedcreate.d.ts +61 -0
  90. package/models/components/productpriceonetimefixedcreate.d.ts.map +1 -0
  91. package/models/components/{productpriceonetimecreate.js → productpriceonetimefixedcreate.js} +25 -25
  92. package/models/components/productpriceonetimefixedcreate.js.map +1 -0
  93. package/models/components/productpriceoutput.d.ts +3 -11
  94. package/models/components/productpriceoutput.d.ts.map +1 -1
  95. package/models/components/productpriceoutput.js +5 -13
  96. package/models/components/productpriceoutput.js.map +1 -1
  97. package/models/components/productpricerecurringcreate.d.ts +7 -7
  98. package/models/components/productpricerecurringcreate.d.ts.map +1 -1
  99. package/models/components/productpricerecurringcreate.js +9 -9
  100. package/models/components/productpricerecurringcreate.js.map +1 -1
  101. package/models/components/productpricerecurringcustom.d.ts +130 -0
  102. package/models/components/productpricerecurringcustom.d.ts.map +1 -0
  103. package/models/components/productpricerecurringcustom.js +135 -0
  104. package/models/components/productpricerecurringcustom.js.map +1 -0
  105. package/models/components/productpricerecurringfixed.d.ts +120 -0
  106. package/models/components/productpricerecurringfixed.d.ts.map +1 -0
  107. package/models/components/productpricerecurringfixed.js +128 -0
  108. package/models/components/productpricerecurringfixed.js.map +1 -0
  109. package/models/components/productpricerecurringinput.d.ts +31 -0
  110. package/models/components/productpricerecurringinput.d.ts.map +1 -0
  111. package/models/components/productpricerecurringinput.js +62 -0
  112. package/models/components/productpricerecurringinput.js.map +1 -0
  113. package/models/components/productpricerecurringoutput.d.ts +31 -0
  114. package/models/components/productpricerecurringoutput.d.ts.map +1 -0
  115. package/models/components/productpricerecurringoutput.js +62 -0
  116. package/models/components/productpricerecurringoutput.js.map +1 -0
  117. package/models/components/productupdate.d.ts +15 -14
  118. package/models/components/productupdate.d.ts.map +1 -1
  119. package/models/components/productupdate.js +20 -16
  120. package/models/components/productupdate.js.map +1 -1
  121. package/models/components/subscriptioninput.d.ts +7 -0
  122. package/models/components/subscriptioninput.d.ts.map +1 -1
  123. package/models/components/subscriptioninput.js +9 -0
  124. package/models/components/subscriptioninput.js.map +1 -1
  125. package/models/components/subscriptionoutput.d.ts +7 -0
  126. package/models/components/subscriptionoutput.d.ts.map +1 -1
  127. package/models/components/subscriptionoutput.js +9 -0
  128. package/models/components/subscriptionoutput.js.map +1 -1
  129. package/models/components/subscriptionrecurringinterval.d.ts +28 -0
  130. package/models/components/{productpricerecurringinterval.d.ts.map → subscriptionrecurringinterval.d.ts.map} +1 -1
  131. package/models/components/{productpricerecurringinterval.js → subscriptionrecurringinterval.js} +12 -12
  132. package/models/components/{productpricerecurringinterval.js.map → subscriptionrecurringinterval.js.map} +1 -1
  133. package/models/components/subscriptionsortproperty.d.ts +6 -6
  134. package/models/components/subscriptionsortproperty.js +2 -2
  135. package/models/components/subscriptionsortproperty.js.map +1 -1
  136. package/models/components/userordersubscription.d.ts +7 -0
  137. package/models/components/userordersubscription.d.ts.map +1 -1
  138. package/models/components/userordersubscription.js +9 -0
  139. package/models/components/userordersubscription.js.map +1 -1
  140. package/models/components/usersubscription.d.ts +10 -0
  141. package/models/components/usersubscription.d.ts.map +1 -1
  142. package/models/components/usersubscription.js +9 -0
  143. package/models/components/usersubscription.js.map +1 -1
  144. package/models/components/usersubscriptionsortproperty.d.ts +6 -6
  145. package/models/components/usersubscriptionsortproperty.js +2 -2
  146. package/models/components/usersubscriptionsortproperty.js.map +1 -1
  147. package/package.json +1 -1
  148. package/src/funcs/advertisementsList.ts +2 -2
  149. package/src/funcs/articlesList.ts +2 -2
  150. package/src/funcs/benefitsGrants.ts +2 -2
  151. package/src/funcs/benefitsList.ts +2 -2
  152. package/src/funcs/externalOrganizationsList.ts +2 -2
  153. package/src/funcs/filesList.ts +2 -2
  154. package/src/funcs/licenseKeysList.ts +2 -2
  155. package/src/funcs/oauth2ClientsList.ts +2 -2
  156. package/src/funcs/ordersList.ts +2 -2
  157. package/src/funcs/organizationsList.ts +2 -2
  158. package/src/funcs/productsList.ts +2 -2
  159. package/src/funcs/repositoriesList.ts +2 -2
  160. package/src/funcs/subscriptionsList.ts +2 -2
  161. package/src/funcs/usersAdvertisementsList.ts +2 -2
  162. package/src/funcs/usersBenefitsList.ts +2 -2
  163. package/src/funcs/usersDownloadablesList.ts +2 -2
  164. package/src/funcs/usersLicenseKeysList.ts +2 -2
  165. package/src/funcs/usersOrdersList.ts +2 -2
  166. package/src/funcs/usersSubscriptionsList.ts +2 -2
  167. package/src/lib/config.ts +18 -12
  168. package/src/models/components/bodysubscriptionsimport.ts +4 -2
  169. package/src/models/components/index.ts +9 -3
  170. package/src/models/components/ordersubscription.ts +19 -0
  171. package/src/models/components/organizationfeaturesettings.ts +0 -9
  172. package/src/models/components/organizationprofilesettings.ts +16 -0
  173. package/src/models/components/productonetimecreate.ts +69 -9
  174. package/src/models/components/productpriceinput.ts +13 -29
  175. package/src/models/components/productpriceonetime.ts +27 -115
  176. package/src/models/components/productpriceonetimecustom.ts +201 -0
  177. package/src/models/components/productpriceonetimecustomcreate.ts +122 -0
  178. package/src/models/components/productpriceonetimefixed.ts +182 -0
  179. package/src/models/components/productpriceonetimefixedcreate.ts +103 -0
  180. package/src/models/components/productpriceoutput.ts +13 -29
  181. package/src/models/components/productpricerecurringcreate.ts +18 -18
  182. package/src/models/components/productpricerecurringcustom.ts +216 -0
  183. package/src/models/components/productpricerecurringfixed.ts +191 -0
  184. package/src/models/components/productpricerecurringinput.ts +75 -0
  185. package/src/models/components/productpricerecurringoutput.ts +75 -0
  186. package/src/models/components/productupdate.ts +49 -32
  187. package/src/models/components/subscriptioninput.ts +19 -0
  188. package/src/models/components/subscriptionoutput.ts +19 -0
  189. package/src/models/components/subscriptionrecurringinterval.ts +35 -0
  190. package/src/models/components/subscriptionsortproperty.ts +2 -2
  191. package/src/models/components/userordersubscription.ts +19 -0
  192. package/src/models/components/usersubscription.ts +22 -0
  193. package/src/models/components/usersubscriptionsortproperty.ts +2 -2
  194. package/models/components/productpriceonetimecreate.d.ts +0 -61
  195. package/models/components/productpriceonetimecreate.d.ts.map +0 -1
  196. package/models/components/productpriceonetimecreate.js.map +0 -1
  197. package/models/components/productpricerecurring.d.ts +0 -96
  198. package/models/components/productpricerecurring.d.ts.map +0 -1
  199. package/models/components/productpricerecurring.js +0 -105
  200. package/models/components/productpricerecurring.js.map +0 -1
  201. package/models/components/productpricerecurringinterval.d.ts +0 -28
  202. package/src/models/components/productpriceonetimecreate.ts +0 -102
  203. package/src/models/components/productpricerecurring.ts +0 -161
  204. package/src/models/components/productpricerecurringinterval.ts +0 -35
@@ -6,10 +6,10 @@ import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { ClosedEnum } from "../../types/enums.js";
8
8
  import {
9
- ProductPriceRecurringInterval,
10
- ProductPriceRecurringInterval$inboundSchema,
11
- ProductPriceRecurringInterval$outboundSchema,
12
- } from "./productpricerecurringinterval.js";
9
+ SubscriptionRecurringInterval,
10
+ SubscriptionRecurringInterval$inboundSchema,
11
+ SubscriptionRecurringInterval$outboundSchema,
12
+ } from "./subscriptionrecurringinterval.js";
13
13
 
14
14
  export const ProductPriceRecurringCreateType = {
15
15
  Recurring: "recurring",
@@ -24,17 +24,17 @@ export type ProductPriceRecurringCreateType = ClosedEnum<
24
24
  export type ProductPriceRecurringCreate = {
25
25
  type?: "recurring" | undefined;
26
26
  /**
27
- * The recurring interval of the price.
27
+ * The currency. Currently, only `usd` is supported.
28
28
  */
29
- recurringInterval: ProductPriceRecurringInterval;
29
+ priceCurrency?: string | undefined;
30
30
  /**
31
31
  * The price in cents.
32
32
  */
33
33
  priceAmount: number;
34
34
  /**
35
- * The currency. Currently, only `usd` is supported.
35
+ * The recurring interval of the price.
36
36
  */
37
- priceCurrency?: string | undefined;
37
+ recurringInterval: SubscriptionRecurringInterval;
38
38
  };
39
39
 
40
40
  /** @internal */
@@ -65,23 +65,23 @@ export const ProductPriceRecurringCreate$inboundSchema: z.ZodType<
65
65
  unknown
66
66
  > = z.object({
67
67
  type: z.literal("recurring").optional(),
68
- recurring_interval: ProductPriceRecurringInterval$inboundSchema,
69
- price_amount: z.number().int(),
70
68
  price_currency: z.string().default("usd"),
69
+ price_amount: z.number().int(),
70
+ recurring_interval: SubscriptionRecurringInterval$inboundSchema,
71
71
  }).transform((v) => {
72
72
  return remap$(v, {
73
- "recurring_interval": "recurringInterval",
74
- "price_amount": "priceAmount",
75
73
  "price_currency": "priceCurrency",
74
+ "price_amount": "priceAmount",
75
+ "recurring_interval": "recurringInterval",
76
76
  });
77
77
  });
78
78
 
79
79
  /** @internal */
80
80
  export type ProductPriceRecurringCreate$Outbound = {
81
81
  type: "recurring";
82
- recurring_interval: string;
83
- price_amount: number;
84
82
  price_currency: string;
83
+ price_amount: number;
84
+ recurring_interval: string;
85
85
  };
86
86
 
87
87
  /** @internal */
@@ -91,14 +91,14 @@ export const ProductPriceRecurringCreate$outboundSchema: z.ZodType<
91
91
  ProductPriceRecurringCreate
92
92
  > = z.object({
93
93
  type: z.literal("recurring").default("recurring"),
94
- recurringInterval: ProductPriceRecurringInterval$outboundSchema,
95
- priceAmount: z.number().int(),
96
94
  priceCurrency: z.string().default("usd"),
95
+ priceAmount: z.number().int(),
96
+ recurringInterval: SubscriptionRecurringInterval$outboundSchema,
97
97
  }).transform((v) => {
98
98
  return remap$(v, {
99
- recurringInterval: "recurring_interval",
100
- priceAmount: "price_amount",
101
99
  priceCurrency: "price_currency",
100
+ priceAmount: "price_amount",
101
+ recurringInterval: "recurring_interval",
102
102
  });
103
103
  });
104
104
 
@@ -0,0 +1,216 @@
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 { ClosedEnum } from "../../types/enums.js";
8
+ import {
9
+ SubscriptionRecurringInterval,
10
+ SubscriptionRecurringInterval$inboundSchema,
11
+ SubscriptionRecurringInterval$outboundSchema,
12
+ } from "./subscriptionrecurringinterval.js";
13
+
14
+ export const ProductPriceRecurringCustomAmountType = {
15
+ Custom: "custom",
16
+ } as const;
17
+ export type ProductPriceRecurringCustomAmountType = ClosedEnum<
18
+ typeof ProductPriceRecurringCustomAmountType
19
+ >;
20
+
21
+ /**
22
+ * The type of the price.
23
+ */
24
+ export const ProductPriceRecurringCustomType = {
25
+ Recurring: "recurring",
26
+ } as const;
27
+ /**
28
+ * The type of the price.
29
+ */
30
+ export type ProductPriceRecurringCustomType = ClosedEnum<
31
+ typeof ProductPriceRecurringCustomType
32
+ >;
33
+
34
+ /**
35
+ * A pay-what-you-want recurring price for a product, i.e. a subscription.
36
+ */
37
+ export type ProductPriceRecurringCustom = {
38
+ /**
39
+ * Creation timestamp of the object.
40
+ */
41
+ createdAt: Date;
42
+ /**
43
+ * Last modification timestamp of the object.
44
+ */
45
+ modifiedAt: Date | null;
46
+ /**
47
+ * The ID of the price.
48
+ */
49
+ id: string;
50
+ amountType?: "custom" | undefined;
51
+ /**
52
+ * The currency.
53
+ */
54
+ priceCurrency: string;
55
+ /**
56
+ * Whether the price is archived and no longer available.
57
+ */
58
+ isArchived: boolean;
59
+ /**
60
+ * The minimum amount the customer can pay.
61
+ */
62
+ minimumAmount: number | null;
63
+ /**
64
+ * The maximum amount the customer can pay.
65
+ */
66
+ maximumAmount: number | null;
67
+ /**
68
+ * The initial amount shown to the customer.
69
+ */
70
+ presetAmount: number | null;
71
+ /**
72
+ * The type of the price.
73
+ */
74
+ type?: "recurring" | undefined;
75
+ /**
76
+ * The recurring interval of the price.
77
+ */
78
+ recurringInterval: SubscriptionRecurringInterval;
79
+ };
80
+
81
+ /** @internal */
82
+ export const ProductPriceRecurringCustomAmountType$inboundSchema:
83
+ z.ZodNativeEnum<typeof ProductPriceRecurringCustomAmountType> = z.nativeEnum(
84
+ ProductPriceRecurringCustomAmountType,
85
+ );
86
+
87
+ /** @internal */
88
+ export const ProductPriceRecurringCustomAmountType$outboundSchema:
89
+ z.ZodNativeEnum<typeof ProductPriceRecurringCustomAmountType> =
90
+ ProductPriceRecurringCustomAmountType$inboundSchema;
91
+
92
+ /**
93
+ * @internal
94
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
95
+ */
96
+ export namespace ProductPriceRecurringCustomAmountType$ {
97
+ /** @deprecated use `ProductPriceRecurringCustomAmountType$inboundSchema` instead. */
98
+ export const inboundSchema =
99
+ ProductPriceRecurringCustomAmountType$inboundSchema;
100
+ /** @deprecated use `ProductPriceRecurringCustomAmountType$outboundSchema` instead. */
101
+ export const outboundSchema =
102
+ ProductPriceRecurringCustomAmountType$outboundSchema;
103
+ }
104
+
105
+ /** @internal */
106
+ export const ProductPriceRecurringCustomType$inboundSchema: z.ZodNativeEnum<
107
+ typeof ProductPriceRecurringCustomType
108
+ > = z.nativeEnum(ProductPriceRecurringCustomType);
109
+
110
+ /** @internal */
111
+ export const ProductPriceRecurringCustomType$outboundSchema: z.ZodNativeEnum<
112
+ typeof ProductPriceRecurringCustomType
113
+ > = ProductPriceRecurringCustomType$inboundSchema;
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 ProductPriceRecurringCustomType$ {
120
+ /** @deprecated use `ProductPriceRecurringCustomType$inboundSchema` instead. */
121
+ export const inboundSchema = ProductPriceRecurringCustomType$inboundSchema;
122
+ /** @deprecated use `ProductPriceRecurringCustomType$outboundSchema` instead. */
123
+ export const outboundSchema = ProductPriceRecurringCustomType$outboundSchema;
124
+ }
125
+
126
+ /** @internal */
127
+ export const ProductPriceRecurringCustom$inboundSchema: z.ZodType<
128
+ ProductPriceRecurringCustom,
129
+ z.ZodTypeDef,
130
+ unknown
131
+ > = z.object({
132
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
133
+ modified_at: z.nullable(
134
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
135
+ ),
136
+ id: z.string(),
137
+ amount_type: z.literal("custom").optional(),
138
+ price_currency: z.string(),
139
+ is_archived: z.boolean(),
140
+ minimum_amount: z.nullable(z.number().int()),
141
+ maximum_amount: z.nullable(z.number().int()),
142
+ preset_amount: z.nullable(z.number().int()),
143
+ type: z.literal("recurring").optional(),
144
+ recurring_interval: SubscriptionRecurringInterval$inboundSchema,
145
+ }).transform((v) => {
146
+ return remap$(v, {
147
+ "created_at": "createdAt",
148
+ "modified_at": "modifiedAt",
149
+ "amount_type": "amountType",
150
+ "price_currency": "priceCurrency",
151
+ "is_archived": "isArchived",
152
+ "minimum_amount": "minimumAmount",
153
+ "maximum_amount": "maximumAmount",
154
+ "preset_amount": "presetAmount",
155
+ "recurring_interval": "recurringInterval",
156
+ });
157
+ });
158
+
159
+ /** @internal */
160
+ export type ProductPriceRecurringCustom$Outbound = {
161
+ created_at: string;
162
+ modified_at: string | null;
163
+ id: string;
164
+ amount_type: "custom";
165
+ price_currency: string;
166
+ is_archived: boolean;
167
+ minimum_amount: number | null;
168
+ maximum_amount: number | null;
169
+ preset_amount: number | null;
170
+ type: "recurring";
171
+ recurring_interval: string;
172
+ };
173
+
174
+ /** @internal */
175
+ export const ProductPriceRecurringCustom$outboundSchema: z.ZodType<
176
+ ProductPriceRecurringCustom$Outbound,
177
+ z.ZodTypeDef,
178
+ ProductPriceRecurringCustom
179
+ > = z.object({
180
+ createdAt: z.date().transform(v => v.toISOString()),
181
+ modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
182
+ id: z.string(),
183
+ amountType: z.literal("custom").default("custom"),
184
+ priceCurrency: z.string(),
185
+ isArchived: z.boolean(),
186
+ minimumAmount: z.nullable(z.number().int()),
187
+ maximumAmount: z.nullable(z.number().int()),
188
+ presetAmount: z.nullable(z.number().int()),
189
+ type: z.literal("recurring").default("recurring"),
190
+ recurringInterval: SubscriptionRecurringInterval$outboundSchema,
191
+ }).transform((v) => {
192
+ return remap$(v, {
193
+ createdAt: "created_at",
194
+ modifiedAt: "modified_at",
195
+ amountType: "amount_type",
196
+ priceCurrency: "price_currency",
197
+ isArchived: "is_archived",
198
+ minimumAmount: "minimum_amount",
199
+ maximumAmount: "maximum_amount",
200
+ presetAmount: "preset_amount",
201
+ recurringInterval: "recurring_interval",
202
+ });
203
+ });
204
+
205
+ /**
206
+ * @internal
207
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
208
+ */
209
+ export namespace ProductPriceRecurringCustom$ {
210
+ /** @deprecated use `ProductPriceRecurringCustom$inboundSchema` instead. */
211
+ export const inboundSchema = ProductPriceRecurringCustom$inboundSchema;
212
+ /** @deprecated use `ProductPriceRecurringCustom$outboundSchema` instead. */
213
+ export const outboundSchema = ProductPriceRecurringCustom$outboundSchema;
214
+ /** @deprecated use `ProductPriceRecurringCustom$Outbound` instead. */
215
+ export type Outbound = ProductPriceRecurringCustom$Outbound;
216
+ }
@@ -0,0 +1,191 @@
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 { ClosedEnum } from "../../types/enums.js";
8
+ import {
9
+ SubscriptionRecurringInterval,
10
+ SubscriptionRecurringInterval$inboundSchema,
11
+ SubscriptionRecurringInterval$outboundSchema,
12
+ } from "./subscriptionrecurringinterval.js";
13
+
14
+ export const AmountType = {
15
+ Fixed: "fixed",
16
+ } as const;
17
+ export type AmountType = ClosedEnum<typeof AmountType>;
18
+
19
+ /**
20
+ * The type of the price.
21
+ */
22
+ export const ProductPriceRecurringFixedType = {
23
+ Recurring: "recurring",
24
+ } as const;
25
+ /**
26
+ * The type of the price.
27
+ */
28
+ export type ProductPriceRecurringFixedType = ClosedEnum<
29
+ typeof ProductPriceRecurringFixedType
30
+ >;
31
+
32
+ /**
33
+ * A recurring price for a product, i.e. a subscription.
34
+ */
35
+ export type ProductPriceRecurringFixed = {
36
+ /**
37
+ * Creation timestamp of the object.
38
+ */
39
+ createdAt: Date;
40
+ /**
41
+ * Last modification timestamp of the object.
42
+ */
43
+ modifiedAt: Date | null;
44
+ /**
45
+ * The ID of the price.
46
+ */
47
+ id: string;
48
+ amountType?: "fixed" | undefined;
49
+ /**
50
+ * The currency.
51
+ */
52
+ priceCurrency: string;
53
+ /**
54
+ * Whether the price is archived and no longer available.
55
+ */
56
+ isArchived: boolean;
57
+ /**
58
+ * The price in cents.
59
+ */
60
+ priceAmount: number;
61
+ /**
62
+ * The type of the price.
63
+ */
64
+ type?: "recurring" | undefined;
65
+ /**
66
+ * The recurring interval of the price.
67
+ */
68
+ recurringInterval: SubscriptionRecurringInterval;
69
+ };
70
+
71
+ /** @internal */
72
+ export const AmountType$inboundSchema: z.ZodNativeEnum<typeof AmountType> = z
73
+ .nativeEnum(AmountType);
74
+
75
+ /** @internal */
76
+ export const AmountType$outboundSchema: z.ZodNativeEnum<typeof AmountType> =
77
+ AmountType$inboundSchema;
78
+
79
+ /**
80
+ * @internal
81
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
82
+ */
83
+ export namespace AmountType$ {
84
+ /** @deprecated use `AmountType$inboundSchema` instead. */
85
+ export const inboundSchema = AmountType$inboundSchema;
86
+ /** @deprecated use `AmountType$outboundSchema` instead. */
87
+ export const outboundSchema = AmountType$outboundSchema;
88
+ }
89
+
90
+ /** @internal */
91
+ export const ProductPriceRecurringFixedType$inboundSchema: z.ZodNativeEnum<
92
+ typeof ProductPriceRecurringFixedType
93
+ > = z.nativeEnum(ProductPriceRecurringFixedType);
94
+
95
+ /** @internal */
96
+ export const ProductPriceRecurringFixedType$outboundSchema: z.ZodNativeEnum<
97
+ typeof ProductPriceRecurringFixedType
98
+ > = ProductPriceRecurringFixedType$inboundSchema;
99
+
100
+ /**
101
+ * @internal
102
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
103
+ */
104
+ export namespace ProductPriceRecurringFixedType$ {
105
+ /** @deprecated use `ProductPriceRecurringFixedType$inboundSchema` instead. */
106
+ export const inboundSchema = ProductPriceRecurringFixedType$inboundSchema;
107
+ /** @deprecated use `ProductPriceRecurringFixedType$outboundSchema` instead. */
108
+ export const outboundSchema = ProductPriceRecurringFixedType$outboundSchema;
109
+ }
110
+
111
+ /** @internal */
112
+ export const ProductPriceRecurringFixed$inboundSchema: z.ZodType<
113
+ ProductPriceRecurringFixed,
114
+ z.ZodTypeDef,
115
+ unknown
116
+ > = z.object({
117
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
118
+ modified_at: z.nullable(
119
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
120
+ ),
121
+ id: z.string(),
122
+ amount_type: z.literal("fixed").optional(),
123
+ price_currency: z.string(),
124
+ is_archived: z.boolean(),
125
+ price_amount: z.number().int(),
126
+ type: z.literal("recurring").optional(),
127
+ recurring_interval: SubscriptionRecurringInterval$inboundSchema,
128
+ }).transform((v) => {
129
+ return remap$(v, {
130
+ "created_at": "createdAt",
131
+ "modified_at": "modifiedAt",
132
+ "amount_type": "amountType",
133
+ "price_currency": "priceCurrency",
134
+ "is_archived": "isArchived",
135
+ "price_amount": "priceAmount",
136
+ "recurring_interval": "recurringInterval",
137
+ });
138
+ });
139
+
140
+ /** @internal */
141
+ export type ProductPriceRecurringFixed$Outbound = {
142
+ created_at: string;
143
+ modified_at: string | null;
144
+ id: string;
145
+ amount_type: "fixed";
146
+ price_currency: string;
147
+ is_archived: boolean;
148
+ price_amount: number;
149
+ type: "recurring";
150
+ recurring_interval: string;
151
+ };
152
+
153
+ /** @internal */
154
+ export const ProductPriceRecurringFixed$outboundSchema: z.ZodType<
155
+ ProductPriceRecurringFixed$Outbound,
156
+ z.ZodTypeDef,
157
+ ProductPriceRecurringFixed
158
+ > = z.object({
159
+ createdAt: z.date().transform(v => v.toISOString()),
160
+ modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
161
+ id: z.string(),
162
+ amountType: z.literal("fixed").default("fixed"),
163
+ priceCurrency: z.string(),
164
+ isArchived: z.boolean(),
165
+ priceAmount: z.number().int(),
166
+ type: z.literal("recurring").default("recurring"),
167
+ recurringInterval: SubscriptionRecurringInterval$outboundSchema,
168
+ }).transform((v) => {
169
+ return remap$(v, {
170
+ createdAt: "created_at",
171
+ modifiedAt: "modified_at",
172
+ amountType: "amount_type",
173
+ priceCurrency: "price_currency",
174
+ isArchived: "is_archived",
175
+ priceAmount: "price_amount",
176
+ recurringInterval: "recurring_interval",
177
+ });
178
+ });
179
+
180
+ /**
181
+ * @internal
182
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
183
+ */
184
+ export namespace ProductPriceRecurringFixed$ {
185
+ /** @deprecated use `ProductPriceRecurringFixed$inboundSchema` instead. */
186
+ export const inboundSchema = ProductPriceRecurringFixed$inboundSchema;
187
+ /** @deprecated use `ProductPriceRecurringFixed$outboundSchema` instead. */
188
+ export const outboundSchema = ProductPriceRecurringFixed$outboundSchema;
189
+ /** @deprecated use `ProductPriceRecurringFixed$Outbound` instead. */
190
+ export type Outbound = ProductPriceRecurringFixed$Outbound;
191
+ }
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import {
7
+ ProductPriceRecurringCustom,
8
+ ProductPriceRecurringCustom$inboundSchema,
9
+ ProductPriceRecurringCustom$Outbound,
10
+ ProductPriceRecurringCustom$outboundSchema,
11
+ } from "./productpricerecurringcustom.js";
12
+ import {
13
+ ProductPriceRecurringFixed,
14
+ ProductPriceRecurringFixed$inboundSchema,
15
+ ProductPriceRecurringFixed$Outbound,
16
+ ProductPriceRecurringFixed$outboundSchema,
17
+ } from "./productpricerecurringfixed.js";
18
+
19
+ export type ProductPriceRecurringInput =
20
+ | (ProductPriceRecurringFixed & { amountType: "fixed" })
21
+ | (ProductPriceRecurringCustom & { amountType: "custom" });
22
+
23
+ /** @internal */
24
+ export const ProductPriceRecurringInput$inboundSchema: z.ZodType<
25
+ ProductPriceRecurringInput,
26
+ z.ZodTypeDef,
27
+ unknown
28
+ > = z.union([
29
+ ProductPriceRecurringFixed$inboundSchema.and(
30
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
31
+ amountType: v.amount_type,
32
+ })),
33
+ ),
34
+ ProductPriceRecurringCustom$inboundSchema.and(
35
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
36
+ amountType: v.amount_type,
37
+ })),
38
+ ),
39
+ ]);
40
+
41
+ /** @internal */
42
+ export type ProductPriceRecurringInput$Outbound =
43
+ | (ProductPriceRecurringFixed$Outbound & { amount_type: "fixed" })
44
+ | (ProductPriceRecurringCustom$Outbound & { amount_type: "custom" });
45
+
46
+ /** @internal */
47
+ export const ProductPriceRecurringInput$outboundSchema: z.ZodType<
48
+ ProductPriceRecurringInput$Outbound,
49
+ z.ZodTypeDef,
50
+ ProductPriceRecurringInput
51
+ > = z.union([
52
+ ProductPriceRecurringFixed$outboundSchema.and(
53
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
54
+ amount_type: v.amountType,
55
+ })),
56
+ ),
57
+ ProductPriceRecurringCustom$outboundSchema.and(
58
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
59
+ amount_type: v.amountType,
60
+ })),
61
+ ),
62
+ ]);
63
+
64
+ /**
65
+ * @internal
66
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
67
+ */
68
+ export namespace ProductPriceRecurringInput$ {
69
+ /** @deprecated use `ProductPriceRecurringInput$inboundSchema` instead. */
70
+ export const inboundSchema = ProductPriceRecurringInput$inboundSchema;
71
+ /** @deprecated use `ProductPriceRecurringInput$outboundSchema` instead. */
72
+ export const outboundSchema = ProductPriceRecurringInput$outboundSchema;
73
+ /** @deprecated use `ProductPriceRecurringInput$Outbound` instead. */
74
+ export type Outbound = ProductPriceRecurringInput$Outbound;
75
+ }
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import {
7
+ ProductPriceRecurringCustom,
8
+ ProductPriceRecurringCustom$inboundSchema,
9
+ ProductPriceRecurringCustom$Outbound,
10
+ ProductPriceRecurringCustom$outboundSchema,
11
+ } from "./productpricerecurringcustom.js";
12
+ import {
13
+ ProductPriceRecurringFixed,
14
+ ProductPriceRecurringFixed$inboundSchema,
15
+ ProductPriceRecurringFixed$Outbound,
16
+ ProductPriceRecurringFixed$outboundSchema,
17
+ } from "./productpricerecurringfixed.js";
18
+
19
+ export type ProductPriceRecurringOutput =
20
+ | (ProductPriceRecurringFixed & { amountType: "fixed" })
21
+ | (ProductPriceRecurringCustom & { amountType: "custom" });
22
+
23
+ /** @internal */
24
+ export const ProductPriceRecurringOutput$inboundSchema: z.ZodType<
25
+ ProductPriceRecurringOutput,
26
+ z.ZodTypeDef,
27
+ unknown
28
+ > = z.union([
29
+ ProductPriceRecurringFixed$inboundSchema.and(
30
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
31
+ amountType: v.amount_type,
32
+ })),
33
+ ),
34
+ ProductPriceRecurringCustom$inboundSchema.and(
35
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
36
+ amountType: v.amount_type,
37
+ })),
38
+ ),
39
+ ]);
40
+
41
+ /** @internal */
42
+ export type ProductPriceRecurringOutput$Outbound =
43
+ | (ProductPriceRecurringFixed$Outbound & { amount_type: "fixed" })
44
+ | (ProductPriceRecurringCustom$Outbound & { amount_type: "custom" });
45
+
46
+ /** @internal */
47
+ export const ProductPriceRecurringOutput$outboundSchema: z.ZodType<
48
+ ProductPriceRecurringOutput$Outbound,
49
+ z.ZodTypeDef,
50
+ ProductPriceRecurringOutput
51
+ > = z.union([
52
+ ProductPriceRecurringFixed$outboundSchema.and(
53
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
54
+ amount_type: v.amountType,
55
+ })),
56
+ ),
57
+ ProductPriceRecurringCustom$outboundSchema.and(
58
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
59
+ amount_type: v.amountType,
60
+ })),
61
+ ),
62
+ ]);
63
+
64
+ /**
65
+ * @internal
66
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
67
+ */
68
+ export namespace ProductPriceRecurringOutput$ {
69
+ /** @deprecated use `ProductPriceRecurringOutput$inboundSchema` instead. */
70
+ export const inboundSchema = ProductPriceRecurringOutput$inboundSchema;
71
+ /** @deprecated use `ProductPriceRecurringOutput$outboundSchema` instead. */
72
+ export const outboundSchema = ProductPriceRecurringOutput$outboundSchema;
73
+ /** @deprecated use `ProductPriceRecurringOutput$Outbound` instead. */
74
+ export type Outbound = ProductPriceRecurringOutput$Outbound;
75
+ }