@cloudpdf/sdk 3.0.0-next.1 → 3.0.0-next.2

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 (281) hide show
  1. package/README.md +23 -46
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +3 -0
  4. package/dist/cjs/Client.js +9 -4
  5. package/dist/cjs/CloudPDFClient.d.ts +20 -0
  6. package/dist/cjs/CloudPDFClient.js +39 -0
  7. package/dist/cjs/api/errors/ConflictError.d.ts +7 -0
  8. package/dist/cjs/api/errors/ConflictError.js +54 -0
  9. package/dist/cjs/api/errors/GoneError.d.ts +7 -0
  10. package/dist/cjs/api/errors/GoneError.js +54 -0
  11. package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +7 -0
  12. package/dist/cjs/api/errors/UnprocessableEntityError.js +54 -0
  13. package/dist/cjs/api/errors/index.d.ts +3 -0
  14. package/dist/cjs/api/errors/index.js +3 -0
  15. package/dist/cjs/api/resources/documents/client/Client.d.ts +14 -5
  16. package/dist/cjs/api/resources/documents/client/Client.js +26 -14
  17. package/dist/cjs/api/resources/documents/client/requests/DocumentsInitRequest.d.ts +7 -0
  18. package/dist/cjs/api/resources/documents/client/requests/DocumentsInitRequest.js +5 -0
  19. package/dist/cjs/api/resources/documents/client/requests/UploadProxyDocumentsRequest.d.ts +14 -0
  20. package/dist/cjs/api/resources/documents/client/requests/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/index.js +3 -1
  23. package/dist/cjs/api/resources/shares/client/Client.d.ts +119 -0
  24. package/dist/cjs/api/resources/shares/client/Client.js +422 -0
  25. package/dist/cjs/api/resources/shares/client/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/shares/client/index.js +17 -0
  27. package/dist/cjs/api/resources/shares/client/requests/DeleteSharesRequest.d.ts +11 -0
  28. package/dist/cjs/api/resources/shares/client/requests/GetSharesRequest.d.ts +11 -0
  29. package/dist/cjs/api/resources/shares/client/requests/GetSharesRequest.js +3 -0
  30. package/dist/cjs/api/resources/shares/client/requests/ListSharesRequest.d.ts +12 -0
  31. package/dist/cjs/api/resources/shares/client/requests/ListSharesRequest.js +3 -0
  32. package/dist/cjs/api/resources/shares/client/requests/SharesCreateRequest.d.ts +18 -0
  33. package/dist/cjs/api/resources/shares/client/requests/SharesCreateRequest.js +3 -0
  34. package/dist/cjs/api/resources/shares/client/requests/SharesExchangeRequest.d.ts +10 -0
  35. package/dist/cjs/api/resources/shares/client/requests/SharesExchangeRequest.js +3 -0
  36. package/dist/cjs/api/resources/shares/client/requests/SharesUpdateRequest.d.ts +17 -0
  37. package/dist/cjs/api/resources/shares/client/requests/SharesUpdateRequest.js +3 -0
  38. package/dist/cjs/api/resources/shares/client/requests/index.d.ts +6 -0
  39. package/dist/cjs/api/resources/shares/client/requests/index.js +2 -0
  40. package/dist/cjs/api/resources/shares/exports.d.ts +2 -0
  41. package/dist/cjs/api/resources/shares/exports.js +21 -0
  42. package/dist/cjs/api/resources/shares/index.d.ts +1 -0
  43. package/dist/cjs/api/resources/shares/index.js +17 -0
  44. package/dist/cjs/api/resources/tenants/client/Client.d.ts +50 -0
  45. package/dist/cjs/api/resources/tenants/client/Client.js +181 -0
  46. package/dist/cjs/api/resources/tenants/client/requests/ResumeTenantsRequest.d.ts +9 -0
  47. package/dist/cjs/api/resources/tenants/client/requests/ResumeTenantsRequest.js +3 -0
  48. package/dist/cjs/api/resources/tenants/client/requests/TenantsSuspendRequest.d.ts +10 -0
  49. package/dist/cjs/api/resources/tenants/client/requests/TenantsSuspendRequest.js +3 -0
  50. package/dist/cjs/api/resources/tenants/client/requests/UsageTenantsRequest.d.ts +10 -0
  51. package/dist/cjs/api/resources/tenants/client/requests/UsageTenantsRequest.js +3 -0
  52. package/dist/cjs/api/resources/tenants/client/requests/index.d.ts +3 -0
  53. package/dist/cjs/api/types/DocumentsInit200ResponseCreatedUpload.d.ts +3 -3
  54. package/dist/cjs/api/types/DocumentsInit200ResponseResumedUpload.d.ts +3 -3
  55. package/dist/cjs/api/types/DocumentsUploadProxy200Response.d.ts +3 -0
  56. package/dist/cjs/api/types/DocumentsUploadProxy200Response.js +3 -0
  57. package/dist/cjs/api/types/DocumentsUploadProxy400Response.d.ts +9 -0
  58. package/dist/cjs/api/types/DocumentsUploadProxy400Response.js +3 -0
  59. package/dist/cjs/api/types/DocumentsUploadProxy409Response.d.ts +9 -0
  60. package/dist/cjs/api/types/DocumentsUploadProxy409Response.js +3 -0
  61. package/dist/cjs/api/types/SharesCreate200Response.d.ts +22 -0
  62. package/dist/cjs/api/types/SharesCreate200Response.js +3 -0
  63. package/dist/cjs/api/types/SharesCreate400Response.d.ts +9 -0
  64. package/dist/cjs/api/types/SharesCreate400Response.js +3 -0
  65. package/dist/cjs/api/types/SharesCreate403Response.d.ts +9 -0
  66. package/dist/cjs/api/types/SharesCreate403Response.js +3 -0
  67. package/dist/cjs/api/types/SharesCreate404Response.d.ts +9 -0
  68. package/dist/cjs/api/types/SharesCreate404Response.js +3 -0
  69. package/dist/cjs/api/types/SharesDeleteResponse.d.ts +9 -0
  70. package/dist/cjs/api/types/SharesDeleteResponse.js +3 -0
  71. package/dist/cjs/api/types/SharesExchange200Response.d.ts +6 -0
  72. package/dist/cjs/api/types/SharesExchange200Response.js +3 -0
  73. package/dist/cjs/api/types/SharesExchange400Response.d.ts +9 -0
  74. package/dist/cjs/api/types/SharesExchange400Response.js +3 -0
  75. package/dist/cjs/api/types/SharesExchange403Response.d.ts +9 -0
  76. package/dist/cjs/api/types/SharesExchange403Response.js +3 -0
  77. package/dist/cjs/api/types/SharesExchange404Response.d.ts +9 -0
  78. package/dist/cjs/api/types/SharesExchange404Response.js +3 -0
  79. package/dist/cjs/api/types/SharesExchange410Response.d.ts +9 -0
  80. package/dist/cjs/api/types/SharesExchange410Response.js +3 -0
  81. package/dist/cjs/api/types/SharesExchange422Response.d.ts +9 -0
  82. package/dist/cjs/api/types/SharesExchange422Response.js +3 -0
  83. package/dist/cjs/api/types/SharesGet200Response.d.ts +22 -0
  84. package/dist/cjs/api/types/SharesGet200Response.js +3 -0
  85. package/dist/cjs/api/types/SharesGet404Response.d.ts +9 -0
  86. package/dist/cjs/api/types/SharesGet404Response.js +3 -0
  87. package/dist/cjs/api/types/SharesList200Response.d.ts +26 -0
  88. package/dist/cjs/api/types/SharesList200Response.js +3 -0
  89. package/dist/cjs/api/types/SharesList400Response.d.ts +9 -0
  90. package/dist/cjs/api/types/SharesList400Response.js +3 -0
  91. package/dist/cjs/api/types/SharesUpdate200Response.d.ts +22 -0
  92. package/dist/cjs/api/types/SharesUpdate200Response.js +3 -0
  93. package/dist/cjs/api/types/SharesUpdate400Response.d.ts +9 -0
  94. package/dist/cjs/api/types/SharesUpdate400Response.js +3 -0
  95. package/dist/cjs/api/types/SharesUpdate404Response.d.ts +9 -0
  96. package/dist/cjs/api/types/SharesUpdate404Response.js +3 -0
  97. package/dist/cjs/api/types/TenantsCreate200Response.d.ts +8 -0
  98. package/dist/cjs/api/types/TenantsCreate200Response.js +11 -0
  99. package/dist/cjs/api/types/TenantsGet200Response.d.ts +8 -0
  100. package/dist/cjs/api/types/TenantsGet200Response.js +11 -0
  101. package/dist/cjs/api/types/TenantsList200Response.d.ts +8 -0
  102. package/dist/cjs/api/types/TenantsList200Response.js +14 -0
  103. package/dist/cjs/api/types/TenantsResumeResponse.d.ts +9 -0
  104. package/dist/cjs/api/types/TenantsResumeResponse.js +3 -0
  105. package/dist/cjs/api/types/TenantsSuspendResponse.d.ts +9 -0
  106. package/dist/cjs/api/types/TenantsSuspendResponse.js +3 -0
  107. package/dist/cjs/api/types/TenantsUsage200Response.d.ts +13 -0
  108. package/dist/cjs/api/types/TenantsUsage200Response.js +3 -0
  109. package/dist/cjs/api/types/TenantsUsage400Response.d.ts +9 -0
  110. package/dist/cjs/api/types/TenantsUsage400Response.js +3 -0
  111. package/dist/cjs/api/types/TenantsUsage404Response.d.ts +9 -0
  112. package/dist/cjs/api/types/TenantsUsage404Response.js +3 -0
  113. package/dist/cjs/api/types/TokensIssueRequest.d.ts +2 -1
  114. package/dist/cjs/api/types/index.d.ts +26 -2
  115. package/dist/cjs/api/types/index.js +26 -2
  116. package/dist/cjs/auth/BearerAuthProvider.d.ts +1 -1
  117. package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
  118. package/dist/cjs/core/form-data-utils/FormDataWrapper.js +188 -0
  119. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  120. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
  121. package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
  122. package/dist/cjs/core/form-data-utils/index.js +20 -0
  123. package/dist/cjs/core/index.d.ts +1 -0
  124. package/dist/cjs/core/index.js +1 -0
  125. package/dist/cjs/index.d.ts +3 -1
  126. package/dist/cjs/index.js +5 -2
  127. package/dist/cjs/uploads/Uploads.d.ts +7 -0
  128. package/dist/cjs/uploads/Uploads.js +78 -0
  129. package/dist/cjs/uploads/index.d.ts +2 -0
  130. package/dist/cjs/uploads/index.js +5 -0
  131. package/dist/cjs/uploads/source.d.ts +10 -0
  132. package/dist/cjs/uploads/source.js +155 -0
  133. package/dist/cjs/uploads/types.d.ts +46 -0
  134. package/dist/cjs/uploads/types.js +2 -0
  135. package/dist/cjs/version.d.ts +1 -1
  136. package/dist/cjs/version.js +1 -1
  137. package/dist/esm/BaseClient.mjs +2 -2
  138. package/dist/esm/Client.d.mts +3 -0
  139. package/dist/esm/Client.mjs +5 -0
  140. package/dist/esm/CloudPDFClient.d.mts +20 -0
  141. package/dist/esm/CloudPDFClient.mjs +35 -0
  142. package/dist/esm/api/errors/ConflictError.d.mts +7 -0
  143. package/dist/esm/api/errors/ConflictError.mjs +17 -0
  144. package/dist/esm/api/errors/GoneError.d.mts +7 -0
  145. package/dist/esm/api/errors/GoneError.mjs +17 -0
  146. package/dist/esm/api/errors/UnprocessableEntityError.d.mts +7 -0
  147. package/dist/esm/api/errors/UnprocessableEntityError.mjs +17 -0
  148. package/dist/esm/api/errors/index.d.mts +3 -0
  149. package/dist/esm/api/errors/index.mjs +3 -0
  150. package/dist/esm/api/resources/documents/client/Client.d.mts +14 -5
  151. package/dist/esm/api/resources/documents/client/Client.mjs +27 -15
  152. package/dist/esm/api/resources/documents/client/requests/DocumentsInitRequest.d.mts +7 -0
  153. package/dist/esm/api/resources/documents/client/requests/DocumentsInitRequest.mjs +5 -0
  154. package/dist/esm/api/resources/documents/client/requests/UploadProxyDocumentsRequest.d.mts +14 -0
  155. package/dist/esm/api/resources/documents/client/requests/index.d.mts +1 -0
  156. package/dist/esm/api/resources/index.d.mts +2 -0
  157. package/dist/esm/api/resources/index.mjs +2 -0
  158. package/dist/esm/api/resources/shares/client/Client.d.mts +119 -0
  159. package/dist/esm/api/resources/shares/client/Client.mjs +385 -0
  160. package/dist/esm/api/resources/shares/client/index.d.mts +1 -0
  161. package/dist/esm/api/resources/shares/client/index.mjs +1 -0
  162. package/dist/esm/api/resources/shares/client/requests/DeleteSharesRequest.d.mts +11 -0
  163. package/dist/esm/api/resources/shares/client/requests/GetSharesRequest.d.mts +11 -0
  164. package/dist/esm/api/resources/shares/client/requests/GetSharesRequest.mjs +2 -0
  165. package/dist/esm/api/resources/shares/client/requests/ListSharesRequest.d.mts +12 -0
  166. package/dist/esm/api/resources/shares/client/requests/ListSharesRequest.mjs +2 -0
  167. package/dist/esm/api/resources/shares/client/requests/SharesCreateRequest.d.mts +18 -0
  168. package/dist/esm/api/resources/shares/client/requests/SharesCreateRequest.mjs +2 -0
  169. package/dist/esm/api/resources/shares/client/requests/SharesExchangeRequest.d.mts +10 -0
  170. package/dist/esm/api/resources/shares/client/requests/SharesExchangeRequest.mjs +2 -0
  171. package/dist/esm/api/resources/shares/client/requests/SharesUpdateRequest.d.mts +17 -0
  172. package/dist/esm/api/resources/shares/client/requests/SharesUpdateRequest.mjs +2 -0
  173. package/dist/esm/api/resources/shares/client/requests/index.d.mts +6 -0
  174. package/dist/esm/api/resources/shares/client/requests/index.mjs +1 -0
  175. package/dist/esm/api/resources/shares/exports.d.mts +2 -0
  176. package/dist/esm/api/resources/shares/exports.mjs +3 -0
  177. package/dist/esm/api/resources/shares/index.d.mts +1 -0
  178. package/dist/esm/api/resources/shares/index.mjs +1 -0
  179. package/dist/esm/api/resources/tenants/client/Client.d.mts +50 -0
  180. package/dist/esm/api/resources/tenants/client/Client.mjs +181 -0
  181. package/dist/esm/api/resources/tenants/client/requests/ResumeTenantsRequest.d.mts +9 -0
  182. package/dist/esm/api/resources/tenants/client/requests/ResumeTenantsRequest.mjs +2 -0
  183. package/dist/esm/api/resources/tenants/client/requests/TenantsSuspendRequest.d.mts +10 -0
  184. package/dist/esm/api/resources/tenants/client/requests/TenantsSuspendRequest.mjs +2 -0
  185. package/dist/esm/api/resources/tenants/client/requests/UsageTenantsRequest.d.mts +10 -0
  186. package/dist/esm/api/resources/tenants/client/requests/UsageTenantsRequest.mjs +2 -0
  187. package/dist/esm/api/resources/tenants/client/requests/index.d.mts +3 -0
  188. package/dist/esm/api/types/DocumentsInit200ResponseCreatedUpload.d.mts +3 -3
  189. package/dist/esm/api/types/DocumentsInit200ResponseResumedUpload.d.mts +3 -3
  190. package/dist/esm/api/types/DocumentsUploadProxy200Response.d.mts +3 -0
  191. package/dist/esm/api/types/DocumentsUploadProxy200Response.mjs +2 -0
  192. package/dist/esm/api/types/DocumentsUploadProxy400Response.d.mts +9 -0
  193. package/dist/esm/api/types/DocumentsUploadProxy400Response.mjs +2 -0
  194. package/dist/esm/api/types/DocumentsUploadProxy409Response.d.mts +9 -0
  195. package/dist/esm/api/types/DocumentsUploadProxy409Response.mjs +2 -0
  196. package/dist/esm/api/types/SharesCreate200Response.d.mts +22 -0
  197. package/dist/esm/api/types/SharesCreate200Response.mjs +2 -0
  198. package/dist/esm/api/types/SharesCreate400Response.d.mts +9 -0
  199. package/dist/esm/api/types/SharesCreate400Response.mjs +2 -0
  200. package/dist/esm/api/types/SharesCreate403Response.d.mts +9 -0
  201. package/dist/esm/api/types/SharesCreate403Response.mjs +2 -0
  202. package/dist/esm/api/types/SharesCreate404Response.d.mts +9 -0
  203. package/dist/esm/api/types/SharesCreate404Response.mjs +2 -0
  204. package/dist/esm/api/types/SharesDeleteResponse.d.mts +9 -0
  205. package/dist/esm/api/types/SharesDeleteResponse.mjs +2 -0
  206. package/dist/esm/api/types/SharesExchange200Response.d.mts +6 -0
  207. package/dist/esm/api/types/SharesExchange200Response.mjs +2 -0
  208. package/dist/esm/api/types/SharesExchange400Response.d.mts +9 -0
  209. package/dist/esm/api/types/SharesExchange400Response.mjs +2 -0
  210. package/dist/esm/api/types/SharesExchange403Response.d.mts +9 -0
  211. package/dist/esm/api/types/SharesExchange403Response.mjs +2 -0
  212. package/dist/esm/api/types/SharesExchange404Response.d.mts +9 -0
  213. package/dist/esm/api/types/SharesExchange404Response.mjs +2 -0
  214. package/dist/esm/api/types/SharesExchange410Response.d.mts +9 -0
  215. package/dist/esm/api/types/SharesExchange410Response.mjs +2 -0
  216. package/dist/esm/api/types/SharesExchange422Response.d.mts +9 -0
  217. package/dist/esm/api/types/SharesExchange422Response.mjs +2 -0
  218. package/dist/esm/api/types/SharesGet200Response.d.mts +22 -0
  219. package/dist/esm/api/types/SharesGet200Response.mjs +2 -0
  220. package/dist/esm/api/types/SharesGet404Response.d.mts +9 -0
  221. package/dist/esm/api/types/SharesGet404Response.mjs +2 -0
  222. package/dist/esm/api/types/SharesList200Response.d.mts +26 -0
  223. package/dist/esm/api/types/SharesList200Response.mjs +2 -0
  224. package/dist/esm/api/types/SharesList400Response.d.mts +9 -0
  225. package/dist/esm/api/types/SharesList400Response.mjs +2 -0
  226. package/dist/esm/api/types/SharesUpdate200Response.d.mts +22 -0
  227. package/dist/esm/api/types/SharesUpdate200Response.mjs +2 -0
  228. package/dist/esm/api/types/SharesUpdate400Response.d.mts +9 -0
  229. package/dist/esm/api/types/SharesUpdate400Response.mjs +2 -0
  230. package/dist/esm/api/types/SharesUpdate404Response.d.mts +9 -0
  231. package/dist/esm/api/types/SharesUpdate404Response.mjs +2 -0
  232. package/dist/esm/api/types/TenantsCreate200Response.d.mts +8 -0
  233. package/dist/esm/api/types/TenantsCreate200Response.mjs +10 -1
  234. package/dist/esm/api/types/TenantsGet200Response.d.mts +8 -0
  235. package/dist/esm/api/types/TenantsGet200Response.mjs +10 -1
  236. package/dist/esm/api/types/TenantsList200Response.d.mts +8 -0
  237. package/dist/esm/api/types/TenantsList200Response.mjs +13 -1
  238. package/dist/esm/api/types/TenantsResumeResponse.d.mts +9 -0
  239. package/dist/esm/api/types/TenantsResumeResponse.mjs +2 -0
  240. package/dist/esm/api/types/TenantsSuspendResponse.d.mts +9 -0
  241. package/dist/esm/api/types/TenantsSuspendResponse.mjs +2 -0
  242. package/dist/esm/api/types/TenantsUsage200Response.d.mts +13 -0
  243. package/dist/esm/api/types/TenantsUsage200Response.mjs +2 -0
  244. package/dist/esm/api/types/TenantsUsage400Response.d.mts +9 -0
  245. package/dist/esm/api/types/TenantsUsage400Response.mjs +2 -0
  246. package/dist/esm/api/types/TenantsUsage404Response.d.mts +9 -0
  247. package/dist/esm/api/types/TenantsUsage404Response.mjs +2 -0
  248. package/dist/esm/api/types/TokensIssueRequest.d.mts +2 -1
  249. package/dist/esm/api/types/index.d.mts +26 -2
  250. package/dist/esm/api/types/index.mjs +26 -2
  251. package/dist/esm/auth/BearerAuthProvider.d.mts +1 -1
  252. package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
  253. package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +150 -0
  254. package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
  255. package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
  256. package/dist/esm/core/form-data-utils/index.d.mts +2 -0
  257. package/dist/esm/core/form-data-utils/index.mjs +2 -0
  258. package/dist/esm/core/index.d.mts +1 -0
  259. package/dist/esm/core/index.mjs +1 -0
  260. package/dist/esm/index.d.mts +3 -1
  261. package/dist/esm/index.mjs +3 -1
  262. package/dist/esm/uploads/Uploads.d.mts +7 -0
  263. package/dist/esm/uploads/Uploads.mjs +74 -0
  264. package/dist/esm/uploads/index.d.mts +2 -0
  265. package/dist/esm/uploads/index.mjs +1 -0
  266. package/dist/esm/uploads/source.d.mts +10 -0
  267. package/dist/esm/uploads/source.mjs +119 -0
  268. package/dist/esm/uploads/types.d.mts +46 -0
  269. package/dist/esm/uploads/types.mjs +1 -0
  270. package/dist/esm/version.d.mts +1 -1
  271. package/dist/esm/version.mjs +1 -1
  272. package/package.json +188 -177
  273. package/reference.md +588 -0
  274. package/dist/cjs/api/types/DocumentsUploadDirect200Response.d.ts +0 -3
  275. package/dist/cjs/api/types/DocumentsUploadDirect400Response.d.ts +0 -9
  276. package/dist/esm/api/types/DocumentsUploadDirect200Response.d.mts +0 -3
  277. package/dist/esm/api/types/DocumentsUploadDirect400Response.d.mts +0 -9
  278. /package/dist/cjs/api/{types/DocumentsUploadDirect200Response.js → resources/documents/client/requests/UploadProxyDocumentsRequest.js} +0 -0
  279. /package/dist/cjs/api/{types/DocumentsUploadDirect400Response.js → resources/shares/client/requests/DeleteSharesRequest.js} +0 -0
  280. /package/dist/esm/api/{types/DocumentsUploadDirect200Response.mjs → resources/documents/client/requests/UploadProxyDocumentsRequest.mjs} +0 -0
  281. /package/dist/esm/api/{types/DocumentsUploadDirect400Response.mjs → resources/shares/client/requests/DeleteSharesRequest.mjs} +0 -0
