@polar-sh/sdk 0.17.3 → 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 (316) 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/docs/sdks/files/README.md +5 -1
  6. package/funcs/filesCreate.js +1 -1
  7. package/funcs/filesDelete.d.ts +1 -1
  8. package/funcs/filesDelete.d.ts.map +1 -1
  9. package/funcs/filesDelete.js +1 -1
  10. package/funcs/filesDelete.js.map +1 -1
  11. package/funcs/filesUpdate.d.ts +1 -1
  12. package/funcs/filesUpdate.d.ts.map +1 -1
  13. package/funcs/filesUpdate.js +2 -2
  14. package/funcs/filesUpdate.js.map +1 -1
  15. package/funcs/filesUploaded.d.ts +1 -1
  16. package/funcs/filesUploaded.d.ts.map +1 -1
  17. package/funcs/filesUploaded.js +2 -2
  18. package/funcs/filesUploaded.js.map +1 -1
  19. package/hooks/hooks.d.ts.map +1 -1
  20. package/hooks/hooks.js +18 -0
  21. package/hooks/hooks.js.map +1 -1
  22. package/hooks/types.d.ts +3 -0
  23. package/hooks/types.d.ts.map +1 -1
  24. package/lib/config.d.ts +3 -3
  25. package/lib/config.js +3 -3
  26. package/lib/config.js.map +1 -1
  27. package/models/components/benefit.d.ts +2 -3
  28. package/models/components/benefit.d.ts.map +1 -1
  29. package/models/components/benefit.js +0 -3
  30. package/models/components/benefit.js.map +1 -1
  31. package/models/components/benefitadssubscriber.d.ts +7 -7
  32. package/models/components/benefitadssubscriber.d.ts.map +1 -1
  33. package/models/components/benefitadssubscriber.js +11 -11
  34. package/models/components/benefitadssubscriber.js.map +1 -1
  35. package/models/components/benefitgrant.d.ts +4 -5
  36. package/models/components/benefitgrant.d.ts.map +1 -1
  37. package/models/components/benefitgrant.js +0 -5
  38. package/models/components/benefitgrant.js.map +1 -1
  39. package/models/components/benefitgrantwebhook.d.ts +8 -9
  40. package/models/components/benefitgrantwebhook.d.ts.map +1 -1
  41. package/models/components/benefitgrantwebhook.js +0 -9
  42. package/models/components/benefitgrantwebhook.js.map +1 -1
  43. package/models/components/benefittype.d.ts +0 -3
  44. package/models/components/benefittype.d.ts.map +1 -1
  45. package/models/components/benefittype.js +0 -1
  46. package/models/components/benefittype.js.map +1 -1
  47. package/models/components/checkoutlinkproduct.d.ts +2 -24
  48. package/models/components/checkoutlinkproduct.d.ts.map +1 -1
  49. package/models/components/checkoutlinkproduct.js +3 -27
  50. package/models/components/checkoutlinkproduct.js.map +1 -1
  51. package/models/components/checkoutproduct.d.ts +2 -24
  52. package/models/components/checkoutproduct.d.ts.map +1 -1
  53. package/models/components/checkoutproduct.js +3 -27
  54. package/models/components/checkoutproduct.js.map +1 -1
  55. package/models/components/index.d.ts +0 -15
  56. package/models/components/index.d.ts.map +1 -1
  57. package/models/components/index.js +0 -15
  58. package/models/components/index.js.map +1 -1
  59. package/models/components/listresourceuserbenefit.d.ts +0 -9
  60. package/models/components/listresourceuserbenefit.d.ts.map +1 -1
  61. package/models/components/listresourceuserbenefit.js +0 -13
  62. package/models/components/listresourceuserbenefit.js.map +1 -1
  63. package/models/components/oauth2client.js +2 -2
  64. package/models/components/oauth2client.js.map +1 -1
  65. package/models/components/oauth2clientconfiguration.js +2 -2
  66. package/models/components/oauth2clientconfiguration.js.map +1 -1
  67. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  68. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  69. package/models/components/organizationfeaturesettings.d.ts +0 -5
  70. package/models/components/organizationfeaturesettings.d.ts.map +1 -1
  71. package/models/components/organizationfeaturesettings.js +0 -4
  72. package/models/components/organizationfeaturesettings.js.map +1 -1
  73. package/models/components/scope.d.ts +0 -6
  74. package/models/components/scope.d.ts.map +1 -1
  75. package/models/components/scope.js +0 -2
  76. package/models/components/scope.js.map +1 -1
  77. package/models/components/userorderproduct.d.ts +2 -24
  78. package/models/components/userorderproduct.d.ts.map +1 -1
  79. package/models/components/userorderproduct.js +3 -27
  80. package/models/components/userorderproduct.js.map +1 -1
  81. package/models/components/usersubscriptionproduct.d.ts +2 -24
  82. package/models/components/usersubscriptionproduct.d.ts.map +1 -1
  83. package/models/components/usersubscriptionproduct.js +3 -27
  84. package/models/components/usersubscriptionproduct.js.map +1 -1
  85. package/models/errors/index.d.ts +0 -1
  86. package/models/errors/index.d.ts.map +1 -1
  87. package/models/errors/index.js +0 -1
  88. package/models/errors/index.js.map +1 -1
  89. package/models/operations/benefitsupdate.d.ts +4 -4
  90. package/models/operations/benefitsupdate.d.ts.map +1 -1
  91. package/models/operations/benefitsupdate.js +0 -4
  92. package/models/operations/benefitsupdate.js.map +1 -1
  93. package/models/operations/filesupdate.d.ts +1 -1
  94. package/models/operations/filesuploaded.d.ts +1 -1
  95. package/models/operations/index.d.ts +0 -8
  96. package/models/operations/index.d.ts.map +1 -1
  97. package/models/operations/index.js +0 -8
  98. package/models/operations/index.js.map +1 -1
  99. package/models/operations/usersbenefitsget.d.ts +2 -6
  100. package/models/operations/usersbenefitsget.d.ts.map +1 -1
  101. package/models/operations/usersbenefitsget.js +0 -6
  102. package/models/operations/usersbenefitsget.js.map +1 -1
  103. package/package.json +1 -3
  104. package/sdk/sdk.d.ts +0 -3
  105. package/sdk/sdk.d.ts.map +1 -1
  106. package/sdk/sdk.js +0 -5
  107. package/sdk/sdk.js.map +1 -1
  108. package/src/funcs/filesCreate.ts +1 -1
  109. package/src/funcs/filesDelete.ts +3 -3
  110. package/src/funcs/filesUpdate.ts +7 -1
  111. package/src/funcs/filesUploaded.ts +7 -1
  112. package/src/hooks/hooks.ts +20 -0
  113. package/src/hooks/types.ts +9 -0
  114. package/src/lib/config.ts +3 -3
  115. package/src/models/components/benefit.ts +0 -10
  116. package/src/models/components/benefitadssubscriber.ts +12 -15
  117. package/src/models/components/benefitgrant.ts +0 -14
  118. package/src/models/components/benefitgrantwebhook.ts +0 -22
  119. package/src/models/components/benefittype.ts +0 -1
  120. package/src/models/components/checkoutlinkproduct.ts +4 -68
  121. package/src/models/components/checkoutproduct.ts +4 -66
  122. package/src/models/components/index.ts +0 -15
  123. package/src/models/components/listresourceuserbenefit.ts +0 -30
  124. package/src/models/components/oauth2client.ts +2 -2
  125. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  126. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  127. package/src/models/components/organizationfeaturesettings.ts +0 -9
  128. package/src/models/components/scope.ts +0 -2
  129. package/src/models/components/userorderproduct.ts +4 -60
  130. package/src/models/components/usersubscriptionproduct.ts +4 -68
  131. package/src/models/errors/index.ts +0 -1
  132. package/src/models/operations/benefitsupdate.ts +0 -8
  133. package/src/models/operations/filesupdate.ts +1 -1
  134. package/src/models/operations/filesuploaded.ts +1 -1
  135. package/src/models/operations/index.ts +0 -8
  136. package/src/models/operations/usersbenefitsget.ts +0 -12
  137. package/src/sdk/sdk.ts +0 -6
  138. package/src/types/index.ts +1 -0
  139. package/src/types/webhooks.ts +7 -0
  140. package/types/index.d.ts +1 -0
  141. package/types/index.d.ts.map +1 -1
  142. package/types/webhooks.d.ts +4 -0
  143. package/types/webhooks.d.ts.map +1 -0
  144. package/types/webhooks.js +6 -0
  145. package/types/webhooks.js.map +1 -0
  146. package/docs/sdks/articles/README.md +0 -724
  147. package/funcs/articlesCreate.d.ts +0 -16
  148. package/funcs/articlesCreate.d.ts.map +0 -1
  149. package/funcs/articlesCreate.js +0 -99
  150. package/funcs/articlesCreate.js.map +0 -1
  151. package/funcs/articlesDelete.d.ts +0 -16
  152. package/funcs/articlesDelete.d.ts.map +0 -1
  153. package/funcs/articlesDelete.js +0 -105
  154. package/funcs/articlesDelete.js.map +0 -1
  155. package/funcs/articlesExport.d.ts +0 -16
  156. package/funcs/articlesExport.d.ts.map +0 -1
  157. package/funcs/articlesExport.js +0 -103
  158. package/funcs/articlesExport.js.map +0 -1
  159. package/funcs/articlesGet.d.ts +0 -17
  160. package/funcs/articlesGet.d.ts.map +0 -1
  161. package/funcs/articlesGet.js +0 -105
  162. package/funcs/articlesGet.js.map +0 -1
  163. package/funcs/articlesList.d.ts +0 -19
  164. package/funcs/articlesList.d.ts.map +0 -1
  165. package/funcs/articlesList.js +0 -138
  166. package/funcs/articlesList.js.map +0 -1
  167. package/funcs/articlesPreview.d.ts +0 -16
  168. package/funcs/articlesPreview.d.ts.map +0 -1
  169. package/funcs/articlesPreview.js +0 -106
  170. package/funcs/articlesPreview.js.map +0 -1
  171. package/funcs/articlesReceivers.d.ts +0 -17
  172. package/funcs/articlesReceivers.d.ts.map +0 -1
  173. package/funcs/articlesReceivers.js +0 -105
  174. package/funcs/articlesReceivers.js.map +0 -1
  175. package/funcs/articlesSend.d.ts +0 -16
  176. package/funcs/articlesSend.d.ts.map +0 -1
  177. package/funcs/articlesSend.js +0 -105
  178. package/funcs/articlesSend.js.map +0 -1
  179. package/funcs/articlesUpdate.d.ts +0 -17
  180. package/funcs/articlesUpdate.d.ts.map +0 -1
  181. package/funcs/articlesUpdate.js +0 -106
  182. package/funcs/articlesUpdate.js.map +0 -1
  183. package/models/components/article.d.ts +0 -68
  184. package/models/components/article.d.ts.map +0 -1
  185. package/models/components/article.js +0 -129
  186. package/models/components/article.js.map +0 -1
  187. package/models/components/articlebyline.d.ts +0 -28
  188. package/models/components/articlebyline.d.ts.map +0 -1
  189. package/models/components/articlebyline.js +0 -50
  190. package/models/components/articlebyline.js.map +0 -1
  191. package/models/components/articlecreate.d.ts +0 -93
  192. package/models/components/articlecreate.d.ts.map +0 -1
  193. package/models/components/articlecreate.js +0 -112
  194. package/models/components/articlecreate.js.map +0 -1
  195. package/models/components/articlepreview.d.ts +0 -32
  196. package/models/components/articlepreview.d.ts.map +0 -1
  197. package/models/components/articlepreview.js +0 -59
  198. package/models/components/articlepreview.js.map +0 -1
  199. package/models/components/articlereceivers.d.ts +0 -33
  200. package/models/components/articlereceivers.d.ts.map +0 -1
  201. package/models/components/articlereceivers.js +0 -76
  202. package/models/components/articlereceivers.js.map +0 -1
  203. package/models/components/articleupdate.d.ts +0 -85
  204. package/models/components/articleupdate.d.ts.map +0 -1
  205. package/models/components/articleupdate.js +0 -108
  206. package/models/components/articleupdate.js.map +0 -1
  207. package/models/components/articlevisibility.d.ts +0 -31
  208. package/models/components/articlevisibility.d.ts.map +0 -1
  209. package/models/components/articlevisibility.js +0 -51
  210. package/models/components/articlevisibility.js.map +0 -1
  211. package/models/components/benefitarticles.d.ts +0 -100
  212. package/models/components/benefitarticles.d.ts.map +0 -1
  213. package/models/components/benefitarticles.js +0 -107
  214. package/models/components/benefitarticles.js.map +0 -1
  215. package/models/components/benefitarticlesproperties.d.ts +0 -35
  216. package/models/components/benefitarticlesproperties.d.ts.map +0 -1
  217. package/models/components/benefitarticlesproperties.js +0 -68
  218. package/models/components/benefitarticlesproperties.js.map +0 -1
  219. package/models/components/benefitarticlessubscriber.d.ts +0 -99
  220. package/models/components/benefitarticlessubscriber.d.ts.map +0 -1
  221. package/models/components/benefitarticlessubscriber.js +0 -113
  222. package/models/components/benefitarticlessubscriber.js.map +0 -1
  223. package/models/components/benefitarticlessubscriberproperties.d.ts +0 -35
  224. package/models/components/benefitarticlessubscriberproperties.d.ts.map +0 -1
  225. package/models/components/benefitarticlessubscriberproperties.js +0 -68
  226. package/models/components/benefitarticlessubscriberproperties.js.map +0 -1
  227. package/models/components/benefitarticlesupdate.d.ts +0 -57
  228. package/models/components/benefitarticlesupdate.d.ts.map +0 -1
  229. package/models/components/benefitarticlesupdate.js +0 -79
  230. package/models/components/benefitarticlesupdate.js.map +0 -1
  231. package/models/components/benefitgrantarticlesproperties.d.ts +0 -25
  232. package/models/components/benefitgrantarticlesproperties.d.ts.map +0 -1
  233. package/models/components/benefitgrantarticlesproperties.js +0 -55
  234. package/models/components/benefitgrantarticlesproperties.js.map +0 -1
  235. package/models/components/bylineprofile.d.ts +0 -31
  236. package/models/components/bylineprofile.d.ts.map +0 -1
  237. package/models/components/bylineprofile.js +0 -70
  238. package/models/components/bylineprofile.js.map +0 -1
  239. package/models/components/listresourcearticle.d.ts +0 -33
  240. package/models/components/listresourcearticle.d.ts.map +0 -1
  241. package/models/components/listresourcearticle.js +0 -63
  242. package/models/components/listresourcearticle.js.map +0 -1
  243. package/models/errors/filenotfound.d.ts +0 -57
  244. package/models/errors/filenotfound.d.ts.map +0 -1
  245. package/models/errors/filenotfound.js +0 -88
  246. package/models/errors/filenotfound.js.map +0 -1
  247. package/models/operations/articlesdelete.d.ts +0 -29
  248. package/models/operations/articlesdelete.d.ts.map +0 -1
  249. package/models/operations/articlesdelete.js +0 -59
  250. package/models/operations/articlesdelete.js.map +0 -1
  251. package/models/operations/articlesexport.d.ts +0 -29
  252. package/models/operations/articlesexport.d.ts.map +0 -1
  253. package/models/operations/articlesexport.js +0 -68
  254. package/models/operations/articlesexport.js.map +0 -1
  255. package/models/operations/articlesget.d.ts +0 -29
  256. package/models/operations/articlesget.d.ts.map +0 -1
  257. package/models/operations/articlesget.js +0 -59
  258. package/models/operations/articlesget.js.map +0 -1
  259. package/models/operations/articleslist.d.ts +0 -141
  260. package/models/operations/articleslist.d.ts.map +0 -1
  261. package/models/operations/articleslist.js +0 -184
  262. package/models/operations/articleslist.js.map +0 -1
  263. package/models/operations/articlespreview.d.ts +0 -32
  264. package/models/operations/articlespreview.d.ts.map +0 -1
  265. package/models/operations/articlespreview.js +0 -71
  266. package/models/operations/articlespreview.js.map +0 -1
  267. package/models/operations/articlesreceivers.d.ts +0 -29
  268. package/models/operations/articlesreceivers.d.ts.map +0 -1
  269. package/models/operations/articlesreceivers.js +0 -59
  270. package/models/operations/articlesreceivers.js.map +0 -1
  271. package/models/operations/articlessend.d.ts +0 -29
  272. package/models/operations/articlessend.d.ts.map +0 -1
  273. package/models/operations/articlessend.js +0 -59
  274. package/models/operations/articlessend.js.map +0 -1
  275. package/models/operations/articlesupdate.d.ts +0 -32
  276. package/models/operations/articlesupdate.d.ts.map +0 -1
  277. package/models/operations/articlesupdate.js +0 -71
  278. package/models/operations/articlesupdate.js.map +0 -1
  279. package/sdk/articles.d.ts +0 -72
  280. package/sdk/articles.d.ts.map +0 -1
  281. package/sdk/articles.js +0 -103
  282. package/sdk/articles.js.map +0 -1
  283. package/src/funcs/articlesCreate.ts +0 -131
  284. package/src/funcs/articlesDelete.ts +0 -144
  285. package/src/funcs/articlesExport.ts +0 -136
  286. package/src/funcs/articlesGet.ts +0 -141
  287. package/src/funcs/articlesList.ts +0 -205
  288. package/src/funcs/articlesPreview.ts +0 -145
  289. package/src/funcs/articlesReceivers.ts +0 -138
  290. package/src/funcs/articlesSend.ts +0 -144
  291. package/src/funcs/articlesUpdate.ts +0 -145
  292. package/src/models/components/article.ts +0 -187
  293. package/src/models/components/articlebyline.ts +0 -33
  294. package/src/models/components/articlecreate.ts +0 -191
  295. package/src/models/components/articlepreview.ts +0 -65
  296. package/src/models/components/articlereceivers.ts +0 -87
  297. package/src/models/components/articleupdate.ts +0 -179
  298. package/src/models/components/articlevisibility.ts +0 -34
  299. package/src/models/components/benefitarticles.ts +0 -175
  300. package/src/models/components/benefitarticlesproperties.ts +0 -81
  301. package/src/models/components/benefitarticlessubscriber.ts +0 -189
  302. package/src/models/components/benefitarticlessubscriberproperties.ts +0 -86
  303. package/src/models/components/benefitarticlesupdate.ts +0 -102
  304. package/src/models/components/benefitgrantarticlesproperties.ts +0 -60
  305. package/src/models/components/bylineprofile.ts +0 -75
  306. package/src/models/components/listresourcearticle.ts +0 -82
  307. package/src/models/errors/filenotfound.ts +0 -102
  308. package/src/models/operations/articlesdelete.ts +0 -66
  309. package/src/models/operations/articlesexport.ts +0 -75
  310. package/src/models/operations/articlesget.ts +0 -66
  311. package/src/models/operations/articleslist.ts +0 -342
  312. package/src/models/operations/articlespreview.ts +0 -80
  313. package/src/models/operations/articlesreceivers.ts +0 -66
  314. package/src/models/operations/articlessend.ts +0 -66
  315. package/src/models/operations/articlesupdate.ts +0 -80
  316. package/src/sdk/articles.ts +0 -173
