@polar-sh/sdk 0.6.1 → 0.7.1

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 (249) hide show
  1. package/README.md +39 -39
  2. package/docs/sdks/advertisements/README.md +7 -7
  3. package/docs/sdks/articles/README.md +12 -14
  4. package/docs/sdks/benefits/README.md +10 -12
  5. package/docs/sdks/checkouts/README.md +7 -7
  6. package/docs/sdks/clients/README.md +10 -10
  7. package/docs/sdks/downloadables/README.md +7 -7
  8. package/docs/sdks/externalorganizations/README.md +1 -1
  9. package/docs/sdks/files/README.md +4 -6
  10. package/docs/sdks/licensekeys/README.md +9 -9
  11. package/docs/sdks/metrics/README.md +13 -13
  12. package/docs/sdks/oauth2/README.md +4 -4
  13. package/docs/sdks/orders/README.md +8 -8
  14. package/docs/sdks/organizations/README.md +9 -9
  15. package/docs/sdks/polaradvertisements/README.md +10 -12
  16. package/docs/sdks/polarbenefits/README.md +7 -7
  17. package/docs/sdks/polarlicensekeys/README.md +9 -11
  18. package/docs/sdks/polarorders/README.md +8 -8
  19. package/docs/sdks/polarsubscriptions/README.md +10 -10
  20. package/docs/sdks/products/README.md +10 -10
  21. package/docs/sdks/repositories/README.md +8 -8
  22. package/docs/sdks/subscriptions/README.md +4 -4
  23. package/funcs/{organizationsRetrieve.d.ts → advertisementsGet.d.ts} +4 -4
  24. package/funcs/{checkoutsRetrieve.d.ts.map → advertisementsGet.d.ts.map} +1 -1
  25. package/funcs/{advertisementsRetrieve.js → advertisementsGet.js} +3 -3
  26. package/funcs/advertisementsGet.js.map +1 -0
  27. package/funcs/{articlesRetrieve.d.ts → articlesGet.d.ts} +2 -2
  28. package/funcs/articlesGet.d.ts.map +1 -0
  29. package/funcs/{articlesRetrieve.js → articlesGet.js} +3 -3
  30. package/funcs/articlesGet.js.map +1 -0
  31. package/funcs/{benefitsRetrieve.d.ts → benefitsGet.d.ts} +2 -2
  32. package/funcs/benefitsGet.d.ts.map +1 -0
  33. package/funcs/{benefitsRetrieve.js → benefitsGet.js} +3 -3
  34. package/funcs/benefitsGet.js.map +1 -0
  35. package/funcs/checkoutsGet.d.ts +17 -0
  36. package/funcs/checkoutsGet.d.ts.map +1 -0
  37. package/funcs/{checkoutsRetrieve.js → checkoutsGet.js} +3 -3
  38. package/funcs/checkoutsGet.js.map +1 -0
  39. package/funcs/{checkoutsRetrieve.d.ts → licenseKeysGet.d.ts} +4 -4
  40. package/funcs/licenseKeysGet.d.ts.map +1 -0
  41. package/funcs/{licenseKeysRetrieve.js → licenseKeysGet.js} +3 -3
  42. package/funcs/licenseKeysGet.js.map +1 -0
  43. package/funcs/{metricsRetrieve.d.ts → metricsGet.d.ts} +2 -2
  44. package/funcs/metricsGet.d.ts.map +1 -0
  45. package/funcs/{metricsRetrieve.js → metricsGet.js} +3 -3
  46. package/funcs/metricsGet.js.map +1 -0
  47. package/funcs/{usersAdvertisementsRetrieve.d.ts → oauth2ClientsGet.d.ts} +4 -5
  48. package/funcs/oauth2ClientsGet.d.ts.map +1 -0
  49. package/funcs/{oauth2ClientsRetrieve.js → oauth2ClientsGet.js} +3 -3
  50. package/funcs/oauth2ClientsGet.js.map +1 -0
  51. package/funcs/{ordersRetrieve.d.ts → ordersGet.d.ts} +2 -2
  52. package/funcs/ordersGet.d.ts.map +1 -0
  53. package/funcs/{ordersRetrieve.js → ordersGet.js} +3 -3
  54. package/funcs/ordersGet.js.map +1 -0
  55. package/funcs/organizationsGet.d.ts +17 -0
  56. package/funcs/{articlesRetrieve.d.ts.map → organizationsGet.d.ts.map} +1 -1
  57. package/funcs/{organizationsRetrieve.js → organizationsGet.js} +3 -3
  58. package/funcs/organizationsGet.js.map +1 -0
  59. package/funcs/{productsRetrieve.d.ts → productsGet.d.ts} +2 -2
  60. package/funcs/productsGet.d.ts.map +1 -0
  61. package/funcs/{productsRetrieve.js → productsGet.js} +3 -3
  62. package/funcs/productsGet.js.map +1 -0
  63. package/funcs/{repositoriesRetrieve.d.ts → repositoriesGet.d.ts} +2 -2
  64. package/funcs/{metricsRetrieve.d.ts.map → repositoriesGet.d.ts.map} +1 -1
  65. package/funcs/{repositoriesRetrieve.js → repositoriesGet.js} +3 -3
  66. package/funcs/repositoriesGet.js.map +1 -0
  67. package/funcs/subscriptionsImportSubscriptions.d.ts.map +1 -1
  68. package/funcs/subscriptionsImportSubscriptions.js +7 -0
  69. package/funcs/subscriptionsImportSubscriptions.js.map +1 -1
  70. package/funcs/{advertisementsRetrieve.d.ts → usersAdvertisementsGet.d.ts} +3 -3
  71. package/funcs/{advertisementsRetrieve.d.ts.map → usersAdvertisementsGet.d.ts.map} +1 -1
  72. package/funcs/{usersAdvertisementsRetrieve.js → usersAdvertisementsGet.js} +3 -3
  73. package/funcs/{advertisementsRetrieve.js.map → usersAdvertisementsGet.js.map} +1 -1
  74. package/funcs/{usersBenefitsRetrieve.d.ts → usersBenefitsGet.d.ts} +2 -2
  75. package/funcs/{benefitsRetrieve.d.ts.map → usersBenefitsGet.d.ts.map} +1 -1
  76. package/funcs/{usersBenefitsRetrieve.js → usersBenefitsGet.js} +3 -3
  77. package/funcs/usersBenefitsGet.js.map +1 -0
  78. package/funcs/{usersDownloadablesRetrieve.d.ts → usersDownloadablesGet.d.ts} +2 -2
  79. package/funcs/usersDownloadablesGet.d.ts.map +1 -0
  80. package/funcs/{usersDownloadablesRetrieve.js → usersDownloadablesGet.js} +3 -3
  81. package/funcs/usersDownloadablesGet.js.map +1 -0
  82. package/funcs/{licenseKeysRetrieve.d.ts → usersLicenseKeysGet.d.ts} +2 -2
  83. package/funcs/{licenseKeysRetrieve.d.ts.map → usersLicenseKeysGet.d.ts.map} +1 -1
  84. package/funcs/{usersLicenseKeysRetrieve.js → usersLicenseKeysGet.js} +3 -3
  85. package/funcs/{licenseKeysRetrieve.js.map → usersLicenseKeysGet.js.map} +1 -1
  86. package/funcs/{usersOrdersRetrieve.d.ts → usersOrdersGet.d.ts} +2 -2
  87. package/funcs/{ordersRetrieve.d.ts.map → usersOrdersGet.d.ts.map} +1 -1
  88. package/funcs/{usersOrdersRetrieve.js → usersOrdersGet.js} +3 -3
  89. package/funcs/usersOrdersGet.js.map +1 -0
  90. package/funcs/{usersSubscriptionsRetrieve.d.ts → usersSubscriptionsGet.d.ts} +2 -2
  91. package/funcs/{organizationsRetrieve.d.ts.map → usersSubscriptionsGet.d.ts.map} +1 -1
  92. package/funcs/{usersSubscriptionsRetrieve.js → usersSubscriptionsGet.js} +3 -3
  93. package/funcs/{organizationsRetrieve.js.map → usersSubscriptionsGet.js.map} +1 -1
  94. package/index.d.ts +1 -0
  95. package/index.d.ts.map +1 -1
  96. package/index.js +14 -0
  97. package/index.js.map +1 -1
  98. package/lib/config.d.ts +3 -3
  99. package/lib/config.js +3 -3
  100. package/lib/files.d.ts +8 -0
  101. package/lib/files.d.ts.map +1 -0
  102. package/lib/files.js +36 -0
  103. package/lib/files.js.map +1 -0
  104. package/lib/sdks.d.ts.map +1 -1
  105. package/lib/sdks.js +12 -0
  106. package/lib/sdks.js.map +1 -1
  107. package/models/components/bodysubscriptionsimport.d.ts +2 -2
  108. package/models/components/bodysubscriptionsimport.d.ts.map +1 -1
  109. package/models/components/bodysubscriptionsimport.js +12 -3
  110. package/models/components/bodysubscriptionsimport.js.map +1 -1
  111. package/package.json +2 -1
  112. package/sdk/advertisements.d.ts +1 -1
  113. package/sdk/advertisements.d.ts.map +1 -1
  114. package/sdk/advertisements.js +3 -3
  115. package/sdk/advertisements.js.map +1 -1
  116. package/sdk/articles.d.ts +1 -1
  117. package/sdk/articles.d.ts.map +1 -1
  118. package/sdk/articles.js +3 -3
  119. package/sdk/articles.js.map +1 -1
  120. package/sdk/benefits.d.ts +1 -1
  121. package/sdk/benefits.d.ts.map +1 -1
  122. package/sdk/benefits.js +3 -3
  123. package/sdk/benefits.js.map +1 -1
  124. package/sdk/checkouts.d.ts +1 -1
  125. package/sdk/checkouts.d.ts.map +1 -1
  126. package/sdk/checkouts.js +3 -3
  127. package/sdk/checkouts.js.map +1 -1
  128. package/sdk/clients.d.ts +1 -1
  129. package/sdk/clients.d.ts.map +1 -1
  130. package/sdk/clients.js +3 -3
  131. package/sdk/clients.js.map +1 -1
  132. package/sdk/downloadables.d.ts +1 -1
  133. package/sdk/downloadables.d.ts.map +1 -1
  134. package/sdk/downloadables.js +3 -3
  135. package/sdk/downloadables.js.map +1 -1
  136. package/sdk/licensekeys.d.ts +1 -1
  137. package/sdk/licensekeys.d.ts.map +1 -1
  138. package/sdk/licensekeys.js +3 -3
  139. package/sdk/licensekeys.js.map +1 -1
  140. package/sdk/metrics.d.ts +1 -1
  141. package/sdk/metrics.d.ts.map +1 -1
  142. package/sdk/metrics.js +3 -3
  143. package/sdk/metrics.js.map +1 -1
  144. package/sdk/orders.d.ts +1 -1
  145. package/sdk/orders.d.ts.map +1 -1
  146. package/sdk/orders.js +3 -3
  147. package/sdk/orders.js.map +1 -1
  148. package/sdk/organizations.d.ts +1 -1
  149. package/sdk/organizations.d.ts.map +1 -1
  150. package/sdk/organizations.js +3 -3
  151. package/sdk/organizations.js.map +1 -1
  152. package/sdk/polaradvertisements.d.ts +1 -1
  153. package/sdk/polaradvertisements.d.ts.map +1 -1
  154. package/sdk/polaradvertisements.js +3 -3
  155. package/sdk/polaradvertisements.js.map +1 -1
  156. package/sdk/polarbenefits.d.ts +1 -1
  157. package/sdk/polarbenefits.d.ts.map +1 -1
  158. package/sdk/polarbenefits.js +3 -3
  159. package/sdk/polarbenefits.js.map +1 -1
  160. package/sdk/polarlicensekeys.d.ts +1 -1
  161. package/sdk/polarlicensekeys.d.ts.map +1 -1
  162. package/sdk/polarlicensekeys.js +3 -3
  163. package/sdk/polarlicensekeys.js.map +1 -1
  164. package/sdk/polarorders.d.ts +1 -1
  165. package/sdk/polarorders.d.ts.map +1 -1
  166. package/sdk/polarorders.js +3 -3
  167. package/sdk/polarorders.js.map +1 -1
  168. package/sdk/polarsubscriptions.d.ts +1 -1
  169. package/sdk/polarsubscriptions.d.ts.map +1 -1
  170. package/sdk/polarsubscriptions.js +3 -3
  171. package/sdk/polarsubscriptions.js.map +1 -1
  172. package/sdk/products.d.ts +1 -1
  173. package/sdk/products.d.ts.map +1 -1
  174. package/sdk/products.js +3 -3
  175. package/sdk/products.js.map +1 -1
  176. package/sdk/repositories.d.ts +1 -1
  177. package/sdk/repositories.d.ts.map +1 -1
  178. package/sdk/repositories.js +3 -3
  179. package/sdk/repositories.js.map +1 -1
  180. package/src/funcs/{advertisementsRetrieve.ts → advertisementsGet.ts} +1 -1
  181. package/src/funcs/{articlesRetrieve.ts → articlesGet.ts} +1 -1
  182. package/src/funcs/{benefitsRetrieve.ts → benefitsGet.ts} +1 -1
  183. package/src/funcs/{checkoutsRetrieve.ts → checkoutsGet.ts} +1 -1
  184. package/src/funcs/{licenseKeysRetrieve.ts → licenseKeysGet.ts} +1 -1
  185. package/src/funcs/{metricsRetrieve.ts → metricsGet.ts} +1 -1
  186. package/src/funcs/{oauth2ClientsRetrieve.ts → oauth2ClientsGet.ts} +1 -1
  187. package/src/funcs/{ordersRetrieve.ts → ordersGet.ts} +1 -1
  188. package/src/funcs/{organizationsRetrieve.ts → organizationsGet.ts} +1 -1
  189. package/src/funcs/{productsRetrieve.ts → productsGet.ts} +1 -1
  190. package/src/funcs/{repositoriesRetrieve.ts → repositoriesGet.ts} +1 -1
  191. package/src/funcs/subscriptionsImportSubscriptions.ts +6 -0
  192. package/src/funcs/{usersAdvertisementsRetrieve.ts → usersAdvertisementsGet.ts} +1 -1
  193. package/src/funcs/{usersBenefitsRetrieve.ts → usersBenefitsGet.ts} +1 -1
  194. package/src/funcs/{usersDownloadablesRetrieve.ts → usersDownloadablesGet.ts} +1 -1
  195. package/src/funcs/{usersLicenseKeysRetrieve.ts → usersLicenseKeysGet.ts} +1 -1
  196. package/src/funcs/{usersOrdersRetrieve.ts → usersOrdersGet.ts} +1 -1
  197. package/src/funcs/{usersSubscriptionsRetrieve.ts → usersSubscriptionsGet.ts} +1 -1
  198. package/src/index.ts +1 -0
  199. package/src/lib/config.ts +3 -3
  200. package/src/lib/files.ts +40 -0
  201. package/src/lib/sdks.ts +12 -0
  202. package/src/models/components/bodysubscriptionsimport.ts +14 -5
  203. package/src/sdk/advertisements.ts +3 -3
  204. package/src/sdk/articles.ts +3 -3
  205. package/src/sdk/benefits.ts +3 -3
  206. package/src/sdk/checkouts.ts +3 -3
  207. package/src/sdk/clients.ts +3 -3
  208. package/src/sdk/downloadables.ts +3 -3
  209. package/src/sdk/licensekeys.ts +3 -3
  210. package/src/sdk/metrics.ts +3 -3
  211. package/src/sdk/orders.ts +3 -3
  212. package/src/sdk/organizations.ts +3 -3
  213. package/src/sdk/polaradvertisements.ts +3 -3
  214. package/src/sdk/polarbenefits.ts +3 -3
  215. package/src/sdk/polarlicensekeys.ts +3 -3
  216. package/src/sdk/polarorders.ts +3 -3
  217. package/src/sdk/polarsubscriptions.ts +3 -3
  218. package/src/sdk/products.ts +3 -3
  219. package/src/sdk/repositories.ts +3 -3
  220. package/src/types/streams.ts +21 -0
  221. package/types/streams.d.ts +2 -0
  222. package/types/streams.d.ts.map +1 -0
  223. package/types/streams.js +18 -0
  224. package/types/streams.js.map +1 -0
  225. package/funcs/articlesRetrieve.js.map +0 -1
  226. package/funcs/benefitsRetrieve.js.map +0 -1
  227. package/funcs/checkoutsRetrieve.js.map +0 -1
  228. package/funcs/metricsRetrieve.js.map +0 -1
  229. package/funcs/oauth2ClientsRetrieve.d.ts +0 -16
  230. package/funcs/oauth2ClientsRetrieve.d.ts.map +0 -1
  231. package/funcs/oauth2ClientsRetrieve.js.map +0 -1
  232. package/funcs/ordersRetrieve.js.map +0 -1
  233. package/funcs/productsRetrieve.d.ts.map +0 -1
  234. package/funcs/productsRetrieve.js.map +0 -1
  235. package/funcs/repositoriesRetrieve.d.ts.map +0 -1
  236. package/funcs/repositoriesRetrieve.js.map +0 -1
  237. package/funcs/usersAdvertisementsRetrieve.d.ts.map +0 -1
  238. package/funcs/usersAdvertisementsRetrieve.js.map +0 -1
  239. package/funcs/usersBenefitsRetrieve.d.ts.map +0 -1
  240. package/funcs/usersBenefitsRetrieve.js.map +0 -1
  241. package/funcs/usersDownloadablesRetrieve.d.ts.map +0 -1
  242. package/funcs/usersDownloadablesRetrieve.js.map +0 -1
  243. package/funcs/usersLicenseKeysRetrieve.d.ts +0 -17
  244. package/funcs/usersLicenseKeysRetrieve.d.ts.map +0 -1
  245. package/funcs/usersLicenseKeysRetrieve.js.map +0 -1
  246. package/funcs/usersOrdersRetrieve.d.ts.map +0 -1
  247. package/funcs/usersOrdersRetrieve.js.map +0 -1
  248. package/funcs/usersSubscriptionsRetrieve.d.ts.map +0 -1
  249. package/funcs/usersSubscriptionsRetrieve.js.map +0 -1