package/README.md CHANGED
@@ -45,8 +45,8 @@ Instantiate and use the client with the following:
45
45
  import { CloudPDFClient } from "@cloudpdf/sdk";
46
46
 
47
47
  const client = new CloudPDFClient({ baseUrl: "YOUR_BASE_URL", token: "YOUR_TOKEN" });
48
- await client.tenants.create({
49
- id: "id"
48
+ await client.shares.exchange({
49
+ shareToken: "shareToken"
50
50
  });
51
51
  ```
52
52
 
@@ -72,7 +72,7 @@ will be thrown.
72
72
  import { CloudPDFError } from "@cloudpdf/sdk";
73
73
 
74
74
  try {
75
- await client.tenants.create(...);
75
+ await client.shares.exchange(...);
76
76
  } catch (err) {
77
77
  if (err instanceof CloudPDFError) {
78
78
  console.log(err.statusCode);
@@ -85,47 +85,24 @@ try {
85
85
 
86
86
  ## File Uploads
87
87
 
88
- You can upload files using the client:
88
+ Use the high-level upload workflow. It computes the content hash before init,
89
+ prefers a direct presigned object-store upload, and commits only after a
90
+ successful transfer:
89
91
 
90
92
  ```typescript
91
- import { createReadStream } from "fs";
92
-
93
- await client.documents.uploadDirect(createReadStream("path/to/file"), ...);
94
- await client.documents.uploadDirect(new ReadableStream(), ...);
95
- await client.documents.uploadDirect(Buffer.from('binary data'), ...);
96
- await client.documents.uploadDirect(new Blob(['binary data'], { type: 'audio/mpeg' }), ...);
97
- await client.documents.uploadDirect(new File(['binary data'], 'file.mp3'), ...);
98
- await client.documents.uploadDirect(new ArrayBuffer(8), ...);
99
- await client.documents.uploadDirect(new Uint8Array([0, 1, 2]), ...);
100
- ```
101
- The client accepts a variety of types for file upload parameters:
102
- * Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
103
- * Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
104
-
105
- ### Metadata
106
-
107
- You can configure metadata when uploading a file:
108
- ```typescript
109
- const file: Uploadable.WithMetadata = {
110
- data: createReadStream("path/to/file"),
111
- filename: "my-file", // optional
112
- contentType: "audio/mpeg", // optional
113
- contentLength: 1949, // optional
114
- };
115
- ```
116
-
117
- Alternatively, you can upload a file directly from a file path:
118
- ```typescript
119
- const file : Uploadable.FromPath = {
120
- path: "path/to/file",
121
- filename: "my-file", // optional
122
- contentType: "audio/mpeg", // optional
123
- contentLength: 1949, // optional
124
- };
93
+ const result = await client.uploads.create({
94
+ tenantId: "tenant_123",
95
+ source: { path: "invoice.pdf" },
96
+ uploadPreference: "auto",
97
+ onProgress: (loaded, total) => console.log(`${loaded}/${total}`),
98
+ });
125
99
  ```
126
100
 
127
- The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
128
- For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
101
+ `source` accepts a `Uint8Array`, `ArrayBuffer`, `Blob`, `{ path: string }`, or
102
+ a reopenable source with a known size and SHA-256. An unknown one-shot stream is
103
+ intentionally rejected: the server pins size and hash during init, before any
104
+ bytes are transferred. Set `uploadPreference: "proxy"` only when the server is
105
+ configured to allow its bounded multipart fallback.
129
106
 
130
107
 
131
108
  ## Binary Response
@@ -543,7 +520,7 @@ const client = new CloudPDFClient({
543
520
  }
544
521
  });
545
522
 
546
- const response = await client.tenants.create(..., {
523
+ const response = await client.shares.exchange(..., {
547
524
  headers: {
548
525
  'X-Custom-Header': 'custom value'
549
526
  }
@@ -555,7 +532,7 @@ const response = await client.tenants.create(..., {
555
532
  If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
556
533
 
557
534
  ```typescript
558
- const response = await client.tenants.create(..., {
535
+ const response = await client.shares.exchange(..., {
559
536
  queryParams: {
560
537
  'customQueryParamKey': 'custom query param value'
561
538
  }
@@ -585,7 +562,7 @@ Which status codes are retried depends on the `retryStatusCodes` generator confi
585
562
  Use the `maxRetries` request option to configure this behavior.
586
563
 
587
564
  ```typescript
588
- const response = await client.tenants.create(..., {
565
+ const response = await client.shares.exchange(..., {
589
566
  maxRetries: 0 // override maxRetries at the request level
590
567
  });
591
568
  ```
@@ -595,7 +572,7 @@ const response = await client.tenants.create(..., {
595
572
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
596
573
 
597
574
  ```typescript
598
- const response = await client.tenants.create(..., {
575
+ const response = await client.shares.exchange(..., {
599
576
  timeoutInSeconds: 30 // override timeout to 30s
600
577
  });
601
578
  ```
@@ -606,7 +583,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
606
583
 
607
584
  ```typescript
608
585
  const controller = new AbortController();
609
- const response = await client.tenants.create(..., {
586
+ const response = await client.shares.exchange(..., {
610
587
  abortSignal: controller.signal
611
588
  });
612
589
  controller.abort(); // aborts the request
@@ -618,7 +595,7 @@ The SDK provides access to raw response data, including headers, through the `.w
618
595
  The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
619
596
 
620
597
  ```typescript
621
- const { data, rawResponse } = await client.tenants.create(...).withRawResponse();
598
+ const { data, rawResponse } = await client.shares.exchange(...).withRawResponse();
622
599
 
623
600
  console.log(data);
624
601
  console.log(rawResponse.headers['X-My-Header']);
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@cloudpdf/sdk",
46
- "X-Fern-SDK-Version": "3.0.0-next.1",
47
- "User-Agent": "@cloudpdf/sdk/3.0.0-next.1",
46
+ "X-Fern-SDK-Version": "3.0.0-next.2",
47
+ "User-Agent": "@cloudpdf/sdk/3.0.0-next.2",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,6 +1,7 @@
1
1
  import { DeploymentClient } from "./api/resources/deployment/client/Client.js";
2
2
  import { DocClient } from "./api/resources/doc/client/Client.js";
3
3
  import { DocumentsClient } from "./api/resources/documents/client/Client.js";
4
+ import { SharesClient } from "./api/resources/shares/client/Client.js";
4
5
  import { TenantsClient } from "./api/resources/tenants/client/Client.js";
5
6
  import { TokensClient } from "./api/resources/tokens/client/Client.js";
6
7
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
@@ -15,12 +16,14 @@ export declare class CloudPDFClient {
15
16
  protected readonly _options: NormalizedClientOptionsWithAuth<CloudPDFClient.Options>;
16
17
  protected _deployment: DeploymentClient | undefined;
17
18
  protected _doc: DocClient | undefined;
19
+ protected _shares: SharesClient | undefined;
18
20
  protected _tenants: TenantsClient | undefined;
19
21
  protected _documents: DocumentsClient | undefined;
20
22
  protected _tokens: TokensClient | undefined;
21
23
  constructor(options: CloudPDFClient.Options);
22
24
  get deployment(): DeploymentClient;
23
25
  get doc(): DocClient;
26
+ get shares(): SharesClient;
24
27
  get tenants(): TenantsClient;
25
28
  get documents(): DocumentsClient;
26
29
  get tokens(): TokensClient;
@@ -47,8 +47,9 @@ exports.CloudPDFClient = void 0;
47
47
  const Client_js_1 = require("./api/resources/deployment/client/Client.js");
48
48
  const Client_js_2 = require("./api/resources/doc/client/Client.js");
49
49
  const Client_js_3 = require("./api/resources/documents/client/Client.js");
50
- const Client_js_4 = require("./api/resources/tenants/client/Client.js");
51
- const Client_js_5 = require("./api/resources/tokens/client/Client.js");
50
+ const Client_js_4 = require("./api/resources/shares/client/Client.js");
51
+ const Client_js_5 = require("./api/resources/tenants/client/Client.js");
52
+ const Client_js_6 = require("./api/resources/tokens/client/Client.js");
52
53
  const BaseClient_js_1 = require("./BaseClient.js");
53
54
  const core = __importStar(require("./core/index.js"));
54
55
  class CloudPDFClient {
@@ -63,9 +64,13 @@ class CloudPDFClient {
63
64
  var _a;
64
65
  return ((_a = this._doc) !== null && _a !== void 0 ? _a : (this._doc = new Client_js_2.DocClient(this._options)));
65
66
  }
67
+ get shares() {
68
+ var _a;
69
+ return ((_a = this._shares) !== null && _a !== void 0 ? _a : (this._shares = new Client_js_4.SharesClient(this._options)));
70
+ }
66
71
  get tenants() {
67
72
  var _a;
68
- return ((_a = this._tenants) !== null && _a !== void 0 ? _a : (this._tenants = new Client_js_4.TenantsClient(this._options)));
73
+ return ((_a = this._tenants) !== null && _a !== void 0 ? _a : (this._tenants = new Client_js_5.TenantsClient(this._options)));
69
74
  }
70
75
  get documents() {
71
76
  var _a;
@@ -73,7 +78,7 @@ class CloudPDFClient {
73
78
  }
74
79
  get tokens() {
75
80
  var _a;
76
- return ((_a = this._tokens) !== null && _a !== void 0 ? _a : (this._tokens = new Client_js_5.TokensClient(this._options)));
81
+ return ((_a = this._tokens) !== null && _a !== void 0 ? _a : (this._tokens = new Client_js_6.TokensClient(this._options)));
77
82
  }
78
83
  /**
79
84
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
@@ -0,0 +1,20 @@
1
+ import { CloudPDFClient as GeneratedCloudPDFClient } from "./Client.js";
2
+ import type * as CloudPDF from "./api/index.js";
3
+ import { Uploads } from "./uploads/Uploads.js";
4
+ export declare namespace CloudPDFClient {
5
+ type GeneratedOptions = GeneratedCloudPDFClient.Options;
6
+ type Endpoint = GeneratedOptions["environment"];
7
+ type Options = Omit<GeneratedOptions, "environment" | "baseUrl"> & ({
8
+ baseUrl: NonNullable<GeneratedOptions["baseUrl"]>;
9
+ environment?: Endpoint;
10
+ } | {
11
+ environment: Endpoint;
12
+ baseUrl?: GeneratedOptions["baseUrl"];
13
+ });
14
+ type RequestOptions = GeneratedCloudPDFClient.RequestOptions;
15
+ }
16
+ /** Generated protocol client plus CloudPDF's handwritten workflow layer. */
17
+ export declare class CloudPDFClient extends GeneratedCloudPDFClient {
18
+ readonly uploads: Uploads<CloudPDF.DocumentsCommit200Response.Document>;
19
+ constructor(options: CloudPDFClient.Options);
20
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CloudPDFClient = void 0;
13
+ const Client_js_1 = require("./Client.js");
14
+ const Uploads_js_1 = require("./uploads/Uploads.js");
15
+ /** Generated protocol client plus CloudPDF's handwritten workflow layer. */
16
+ class CloudPDFClient extends Client_js_1.CloudPDFClient {
17
+ constructor(options) {
18
+ var _a, _b, _c;
19
+ // Self-hosted CloudPDF has no universal environment URL. Let callers
20
+ // provide the familiar `baseUrl` alone while still satisfying Fern's
21
+ // generated client's internal environment slot.
22
+ super(Object.assign(Object.assign({}, options), { environment: (_a = options.environment) !== null && _a !== void 0 ? _a : options.baseUrl }));
23
+ const rawFetch = (_b = options.fetch) !== null && _b !== void 0 ? _b : (_c = globalThis.fetch) === null || _c === void 0 ? void 0 : _c.bind(globalThis);
24
+ if (!rawFetch)
25
+ throw new Error("CloudPDFClient requires a fetch implementation");
26
+ this.uploads = new Uploads_js_1.Uploads({
27
+ init: (request, requestOptions) => __awaiter(this, void 0, void 0, function* () { return this.documents.init(request, requestOptions); }),
28
+ commit: (request, requestOptions) => __awaiter(this, void 0, void 0, function* () { return this.documents.commit(request, requestOptions); }),
29
+ proxy: (url, form, requestOptions) => __awaiter(this, void 0, void 0, function* () {
30
+ return this.fetch(url, { method: "POST", body: form }, {
31
+ abortSignal: requestOptions.abortSignal,
32
+ maxRetries: requestOptions.maxRetries,
33
+ });
34
+ }),
35
+ presigned: (url, init) => __awaiter(this, void 0, void 0, function* () { return rawFetch(url, init); }),
36
+ });
37
+ }
38
+ }
39
+ exports.CloudPDFClient = CloudPDFClient;
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as CloudPDF from "../index.js";
4
+ export declare class ConflictError extends errors.CloudPDFError {
5
+ readonly body: CloudPDF.DocumentsUploadProxy409Response;
6
+ constructor(body: CloudPDF.DocumentsUploadProxy409Response, rawResponse?: core.RawResponse);
7
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ConflictError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class ConflictError extends errors.CloudPDFError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "ConflictError",
43
+ statusCode: 409,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "ConflictError";
52
+ }
53
+ }
54
+ exports.ConflictError = ConflictError;
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as CloudPDF from "../index.js";
4
+ export declare class GoneError extends errors.CloudPDFError {
5
+ readonly body: CloudPDF.SharesExchange410Response;
6
+ constructor(body: CloudPDF.SharesExchange410Response, rawResponse?: core.RawResponse);
7
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GoneError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class GoneError extends errors.CloudPDFError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "GoneError",
43
+ statusCode: 410,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "GoneError";
52
+ }
53
+ }
54
+ exports.GoneError = GoneError;
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as CloudPDF from "../index.js";
4
+ export declare class UnprocessableEntityError extends errors.CloudPDFError {
5
+ readonly body: CloudPDF.SharesExchange422Response;
6
+ constructor(body: CloudPDF.SharesExchange422Response, rawResponse?: core.RawResponse);
7
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.UnprocessableEntityError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class UnprocessableEntityError extends errors.CloudPDFError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "UnprocessableEntityError",
43
+ statusCode: 422,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "UnprocessableEntityError";
52
+ }
53
+ }
54
+ exports.UnprocessableEntityError = UnprocessableEntityError;
@@ -1,3 +1,6 @@
1
1
  export * from "./BadRequestError.js";
2
+ export * from "./ConflictError.js";
2
3
  export * from "./ForbiddenError.js";
4
+ export * from "./GoneError.js";
3
5
  export * from "./NotFoundError.js";
6
+ export * from "./UnprocessableEntityError.js";
@@ -15,5 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BadRequestError.js"), exports);
18
+ __exportStar(require("./ConflictError.js"), exports);
18
19
  __exportStar(require("./ForbiddenError.js"), exports);
20
+ __exportStar(require("./GoneError.js"), exports);
19
21
  __exportStar(require("./NotFoundError.js"), exports);
22
+ __exportStar(require("./UnprocessableEntityError.js"), exports);
@@ -93,17 +93,26 @@ export declare class DocumentsClient {
93
93
  thumbnail(request: CloudPDF.ThumbnailDocumentsRequest, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
94
94
  private __thumbnail;
95
95
  /**
96
- * @param {core.file.Uploadable} uploadable
97
- * @param {string} tenantId
98
- * @param {string} id
96
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
97
+ *
98
+ * @param {CloudPDF.UploadProxyDocumentsRequest} request
99
99
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
100
100
  *
101
101
  * @throws {@link CloudPDF.BadRequestError}
102
+ * @throws {@link CloudPDF.ConflictError}
102
103
  * @throws {@link errors.CloudPDFError}
103
104
  * @throws {@link errors.CloudPDFTimeoutError}
105
+ *
106
+ * @example
107
+ * import { createReadStream } from "fs";
108
+ * await client.documents.uploadProxy({
109
+ * file: fs.createReadStream("/path/to/your/file"),
110
+ * tenantId: "tenantId",
111
+ * id: "id"
112
+ * })
104
113
  */
105
- uploadDirect(uploadable: core.file.Uploadable, tenantId: string, id: string, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<CloudPDF.DocumentsUploadDirect200Response>;
106
- private __uploadDirect;
114
+ uploadProxy(request: CloudPDF.UploadProxyDocumentsRequest, requestOptions?: DocumentsClient.RequestOptions): core.HttpResponsePromise<CloudPDF.DocumentsUploadProxy200Response>;
115
+ private __uploadProxy;
107
116
  /**
108
117
  * @param {CloudPDF.DocumentsInitRequest} request
109
118
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -387,33 +387,43 @@ class DocumentsClient {
387
387
  });
388
388
  }
389
389
  /**
390
- * @param {core.file.Uploadable} uploadable
391
- * @param {string} tenantId
392
- * @param {string} id
390
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
391
+ *
392
+ * @param {CloudPDF.UploadProxyDocumentsRequest} request
393
393
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
394
394
  *
395
395
  * @throws {@link CloudPDF.BadRequestError}
396
+ * @throws {@link CloudPDF.ConflictError}
396
397
  * @throws {@link errors.CloudPDFError}
397
398
  * @throws {@link errors.CloudPDFTimeoutError}
399
+ *
400
+ * @example
401
+ * import { createReadStream } from "fs";
402
+ * await client.documents.uploadProxy({
403
+ * file: fs.createReadStream("/path/to/your/file"),
404
+ * tenantId: "tenantId",
405
+ * id: "id"
406
+ * })
398
407
  */
399
- uploadDirect(uploadable, tenantId, id, requestOptions) {
400
- return core.HttpResponsePromise.fromPromise(this.__uploadDirect(uploadable, tenantId, id, requestOptions));
408
+ uploadProxy(request, requestOptions) {
409
+ return core.HttpResponsePromise.fromPromise(this.__uploadProxy(request, requestOptions));
401
410
  }
402
- __uploadDirect(uploadable, tenantId, id, requestOptions) {
411
+ __uploadProxy(request, requestOptions) {
403
412
  return __awaiter(this, void 0, void 0, function* () {
404
413
  var _a, _b, _c, _d, _e, _f, _g, _h;
405
- const _binaryUploadRequest = yield core.file.toBinaryUploadRequest(uploadable);
414
+ const _body = yield core.newFormData();
415
+ yield _body.appendFile("file", request.file);
416
+ const _maybeEncodedRequest = yield _body.getRequest();
406
417
  const _authRequest = yield this._options.authProvider.getAuthRequest();
407
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, _binaryUploadRequest.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
418
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
408
419
  const _response = yield core.fetcher({
409
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/tenants/${core.url.encodePathParam(tenantId)}/documents/${core.url.encodePathParam(id)}/upload-direct`),
420
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `v1/tenants/${core.url.encodePathParam(request.tenantId)}/documents/${core.url.encodePathParam(request.id)}/upload-proxy`),
410
421
  method: "POST",
411
422
  headers: _headers,
412
- contentType: "application/pdf",
413
423
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
414
- requestType: "bytes",
415
- duplex: "half",
416
- body: _binaryUploadRequest.body,
424
+ requestType: "file",
425
+ duplex: _maybeEncodedRequest.duplex,
426
+ body: _maybeEncodedRequest.body,
417
427
  timeoutMs: ((_e = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : (_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) !== null && _e !== void 0 ? _e : 60) * 1000,
418
428
  maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
419
429
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -430,6 +440,8 @@ class DocumentsClient {
430
440
  switch (_response.error.statusCode) {
431
441
  case 400:
432
442
  throw new CloudPDF.BadRequestError(_response.error.body, _response.rawResponse);
443
+ case 409:
444
+ throw new CloudPDF.ConflictError(_response.error.body, _response.rawResponse);
433
445
  default:
434
446
  throw new errors.CloudPDFError({
435
447
  statusCode: _response.error.statusCode,
@@ -438,7 +450,7 @@ class DocumentsClient {
438
450
  });
439
451
  }
440
452
  }
441
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/tenants/{tenantId}/documents/{id}/upload-direct");
453
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/tenants/{tenantId}/documents/{id}/upload-proxy");
442
454
  });
443
455
  }
444
456
  /**
@@ -15,6 +15,7 @@ export interface DocumentsInitRequest {
15
15
  dedupMode?: DocumentsInitRequest.DedupMode;
16
16
  docId?: string;
17
17
  uploadTtlSec?: number;
18
+ uploadPreference?: DocumentsInitRequest.UploadPreference;
18
19
  }
19
20
  export declare namespace DocumentsInitRequest {
20
21
  const DedupMode: {
@@ -22,4 +23,10 @@ export declare namespace DocumentsInitRequest {
22
23
  readonly ReuseExisting: "reuse-existing";
23
24
  };
24
25
  type DedupMode = (typeof DedupMode)[keyof typeof DedupMode];
26
+ const UploadPreference: {
27
+ readonly Auto: "auto";
28
+ readonly Presigned: "presigned";
29
+ readonly Proxy: "proxy";
30
+ };
31
+ type UploadPreference = (typeof UploadPreference)[keyof typeof UploadPreference];
25
32
  }
@@ -8,4 +8,9 @@ var DocumentsInitRequest;
8
8
  AlwaysCreate: "always-create",
9
9
  ReuseExisting: "reuse-existing",
10
10
  };
11
+ DocumentsInitRequest.UploadPreference = {
12
+ Auto: "auto",
13
+ Presigned: "presigned",
14
+ Proxy: "proxy",
15
+ };
11
16
  })(DocumentsInitRequest || (exports.DocumentsInitRequest = DocumentsInitRequest = {}));
@@ -0,0 +1,14 @@
1
+ import type * as core from "../../../../../core/index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * file: fs.createReadStream("/path/to/your/file"),
6
+ * tenantId: "tenantId",
7
+ * id: "id"
8
+ * }
9
+ */
10
+ export interface UploadProxyDocumentsRequest {
11
+ tenantId: string;
12
+ id: string;
13
+ file: core.file.Uploadable;
14
+ }
@@ -5,3 +5,4 @@ export type { DownloadDocumentsRequest } from "./DownloadDocumentsRequest.js";
5
5
  export type { GetDocumentsRequest } from "./GetDocumentsRequest.js";
6
6
  export type { ListDocumentsRequest } from "./ListDocumentsRequest.js";
7
7
  export type { ThumbnailDocumentsRequest } from "./ThumbnailDocumentsRequest.js";
8
+ export type { UploadProxyDocumentsRequest } from "./UploadProxyDocumentsRequest.js";
@@ -4,6 +4,8 @@ export * as doc from "./doc/index.js";
4
4
  export * from "./documents/client/requests/index.js";
5
5
  export * as documents from "./documents/index.js";
6
6
  export * from "./documents/types/index.js";
7
+ export * from "./shares/client/requests/index.js";
8
+ export * as shares from "./shares/index.js";
7
9
  export * from "./tenants/client/requests/index.js";
8
10
  export * as tenants from "./tenants/index.js";
9
11
  export * from "./tokens/client/requests/index.js";