@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,189 +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
- BenefitArticlesSubscriberProperties,
13
- BenefitArticlesSubscriberProperties$inboundSchema,
14
- BenefitArticlesSubscriberProperties$Outbound,
15
- BenefitArticlesSubscriberProperties$outboundSchema,
16
- } from "./benefitarticlessubscriberproperties.js";
17
- import {
18
- BenefitGrantSubscriber,
19
- BenefitGrantSubscriber$inboundSchema,
20
- BenefitGrantSubscriber$Outbound,
21
- BenefitGrantSubscriber$outboundSchema,
22
- } from "./benefitgrantsubscriber.js";
23
- import {
24
- Organization,
25
- Organization$inboundSchema,
26
- Organization$Outbound,
27
- Organization$outboundSchema,
28
- } from "./organization.js";
29
-
30
- export const Type = {
31
- Articles: "articles",
32
- } as const;
33
- export type Type = ClosedEnum<typeof Type>;
34
-
35
- export type BenefitArticlesSubscriber = {
36
- /**
37
- * Creation timestamp of the object.
38
- */
39
- createdAt: Date;
40
- /**
41
- * Last modification timestamp of the object.
42
- */
43
- modifiedAt: Date | null;
44
- /**
45
- * The ID of the benefit.
46
- */
47
- id: string;
48
- type?: "articles" | undefined;
49
- /**
50
- * The description of the benefit.
51
- */
52
- description: string;
53
- /**
54
- * Whether the benefit is selectable when creating a product.
55
- */
56
- selectable: boolean;
57
- /**
58
- * Whether the benefit is deletable.
59
- */
60
- deletable: boolean;
61
- /**
62
- * The ID of the organization owning the benefit.
63
- */
64
- organizationId: string;
65
- grants: Array<BenefitGrantSubscriber>;
66
- organization: Organization;
67
- /**
68
- * Properties available to subscribers for a benefit of type `articles`.
69
- */
70
- properties: BenefitArticlesSubscriberProperties;
71
- };
72
-
73
- /** @internal */
74
- export const Type$inboundSchema: z.ZodNativeEnum<typeof Type> = z.nativeEnum(
75
- Type,
76
- );
77
-
78
- /** @internal */
79
- export const Type$outboundSchema: z.ZodNativeEnum<typeof Type> =
80
- Type$inboundSchema;
81
-
82
- /**
83
- * @internal
84
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
85
- */
86
- export namespace Type$ {
87
- /** @deprecated use `Type$inboundSchema` instead. */
88
- export const inboundSchema = Type$inboundSchema;
89
- /** @deprecated use `Type$outboundSchema` instead. */
90
- export const outboundSchema = Type$outboundSchema;
91
- }
92
-
93
- /** @internal */
94
- export const BenefitArticlesSubscriber$inboundSchema: z.ZodType<
95
- BenefitArticlesSubscriber,
96
- z.ZodTypeDef,
97
- unknown
98
- > = z.object({
99
- created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
100
- modified_at: z.nullable(
101
- z.string().datetime({ offset: true }).transform(v => new Date(v)),
102
- ),
103
- id: z.string(),
104
- type: z.literal("articles").optional(),
105
- description: z.string(),
106
- selectable: z.boolean(),
107
- deletable: z.boolean(),
108
- organization_id: z.string(),
109
- grants: z.array(BenefitGrantSubscriber$inboundSchema),
110
- organization: Organization$inboundSchema,
111
- properties: BenefitArticlesSubscriberProperties$inboundSchema,
112
- }).transform((v) => {
113
- return remap$(v, {
114
- "created_at": "createdAt",
115
- "modified_at": "modifiedAt",
116
- "organization_id": "organizationId",
117
- });
118
- });
119
-
120
- /** @internal */
121
- export type BenefitArticlesSubscriber$Outbound = {
122
- created_at: string;
123
- modified_at: string | null;
124
- id: string;
125
- type: "articles";
126
- description: string;
127
- selectable: boolean;
128
- deletable: boolean;
129
- organization_id: string;
130
- grants: Array<BenefitGrantSubscriber$Outbound>;
131
- organization: Organization$Outbound;
132
- properties: BenefitArticlesSubscriberProperties$Outbound;
133
- };
134
-
135
- /** @internal */
136
- export const BenefitArticlesSubscriber$outboundSchema: z.ZodType<
137
- BenefitArticlesSubscriber$Outbound,
138
- z.ZodTypeDef,
139
- BenefitArticlesSubscriber
140
- > = z.object({
141
- createdAt: z.date().transform(v => v.toISOString()),
142
- modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
143
- id: z.string(),
144
- type: z.literal("articles").default("articles"),
145
- description: z.string(),
146
- selectable: z.boolean(),
147
- deletable: z.boolean(),
148
- organizationId: z.string(),
149
- grants: z.array(BenefitGrantSubscriber$outboundSchema),
150
- organization: Organization$outboundSchema,
151
- properties: BenefitArticlesSubscriberProperties$outboundSchema,
152
- }).transform((v) => {
153
- return remap$(v, {
154
- createdAt: "created_at",
155
- modifiedAt: "modified_at",
156
- organizationId: "organization_id",
157
- });
158
- });
159
-
160
- /**
161
- * @internal
162
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
163
- */
164
- export namespace BenefitArticlesSubscriber$ {
165
- /** @deprecated use `BenefitArticlesSubscriber$inboundSchema` instead. */
166
- export const inboundSchema = BenefitArticlesSubscriber$inboundSchema;
167
- /** @deprecated use `BenefitArticlesSubscriber$outboundSchema` instead. */
168
- export const outboundSchema = BenefitArticlesSubscriber$outboundSchema;
169
- /** @deprecated use `BenefitArticlesSubscriber$Outbound` instead. */
170
- export type Outbound = BenefitArticlesSubscriber$Outbound;
171
- }
172
-
173
- export function benefitArticlesSubscriberToJSON(
174
- benefitArticlesSubscriber: BenefitArticlesSubscriber,
175
- ): string {
176
- return JSON.stringify(
177
- BenefitArticlesSubscriber$outboundSchema.parse(benefitArticlesSubscriber),
178
- );
179
- }
180
-
181
- export function benefitArticlesSubscriberFromJSON(
182
- jsonString: string,
183
- ): SafeParseResult<BenefitArticlesSubscriber, SDKValidationError> {
184
- return safeParse(
185
- jsonString,
186
- (x) => BenefitArticlesSubscriber$inboundSchema.parse(JSON.parse(x)),
187
- `Failed to parse 'BenefitArticlesSubscriber' from JSON`,
188
- );
189
- }
@@ -1,86 +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 available to subscribers for a benefit of type `articles`.
13
- */
14
- export type BenefitArticlesSubscriberProperties = {
15
- /**
16
- * Whether the user can access paid articles.
17
- */
18
- paidArticles: boolean;
19
- };
20
-
21
- /** @internal */
22
- export const BenefitArticlesSubscriberProperties$inboundSchema: z.ZodType<
23
- BenefitArticlesSubscriberProperties,
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 BenefitArticlesSubscriberProperties$Outbound = {
36
- paid_articles: boolean;
37
- };
38
-
39
- /** @internal */
40
- export const BenefitArticlesSubscriberProperties$outboundSchema: z.ZodType<
41
- BenefitArticlesSubscriberProperties$Outbound,
42
- z.ZodTypeDef,
43
- BenefitArticlesSubscriberProperties
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 BenefitArticlesSubscriberProperties$ {
57
- /** @deprecated use `BenefitArticlesSubscriberProperties$inboundSchema` instead. */
58
- export const inboundSchema =
59
- BenefitArticlesSubscriberProperties$inboundSchema;
60
- /** @deprecated use `BenefitArticlesSubscriberProperties$outboundSchema` instead. */
61
- export const outboundSchema =
62
- BenefitArticlesSubscriberProperties$outboundSchema;
63
- /** @deprecated use `BenefitArticlesSubscriberProperties$Outbound` instead. */
64
- export type Outbound = BenefitArticlesSubscriberProperties$Outbound;
65
- }
66
-
67
- export function benefitArticlesSubscriberPropertiesToJSON(
68
- benefitArticlesSubscriberProperties: BenefitArticlesSubscriberProperties,
69
- ): string {
70
- return JSON.stringify(
71
- BenefitArticlesSubscriberProperties$outboundSchema.parse(
72
- benefitArticlesSubscriberProperties,
73
- ),
74
- );
75
- }
76
-
77
- export function benefitArticlesSubscriberPropertiesFromJSON(
78
- jsonString: string,
79
- ): SafeParseResult<BenefitArticlesSubscriberProperties, SDKValidationError> {
80
- return safeParse(
81
- jsonString,
82
- (x) =>
83
- BenefitArticlesSubscriberProperties$inboundSchema.parse(JSON.parse(x)),
84
- `Failed to parse 'BenefitArticlesSubscriberProperties' from JSON`,
85
- );
86
- }
@@ -1,102 +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 { ClosedEnum } from "../../types/enums.js";
8
- import { Result as SafeParseResult } from "../../types/fp.js";
9
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
-
11
- export const BenefitArticlesUpdateType = {
12
- Articles: "articles",
13
- } as const;
14
- export type BenefitArticlesUpdateType = ClosedEnum<
15
- typeof BenefitArticlesUpdateType
16
- >;
17
-
18
- export type BenefitArticlesUpdate = {
19
- /**
20
- * The description of the benefit. Will be displayed on products having this benefit.
21
- */
22
- description?: string | null | undefined;
23
- type?: "articles" | undefined;
24
- };
25
-
26
- /** @internal */
27
- export const BenefitArticlesUpdateType$inboundSchema: z.ZodNativeEnum<
28
- typeof BenefitArticlesUpdateType
29
- > = z.nativeEnum(BenefitArticlesUpdateType);
30
-
31
- /** @internal */
32
- export const BenefitArticlesUpdateType$outboundSchema: z.ZodNativeEnum<
33
- typeof BenefitArticlesUpdateType
34
- > = BenefitArticlesUpdateType$inboundSchema;
35
-
36
- /**
37
- * @internal
38
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
39
- */
40
- export namespace BenefitArticlesUpdateType$ {
41
- /** @deprecated use `BenefitArticlesUpdateType$inboundSchema` instead. */
42
- export const inboundSchema = BenefitArticlesUpdateType$inboundSchema;
43
- /** @deprecated use `BenefitArticlesUpdateType$outboundSchema` instead. */
44
- export const outboundSchema = BenefitArticlesUpdateType$outboundSchema;
45
- }
46
-
47
- /** @internal */
48
- export const BenefitArticlesUpdate$inboundSchema: z.ZodType<
49
- BenefitArticlesUpdate,
50
- z.ZodTypeDef,
51
- unknown
52
- > = z.object({
53
- description: z.nullable(z.string()).optional(),
54
- type: z.literal("articles").optional(),
55
- });
56
-
57
- /** @internal */
58
- export type BenefitArticlesUpdate$Outbound = {
59
- description?: string | null | undefined;
60
- type: "articles";
61
- };
62
-
63
- /** @internal */
64
- export const BenefitArticlesUpdate$outboundSchema: z.ZodType<
65
- BenefitArticlesUpdate$Outbound,
66
- z.ZodTypeDef,
67
- BenefitArticlesUpdate
68
- > = z.object({
69
- description: z.nullable(z.string()).optional(),
70
- type: z.literal("articles").default("articles"),
71
- });
72
-
73
- /**
74
- * @internal
75
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
76
- */
77
- export namespace BenefitArticlesUpdate$ {
78
- /** @deprecated use `BenefitArticlesUpdate$inboundSchema` instead. */
79
- export const inboundSchema = BenefitArticlesUpdate$inboundSchema;
80
- /** @deprecated use `BenefitArticlesUpdate$outboundSchema` instead. */
81
- export const outboundSchema = BenefitArticlesUpdate$outboundSchema;
82
- /** @deprecated use `BenefitArticlesUpdate$Outbound` instead. */
83
- export type Outbound = BenefitArticlesUpdate$Outbound;
84
- }
85
-
86
- export function benefitArticlesUpdateToJSON(
87
- benefitArticlesUpdate: BenefitArticlesUpdate,
88
- ): string {
89
- return JSON.stringify(
90
- BenefitArticlesUpdate$outboundSchema.parse(benefitArticlesUpdate),
91
- );
92
- }
93
-
94
- export function benefitArticlesUpdateFromJSON(
95
- jsonString: string,
96
- ): SafeParseResult<BenefitArticlesUpdate, SDKValidationError> {
97
- return safeParse(
98
- jsonString,
99
- (x) => BenefitArticlesUpdate$inboundSchema.parse(JSON.parse(x)),
100
- `Failed to parse 'BenefitArticlesUpdate' from JSON`,
101
- );
102
- }
@@ -1,60 +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 BenefitGrantArticlesProperties = {};
11
-
12
- /** @internal */
13
- export const BenefitGrantArticlesProperties$inboundSchema: z.ZodType<
14
- BenefitGrantArticlesProperties,
15
- z.ZodTypeDef,
16
- unknown
17
- > = z.object({});
18
-
19
- /** @internal */
20
- export type BenefitGrantArticlesProperties$Outbound = {};
21
-
22
- /** @internal */
23
- export const BenefitGrantArticlesProperties$outboundSchema: z.ZodType<
24
- BenefitGrantArticlesProperties$Outbound,
25
- z.ZodTypeDef,
26
- BenefitGrantArticlesProperties
27
- > = z.object({});
28
-
29
- /**
30
- * @internal
31
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
32
- */
33
- export namespace BenefitGrantArticlesProperties$ {
34
- /** @deprecated use `BenefitGrantArticlesProperties$inboundSchema` instead. */
35
- export const inboundSchema = BenefitGrantArticlesProperties$inboundSchema;
36
- /** @deprecated use `BenefitGrantArticlesProperties$outboundSchema` instead. */
37
- export const outboundSchema = BenefitGrantArticlesProperties$outboundSchema;
38
- /** @deprecated use `BenefitGrantArticlesProperties$Outbound` instead. */
39
- export type Outbound = BenefitGrantArticlesProperties$Outbound;
40
- }
41
-
42
- export function benefitGrantArticlesPropertiesToJSON(
43
- benefitGrantArticlesProperties: BenefitGrantArticlesProperties,
44
- ): string {
45
- return JSON.stringify(
46
- BenefitGrantArticlesProperties$outboundSchema.parse(
47
- benefitGrantArticlesProperties,
48
- ),
49
- );
50
- }
51
-
52
- export function benefitGrantArticlesPropertiesFromJSON(
53
- jsonString: string,
54
- ): SafeParseResult<BenefitGrantArticlesProperties, SDKValidationError> {
55
- return safeParse(
56
- jsonString,
57
- (x) => BenefitGrantArticlesProperties$inboundSchema.parse(JSON.parse(x)),
58
- `Failed to parse 'BenefitGrantArticlesProperties' from JSON`,
59
- );
60
- }
@@ -1,75 +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 BylineProfile = {
12
- name: string;
13
- avatarUrl: string | null;
14
- };
15
-
16
- /** @internal */
17
- export const BylineProfile$inboundSchema: z.ZodType<
18
- BylineProfile,
19
- z.ZodTypeDef,
20
- unknown
21
- > = z.object({
22
- name: z.string(),
23
- avatar_url: z.nullable(z.string()),
24
- }).transform((v) => {
25
- return remap$(v, {
26
- "avatar_url": "avatarUrl",
27
- });
28
- });
29
-
30
- /** @internal */
31
- export type BylineProfile$Outbound = {
32
- name: string;
33
- avatar_url: string | null;
34
- };
35
-
36
- /** @internal */
37
- export const BylineProfile$outboundSchema: z.ZodType<
38
- BylineProfile$Outbound,
39
- z.ZodTypeDef,
40
- BylineProfile
41
- > = z.object({
42
- name: z.string(),
43
- avatarUrl: z.nullable(z.string()),
44
- }).transform((v) => {
45
- return remap$(v, {
46
- avatarUrl: "avatar_url",
47
- });
48
- });
49
-
50
- /**
51
- * @internal
52
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
53
- */
54
- export namespace BylineProfile$ {
55
- /** @deprecated use `BylineProfile$inboundSchema` instead. */
56
- export const inboundSchema = BylineProfile$inboundSchema;
57
- /** @deprecated use `BylineProfile$outboundSchema` instead. */
58
- export const outboundSchema = BylineProfile$outboundSchema;
59
- /** @deprecated use `BylineProfile$Outbound` instead. */
60
- export type Outbound = BylineProfile$Outbound;
61
- }
62
-
63
- export function bylineProfileToJSON(bylineProfile: BylineProfile): string {
64
- return JSON.stringify(BylineProfile$outboundSchema.parse(bylineProfile));
65
- }
66
-
67
- export function bylineProfileFromJSON(
68
- jsonString: string,
69
- ): SafeParseResult<BylineProfile, SDKValidationError> {
70
- return safeParse(
71
- jsonString,
72
- (x) => BylineProfile$inboundSchema.parse(JSON.parse(x)),
73
- `Failed to parse 'BylineProfile' from JSON`,
74
- );
75
- }
@@ -1,82 +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
- import {
10
- Article,
11
- Article$inboundSchema,
12
- Article$Outbound,
13
- Article$outboundSchema,
14
- } from "./article.js";
15
- import {
16
- Pagination,
17
- Pagination$inboundSchema,
18
- Pagination$Outbound,
19
- Pagination$outboundSchema,
20
- } from "./pagination.js";
21
-
22
- export type ListResourceArticle = {
23
- items: Array<Article>;
24
- pagination: Pagination;
25
- };
26
-
27
- /** @internal */
28
- export const ListResourceArticle$inboundSchema: z.ZodType<
29
- ListResourceArticle,
30
- z.ZodTypeDef,
31
- unknown
32
- > = z.object({
33
- items: z.array(Article$inboundSchema),
34
- pagination: Pagination$inboundSchema,
35
- });
36
-
37
- /** @internal */
38
- export type ListResourceArticle$Outbound = {
39
- items: Array<Article$Outbound>;
40
- pagination: Pagination$Outbound;
41
- };
42
-
43
- /** @internal */
44
- export const ListResourceArticle$outboundSchema: z.ZodType<
45
- ListResourceArticle$Outbound,
46
- z.ZodTypeDef,
47
- ListResourceArticle
48
- > = z.object({
49
- items: z.array(Article$outboundSchema),
50
- pagination: Pagination$outboundSchema,
51
- });
52
-
53
- /**
54
- * @internal
55
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
56
- */
57
- export namespace ListResourceArticle$ {
58
- /** @deprecated use `ListResourceArticle$inboundSchema` instead. */
59
- export const inboundSchema = ListResourceArticle$inboundSchema;
60
- /** @deprecated use `ListResourceArticle$outboundSchema` instead. */
61
- export const outboundSchema = ListResourceArticle$outboundSchema;
62
- /** @deprecated use `ListResourceArticle$Outbound` instead. */
63
- export type Outbound = ListResourceArticle$Outbound;
64
- }
65
-
66
- export function listResourceArticleToJSON(
67
- listResourceArticle: ListResourceArticle,
68
- ): string {
69
- return JSON.stringify(
70
- ListResourceArticle$outboundSchema.parse(listResourceArticle),
71
- );
72
- }
73
-
74
- export function listResourceArticleFromJSON(
75
- jsonString: string,
76
- ): SafeParseResult<ListResourceArticle, SDKValidationError> {
77
- return safeParse(
78
- jsonString,
79
- (x) => ListResourceArticle$inboundSchema.parse(JSON.parse(x)),
80
- `Failed to parse 'ListResourceArticle' from JSON`,
81
- );
82
- }
@@ -1,102 +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 FileNotFoundError = {
9
- FileNotFound: "FileNotFound",
10
- } as const;
11
- export type FileNotFoundError = ClosedEnum<typeof FileNotFoundError>;
12
-
13
- export type FileNotFoundData = {
14
- error: "FileNotFound";
15
- detail: string;
16
- };
17
-
18
- export class FileNotFound extends Error {
19
- error: "FileNotFound";
20
- detail: string;
21
-
22
- /** The original data that was passed to this error instance. */
23
- data$: FileNotFoundData;
24
-
25
- constructor(err: FileNotFoundData) {
26
- const message = "message" in err && typeof err.message === "string"
27
- ? err.message
28
- : `API error occurred: ${JSON.stringify(err)}`;
29
- super(message);
30
- this.data$ = err;
31
-
32
- this.error = err.error;
33
- this.detail = err.detail;
34
-
35
- this.name = "FileNotFound";
36
- }
37
- }
38
-
39
- /** @internal */
40
- export const FileNotFoundError$inboundSchema: z.ZodNativeEnum<
41
- typeof FileNotFoundError
42
- > = z.nativeEnum(FileNotFoundError);
43
-
44
- /** @internal */
45
- export const FileNotFoundError$outboundSchema: z.ZodNativeEnum<
46
- typeof FileNotFoundError
47
- > = FileNotFoundError$inboundSchema;
48
-
49
- /**
50
- * @internal
51
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
52
- */
53
- export namespace FileNotFoundError$ {
54
- /** @deprecated use `FileNotFoundError$inboundSchema` instead. */
55
- export const inboundSchema = FileNotFoundError$inboundSchema;
56
- /** @deprecated use `FileNotFoundError$outboundSchema` instead. */
57
- export const outboundSchema = FileNotFoundError$outboundSchema;
58
- }
59
-
60
- /** @internal */
61
- export const FileNotFound$inboundSchema: z.ZodType<
62
- FileNotFound,
63
- z.ZodTypeDef,
64
- unknown
65
- > = z.object({
66
- error: z.literal("FileNotFound"),
67
- detail: z.string(),
68
- })
69
- .transform((v) => {
70
- return new FileNotFound(v);
71
- });
72
-
73
- /** @internal */
74
- export type FileNotFound$Outbound = {
75
- error: "FileNotFound";
76
- detail: string;
77
- };
78
-
79
- /** @internal */
80
- export const FileNotFound$outboundSchema: z.ZodType<
81
- FileNotFound$Outbound,
82
- z.ZodTypeDef,
83
- FileNotFound
84
- > = z.instanceof(FileNotFound)
85
- .transform(v => v.data$)
86
- .pipe(z.object({
87
- error: z.literal("FileNotFound").default("FileNotFound"),
88
- detail: z.string(),
89
- }));
90
-
91
- /**
92
- * @internal
93
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
94
- */
95
- export namespace FileNotFound$ {
96
- /** @deprecated use `FileNotFound$inboundSchema` instead. */
97
- export const inboundSchema = FileNotFound$inboundSchema;
98
- /** @deprecated use `FileNotFound$outboundSchema` instead. */
99
- export const outboundSchema = FileNotFound$outboundSchema;
100
- /** @deprecated use `FileNotFound$Outbound` instead. */
101
- export type Outbound = FileNotFound$Outbound;
102
- }