@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
@@ -165,11 +165,16 @@ export * from "./productonetimecreate.js";
165
165
  export * from "./productoutput.js";
166
166
  export * from "./productpriceinput.js";
167
167
  export * from "./productpriceonetime.js";
168
- export * from "./productpriceonetimecreate.js";
168
+ export * from "./productpriceonetimecustom.js";
169
+ export * from "./productpriceonetimecustomcreate.js";
170
+ export * from "./productpriceonetimefixed.js";
171
+ export * from "./productpriceonetimefixedcreate.js";
169
172
  export * from "./productpriceoutput.js";
170
- export * from "./productpricerecurring.js";
171
173
  export * from "./productpricerecurringcreate.js";
172
- export * from "./productpricerecurringinterval.js";
174
+ export * from "./productpricerecurringcustom.js";
175
+ export * from "./productpricerecurringfixed.js";
176
+ export * from "./productpricerecurringinput.js";
177
+ export * from "./productpricerecurringoutput.js";
173
178
  export * from "./productpricetype.js";
174
179
  export * from "./productrecurringcreate.js";
175
180
  export * from "./productupdate.js";
@@ -192,6 +197,7 @@ export * from "./state.js";
192
197
  export * from "./subscriptioncreateemail.js";
193
198
  export * from "./subscriptioninput.js";
194
199
  export * from "./subscriptionoutput.js";
200
+ export * from "./subscriptionrecurringinterval.js";
195
201
  export * from "./subscriptionsimported.js";
196
202
  export * from "./subscriptionsortproperty.js";
197
203
  export * from "./subscriptionstatus.js";
