@polar-sh/sdk 0.17.4 → 0.18.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 (284) hide show
  1. package/FUNCTIONS.md +106 -0
  2. package/README.md +181 -30
  3. package/RUNTIMES.md +22 -0
  4. package/docs/sdks/checkouts/README.md +1 -1
  5. package/hooks/hooks.d.ts.map +1 -1
  6. package/hooks/hooks.js +18 -0
  7. package/hooks/hooks.js.map +1 -1
  8. package/hooks/types.d.ts +3 -0
  9. package/hooks/types.d.ts.map +1 -1
  10. package/lib/config.d.ts +3 -3
  11. package/lib/config.js +3 -3
  12. package/lib/config.js.map +1 -1
  13. package/models/components/benefit.d.ts +2 -3
  14. package/models/components/benefit.d.ts.map +1 -1
  15. package/models/components/benefit.js +0 -3
  16. package/models/components/benefit.js.map +1 -1
  17. package/models/components/benefitadssubscriber.d.ts +7 -7
  18. package/models/components/benefitadssubscriber.d.ts.map +1 -1
  19. package/models/components/benefitadssubscriber.js +11 -11
  20. package/models/components/benefitadssubscriber.js.map +1 -1
  21. package/models/components/benefitgrant.d.ts +4 -5
  22. package/models/components/benefitgrant.d.ts.map +1 -1
  23. package/models/components/benefitgrant.js +0 -5
  24. package/models/components/benefitgrant.js.map +1 -1
  25. package/models/components/benefitgrantwebhook.d.ts +8 -9
  26. package/models/components/benefitgrantwebhook.d.ts.map +1 -1
  27. package/models/components/benefitgrantwebhook.js +0 -9
  28. package/models/components/benefitgrantwebhook.js.map +1 -1
  29. package/models/components/benefittype.d.ts +0 -3
  30. package/models/components/benefittype.d.ts.map +1 -1
  31. package/models/components/benefittype.js +0 -1
  32. package/models/components/benefittype.js.map +1 -1
  33. package/models/components/checkoutlinkproduct.d.ts +2 -24
  34. package/models/components/checkoutlinkproduct.d.ts.map +1 -1
  35. package/models/components/checkoutlinkproduct.js +3 -27
  36. package/models/components/checkoutlinkproduct.js.map +1 -1
  37. package/models/components/checkoutproduct.d.ts +2 -24
  38. package/models/components/checkoutproduct.d.ts.map +1 -1
  39. package/models/components/checkoutproduct.js +3 -27
  40. package/models/components/checkoutproduct.js.map +1 -1
  41. package/models/components/index.d.ts +0 -15
  42. package/models/components/index.d.ts.map +1 -1
  43. package/models/components/index.js +0 -15
  44. package/models/components/index.js.map +1 -1
  45. package/models/components/listresourceuserbenefit.d.ts +0 -9
  46. package/models/components/listresourceuserbenefit.d.ts.map +1 -1
  47. package/models/components/listresourceuserbenefit.js +0 -13
  48. package/models/components/listresourceuserbenefit.js.map +1 -1
  49. package/models/components/oauth2client.js +2 -2
  50. package/models/components/oauth2client.js.map +1 -1
  51. package/models/components/oauth2clientconfiguration.js +2 -2
  52. package/models/components/oauth2clientconfiguration.js.map +1 -1
  53. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  54. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  55. package/models/components/organizationfeaturesettings.d.ts +0 -5
  56. package/models/components/organizationfeaturesettings.d.ts.map +1 -1
  57. package/models/components/organizationfeaturesettings.js +0 -4
  58. package/models/components/organizationfeaturesettings.js.map +1 -1
  59. package/models/components/scope.d.ts +0 -6
  60. package/models/components/scope.d.ts.map +1 -1
  61. package/models/components/scope.js +0 -2
  62. package/models/components/scope.js.map +1 -1
  63. package/models/components/userorderproduct.d.ts +2 -24
  64. package/models/components/userorderproduct.d.ts.map +1 -1
  65. package/models/components/userorderproduct.js +3 -27
  66. package/models/components/userorderproduct.js.map +1 -1
  67. package/models/components/usersubscriptionproduct.d.ts +2 -24
  68. package/models/components/usersubscriptionproduct.d.ts.map +1 -1
  69. package/models/components/usersubscriptionproduct.js +3 -27
  70. package/models/components/usersubscriptionproduct.js.map +1 -1
  71. package/models/operations/benefitsupdate.d.ts +4 -4
  72. package/models/operations/benefitsupdate.d.ts.map +1 -1
  73. package/models/operations/benefitsupdate.js +0 -4
  74. package/models/operations/benefitsupdate.js.map +1 -1
  75. package/models/operations/index.d.ts +0 -8
  76. package/models/operations/index.d.ts.map +1 -1
  77. package/models/operations/index.js +0 -8
  78. package/models/operations/index.js.map +1 -1
  79. package/models/operations/usersbenefitsget.d.ts +2 -6
  80. package/models/operations/usersbenefitsget.d.ts.map +1 -1
  81. package/models/operations/usersbenefitsget.js +0 -6
  82. package/models/operations/usersbenefitsget.js.map +1 -1
  83. package/package.json +1 -3
  84. package/sdk/sdk.d.ts +0 -3
  85. package/sdk/sdk.d.ts.map +1 -1
  86. package/sdk/sdk.js +0 -5
  87. package/sdk/sdk.js.map +1 -1
  88. package/src/hooks/hooks.ts +20 -0
  89. package/src/hooks/types.ts +9 -0
  90. package/src/lib/config.ts +3 -3
  91. package/src/models/components/benefit.ts +0 -10
  92. package/src/models/components/benefitadssubscriber.ts +12 -15
  93. package/src/models/components/benefitgrant.ts +0 -14
  94. package/src/models/components/benefitgrantwebhook.ts +0 -22
  95. package/src/models/components/benefittype.ts +0 -1
  96. package/src/models/components/checkoutlinkproduct.ts +4 -68
  97. package/src/models/components/checkoutproduct.ts +4 -66
  98. package/src/models/components/index.ts +0 -15
  99. package/src/models/components/listresourceuserbenefit.ts +0 -30
  100. package/src/models/components/oauth2client.ts +2 -2
  101. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  102. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  103. package/src/models/components/organizationfeaturesettings.ts +0 -9
  104. package/src/models/components/scope.ts +0 -2
  105. package/src/models/components/userorderproduct.ts +4 -60
  106. package/src/models/components/usersubscriptionproduct.ts +4 -68
  107. package/src/models/operations/benefitsupdate.ts +0 -8
  108. package/src/models/operations/index.ts +0 -8
  109. package/src/models/operations/usersbenefitsget.ts +0 -12
  110. package/src/sdk/sdk.ts +0 -6
  111. package/src/types/index.ts +1 -0
  112. package/src/types/webhooks.ts +7 -0
  113. package/types/index.d.ts +1 -0
  114. package/types/index.d.ts.map +1 -1
  115. package/types/webhooks.d.ts +4 -0
  116. package/types/webhooks.d.ts.map +1 -0
  117. package/types/webhooks.js +6 -0
  118. package/types/webhooks.js.map +1 -0
  119. package/docs/sdks/articles/README.md +0 -724
  120. package/funcs/articlesCreate.d.ts +0 -16
  121. package/funcs/articlesCreate.d.ts.map +0 -1
  122. package/funcs/articlesCreate.js +0 -99
  123. package/funcs/articlesCreate.js.map +0 -1
  124. package/funcs/articlesDelete.d.ts +0 -16
  125. package/funcs/articlesDelete.d.ts.map +0 -1
  126. package/funcs/articlesDelete.js +0 -105
  127. package/funcs/articlesDelete.js.map +0 -1
  128. package/funcs/articlesExport.d.ts +0 -16
  129. package/funcs/articlesExport.d.ts.map +0 -1
  130. package/funcs/articlesExport.js +0 -103
  131. package/funcs/articlesExport.js.map +0 -1
  132. package/funcs/articlesGet.d.ts +0 -17
  133. package/funcs/articlesGet.d.ts.map +0 -1
  134. package/funcs/articlesGet.js +0 -105
  135. package/funcs/articlesGet.js.map +0 -1
  136. package/funcs/articlesList.d.ts +0 -19
  137. package/funcs/articlesList.d.ts.map +0 -1
  138. package/funcs/articlesList.js +0 -138
  139. package/funcs/articlesList.js.map +0 -1
  140. package/funcs/articlesPreview.d.ts +0 -16
  141. package/funcs/articlesPreview.d.ts.map +0 -1
  142. package/funcs/articlesPreview.js +0 -106
  143. package/funcs/articlesPreview.js.map +0 -1
  144. package/funcs/articlesReceivers.d.ts +0 -17
  145. package/funcs/articlesReceivers.d.ts.map +0 -1
  146. package/funcs/articlesReceivers.js +0 -105
  147. package/funcs/articlesReceivers.js.map +0 -1
  148. package/funcs/articlesSend.d.ts +0 -16
  149. package/funcs/articlesSend.d.ts.map +0 -1
  150. package/funcs/articlesSend.js +0 -105
  151. package/funcs/articlesSend.js.map +0 -1
  152. package/funcs/articlesUpdate.d.ts +0 -17
  153. package/funcs/articlesUpdate.d.ts.map +0 -1
  154. package/funcs/articlesUpdate.js +0 -106
  155. package/funcs/articlesUpdate.js.map +0 -1
  156. package/models/components/article.d.ts +0 -68
  157. package/models/components/article.d.ts.map +0 -1
  158. package/models/components/article.js +0 -129
  159. package/models/components/article.js.map +0 -1
  160. package/models/components/articlebyline.d.ts +0 -28
  161. package/models/components/articlebyline.d.ts.map +0 -1
  162. package/models/components/articlebyline.js +0 -50
  163. package/models/components/articlebyline.js.map +0 -1
  164. package/models/components/articlecreate.d.ts +0 -93
  165. package/models/components/articlecreate.d.ts.map +0 -1
  166. package/models/components/articlecreate.js +0 -112
  167. package/models/components/articlecreate.js.map +0 -1
  168. package/models/components/articlepreview.d.ts +0 -32
  169. package/models/components/articlepreview.d.ts.map +0 -1
  170. package/models/components/articlepreview.js +0 -59
  171. package/models/components/articlepreview.js.map +0 -1
  172. package/models/components/articlereceivers.d.ts +0 -33
  173. package/models/components/articlereceivers.d.ts.map +0 -1
  174. package/models/components/articlereceivers.js +0 -76
  175. package/models/components/articlereceivers.js.map +0 -1
  176. package/models/components/articleupdate.d.ts +0 -85
  177. package/models/components/articleupdate.d.ts.map +0 -1
  178. package/models/components/articleupdate.js +0 -108
  179. package/models/components/articleupdate.js.map +0 -1
  180. package/models/components/articlevisibility.d.ts +0 -31
  181. package/models/components/articlevisibility.d.ts.map +0 -1
  182. package/models/components/articlevisibility.js +0 -51
  183. package/models/components/articlevisibility.js.map +0 -1
  184. package/models/components/benefitarticles.d.ts +0 -100
  185. package/models/components/benefitarticles.d.ts.map +0 -1
  186. package/models/components/benefitarticles.js +0 -107
  187. package/models/components/benefitarticles.js.map +0 -1
  188. package/models/components/benefitarticlesproperties.d.ts +0 -35
  189. package/models/components/benefitarticlesproperties.d.ts.map +0 -1
  190. package/models/components/benefitarticlesproperties.js +0 -68
  191. package/models/components/benefitarticlesproperties.js.map +0 -1
  192. package/models/components/benefitarticlessubscriber.d.ts +0 -99
  193. package/models/components/benefitarticlessubscriber.d.ts.map +0 -1
  194. package/models/components/benefitarticlessubscriber.js +0 -113
  195. package/models/components/benefitarticlessubscriber.js.map +0 -1
  196. package/models/components/benefitarticlessubscriberproperties.d.ts +0 -35
  197. package/models/components/benefitarticlessubscriberproperties.d.ts.map +0 -1
  198. package/models/components/benefitarticlessubscriberproperties.js +0 -68
  199. package/models/components/benefitarticlessubscriberproperties.js.map +0 -1
  200. package/models/components/benefitarticlesupdate.d.ts +0 -57
  201. package/models/components/benefitarticlesupdate.d.ts.map +0 -1
  202. package/models/components/benefitarticlesupdate.js +0 -79
  203. package/models/components/benefitarticlesupdate.js.map +0 -1
  204. package/models/components/benefitgrantarticlesproperties.d.ts +0 -25
  205. package/models/components/benefitgrantarticlesproperties.d.ts.map +0 -1
  206. package/models/components/benefitgrantarticlesproperties.js +0 -55
  207. package/models/components/benefitgrantarticlesproperties.js.map +0 -1
  208. package/models/components/bylineprofile.d.ts +0 -31
  209. package/models/components/bylineprofile.d.ts.map +0 -1
  210. package/models/components/bylineprofile.js +0 -70
  211. package/models/components/bylineprofile.js.map +0 -1
  212. package/models/components/listresourcearticle.d.ts +0 -33
  213. package/models/components/listresourcearticle.d.ts.map +0 -1
  214. package/models/components/listresourcearticle.js +0 -63
  215. package/models/components/listresourcearticle.js.map +0 -1
  216. package/models/operations/articlesdelete.d.ts +0 -29
  217. package/models/operations/articlesdelete.d.ts.map +0 -1
  218. package/models/operations/articlesdelete.js +0 -59
  219. package/models/operations/articlesdelete.js.map +0 -1
  220. package/models/operations/articlesexport.d.ts +0 -29
  221. package/models/operations/articlesexport.d.ts.map +0 -1
  222. package/models/operations/articlesexport.js +0 -68
  223. package/models/operations/articlesexport.js.map +0 -1
  224. package/models/operations/articlesget.d.ts +0 -29
  225. package/models/operations/articlesget.d.ts.map +0 -1
  226. package/models/operations/articlesget.js +0 -59
  227. package/models/operations/articlesget.js.map +0 -1
  228. package/models/operations/articleslist.d.ts +0 -141
  229. package/models/operations/articleslist.d.ts.map +0 -1
  230. package/models/operations/articleslist.js +0 -184
  231. package/models/operations/articleslist.js.map +0 -1
  232. package/models/operations/articlespreview.d.ts +0 -32
  233. package/models/operations/articlespreview.d.ts.map +0 -1
  234. package/models/operations/articlespreview.js +0 -71
  235. package/models/operations/articlespreview.js.map +0 -1
  236. package/models/operations/articlesreceivers.d.ts +0 -29
  237. package/models/operations/articlesreceivers.d.ts.map +0 -1
  238. package/models/operations/articlesreceivers.js +0 -59
  239. package/models/operations/articlesreceivers.js.map +0 -1
  240. package/models/operations/articlessend.d.ts +0 -29
  241. package/models/operations/articlessend.d.ts.map +0 -1
  242. package/models/operations/articlessend.js +0 -59
  243. package/models/operations/articlessend.js.map +0 -1
  244. package/models/operations/articlesupdate.d.ts +0 -32
  245. package/models/operations/articlesupdate.d.ts.map +0 -1
  246. package/models/operations/articlesupdate.js +0 -71
  247. package/models/operations/articlesupdate.js.map +0 -1
  248. package/sdk/articles.d.ts +0 -72
  249. package/sdk/articles.d.ts.map +0 -1
  250. package/sdk/articles.js +0 -103
  251. package/sdk/articles.js.map +0 -1
  252. package/src/funcs/articlesCreate.ts +0 -131
  253. package/src/funcs/articlesDelete.ts +0 -144
  254. package/src/funcs/articlesExport.ts +0 -136
  255. package/src/funcs/articlesGet.ts +0 -141
  256. package/src/funcs/articlesList.ts +0 -205
  257. package/src/funcs/articlesPreview.ts +0 -145
  258. package/src/funcs/articlesReceivers.ts +0 -138
  259. package/src/funcs/articlesSend.ts +0 -144
  260. package/src/funcs/articlesUpdate.ts +0 -145
  261. package/src/models/components/article.ts +0 -187
  262. package/src/models/components/articlebyline.ts +0 -33
  263. package/src/models/components/articlecreate.ts +0 -191
  264. package/src/models/components/articlepreview.ts +0 -65
  265. package/src/models/components/articlereceivers.ts +0 -87
  266. package/src/models/components/articleupdate.ts +0 -179
  267. package/src/models/components/articlevisibility.ts +0 -34
  268. package/src/models/components/benefitarticles.ts +0 -175
  269. package/src/models/components/benefitarticlesproperties.ts +0 -81
  270. package/src/models/components/benefitarticlessubscriber.ts +0 -189
  271. package/src/models/components/benefitarticlessubscriberproperties.ts +0 -86
  272. package/src/models/components/benefitarticlesupdate.ts +0 -102
  273. package/src/models/components/benefitgrantarticlesproperties.ts +0 -60
  274. package/src/models/components/bylineprofile.ts +0 -75
  275. package/src/models/components/listresourcearticle.ts +0 -82
  276. package/src/models/operations/articlesdelete.ts +0 -66
  277. package/src/models/operations/articlesexport.ts +0 -75
  278. package/src/models/operations/articlesget.ts +0 -66
  279. package/src/models/operations/articleslist.ts +0 -342
  280. package/src/models/operations/articlespreview.ts +0 -80
  281. package/src/models/operations/articlesreceivers.ts +0 -66
  282. package/src/models/operations/articlessend.ts +0 -66
  283. package/src/models/operations/articlesupdate.ts +0 -80
  284. package/src/sdk/articles.ts +0 -173