@@ -28,7 +28,7 @@ import { Result } from "../types/fp.js";
28
28
  * @remarks
29
29
  * Get a benefit by ID.
30
30
  */
31
- export async function benefitsRetrieve(
31
+ export async function benefitsGet(
32
32
  client$: PolarCore,
33
33
  request: operations.BenefitsGetRequest,
34
34
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get an active checkout session by ID.
31
31
  */
32
- export async function checkoutsRetrieve(
32
+ export async function checkoutsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.CheckoutsGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get a license key.
31
31
  */
32
- export async function licenseKeysRetrieve(
32
+ export async function licenseKeysGet(
33
33
  client$: PolarCore,
34
34
  request: operations.LicenseKeysGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get metrics about your orders and subscriptions.
31
31
  */
32
- export async function metricsRetrieve(
32
+ export async function metricsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.MetricsGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import * as z from "zod";
29
29
  * @remarks
30
30
  * Get an OAuth2 client by Client ID.
31
31
  */
32
- export async function oauth2ClientsRetrieve(
32
+ export async function oauth2ClientsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.Oauth2ClientsOauth2GetClientRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get an order by ID.
31
31
  */
32
- export async function ordersRetrieve(
32
+ export async function ordersGet(
33
33
  client$: PolarCore,
34
34
  request: operations.OrdersGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get an organization by ID.
31
31
  */
32
- export async function organizationsRetrieve(
32
+ export async function organizationsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.OrganizationsGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get a product by ID.
31
31
  */
32
- export async function productsRetrieve(
32
+ export async function productsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.ProductsGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get a repository by ID.
31
31
  */
32
- export async function repositoriesRetrieve(
32
+ export async function repositoriesGet(
33
33
  client$: PolarCore,
34
34
  request: operations.RepositoriesGetRequest,
35
35
  options?: RequestOptions
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { PolarCore } from "../core.js";
6
+ import { readableStreamToArrayBuffer } from "../lib/files.js";
6
7
  import * as m$ from "../lib/matchers.js";
7
8
  import * as schemas$ from "../lib/schemas.js";
8
9
  import { RequestOptions } from "../lib/sdks.js";
@@ -21,6 +22,7 @@ import { SDKError } from "../models/errors/sdkerror.js";
21
22
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
23
  import { isBlobLike } from "../types/blobs.js";
23
24
  import { Result } from "../types/fp.js";
25
+ import { isReadableStream } from "../types/streams.js";
24
26
 
25
27
  /**
26
28
  * Import Subscriptions
@@ -60,6 +62,10 @@ export async function subscriptionsImportSubscriptions(
60
62
 
61
63
  if (isBlobLike(payload$.file)) {
62
64
  body$.append("file", payload$.file);
65
+ } else if (isReadableStream(payload$.file.content)) {
66
+ const buffer = await readableStreamToArrayBuffer(payload$.file.content);
67
+ const blob = new Blob([buffer], { type: "application/octet-stream" });
68
+ body$.append("file", blob);
63
69
  } else {
64
70
  body$.append(
65
71
  "file",
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get an advertisement campaign by ID.
31
31
  */
32
- export async function usersAdvertisementsRetrieve(
32
+ export async function usersAdvertisementsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.UsersAdvertisementsGetRequest,
35
35
  options?: RequestOptions
@@ -28,7 +28,7 @@ import { Result } from "../types/fp.js";
28
28
  * @remarks
29
29
  * Get a granted benefit by ID.
30
30
  */
31
- export async function usersBenefitsRetrieve(
31
+ export async function usersBenefitsGet(
32
32
  client$: PolarCore,
33
33
  request: operations.UsersBenefitsGetRequest,
34
34
  options?: RequestOptions
@@ -26,7 +26,7 @@ import * as z from "zod";
26
26
  /**
27
27
  * Get Downloadable
28
28
  */
29
- export async function usersDownloadablesRetrieve(
29
+ export async function usersDownloadablesGet(
30
30
  client$: PolarCore,
31
31
  request: operations.UsersDownloadablesGetRequest,
32
32
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get a license key.
31
31
  */
32
- export async function usersLicenseKeysRetrieve(
32
+ export async function usersLicenseKeysGet(
33
33
  client$: PolarCore,
34
34
  request: operations.UsersLicenseKeysGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get an order by ID.
31
31
  */
32
- export async function usersOrdersRetrieve(
32
+ export async function usersOrdersGet(
33
33
  client$: PolarCore,
34
34
  request: operations.UsersOrdersGetRequest,
35
35
  options?: RequestOptions
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * @remarks
30
30
  * Get a subscription by ID.
31
31
  */
32
- export async function usersSubscriptionsRetrieve(
32
+ export async function usersSubscriptionsGet(
33
33
  client$: PolarCore,
34
34
  request: operations.UsersSubscriptionsGetRequest,
35
35
  options?: RequestOptions
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@
4
4
 
5
5
  export * from "./sdk/sdk.js";
6
6
  export * from "./lib/config.js";
7
+ export * as files from "./lib/files.js";
package/src/lib/config.ts CHANGED
@@ -52,7 +52,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
52
52
  export const SDK_METADATA = {
53
53
  language: "typescript",
54
54
  openapiDocVersion: "0.1.0",
55
- sdkVersion: "0.6.1",
56
- genVersion: "2.407.2",
57
- userAgent: "speakeasy-sdk/typescript 0.6.1 2.407.2 0.1.0 @polar-sh/sdk",
55
+ sdkVersion: "0.7.1",
56
+ genVersion: "2.409.8",
57
+ userAgent: "speakeasy-sdk/typescript 0.7.1 2.409.8 0.1.0 @polar-sh/sdk",
58
58
  } as const;
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ /**
6
+ * Consumes a stream and returns a concatenated array buffer. Useful in
7
+ * situations where we need to read the whole file because it forms part of a
8
+ * larger payload containing other fields, and we can't modify the underlying
9
+ * request structure.
10
+ */
11
+ export async function readableStreamToArrayBuffer(
12
+ readable: ReadableStream<Uint8Array>,
13
+ ): Promise<ArrayBuffer> {
14
+ const reader = readable.getReader();
15
+ const chunks: Uint8Array[] = [];
16
+
17
+ let totalLength = 0;
18
+ let done = false;
19
+
20
+ while (!done) {
21
+ const { value, done: doneReading } = await reader.read();
22
+
23
+ if (doneReading) {
24
+ done = true;
25
+ } else {
26
+ chunks.push(value);
27
+ totalLength += value.length;
28
+ }
29
+ }
30
+
31
+ const concatenatedChunks = new Uint8Array(totalLength);
32
+ let offset = 0;
33
+
34
+ for (const chunk of chunks) {
35
+ concatenatedChunks.set(chunk, offset);
36
+ offset += chunk.length;
37
+ }
38
+
39
+ return concatenatedChunks.buffer;
40
+ }
package/src/lib/sdks.ts CHANGED
@@ -185,6 +185,18 @@ export class ClientSDK {
185
185
  }
186
186
  }
187
187
 
188
+ if (conf.body instanceof ReadableStream) {
189
+ if (!fetchOptions) {
190
+ fetchOptions = {
191
+ // @ts-expect-error see https://github.com/node-fetch/node-fetch/issues/1769
192
+ duplex: "half",
193
+ };
194
+ } else {
195
+ // @ts-expect-error see https://github.com/node-fetch/node-fetch/issues/1769
196
+ fetchOptions.duplex = "half";
197
+ }
198
+ }
199
+
188
200
  let input;
189
201
  try {
190
202
  input = this.hooks$.beforeCreateRequest(context, {
@@ -2,14 +2,13 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
- import * as b64$ from "../../lib/base64.js";
6
5
  import { remap as remap$ } from "../../lib/primitives.js";
7
6
  import { blobLikeSchema } from "../../types/blobs.js";
8
7
  import * as z from "zod";
9
8
 
10
9
  export type FileT = {
11
10
  fileName: string;
12
- content: Uint8Array | string;
11
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Buffer;
13
12
  };
14
13
 
15
14
  export type BodySubscriptionsImport = {
@@ -26,19 +25,29 @@ export type BodySubscriptionsImport = {
26
25
  /** @internal */
27
26
  export const FileT$inboundSchema: z.ZodType<FileT, z.ZodTypeDef, unknown> = z.object({
28
27
  fileName: z.string(),
29
- content: b64$.zodInbound,
28
+ content: z.union([
29
+ z.instanceof(ReadableStream<Uint8Array>),
30
+ z.instanceof(Blob),
31
+ z.instanceof(ArrayBuffer),
32
+ z.instanceof(Buffer),
33
+ ]),
30
34
  });
31
35
 
32
36
  /** @internal */
33
37
  export type FileT$Outbound = {
34
38
  fileName: string;
35
- content: Uint8Array;
39
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Buffer;
36
40
  };
37
41
 
38
42
  /** @internal */
39
43
  export const FileT$outboundSchema: z.ZodType<FileT$Outbound, z.ZodTypeDef, FileT> = z.object({
40
44
  fileName: z.string(),
41
- content: b64$.zodOutbound,
45
+ content: z.union([
46
+ z.instanceof(ReadableStream<Uint8Array>),
47
+ z.instanceof(Blob),
48
+ z.instanceof(ArrayBuffer),
49
+ z.instanceof(Buffer),
50
+ ]),
42
51
  });
43
52
 
44
53
  /**
@@ -2,8 +2,8 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { advertisementsGet } from "../funcs/advertisementsGet.js";
5
6
  import { advertisementsList } from "../funcs/advertisementsList.js";
6
- import { advertisementsRetrieve } from "../funcs/advertisementsRetrieve.js";
7
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
8
  import * as components from "../models/components/index.js";
9
9
  import * as operations from "../models/operations/index.js";
@@ -30,10 +30,10 @@ export class Advertisements extends ClientSDK {
30
30
  * @remarks
31
31
  * Get an advertisement campaign by ID.
32
32
  */
33
- async retrieve(
33
+ async get(
34
34
  request: operations.AdvertisementsGetRequest,
35
35
  options?: RequestOptions
36
36
  ): Promise<components.AdvertisementCampaign> {
37
- return unwrapAsync(advertisementsRetrieve(this, request, options));
37
+ return unwrapAsync(advertisementsGet(this, request, options));
38
38
  }
39
39
  }
@@ -4,10 +4,10 @@
4
4
 
5
5
  import { articlesCreate } from "../funcs/articlesCreate.js";
6
6
  import { articlesDelete } from "../funcs/articlesDelete.js";
7
+ import { articlesGet } from "../funcs/articlesGet.js";
7
8
  import { articlesList } from "../funcs/articlesList.js";
8
9
  import { articlesPreview } from "../funcs/articlesPreview.js";
9
10
  import { articlesReceivers } from "../funcs/articlesReceivers.js";
10
- import { articlesRetrieve } from "../funcs/articlesRetrieve.js";
11
11
  import { articlesSend } from "../funcs/articlesSend.js";
12
12
  import { articlesUpdate } from "../funcs/articlesUpdate.js";
13
13
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
@@ -49,11 +49,11 @@ export class Articles extends ClientSDK {
49
49
  * @remarks
50
50
  * Get an article by ID.
51
51
  */
52
- async retrieve(
52
+ async get(
53
53
  request: operations.ArticlesGetRequest,
54
54
  options?: RequestOptions
55
55
  ): Promise<components.Article> {
56
- return unwrapAsync(articlesRetrieve(this, request, options));
56
+ return unwrapAsync(articlesGet(this, request, options));
57
57
  }
58
58
 
59
59
  /**
@@ -4,9 +4,9 @@
4
4
 
5
5
  import { benefitsCreate } from "../funcs/benefitsCreate.js";
6
6
  import { benefitsDelete } from "../funcs/benefitsDelete.js";
7
+ import { benefitsGet } from "../funcs/benefitsGet.js";
7
8
  import { benefitsGrants } from "../funcs/benefitsGrants.js";
8
9
  import { benefitsList } from "../funcs/benefitsList.js";
9
- import { benefitsRetrieve } from "../funcs/benefitsRetrieve.js";
10
10
  import { benefitsUpdate } from "../funcs/benefitsUpdate.js";
11
11
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
12
12
  import * as operations from "../models/operations/index.js";
@@ -46,11 +46,11 @@ export class Benefits extends ClientSDK {
46
46
  * @remarks
47
47
  * Get a benefit by ID.
48
48
  */
49
- async retrieve(
49
+ async get(
50
50
  request: operations.BenefitsGetRequest,
51
51
  options?: RequestOptions
52
52
  ): Promise<operations.BenefitsGetResponseBenefitsGet> {
53
- return unwrapAsync(benefitsRetrieve(this, request, options));
53
+ return unwrapAsync(benefitsGet(this, request, options));
54
54
  }
55
55
 
56
56
  /**
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { checkoutsCreate } from "../funcs/checkoutsCreate.js";
6
- import { checkoutsRetrieve } from "../funcs/checkoutsRetrieve.js";
6
+ import { checkoutsGet } from "../funcs/checkoutsGet.js";
7
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
8
  import * as components from "../models/components/index.js";
9
9
  import * as operations from "../models/operations/index.js";
@@ -29,10 +29,10 @@ export class Checkouts extends ClientSDK {
29
29
  * @remarks
30
30
  * Get an active checkout session by ID.
31
31
  */
32
- async retrieve(
32
+ async get(
33
33
  request: operations.CheckoutsGetRequest,
34
34
  options?: RequestOptions
35
35
  ): Promise<components.Checkout> {
36
- return unwrapAsync(checkoutsRetrieve(this, request, options));
36
+ return unwrapAsync(checkoutsGet(this, request, options));
37
37
  }
38
38
  }
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { oauth2ClientsCreate } from "../funcs/oauth2ClientsCreate.js";
6
6
  import { oauth2ClientsDelete } from "../funcs/oauth2ClientsDelete.js";
7
+ import { oauth2ClientsGet } from "../funcs/oauth2ClientsGet.js";
7
8
  import { oauth2ClientsList } from "../funcs/oauth2ClientsList.js";
8
- import { oauth2ClientsRetrieve } from "../funcs/oauth2ClientsRetrieve.js";
9
9
  import { oauth2ClientsUpdate } from "../funcs/oauth2ClientsUpdate.js";
10
10
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
11
11
  import * as components from "../models/components/index.js";
@@ -46,11 +46,11 @@ export class Clients extends ClientSDK {
46
46
  * @remarks
47
47
  * Get an OAuth2 client by Client ID.
48
48
  */
49
- async retrieve(
49
+ async get(
50
50
  request: operations.Oauth2ClientsOauth2GetClientRequest,
51
51
  options?: RequestOptions
52
52
  ): Promise<any> {
53
- return unwrapAsync(oauth2ClientsRetrieve(this, request, options));
53
+ return unwrapAsync(oauth2ClientsGet(this, request, options));
54
54
  }
55
55
 
56
56
  /**
@@ -2,8 +2,8 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { usersDownloadablesGet } from "../funcs/usersDownloadablesGet.js";
5
6
  import { usersDownloadablesList } from "../funcs/usersDownloadablesList.js";
6
- import { usersDownloadablesRetrieve } from "../funcs/usersDownloadablesRetrieve.js";
7
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
8
  import * as operations from "../models/operations/index.js";
9
9
  import { unwrapAsync } from "../types/fp.js";
@@ -23,10 +23,10 @@ export class Downloadables extends ClientSDK {
23
23
  /**
24
24
  * Get Downloadable
25
25
  */
26
- async retrieve(
26
+ async get(
27
27
  request: operations.UsersDownloadablesGetRequest,
28
28
  options?: RequestOptions
29
29
  ): Promise<any | undefined> {
30
- return unwrapAsync(usersDownloadablesRetrieve(this, request, options));
30
+ return unwrapAsync(usersDownloadablesGet(this, request, options));
31
31
  }
32
32
  }
@@ -2,9 +2,9 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { licenseKeysGet } from "../funcs/licenseKeysGet.js";
5
6
  import { licenseKeysGetActivation } from "../funcs/licenseKeysGetActivation.js";
6
7
  import { licenseKeysList } from "../funcs/licenseKeysList.js";
7
- import { licenseKeysRetrieve } from "../funcs/licenseKeysRetrieve.js";
8
8
  import { licenseKeysUpdate } from "../funcs/licenseKeysUpdate.js";
9
9
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
10
10
  import * as components from "../models/components/index.js";
@@ -32,11 +32,11 @@ export class LicenseKeys extends ClientSDK {
32
32
  * @remarks
33
33
  * Get a license key.
34
34
  */
35
- async retrieve(
35
+ async get(
36
36
  request: operations.LicenseKeysGetRequest,
37
37
  options?: RequestOptions
38
38
  ): Promise<components.LicenseKeyWithActivations> {
39
- return unwrapAsync(licenseKeysRetrieve(this, request, options));
39
+ return unwrapAsync(licenseKeysGet(this, request, options));
40
40
  }
41
41
 
42
42
  /**
@@ -2,8 +2,8 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { metricsGet } from "../funcs/metricsGet.js";
5
6
  import { metricsLimits } from "../funcs/metricsLimits.js";
6
- import { metricsRetrieve } from "../funcs/metricsRetrieve.js";
7
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
8
  import * as components from "../models/components/index.js";
9
9
  import * as operations from "../models/operations/index.js";
@@ -16,11 +16,11 @@ export class Metrics extends ClientSDK {
16
16
  * @remarks
17
17
  * Get metrics about your orders and subscriptions.
18
18
  */
19
- async retrieve(
19
+ async get(
20
20
  request: operations.MetricsGetRequest,
21
21
  options?: RequestOptions
22
22
  ): Promise<components.MetricsResponse> {
23
- return unwrapAsync(metricsRetrieve(this, request, options));
23
+ return unwrapAsync(metricsGet(this, request, options));
24
24
  }
25
25
 
26
26
  /**
package/src/sdk/orders.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { ordersGet } from "../funcs/ordersGet.js";
5
6
  import { ordersInvoice } from "../funcs/ordersInvoice.js";
6
7
  import { ordersList } from "../funcs/ordersList.js";
7
- import { ordersRetrieve } from "../funcs/ordersRetrieve.js";
8
8
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
9
  import * as components from "../models/components/index.js";
10
10
  import * as operations from "../models/operations/index.js";
@@ -31,11 +31,11 @@ export class Orders extends ClientSDK {
31
31
  * @remarks
32
32
  * Get an order by ID.
33
33
  */
34
- async retrieve(
34
+ async get(
35
35
  request: operations.OrdersGetRequest,
36
36
  options?: RequestOptions
37
37
  ): Promise<components.OrderOutput> {
38
- return unwrapAsync(ordersRetrieve(this, request, options));
38
+ return unwrapAsync(ordersGet(this, request, options));
39
39
  }
40
40
 
41
41
  /**
@@ -3,8 +3,8 @@
3
3
  */
4
4
 
5
5
  import { organizationsCreate } from "../funcs/organizationsCreate.js";
6
+ import { organizationsGet } from "../funcs/organizationsGet.js";
6
7
  import { organizationsList } from "../funcs/organizationsList.js";
7
- import { organizationsRetrieve } from "../funcs/organizationsRetrieve.js";
8
8
  import { organizationsUpdate } from "../funcs/organizationsUpdate.js";
9
9
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
10
10
  import * as components from "../models/components/index.js";
@@ -45,11 +45,11 @@ export class Organizations extends ClientSDK {
45
45
  * @remarks
46
46
  * Get an organization by ID.
47
47
  */
48
- async retrieve(
48
+ async get(
49
49
  request: operations.OrganizationsGetRequest,
50
50
  options?: RequestOptions
51
51
  ): Promise<components.OrganizationOutput> {
52
- return unwrapAsync(organizationsRetrieve(this, request, options));
52
+ return unwrapAsync(organizationsGet(this, request, options));
53
53
  }
54
54
 
55
55
  /**
@@ -5,8 +5,8 @@
5
5
  import { usersAdvertisementsCreate } from "../funcs/usersAdvertisementsCreate.js";
6
6
  import { usersAdvertisementsDelete } from "../funcs/usersAdvertisementsDelete.js";
7
7
  import { usersAdvertisementsEnable } from "../funcs/usersAdvertisementsEnable.js";
8
+ import { usersAdvertisementsGet } from "../funcs/usersAdvertisementsGet.js";
8
9
  import { usersAdvertisementsList } from "../funcs/usersAdvertisementsList.js";
9
- import { usersAdvertisementsRetrieve } from "../funcs/usersAdvertisementsRetrieve.js";
10
10
  import { usersAdvertisementsUpdate } from "../funcs/usersAdvertisementsUpdate.js";
11
11
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
12
12
  import * as components from "../models/components/index.js";
@@ -47,11 +47,11 @@ export class PolarAdvertisements extends ClientSDK {
47
47
  * @remarks
48
48
  * Get an advertisement campaign by ID.
49
49
  */
50
- async retrieve(
50
+ async get(
51
51
  request: operations.UsersAdvertisementsGetRequest,
52
52
  options?: RequestOptions
53
53
  ): Promise<components.UserAdvertisementCampaign> {
54
- return unwrapAsync(usersAdvertisementsRetrieve(this, request, options));
54
+ return unwrapAsync(usersAdvertisementsGet(this, request, options));
55
55
  }
56
56
 
57
57
  /**
@@ -2,8 +2,8 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { usersBenefitsGet } from "../funcs/usersBenefitsGet.js";
5
6
  import { usersBenefitsList } from "../funcs/usersBenefitsList.js";
6
- import { usersBenefitsRetrieve } from "../funcs/usersBenefitsRetrieve.js";
7
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
8
  import * as operations from "../models/operations/index.js";
9
9
  import { unwrapAsync } from "../types/fp.js";
@@ -29,10 +29,10 @@ export class PolarBenefits extends ClientSDK {
29
29
  * @remarks
30
30
  * Get a granted benefit by ID.
31
31
  */
32
- async retrieve(
32
+ async get(
33
33
  request: operations.UsersBenefitsGetRequest,
34
34
  options?: RequestOptions
35
35
  ): Promise<operations.UsersBenefitsGetResponseUsersBenefitsGet> {
36
- return unwrapAsync(usersBenefitsRetrieve(this, request, options));
36
+ return unwrapAsync(usersBenefitsGet(this, request, options));
37
37
  }
38
38
  }
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { usersLicenseKeysActivate } from "../funcs/usersLicenseKeysActivate.js";
6
6
  import { usersLicenseKeysDeactivate } from "../funcs/usersLicenseKeysDeactivate.js";
7
+ import { usersLicenseKeysGet } from "../funcs/usersLicenseKeysGet.js";
7
8
  import { usersLicenseKeysList } from "../funcs/usersLicenseKeysList.js";
8
- import { usersLicenseKeysRetrieve } from "../funcs/usersLicenseKeysRetrieve.js";
9
9
  import { usersLicenseKeysValidate } from "../funcs/usersLicenseKeysValidate.js";
10
10
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
11
11
  import * as components from "../models/components/index.js";
@@ -30,11 +30,11 @@ export class PolarLicenseKeys extends ClientSDK {
30
30
  * @remarks
31
31
  * Get a license key.
32
32
  */
33
- async retrieve(
33
+ async get(
34
34
  request: operations.UsersLicenseKeysGetRequest,
35
35
  options?: RequestOptions
36
36
  ): Promise<components.LicenseKeyWithActivations> {
37
- return unwrapAsync(usersLicenseKeysRetrieve(this, request, options));
37
+ return unwrapAsync(usersLicenseKeysGet(this, request, options));
38
38
  }
39
39
 
40
40
  /**
@@ -2,9 +2,9 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { usersOrdersGet } from "../funcs/usersOrdersGet.js";
5
6
  import { usersOrdersInvoice } from "../funcs/usersOrdersInvoice.js";
6
7
  import { usersOrdersList } from "../funcs/usersOrdersList.js";
7
- import { usersOrdersRetrieve } from "../funcs/usersOrdersRetrieve.js";
8
8
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
9
  import * as components from "../models/components/index.js";
10
10
  import * as operations from "../models/operations/index.js";
@@ -31,11 +31,11 @@ export class PolarOrders extends ClientSDK {
31
31
  * @remarks
32
32
  * Get an order by ID.
33
33
  */
34
- async retrieve(
34
+ async get(
35
35
  request: operations.UsersOrdersGetRequest,
36
36
  options?: RequestOptions
37
37
  ): Promise<components.UserOrder> {
38
- return unwrapAsync(usersOrdersRetrieve(this, request, options));
38
+ return unwrapAsync(usersOrdersGet(this, request, options));
39
39
  }
40
40
 
41
41
  /**