@@ -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
- }
@@ -1,175 +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 { ClosedEnum } from "../../types/enums.js";
9
- import { Result as SafeParseResult } from "../../types/fp.js";
10
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
- import {
12
- BenefitArticlesProperties,
13
- BenefitArticlesProperties$inboundSchema,
14
- BenefitArticlesProperties$Outbound,
15
- BenefitArticlesProperties$outboundSchema,
16
- } from "./benefitarticlesproperties.js";
17
-
18
- export const BenefitArticlesType = {
19
- Articles: "articles",
20
- } as const;
21
- export type BenefitArticlesType = ClosedEnum<typeof BenefitArticlesType>;
22
-
23
- /**
24
- * A benefit of type `articles`.
25
- *
26
- * @remarks
27
- *
28
- * Use it to grant access to posts.
29
- */
30
- export type BenefitArticles = {
31
- /**
32
- * Creation timestamp of the object.
33
- */
34
- createdAt: Date;
35
- /**
36
- * Last modification timestamp of the object.
37
- */
38
- modifiedAt: Date | null;
39
- /**
40
- * The ID of the benefit.
41
- */
42
- id: string;
43
- type?: "articles" | undefined;
44
- /**
45
- * The description of the benefit.
46
- */
47
- description: string;
48
- /**
49
- * Whether the benefit is selectable when creating a product.
50
- */
51
- selectable: boolean;
52
- /**
53
- * Whether the benefit is deletable.
54
- */
55
- deletable: boolean;
56
- /**
57
- * The ID of the organization owning the benefit.
58
- */
59
- organizationId: string;
60
- /**
61
- * Properties for a benefit of type `articles`.
62
- */
63
- properties: BenefitArticlesProperties;
64
- };
65
-
66
- /** @internal */
67
- export const BenefitArticlesType$inboundSchema: z.ZodNativeEnum<
68
- typeof BenefitArticlesType
69
- > = z.nativeEnum(BenefitArticlesType);
70
-
71
- /** @internal */
72
- export const BenefitArticlesType$outboundSchema: z.ZodNativeEnum<
73
- typeof BenefitArticlesType
74
- > = BenefitArticlesType$inboundSchema;
75
-
76
- /**
77
- * @internal
78
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
79
- */
80
- export namespace BenefitArticlesType$ {
81
- /** @deprecated use `BenefitArticlesType$inboundSchema` instead. */
82
- export const inboundSchema = BenefitArticlesType$inboundSchema;
83
- /** @deprecated use `BenefitArticlesType$outboundSchema` instead. */
84
- export const outboundSchema = BenefitArticlesType$outboundSchema;
85
- }
86
-
87
- /** @internal */
88
- export const BenefitArticles$inboundSchema: z.ZodType<
89
- BenefitArticles,
90
- z.ZodTypeDef,
91
- unknown
92
- > = z.object({
93
- created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
94
- modified_at: z.nullable(
95
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
96
- ),
97
- id: z.string(),
98
- type: z.literal("articles").optional(),
99
- description: z.string(),
100
- selectable: z.boolean(),
101
- deletable: z.boolean(),
102
- organization_id: z.string(),
103
- properties: BenefitArticlesProperties$inboundSchema,
104
- }).transform((v) => {
105
- return remap$(v, {
106
- "created_at": "createdAt",
107
- "modified_at": "modifiedAt",
108
- "organization_id": "organizationId",
109
- });
110
- });
111
-
112
- /** @internal */
113
- export type BenefitArticles$Outbound = {
114
- created_at: string;
115
- modified_at: string | null;
116
- id: string;
117
- type: "articles";
118
- description: string;
119
- selectable: boolean;
120
- deletable: boolean;
121
- organization_id: string;
122
- properties: BenefitArticlesProperties$Outbound;
123
- };
124
-
125
- /** @internal */
126
- export const BenefitArticles$outboundSchema: z.ZodType<
127
- BenefitArticles$Outbound,
128
- z.ZodTypeDef,
129
- BenefitArticles
130
- > = z.object({
131
- createdAt: z.date().transform(v => v.toISOString()),
132
- modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
133
- id: z.string(),
134
- type: z.literal("articles").default("articles"),
135
- description: z.string(),
136
- selectable: z.boolean(),
137
- deletable: z.boolean(),
138
- organizationId: z.string(),
139
- properties: BenefitArticlesProperties$outboundSchema,
140
- }).transform((v) => {
141
- return remap$(v, {
142
- createdAt: "created_at",
143
- modifiedAt: "modified_at",
144
- organizationId: "organization_id",
145
- });
146
- });
147
-
148
- /**
149
- * @internal
150
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
151
- */
152
- export namespace BenefitArticles$ {
153
- /** @deprecated use `BenefitArticles$inboundSchema` instead. */
154
- export const inboundSchema = BenefitArticles$inboundSchema;
155
- /** @deprecated use `BenefitArticles$outboundSchema` instead. */
156
- export const outboundSchema = BenefitArticles$outboundSchema;
157
- /** @deprecated use `BenefitArticles$Outbound` instead. */
158
- export type Outbound = BenefitArticles$Outbound;
159
- }
160
-
161
- export function benefitArticlesToJSON(
162
- benefitArticles: BenefitArticles,
163
- ): string {
164
- return JSON.stringify(BenefitArticles$outboundSchema.parse(benefitArticles));
165
- }
166
-
167
- export function benefitArticlesFromJSON(
168
- jsonString: string,
169
- ): SafeParseResult<BenefitArticles, SDKValidationError> {
170
- return safeParse(
171
- jsonString,
172
- (x) => BenefitArticles$inboundSchema.parse(JSON.parse(x)),
173
- `Failed to parse 'BenefitArticles' from JSON`,
174
- );
175
- }
@@ -1,81 +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
- /**
12
- * Properties for a benefit of type `articles`.
13
- */
14
- export type BenefitArticlesProperties = {
15
- /**
16
- * Whether the user can access paid articles.
17
- */
18
- paidArticles: boolean;
19
- };
20
-
21
- /** @internal */
22
- export const BenefitArticlesProperties$inboundSchema: z.ZodType<
23
- BenefitArticlesProperties,
24
- z.ZodTypeDef,
25
- unknown
26
- > = z.object({
27
- paid_articles: z.boolean(),
28
- }).transform((v) => {
29
- return remap$(v, {
30
- "paid_articles": "paidArticles",
31
- });
32
- });
33
-
34
- /** @internal */
35
- export type BenefitArticlesProperties$Outbound = {
36
- paid_articles: boolean;
37
- };
38
-
39
- /** @internal */
40
- export const BenefitArticlesProperties$outboundSchema: z.ZodType<
41
- BenefitArticlesProperties$Outbound,
42
- z.ZodTypeDef,
43
- BenefitArticlesProperties
44
- > = z.object({
45
- paidArticles: z.boolean(),
46
- }).transform((v) => {
47
- return remap$(v, {
48
- paidArticles: "paid_articles",
49
- });
50
- });
51
-
52
- /**
53
- * @internal
54
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
- */
56
- export namespace BenefitArticlesProperties$ {
57
- /** @deprecated use `BenefitArticlesProperties$inboundSchema` instead. */
58
- export const inboundSchema = BenefitArticlesProperties$inboundSchema;
59
- /** @deprecated use `BenefitArticlesProperties$outboundSchema` instead. */
60
- export const outboundSchema = BenefitArticlesProperties$outboundSchema;
61
- /** @deprecated use `BenefitArticlesProperties$Outbound` instead. */
62
- export type Outbound = BenefitArticlesProperties$Outbound;
63
- }
64
-
65
- export function benefitArticlesPropertiesToJSON(
66
- benefitArticlesProperties: BenefitArticlesProperties,
67
- ): string {
68
- return JSON.stringify(
69
- BenefitArticlesProperties$outboundSchema.parse(benefitArticlesProperties),
70
- );
71
- }
72
-
73
- export function benefitArticlesPropertiesFromJSON(
74
- jsonString: string,
75
- ): SafeParseResult<BenefitArticlesProperties, SDKValidationError> {
76
- return safeParse(
77
- jsonString,
78
- (x) => BenefitArticlesProperties$inboundSchema.parse(JSON.parse(x)),
79
- `Failed to parse 'BenefitArticlesProperties' from JSON`,
80
- );
81
- }