@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,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
- }
@@ -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
- }