@@ -4,6 +4,11 @@
4
4
 
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ SubscriptionRecurringInterval,
9
+ SubscriptionRecurringInterval$inboundSchema,
10
+ SubscriptionRecurringInterval$outboundSchema,
11
+ } from "./subscriptionrecurringinterval.js";
7
12
  import {
8
13
  SubscriptionStatus,
9
14
  SubscriptionStatus$inboundSchema,
@@ -23,6 +28,9 @@ export type OrderSubscription = {
23
28
  * The ID of the object.
24
29
  */
25
30
  id: string;
31
+ amount: number | null;
32
+ currency: string | null;
33
+ recurringInterval: SubscriptionRecurringInterval;
26
34
  status: SubscriptionStatus;
27
35
  currentPeriodStart: Date;
28
36
  currentPeriodEnd: Date | null;
@@ -45,6 +53,9 @@ export const OrderSubscription$inboundSchema: z.ZodType<
45
53
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
46
54
  ),
47
55
  id: z.string(),
56
+ amount: z.nullable(z.number().int()),
57
+ currency: z.nullable(z.string()),
58
+ recurring_interval: SubscriptionRecurringInterval$inboundSchema,
48
59
  status: SubscriptionStatus$inboundSchema,
49
60
  current_period_start: z.string().datetime({ offset: true }).transform(v =>
50
61
  new Date(v)
@@ -66,6 +77,7 @@ export const OrderSubscription$inboundSchema: z.ZodType<
66
77
  return remap$(v, {
67
78
  "created_at": "createdAt",
68
79
  "modified_at": "modifiedAt",
80
+ "recurring_interval": "recurringInterval",
69
81
  "current_period_start": "currentPeriodStart",
70
82
  "current_period_end": "currentPeriodEnd",
71
83
  "cancel_at_period_end": "cancelAtPeriodEnd",
@@ -82,6 +94,9 @@ export type OrderSubscription$Outbound = {
82
94
  created_at: string;
83
95
  modified_at: string | null;
84
96
  id: string;
97
+ amount: number | null;
98
+ currency: string | null;
99
+ recurring_interval: string;
85
100
  status: string;
86
101
  current_period_start: string;
87
102
  current_period_end: string | null;
@@ -102,6 +117,9 @@ export const OrderSubscription$outboundSchema: z.ZodType<
102
117
  createdAt: z.date().transform(v => v.toISOString()),
103
118
  modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
104
119
  id: z.string(),
120
+ amount: z.nullable(z.number().int()),
121
+ currency: z.nullable(z.string()),
122
+ recurringInterval: SubscriptionRecurringInterval$outboundSchema,
105
123
  status: SubscriptionStatus$outboundSchema,
106
124
  currentPeriodStart: z.date().transform(v => v.toISOString()),
107
125
  currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
@@ -115,6 +133,7 @@ export const OrderSubscription$outboundSchema: z.ZodType<
115
133
  return remap$(v, {
116
134
  createdAt: "created_at",
117
135
  modifiedAt: "modified_at",
136
+ recurringInterval: "recurring_interval",
118
137
  currentPeriodStart: "current_period_start",
119
138
  currentPeriodEnd: "current_period_end",
120
139
  cancelAtPeriodEnd: "cancel_at_period_end",
@@ -10,10 +10,6 @@ export type OrganizationFeatureSettings = {
10
10
  * If this organization has articles enabled
11
11
  */
12
12
  articlesEnabled?: boolean | undefined;
13
- /**
14
- * If this organization has subscriptions enabled
15
- */
16
- subscriptionsEnabled?: boolean | undefined;
17
13
  /**
18
14
  * If this organization has issue funding enabled
19
15
  */
@@ -27,12 +23,10 @@ export const OrganizationFeatureSettings$inboundSchema: z.ZodType<
27
23
  unknown
28
24
  > = z.object({
29
25
  articles_enabled: z.boolean().default(false),
30
- subscriptions_enabled: z.boolean().default(false),
31
26
  issue_funding_enabled: z.boolean().default(false),
32
27
  }).transform((v) => {
33
28
  return remap$(v, {
34
29
  "articles_enabled": "articlesEnabled",
35
- "subscriptions_enabled": "subscriptionsEnabled",
36
30
  "issue_funding_enabled": "issueFundingEnabled",
37
31
  });
38
32
  });
@@ -40,7 +34,6 @@ export const OrganizationFeatureSettings$inboundSchema: z.ZodType<
40
34
  /** @internal */
41
35
  export type OrganizationFeatureSettings$Outbound = {
42
36
  articles_enabled: boolean;
43
- subscriptions_enabled: boolean;
44
37
  issue_funding_enabled: boolean;
45
38
  };
46
39
 
@@ -51,12 +44,10 @@ export const OrganizationFeatureSettings$outboundSchema: z.ZodType<
51
44
  OrganizationFeatureSettings
52
45
  > = z.object({
53
46
  articlesEnabled: z.boolean().default(false),
54
- subscriptionsEnabled: z.boolean().default(false),
55
47
  issueFundingEnabled: z.boolean().default(false),
56
48
  }).transform((v) => {
57
49
  return remap$(v, {
58
50
  articlesEnabled: "articles_enabled",
59
- subscriptionsEnabled: "subscriptions_enabled",
60
51
  issueFundingEnabled: "issue_funding_enabled",
61
52
  });
62
53
  });
@@ -12,6 +12,10 @@ import {
12
12
  } from "./organizationsubscribepromotesettings.js";
13
13
 
14
14
  export type OrganizationProfileSettings = {
15
+ /**
16
+ * If this organization has a profile enabled
17
+ */
18
+ enabled?: boolean | null | undefined;
15
19
  /**
16
20
  * A description of the organization
17
21
  */
@@ -32,6 +36,10 @@ export type OrganizationProfileSettings = {
32
36
  * Subscription promotion settings
33
37
  */
34
38
  subscribe?: OrganizationSubscribePromoteSettings | null | undefined;
39
+ /**
40
+ * Accent color for the organization
41
+ */
42
+ accentColor?: string | null | undefined;
35
43
  };
36
44
 
37
45
  /** @internal */
@@ -40,26 +48,31 @@ export const OrganizationProfileSettings$inboundSchema: z.ZodType<
40
48
  z.ZodTypeDef,
41
49
  unknown
42
50
  > = z.object({
51
+ enabled: z.nullable(z.boolean()).optional(),
43
52
  description: z.nullable(z.string()).optional(),
44
53
  featured_projects: z.nullable(z.array(z.string())).optional(),
45
54
  featured_organizations: z.nullable(z.array(z.string())).optional(),
46
55
  links: z.nullable(z.array(z.string())).optional(),
47
56
  subscribe: z.nullable(OrganizationSubscribePromoteSettings$inboundSchema)
48
57
  .optional(),
58
+ accent_color: z.nullable(z.string()).optional(),
49
59
  }).transform((v) => {
50
60
  return remap$(v, {
51
61
  "featured_projects": "featuredProjects",
52
62
  "featured_organizations": "featuredOrganizations",
63
+ "accent_color": "accentColor",
53
64
  });
54
65
  });
55
66
 
56
67
  /** @internal */
57
68
  export type OrganizationProfileSettings$Outbound = {
69
+ enabled?: boolean | null | undefined;
58
70
  description?: string | null | undefined;
59
71
  featured_projects?: Array<string> | null | undefined;
60
72
  featured_organizations?: Array<string> | null | undefined;
61
73
  links?: Array<string> | null | undefined;
62
74
  subscribe?: OrganizationSubscribePromoteSettings$Outbound | null | undefined;
75
+ accent_color?: string | null | undefined;
63
76
  };
64
77
 
65
78
  /** @internal */
@@ -68,16 +81,19 @@ export const OrganizationProfileSettings$outboundSchema: z.ZodType<
68
81
  z.ZodTypeDef,
69
82
  OrganizationProfileSettings
70
83
  > = z.object({
84
+ enabled: z.nullable(z.boolean()).optional(),
71
85
  description: z.nullable(z.string()).optional(),
72
86
  featuredProjects: z.nullable(z.array(z.string())).optional(),
73
87
  featuredOrganizations: z.nullable(z.array(z.string())).optional(),
74
88
  links: z.nullable(z.array(z.string())).optional(),
75
89
  subscribe: z.nullable(OrganizationSubscribePromoteSettings$outboundSchema)
76
90
  .optional(),
91
+ accentColor: z.nullable(z.string()).optional(),
77
92
  }).transform((v) => {
78
93
  return remap$(v, {
79
94
  featuredProjects: "featured_projects",
80
95
  featuredOrganizations: "featured_organizations",
96
+ accentColor: "accent_color",
81
97
  });
82
98
  });
83
99
 
@@ -5,11 +5,21 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import {
8
- ProductPriceOneTimeCreate,
9
- ProductPriceOneTimeCreate$inboundSchema,
10
- ProductPriceOneTimeCreate$Outbound,
11
- ProductPriceOneTimeCreate$outboundSchema,
12
- } from "./productpriceonetimecreate.js";
8
+ ProductPriceOneTimeCustomCreate,
9
+ ProductPriceOneTimeCustomCreate$inboundSchema,
10
+ ProductPriceOneTimeCustomCreate$Outbound,
11
+ ProductPriceOneTimeCustomCreate$outboundSchema,
12
+ } from "./productpriceonetimecustomcreate.js";
13
+ import {
14
+ ProductPriceOneTimeFixedCreate,
15
+ ProductPriceOneTimeFixedCreate$inboundSchema,
16
+ ProductPriceOneTimeFixedCreate$Outbound,
17
+ ProductPriceOneTimeFixedCreate$outboundSchema,
18
+ } from "./productpriceonetimefixedcreate.js";
19
+
20
+ export type Prices =
21
+ | ProductPriceOneTimeFixedCreate
22
+ | ProductPriceOneTimeCustomCreate;
13
23
 
14
24
  /**
15
25
  * Schema to create a one-time product.
@@ -26,7 +36,9 @@ export type ProductOneTimeCreate = {
26
36
  /**
27
37
  * List of available prices for this product.
28
38
  */
29
- prices: Array<ProductPriceOneTimeCreate>;
39
+ prices: Array<
40
+ ProductPriceOneTimeFixedCreate | ProductPriceOneTimeCustomCreate
41
+ >;
30
42
  /**
31
43
  * List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded.
32
44
  */
@@ -37,6 +49,41 @@ export type ProductOneTimeCreate = {
37
49
  organizationId?: string | null | undefined;
38
50
  };
39
51
 
52
+ /** @internal */
53
+ export const Prices$inboundSchema: z.ZodType<Prices, z.ZodTypeDef, unknown> = z
54
+ .union([
55
+ ProductPriceOneTimeFixedCreate$inboundSchema,
56
+ ProductPriceOneTimeCustomCreate$inboundSchema,
57
+ ]);
58
+
59
+ /** @internal */
60
+ export type Prices$Outbound =
61
+ | ProductPriceOneTimeFixedCreate$Outbound
62
+ | ProductPriceOneTimeCustomCreate$Outbound;
63
+
64
+ /** @internal */
65
+ export const Prices$outboundSchema: z.ZodType<
66
+ Prices$Outbound,
67
+ z.ZodTypeDef,
68
+ Prices
69
+ > = z.union([
70
+ ProductPriceOneTimeFixedCreate$outboundSchema,
71
+ ProductPriceOneTimeCustomCreate$outboundSchema,
72
+ ]);
73
+
74
+ /**
75
+ * @internal
76
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
77
+ */
78
+ export namespace Prices$ {
79
+ /** @deprecated use `Prices$inboundSchema` instead. */
80
+ export const inboundSchema = Prices$inboundSchema;
81
+ /** @deprecated use `Prices$outboundSchema` instead. */
82
+ export const outboundSchema = Prices$outboundSchema;
83
+ /** @deprecated use `Prices$Outbound` instead. */
84
+ export type Outbound = Prices$Outbound;
85
+ }
86
+
40
87
  /** @internal */
41
88
  export const ProductOneTimeCreate$inboundSchema: z.ZodType<
42
89
  ProductOneTimeCreate,
@@ -45,7 +92,12 @@ export const ProductOneTimeCreate$inboundSchema: z.ZodType<
45
92
  > = z.object({
46
93
  name: z.string(),
47
94
  description: z.nullable(z.string()).optional(),
48
- prices: z.array(ProductPriceOneTimeCreate$inboundSchema),
95
+ prices: z.array(
96
+ z.union([
97
+ ProductPriceOneTimeFixedCreate$inboundSchema,
98
+ ProductPriceOneTimeCustomCreate$inboundSchema,
99
+ ]),
100
+ ),
49
101
  medias: z.nullable(z.array(z.string())).optional(),
50
102
  organization_id: z.nullable(z.string()).optional(),
51
103
  }).transform((v) => {
@@ -58,7 +110,10 @@ export const ProductOneTimeCreate$inboundSchema: z.ZodType<
58
110
  export type ProductOneTimeCreate$Outbound = {
59
111
  name: string;
60
112
  description?: string | null | undefined;
61
- prices: Array<ProductPriceOneTimeCreate$Outbound>;
113
+ prices: Array<
114
+ | ProductPriceOneTimeFixedCreate$Outbound
115
+ | ProductPriceOneTimeCustomCreate$Outbound
116
+ >;
62
117
  medias?: Array<string> | null | undefined;
63
118
  organization_id?: string | null | undefined;
64
119
  };
@@ -71,7 +126,12 @@ export const ProductOneTimeCreate$outboundSchema: z.ZodType<
71
126
  > = z.object({
72
127
  name: z.string(),
73
128
  description: z.nullable(z.string()).optional(),
74
- prices: z.array(ProductPriceOneTimeCreate$outboundSchema),
129
+ prices: z.array(
130
+ z.union([
131
+ ProductPriceOneTimeFixedCreate$outboundSchema,
132
+ ProductPriceOneTimeCustomCreate$outboundSchema,
133
+ ]),
134
+ ),
75
135
  medias: z.nullable(z.array(z.string())).optional(),
76
136
  organizationId: z.nullable(z.string()).optional(),
77
137
  }).transform((v) => {
@@ -10,15 +10,15 @@ import {
10
10
  ProductPriceOneTime$outboundSchema,
11
11
  } from "./productpriceonetime.js";
12
12
  import {
13
- ProductPriceRecurring,
14
- ProductPriceRecurring$inboundSchema,
15
- ProductPriceRecurring$Outbound,
16
- ProductPriceRecurring$outboundSchema,
17
- } from "./productpricerecurring.js";
13
+ ProductPriceRecurringInput,
14
+ ProductPriceRecurringInput$inboundSchema,
15
+ ProductPriceRecurringInput$Outbound,
16
+ ProductPriceRecurringInput$outboundSchema,
17
+ } from "./productpricerecurringinput.js";
18
18
 
19
19
  export type ProductPriceInput =
20
- | (ProductPriceOneTime & { type: "one_time" })
21
- | (ProductPriceRecurring & { type: "recurring" });
20
+ | ProductPriceRecurringInput
21
+ | ProductPriceOneTime;
22
22
 
23
23
  /** @internal */
24
24
  export const ProductPriceInput$inboundSchema: z.ZodType<
@@ -26,22 +26,14 @@ export const ProductPriceInput$inboundSchema: z.ZodType<
26
26
  z.ZodTypeDef,
27
27
  unknown
28
28
  > = z.union([
29
- ProductPriceOneTime$inboundSchema.and(
30
- z.object({ type: z.literal("one_time") }).transform((v) => ({
31
- type: v.type,
32
- })),
33
- ),
34
- ProductPriceRecurring$inboundSchema.and(
35
- z.object({ type: z.literal("recurring") }).transform((v) => ({
36
- type: v.type,
37
- })),
38
- ),
29
+ ProductPriceRecurringInput$inboundSchema,
30
+ ProductPriceOneTime$inboundSchema,
39
31
  ]);
40
32
 
41
33
  /** @internal */
42
34
  export type ProductPriceInput$Outbound =
43
- | (ProductPriceOneTime$Outbound & { type: "one_time" })
44
- | (ProductPriceRecurring$Outbound & { type: "recurring" });
35
+ | ProductPriceRecurringInput$Outbound
36
+ | ProductPriceOneTime$Outbound;
45
37
 
46
38
  /** @internal */
47
39
  export const ProductPriceInput$outboundSchema: z.ZodType<
@@ -49,16 +41,8 @@ export const ProductPriceInput$outboundSchema: z.ZodType<
49
41
  z.ZodTypeDef,
50
42
  ProductPriceInput
51
43
  > = z.union([
52
- ProductPriceOneTime$outboundSchema.and(
53
- z.object({ type: z.literal("one_time") }).transform((v) => ({
54
- type: v.type,
55
- })),
56
- ),
57
- ProductPriceRecurring$outboundSchema.and(
58
- z.object({ type: z.literal("recurring") }).transform((v) => ({
59
- type: v.type,
60
- })),
61
- ),
44
+ ProductPriceRecurringInput$outboundSchema,
45
+ ProductPriceOneTime$outboundSchema,
62
46
  ]);
63
47
 
64
48
  /**
@@ -3,135 +3,47 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
- import { remap as remap$ } from "../../lib/primitives.js";
7
- import { ClosedEnum } from "../../types/enums.js";
8
-
9
- /**
10
- * The type of the price.
11
- */
12
- export const ProductPriceOneTimeType = {
13
- OneTime: "one_time",
14
- } as const;
15
- /**
16
- * The type of the price.
17
- */
18
- export type ProductPriceOneTimeType = ClosedEnum<
19
- typeof ProductPriceOneTimeType
20
- >;
21
-
22
- /**
23
- * A one-time price for a product.
24
- */
25
- export type ProductPriceOneTime = {
26
- /**
27
- * Creation timestamp of the object.
28
- */
29
- createdAt: Date;
30
- /**
31
- * Last modification timestamp of the object.
32
- */
33
- modifiedAt: Date | null;
34
- /**
35
- * The ID of the price.
36
- */
37
- id: string;
38
- /**
39
- * The price in cents.
40
- */
41
- priceAmount: number;
42
- /**
43
- * The currency.
44
- */
45
- priceCurrency: string;
46
- /**
47
- * Whether the price is archived and no longer available.
48
- */
49
- isArchived: boolean;
50
- /**
51
- * The type of the price.
52
- */
53
- type?: "one_time" | undefined;
54
- };
55
-
56
- /** @internal */
57
- export const ProductPriceOneTimeType$inboundSchema: z.ZodNativeEnum<
58
- typeof ProductPriceOneTimeType
59
- > = z.nativeEnum(ProductPriceOneTimeType);
60
-
61
- /** @internal */
62
- export const ProductPriceOneTimeType$outboundSchema: z.ZodNativeEnum<
63
- typeof ProductPriceOneTimeType
64
- > = ProductPriceOneTimeType$inboundSchema;
65
-
66
- /**
67
- * @internal
68
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
69
- */
70
- export namespace ProductPriceOneTimeType$ {
71
- /** @deprecated use `ProductPriceOneTimeType$inboundSchema` instead. */
72
- export const inboundSchema = ProductPriceOneTimeType$inboundSchema;
73
- /** @deprecated use `ProductPriceOneTimeType$outboundSchema` instead. */
74
- export const outboundSchema = ProductPriceOneTimeType$outboundSchema;
75
- }
6
+ import {
7
+ ProductPriceOneTimeCustom,
8
+ ProductPriceOneTimeCustom$inboundSchema,
9
+ ProductPriceOneTimeCustom$Outbound,
10
+ ProductPriceOneTimeCustom$outboundSchema,
11
+ } from "./productpriceonetimecustom.js";
12
+ import {
13
+ ProductPriceOneTimeFixed,
14
+ ProductPriceOneTimeFixed$inboundSchema,
15
+ ProductPriceOneTimeFixed$Outbound,
16
+ ProductPriceOneTimeFixed$outboundSchema,
17
+ } from "./productpriceonetimefixed.js";
18
+
19
+ export type ProductPriceOneTime =
20
+ | ProductPriceOneTimeFixed
21
+ | ProductPriceOneTimeCustom;
76
22
 
77
23
  /** @internal */
78
24
  export const ProductPriceOneTime$inboundSchema: z.ZodType<
79
25
  ProductPriceOneTime,
80
26
  z.ZodTypeDef,
81
27
  unknown
82
- > = z.object({
83
- created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
84
- modified_at: z.nullable(
85
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
86
- ),
87
- id: z.string(),
88
- price_amount: z.number().int(),
89
- price_currency: z.string(),
90
- is_archived: z.boolean(),
91
- type: z.literal("one_time").optional(),
92
- }).transform((v) => {
93
- return remap$(v, {
94
- "created_at": "createdAt",
95
- "modified_at": "modifiedAt",
96
- "price_amount": "priceAmount",
97
- "price_currency": "priceCurrency",
98
- "is_archived": "isArchived",
99
- });
100
- });
28
+ > = z.union([
29
+ ProductPriceOneTimeFixed$inboundSchema,
30
+ ProductPriceOneTimeCustom$inboundSchema,
31
+ ]);
101
32
 
102
33
  /** @internal */
103
- export type ProductPriceOneTime$Outbound = {
104
- created_at: string;
105
- modified_at: string | null;
106
- id: string;
107
- price_amount: number;
108
- price_currency: string;
109
- is_archived: boolean;
110
- type: "one_time";
111
- };
34
+ export type ProductPriceOneTime$Outbound =
35
+ | ProductPriceOneTimeFixed$Outbound
36
+ | ProductPriceOneTimeCustom$Outbound;
112
37
 
113
38
  /** @internal */
114
39
  export const ProductPriceOneTime$outboundSchema: z.ZodType<
115
40
  ProductPriceOneTime$Outbound,
116
41
  z.ZodTypeDef,
117
42
  ProductPriceOneTime
118
- > = z.object({
119
- createdAt: z.date().transform(v => v.toISOString()),
120
- modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
121
- id: z.string(),
122
- priceAmount: z.number().int(),
123
- priceCurrency: z.string(),
124
- isArchived: z.boolean(),
125
- type: z.literal("one_time").default("one_time"),
126
- }).transform((v) => {
127
- return remap$(v, {
128
- createdAt: "created_at",
129
- modifiedAt: "modified_at",
130
- priceAmount: "price_amount",
131
- priceCurrency: "price_currency",
132
- isArchived: "is_archived",
133
- });
134
- });
43
+ > = z.union([
44
+ ProductPriceOneTimeFixed$outboundSchema,
45
+ ProductPriceOneTimeCustom$outboundSchema,
46
+ ]);
135
47
 
136
48
  /**
137
49
  * @internal