@@ -1,191 +0,0 @@
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
- ArticleByline,
12
- ArticleByline$inboundSchema,
13
- ArticleByline$outboundSchema,
14
- } from "./articlebyline.js";
15
- import {
16
- ArticleVisibility,
17
- ArticleVisibility$inboundSchema,
18
- ArticleVisibility$outboundSchema,
19
- } from "./articlevisibility.js";
20
-
21
- export type ArticleCreate = {
22
- /**
23
- * Title of the article.
24
- */
25
- title: string;
26
- /**
27
- * Slug of the article to be used in URLs. If no slug is provided one will be generated from the title.
28
- */
29
- slug?: string | null | undefined;
30
- /**
31
- * Body in string format. Either one of body or body_base64 is required.
32
- */
33
- body?: string | null | undefined;
34
- /**
35
- * Body in base64-encoded format. Can be helpful to bypass Web Application Firewalls (WAF). Either one of body or body_base64 is required.
36
- */
37
- bodyBase64?: string | null | undefined;
38
- /**
39
- * The ID of the organization owning the article. **Required unless you use an organization token.**
40
- */
41
- organizationId?: string | null | undefined;
42
- byline?: ArticleByline | undefined;
43
- visibility?: ArticleVisibility | undefined;
44
- /**
45
- * Set to true to only make this article available for subscribers to a paid subscription tier in the organization.
46
- */
47
- paidSubscribersOnly?: boolean | undefined;
48
- /**
49
- * If specified, time at which the article should no longer be restricted to paid subscribers. Only relevant if `paid_subscribers_only` is true.
50
- */
51
- paidSubscribersOnlyEndsAt?: Date | null | undefined;
52
- /**
53
- * Time of publishing. If this date is in the future, the post will be scheduled to publish at this time. If visibility is 'public', published_at will default to the current time.
54
- */
55
- publishedAt?: Date | null | undefined;
56
- /**
57
- * Set to true to deliver this article via email and/or notifications to subscribers.
58
- */
59
- notifySubscribers?: boolean | null | undefined;
60
- /**
61
- * If the article should be pinned
62
- */
63
- isPinned?: boolean | null | undefined;
64
- /**
65
- * Custom og:image URL value
66
- */
67
- ogImageUrl?: string | null | undefined;
68
- /**
69
- * Custom og:description value
70
- */
71
- ogDescription?: string | null | undefined;
72
- };
73
-
74
- /** @internal */
75
- export const ArticleCreate$inboundSchema: z.ZodType<
76
- ArticleCreate,
77
- z.ZodTypeDef,
78
- unknown
79
- > = z.object({
80
- title: z.string(),
81
- slug: z.nullable(z.string()).optional(),
82
- body: z.nullable(z.string()).optional(),
83
- body_base64: z.nullable(z.string()).optional(),
84
- organization_id: z.nullable(z.string()).optional(),
85
- byline: ArticleByline$inboundSchema.optional(),
86
- visibility: ArticleVisibility$inboundSchema.optional(),
87
- paid_subscribers_only: z.boolean().default(false),
88
- paid_subscribers_only_ends_at: z.nullable(
89
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
90
- ).optional(),
91
- published_at: z.nullable(
92
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
93
- ).optional(),
94
- notify_subscribers: z.nullable(z.boolean()).optional(),
95
- is_pinned: z.nullable(z.boolean()).optional(),
96
- og_image_url: z.nullable(z.string()).optional(),
97
- og_description: z.nullable(z.string()).optional(),
98
- }).transform((v) => {
99
- return remap$(v, {
100
- "body_base64": "bodyBase64",
101
- "organization_id": "organizationId",
102
- "paid_subscribers_only": "paidSubscribersOnly",
103
- "paid_subscribers_only_ends_at": "paidSubscribersOnlyEndsAt",
104
- "published_at": "publishedAt",
105
- "notify_subscribers": "notifySubscribers",
106
- "is_pinned": "isPinned",
107
- "og_image_url": "ogImageUrl",
108
- "og_description": "ogDescription",
109
- });
110
- });
111
-
112
- /** @internal */
113
- export type ArticleCreate$Outbound = {
114
- title: string;
115
- slug?: string | null | undefined;
116
- body?: string | null | undefined;
117
- body_base64?: string | null | undefined;
118
- organization_id?: string | null | undefined;
119
- byline?: string | undefined;
120
- visibility?: string | undefined;
121
- paid_subscribers_only: boolean;
122
- paid_subscribers_only_ends_at?: string | null | undefined;
123
- published_at?: string | null | undefined;
124
- notify_subscribers?: boolean | null | undefined;
125
- is_pinned?: boolean | null | undefined;
126
- og_image_url?: string | null | undefined;
127
- og_description?: string | null | undefined;
128
- };
129
-
130
- /** @internal */
131
- export const ArticleCreate$outboundSchema: z.ZodType<
132
- ArticleCreate$Outbound,
133
- z.ZodTypeDef,
134
- ArticleCreate
135
- > = z.object({
136
- title: z.string(),
137
- slug: z.nullable(z.string()).optional(),
138
- body: z.nullable(z.string()).optional(),
139
- bodyBase64: z.nullable(z.string()).optional(),
140
- organizationId: z.nullable(z.string()).optional(),
141
- byline: ArticleByline$outboundSchema.optional(),
142
- visibility: ArticleVisibility$outboundSchema.optional(),
143
- paidSubscribersOnly: z.boolean().default(false),
144
- paidSubscribersOnlyEndsAt: z.nullable(
145
- z.date().transform(v => v.toISOString()),
146
- ).optional(),
147
- publishedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
148
- notifySubscribers: z.nullable(z.boolean()).optional(),
149
- isPinned: z.nullable(z.boolean()).optional(),
150
- ogImageUrl: z.nullable(z.string()).optional(),
151
- ogDescription: z.nullable(z.string()).optional(),
152
- }).transform((v) => {
153
- return remap$(v, {
154
- bodyBase64: "body_base64",
155
- organizationId: "organization_id",
156
- paidSubscribersOnly: "paid_subscribers_only",
157
- paidSubscribersOnlyEndsAt: "paid_subscribers_only_ends_at",
158
- publishedAt: "published_at",
159
- notifySubscribers: "notify_subscribers",
160
- isPinned: "is_pinned",
161
- ogImageUrl: "og_image_url",
162
- ogDescription: "og_description",
163
- });
164
- });
165
-
166
- /**
167
- * @internal
168
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
169
- */
170
- export namespace ArticleCreate$ {
171
- /** @deprecated use `ArticleCreate$inboundSchema` instead. */
172
- export const inboundSchema = ArticleCreate$inboundSchema;
173
- /** @deprecated use `ArticleCreate$outboundSchema` instead. */
174
- export const outboundSchema = ArticleCreate$outboundSchema;
175
- /** @deprecated use `ArticleCreate$Outbound` instead. */
176
- export type Outbound = ArticleCreate$Outbound;
177
- }
178
-
179
- export function articleCreateToJSON(articleCreate: ArticleCreate): string {
180
- return JSON.stringify(ArticleCreate$outboundSchema.parse(articleCreate));
181
- }
182
-
183
- export function articleCreateFromJSON(
184
- jsonString: string,
185
- ): SafeParseResult<ArticleCreate, SDKValidationError> {
186
- return safeParse(
187
- jsonString,
188
- (x) => ArticleCreate$inboundSchema.parse(JSON.parse(x)),
189
- `Failed to parse 'ArticleCreate' from JSON`,
190
- );
191
- }
@@ -1,65 +0,0 @@
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
-
10
- export type ArticlePreview = {
11
- /**
12
- * Email address to send the preview to. The user must be registered on Polar.
13
- */
14
- email: string;
15
- };
16
-
17
- /** @internal */
18
- export const ArticlePreview$inboundSchema: z.ZodType<
19
- ArticlePreview,
20
- z.ZodTypeDef,
21
- unknown
22
- > = z.object({
23
- email: z.string(),
24
- });
25
-
26
- /** @internal */
27
- export type ArticlePreview$Outbound = {
28
- email: string;
29
- };
30
-
31
- /** @internal */
32
- export const ArticlePreview$outboundSchema: z.ZodType<
33
- ArticlePreview$Outbound,
34
- z.ZodTypeDef,
35
- ArticlePreview
36
- > = z.object({
37
- email: z.string(),
38
- });
39
-
40
- /**
41
- * @internal
42
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
43
- */
44
- export namespace ArticlePreview$ {
45
- /** @deprecated use `ArticlePreview$inboundSchema` instead. */
46
- export const inboundSchema = ArticlePreview$inboundSchema;
47
- /** @deprecated use `ArticlePreview$outboundSchema` instead. */
48
- export const outboundSchema = ArticlePreview$outboundSchema;
49
- /** @deprecated use `ArticlePreview$Outbound` instead. */
50
- export type Outbound = ArticlePreview$Outbound;
51
- }
52
-
53
- export function articlePreviewToJSON(articlePreview: ArticlePreview): string {
54
- return JSON.stringify(ArticlePreview$outboundSchema.parse(articlePreview));
55
- }
56
-
57
- export function articlePreviewFromJSON(
58
- jsonString: string,
59
- ): SafeParseResult<ArticlePreview, SDKValidationError> {
60
- return safeParse(
61
- jsonString,
62
- (x) => ArticlePreview$inboundSchema.parse(JSON.parse(x)),
63
- `Failed to parse 'ArticlePreview' from JSON`,
64
- );
65
- }
@@ -1,87 +0,0 @@
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 ArticleReceivers = {
12
- freeSubscribers: number;
13
- premiumSubscribers: number;
14
- organizationMembers: number;
15
- };
16
-
17
- /** @internal */
18
- export const ArticleReceivers$inboundSchema: z.ZodType<
19
- ArticleReceivers,
20
- z.ZodTypeDef,
21
- unknown
22
- > = z.object({
23
- free_subscribers: z.number().int(),
24
- premium_subscribers: z.number().int(),
25
- organization_members: z.number().int(),
26
- }).transform((v) => {
27
- return remap$(v, {
28
- "free_subscribers": "freeSubscribers",
29
- "premium_subscribers": "premiumSubscribers",
30
- "organization_members": "organizationMembers",
31
- });
32
- });
33
-
34
- /** @internal */
35
- export type ArticleReceivers$Outbound = {
36
- free_subscribers: number;
37
- premium_subscribers: number;
38
- organization_members: number;
39
- };
40
-
41
- /** @internal */
42
- export const ArticleReceivers$outboundSchema: z.ZodType<
43
- ArticleReceivers$Outbound,
44
- z.ZodTypeDef,
45
- ArticleReceivers
46
- > = z.object({
47
- freeSubscribers: z.number().int(),
48
- premiumSubscribers: z.number().int(),
49
- organizationMembers: z.number().int(),
50
- }).transform((v) => {
51
- return remap$(v, {
52
- freeSubscribers: "free_subscribers",
53
- premiumSubscribers: "premium_subscribers",
54
- organizationMembers: "organization_members",
55
- });
56
- });
57
-
58
- /**
59
- * @internal
60
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
61
- */
62
- export namespace ArticleReceivers$ {
63
- /** @deprecated use `ArticleReceivers$inboundSchema` instead. */
64
- export const inboundSchema = ArticleReceivers$inboundSchema;
65
- /** @deprecated use `ArticleReceivers$outboundSchema` instead. */
66
- export const outboundSchema = ArticleReceivers$outboundSchema;
67
- /** @deprecated use `ArticleReceivers$Outbound` instead. */
68
- export type Outbound = ArticleReceivers$Outbound;
69
- }
70
-
71
- export function articleReceiversToJSON(
72
- articleReceivers: ArticleReceivers,
73
- ): string {
74
- return JSON.stringify(
75
- ArticleReceivers$outboundSchema.parse(articleReceivers),
76
- );
77
- }
78
-
79
- export function articleReceiversFromJSON(
80
- jsonString: string,
81
- ): SafeParseResult<ArticleReceivers, SDKValidationError> {
82
- return safeParse(
83
- jsonString,
84
- (x) => ArticleReceivers$inboundSchema.parse(JSON.parse(x)),
85
- `Failed to parse 'ArticleReceivers' from JSON`,
86
- );
87
- }
@@ -1,179 +0,0 @@
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
- ArticleByline,
12
- ArticleByline$inboundSchema,
13
- ArticleByline$outboundSchema,
14
- } from "./articlebyline.js";
15
- import {
16
- ArticleVisibility,
17
- ArticleVisibility$inboundSchema,
18
- ArticleVisibility$outboundSchema,
19
- } from "./articlevisibility.js";
20
-
21
- export type ArticleUpdate = {
22
- title?: string | null | undefined;
23
- /**
24
- * Body in string format. body and body_base64 are mutually exclusive.
25
- */
26
- body?: string | null | undefined;
27
- /**
28
- * Body in base64-encoded format. Can be helpful to bypass Web Application Firewalls (WAF). body and body_base64 are mutually exclusive.
29
- */
30
- bodyBase64?: string | null | undefined;
31
- slug?: string | null | undefined;
32
- /**
33
- * If the user or organization should be credited in the byline.
34
- */
35
- byline?: ArticleByline | null | undefined;
36
- visibility?: ArticleVisibility | null | undefined;
37
- /**
38
- * Set to true to only make this article available for subscribers to a paid subscription tier in the organization.
39
- */
40
- paidSubscribersOnly?: boolean | null | undefined;
41
- /**
42
- * If specified, time at which the article should no longer be restricted to paid subscribers. Only relevant if `paid_subscribers_only` is true.
43
- */
44
- paidSubscribersOnlyEndsAt?: Date | null | undefined;
45
- /**
46
- * Time of publishing. If this date is in the future, the post will be scheduled to publish at this time.
47
- */
48
- publishedAt?: Date | null | undefined;
49
- /**
50
- * Set to true to deliver this article via email and/or notifications to subscribers.
51
- */
52
- notifySubscribers?: boolean | null | undefined;
53
- /**
54
- * If the article should be pinned
55
- */
56
- isPinned?: boolean | null | undefined;
57
- /**
58
- * Custom og:image URL value
59
- */
60
- ogImageUrl?: string | null | undefined;
61
- /**
62
- * Custom og:description value
63
- */
64
- ogDescription?: string | null | undefined;
65
- };
66
-
67
- /** @internal */
68
- export const ArticleUpdate$inboundSchema: z.ZodType<
69
- ArticleUpdate,
70
- z.ZodTypeDef,
71
- unknown
72
- > = z.object({
73
- title: z.nullable(z.string()).optional(),
74
- body: z.nullable(z.string()).optional(),
75
- body_base64: z.nullable(z.string()).optional(),
76
- slug: z.nullable(z.string()).optional(),
77
- byline: z.nullable(ArticleByline$inboundSchema).optional(),
78
- visibility: z.nullable(ArticleVisibility$inboundSchema).optional(),
79
- paid_subscribers_only: z.nullable(z.boolean()).optional(),
80
- paid_subscribers_only_ends_at: z.nullable(
81
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
82
- ).optional(),
83
- published_at: z.nullable(
84
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
85
- ).optional(),
86
- notify_subscribers: z.nullable(z.boolean()).optional(),
87
- is_pinned: z.nullable(z.boolean()).optional(),
88
- og_image_url: z.nullable(z.string()).optional(),
89
- og_description: z.nullable(z.string()).optional(),
90
- }).transform((v) => {
91
- return remap$(v, {
92
- "body_base64": "bodyBase64",
93
- "paid_subscribers_only": "paidSubscribersOnly",
94
- "paid_subscribers_only_ends_at": "paidSubscribersOnlyEndsAt",
95
- "published_at": "publishedAt",
96
- "notify_subscribers": "notifySubscribers",
97
- "is_pinned": "isPinned",
98
- "og_image_url": "ogImageUrl",
99
- "og_description": "ogDescription",
100
- });
101
- });
102
-
103
- /** @internal */
104
- export type ArticleUpdate$Outbound = {
105
- title?: string | null | undefined;
106
- body?: string | null | undefined;
107
- body_base64?: string | null | undefined;
108
- slug?: string | null | undefined;
109
- byline?: string | null | undefined;
110
- visibility?: string | null | undefined;
111
- paid_subscribers_only?: boolean | null | undefined;
112
- paid_subscribers_only_ends_at?: string | null | undefined;
113
- published_at?: string | null | undefined;
114
- notify_subscribers?: boolean | null | undefined;
115
- is_pinned?: boolean | null | undefined;
116
- og_image_url?: string | null | undefined;
117
- og_description?: string | null | undefined;
118
- };
119
-
120
- /** @internal */
121
- export const ArticleUpdate$outboundSchema: z.ZodType<
122
- ArticleUpdate$Outbound,
123
- z.ZodTypeDef,
124
- ArticleUpdate
125
- > = z.object({
126
- title: z.nullable(z.string()).optional(),
127
- body: z.nullable(z.string()).optional(),
128
- bodyBase64: z.nullable(z.string()).optional(),
129
- slug: z.nullable(z.string()).optional(),
130
- byline: z.nullable(ArticleByline$outboundSchema).optional(),
131
- visibility: z.nullable(ArticleVisibility$outboundSchema).optional(),
132
- paidSubscribersOnly: z.nullable(z.boolean()).optional(),
133
- paidSubscribersOnlyEndsAt: z.nullable(
134
- z.date().transform(v => v.toISOString()),
135
- ).optional(),
136
- publishedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
137
- notifySubscribers: z.nullable(z.boolean()).optional(),
138
- isPinned: z.nullable(z.boolean()).optional(),
139
- ogImageUrl: z.nullable(z.string()).optional(),
140
- ogDescription: z.nullable(z.string()).optional(),
141
- }).transform((v) => {
142
- return remap$(v, {
143
- bodyBase64: "body_base64",
144
- paidSubscribersOnly: "paid_subscribers_only",
145
- paidSubscribersOnlyEndsAt: "paid_subscribers_only_ends_at",
146
- publishedAt: "published_at",
147
- notifySubscribers: "notify_subscribers",
148
- isPinned: "is_pinned",
149
- ogImageUrl: "og_image_url",
150
- ogDescription: "og_description",
151
- });
152
- });
153
-
154
- /**
155
- * @internal
156
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
157
- */
158
- export namespace ArticleUpdate$ {
159
- /** @deprecated use `ArticleUpdate$inboundSchema` instead. */
160
- export const inboundSchema = ArticleUpdate$inboundSchema;
161
- /** @deprecated use `ArticleUpdate$outboundSchema` instead. */
162
- export const outboundSchema = ArticleUpdate$outboundSchema;
163
- /** @deprecated use `ArticleUpdate$Outbound` instead. */
164
- export type Outbound = ArticleUpdate$Outbound;
165
- }
166
-
167
- export function articleUpdateToJSON(articleUpdate: ArticleUpdate): string {
168
- return JSON.stringify(ArticleUpdate$outboundSchema.parse(articleUpdate));
169
- }
170
-
171
- export function articleUpdateFromJSON(
172
- jsonString: string,
173
- ): SafeParseResult<ArticleUpdate, SDKValidationError> {
174
- return safeParse(
175
- jsonString,
176
- (x) => ArticleUpdate$inboundSchema.parse(JSON.parse(x)),
177
- `Failed to parse 'ArticleUpdate' from JSON`,
178
- );
179
- }
@@ -1,34 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
- import { ClosedEnum } from "../../types/enums.js";
7
-
8
- export const ArticleVisibility = {
9
- Public: "public",
10
- Hidden: "hidden",
11
- Private: "private",
12
- } as const;
13
- export type ArticleVisibility = ClosedEnum<typeof ArticleVisibility>;
14
-
15
- /** @internal */
16
- export const ArticleVisibility$inboundSchema: z.ZodNativeEnum<
17
- typeof ArticleVisibility
18
- > = z.nativeEnum(ArticleVisibility);
19
-
20
- /** @internal */
21
- export const ArticleVisibility$outboundSchema: z.ZodNativeEnum<
22
- typeof ArticleVisibility
23
- > = ArticleVisibility$inboundSchema;
24
-
25
- /**
26
- * @internal
27
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
28
- */
29
- export namespace ArticleVisibility$ {
30
- /** @deprecated use `ArticleVisibility$inboundSchema` instead. */
31
- export const inboundSchema = ArticleVisibility$inboundSchema;
32
- /** @deprecated use `ArticleVisibility$outboundSchema` instead. */
33
- export const outboundSchema = ArticleVisibility$outboundSchema;
34
- }