@schedulin/sdk 0.1.2 → 0.3.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 (294) hide show
  1. package/README.md +45 -0
  2. package/cjs/BaseClient.d.ts +12 -0
  3. package/cjs/Client.d.ts +9 -0
  4. package/cjs/Client.js +23 -8
  5. package/cjs/api/errors/InternalServerError.d.ts +1 -0
  6. package/cjs/api/errors/UnauthorizedError.d.ts +1 -0
  7. package/cjs/api/resources/ai/client/Client.d.ts +49 -0
  8. package/cjs/api/resources/ai/client/Client.js +181 -0
  9. package/cjs/api/resources/ai/client/index.d.ts +1 -0
  10. package/cjs/api/resources/ai/client/index.js +17 -0
  11. package/cjs/api/resources/ai/client/requests/GenerateImageAiRequest.d.ts +20 -0
  12. package/cjs/api/resources/ai/client/requests/GenerateImageAiRequest.js +12 -0
  13. package/cjs/api/resources/{posts/client/requests/GetJobStatusPostsRequest.d.ts → ai/client/requests/GetGenerationAiRequest.d.ts} +1 -1
  14. package/cjs/api/resources/ai/client/requests/index.d.ts +2 -0
  15. package/cjs/api/resources/ai/client/requests/index.js +5 -0
  16. package/cjs/api/resources/ai/exports.d.ts +2 -0
  17. package/cjs/api/resources/ai/exports.js +21 -0
  18. package/cjs/api/resources/ai/index.d.ts +1 -0
  19. package/cjs/api/resources/ai/index.js +17 -0
  20. package/cjs/api/resources/index.d.ts +6 -0
  21. package/cjs/api/resources/index.js +7 -1
  22. package/cjs/api/resources/media/client/Client.d.ts +83 -0
  23. package/cjs/api/resources/media/client/Client.js +260 -3
  24. package/cjs/api/resources/media/client/requests/CreateFromUrlMediaRequest.d.ts +12 -0
  25. package/cjs/api/resources/media/client/requests/CreateFromUrlMediaRequest.js +3 -0
  26. package/cjs/api/resources/media/client/requests/CreateUploadLinkMediaRequest.d.ts +7 -0
  27. package/cjs/api/resources/media/client/requests/CreateUploadLinkMediaRequest.js +3 -0
  28. package/{esm/api/resources/posts/client/requests/GetJobStatusPostsRequest.d.mts → cjs/api/resources/media/client/requests/DeleteMediaRequest.d.ts} +1 -1
  29. package/cjs/api/resources/media/client/requests/DeleteMediaRequest.js +3 -0
  30. package/cjs/api/resources/media/client/requests/UploadMediaRequest.d.ts +13 -0
  31. package/cjs/api/resources/media/client/requests/UploadMediaRequest.js +3 -0
  32. package/cjs/api/resources/media/client/requests/index.d.ts +4 -0
  33. package/cjs/api/resources/platforms/client/Client.d.ts +28 -0
  34. package/cjs/api/resources/platforms/client/Client.js +111 -0
  35. package/cjs/api/resources/platforms/client/index.d.ts +1 -0
  36. package/cjs/api/resources/platforms/client/index.js +2 -0
  37. package/cjs/api/resources/platforms/exports.d.ts +2 -0
  38. package/cjs/api/resources/platforms/exports.js +21 -0
  39. package/cjs/api/resources/platforms/index.d.ts +2 -0
  40. package/cjs/api/resources/platforms/index.js +18 -0
  41. package/cjs/api/resources/platforms/types/ListPlatformsResponse.d.ts +56 -0
  42. package/cjs/api/resources/platforms/types/ListPlatformsResponse.js +24 -0
  43. package/cjs/api/resources/platforms/types/index.d.ts +1 -0
  44. package/cjs/api/resources/platforms/types/index.js +17 -0
  45. package/cjs/api/resources/posts/client/Client.d.ts +22 -18
  46. package/cjs/api/resources/posts/client/Client.js +30 -62
  47. package/cjs/api/resources/posts/client/requests/ListPostsRequest.d.ts +1 -0
  48. package/cjs/api/resources/posts/client/requests/PostCreate.d.ts +64 -0
  49. package/cjs/api/resources/posts/client/requests/PostCreate.js +63 -0
  50. package/cjs/api/resources/posts/client/requests/UpdatePostsRequest.d.ts +0 -2
  51. package/cjs/api/resources/posts/client/requests/UpdatePostsRequest.js +0 -2
  52. package/cjs/api/resources/posts/client/requests/index.d.ts +0 -1
  53. package/cjs/api/resources/posts/types/CreatePostsResponse.d.ts +21 -0
  54. package/cjs/api/resources/posts/types/CreatePostsResponse.js +21 -0
  55. package/cjs/api/resources/posts/types/ListPostsRequestStatusesItem.d.ts +8 -0
  56. package/cjs/api/resources/posts/types/ListPostsRequestStatusesItem.js +11 -0
  57. package/cjs/api/resources/posts/types/index.d.ts +1 -0
  58. package/cjs/api/resources/posts/types/index.js +1 -0
  59. package/cjs/api/resources/socialAccounts/client/Client.d.ts +68 -1
  60. package/cjs/api/resources/socialAccounts/client/Client.js +210 -4
  61. package/cjs/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.d.ts +9 -0
  62. package/cjs/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.js +3 -0
  63. package/cjs/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.d.ts +11 -0
  64. package/cjs/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.js +3 -0
  65. package/cjs/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.d.ts +11 -0
  66. package/cjs/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.js +3 -0
  67. package/cjs/api/resources/socialAccounts/client/requests/index.d.ts +3 -0
  68. package/cjs/api/resources/socialAccounts/types/ListSocialAccountsResponse.d.ts +22 -0
  69. package/cjs/api/resources/socialAccounts/types/ListSocialAccountsResponse.js +21 -0
  70. package/cjs/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.d.ts +12 -0
  71. package/cjs/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.js +3 -0
  72. package/cjs/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.d.ts +12 -0
  73. package/cjs/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.js +3 -0
  74. package/cjs/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.d.ts +3 -0
  75. package/cjs/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.js +3 -0
  76. package/cjs/api/resources/socialAccounts/types/index.d.ts +3 -0
  77. package/cjs/api/resources/socialAccounts/types/index.js +3 -0
  78. package/cjs/api/resources/tags/client/Client.d.ts +8 -0
  79. package/cjs/api/resources/tags/client/Client.js +12 -3
  80. package/cjs/api/resources/webhooks/client/Client.d.ts +155 -0
  81. package/cjs/api/resources/webhooks/client/Client.js +538 -0
  82. package/cjs/api/resources/webhooks/client/index.d.ts +1 -0
  83. package/cjs/api/resources/webhooks/client/index.js +17 -0
  84. package/cjs/api/resources/webhooks/client/requests/CreateWebhooksRequest.d.ts +24 -0
  85. package/cjs/api/resources/webhooks/client/requests/CreateWebhooksRequest.js +16 -0
  86. package/cjs/api/resources/webhooks/client/requests/DeleteWebhooksRequest.d.ts +9 -0
  87. package/cjs/api/resources/webhooks/client/requests/DeleteWebhooksRequest.js +3 -0
  88. package/cjs/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.d.ts +11 -0
  89. package/cjs/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.js +3 -0
  90. package/cjs/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.d.ts +9 -0
  91. package/cjs/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.js +3 -0
  92. package/cjs/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.d.ts +9 -0
  93. package/cjs/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.js +3 -0
  94. package/cjs/api/resources/webhooks/client/requests/TestWebhooksRequest.d.ts +9 -0
  95. package/cjs/api/resources/webhooks/client/requests/TestWebhooksRequest.js +3 -0
  96. package/cjs/api/resources/webhooks/client/requests/UpdateWebhooksRequest.d.ts +25 -0
  97. package/cjs/api/resources/webhooks/client/requests/UpdateWebhooksRequest.js +16 -0
  98. package/cjs/api/resources/webhooks/client/requests/index.d.ts +7 -0
  99. package/cjs/api/resources/webhooks/client/requests/index.js +7 -0
  100. package/cjs/api/resources/webhooks/exports.d.ts +2 -0
  101. package/cjs/api/resources/webhooks/exports.js +21 -0
  102. package/cjs/api/resources/webhooks/index.d.ts +1 -0
  103. package/cjs/api/resources/webhooks/index.js +17 -0
  104. package/cjs/api/types/OauthScope.d.ts +12 -0
  105. package/cjs/api/types/OauthScope.js +12 -0
  106. package/cjs/api/types/PostSearch.d.ts +12 -0
  107. package/cjs/api/types/PostSearch.js +10 -0
  108. package/cjs/api/types/PostWithRelations.d.ts +21 -0
  109. package/cjs/api/types/PostWithRelations.js +21 -0
  110. package/cjs/api/types/SocialAccountDisconnectedReason.d.ts +1 -0
  111. package/cjs/api/types/SocialAccountDisconnectedReason.js +1 -0
  112. package/cjs/api/types/SocialPlatform.d.ts +21 -0
  113. package/cjs/api/types/SocialPlatform.js +21 -0
  114. package/cjs/core/exports.d.ts +1 -0
  115. package/cjs/core/exports.js +1 -0
  116. package/cjs/core/fetcher/Fetcher.js +9 -92
  117. package/cjs/core/fetcher/makePassthroughRequest.js +26 -4
  118. package/cjs/core/fetcher/redactUrl.d.ts +2 -0
  119. package/cjs/core/fetcher/redactUrl.js +88 -0
  120. package/cjs/core/file/exports.d.ts +1 -0
  121. package/cjs/core/file/exports.js +2 -0
  122. package/cjs/core/file/file.d.ts +10 -0
  123. package/cjs/core/file/file.js +225 -0
  124. package/cjs/core/file/index.d.ts +2 -0
  125. package/cjs/core/file/index.js +18 -0
  126. package/cjs/core/file/types.d.ts +66 -0
  127. package/cjs/core/file/types.js +2 -0
  128. package/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
  129. package/cjs/core/form-data-utils/FormDataWrapper.js +188 -0
  130. package/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  131. package/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
  132. package/cjs/core/form-data-utils/index.d.ts +2 -0
  133. package/cjs/core/form-data-utils/index.js +20 -0
  134. package/cjs/core/index.d.ts +2 -0
  135. package/cjs/core/index.js +3 -1
  136. package/cjs/core/requestBody.d.ts +12 -0
  137. package/cjs/core/requestBody.js +26 -0
  138. package/cjs/core/runtime/index.d.ts +1 -1
  139. package/cjs/core/runtime/index.js +2 -1
  140. package/cjs/core/runtime/runtime.d.ts +19 -0
  141. package/cjs/core/runtime/runtime.js +74 -2
  142. package/cjs/core/url/qs.js +2 -2
  143. package/cjs/errors/SchedulinError.d.ts +1 -0
  144. package/cjs/errors/SchedulinError.js +4 -0
  145. package/cjs/errors/SchedulinTimeoutError.d.ts +2 -2
  146. package/cjs/errors/SchedulinTimeoutError.js +39 -5
  147. package/esm/BaseClient.d.mts +12 -0
  148. package/esm/Client.d.mts +9 -0
  149. package/esm/Client.mjs +15 -0
  150. package/esm/api/errors/InternalServerError.d.mts +1 -0
  151. package/esm/api/errors/UnauthorizedError.d.mts +1 -0
  152. package/esm/api/resources/ai/client/Client.d.mts +49 -0
  153. package/esm/api/resources/ai/client/Client.mjs +144 -0
  154. package/esm/api/resources/ai/client/index.d.mts +1 -0
  155. package/esm/api/resources/ai/client/index.mjs +1 -0
  156. package/esm/api/resources/ai/client/requests/GenerateImageAiRequest.d.mts +20 -0
  157. package/esm/api/resources/ai/client/requests/GenerateImageAiRequest.mjs +9 -0
  158. package/esm/api/resources/ai/client/requests/GetGenerationAiRequest.d.mts +9 -0
  159. package/esm/api/resources/ai/client/requests/index.d.mts +2 -0
  160. package/esm/api/resources/ai/client/requests/index.mjs +1 -0
  161. package/esm/api/resources/ai/exports.d.mts +2 -0
  162. package/esm/api/resources/ai/exports.mjs +3 -0
  163. package/esm/api/resources/ai/index.d.mts +1 -0
  164. package/esm/api/resources/ai/index.mjs +1 -0
  165. package/esm/api/resources/index.d.mts +6 -0
  166. package/esm/api/resources/index.mjs +6 -0
  167. package/esm/api/resources/media/client/Client.d.mts +83 -0
  168. package/esm/api/resources/media/client/Client.mjs +261 -4
  169. package/esm/api/resources/media/client/requests/CreateFromUrlMediaRequest.d.mts +12 -0
  170. package/esm/api/resources/media/client/requests/CreateFromUrlMediaRequest.mjs +2 -0
  171. package/esm/api/resources/media/client/requests/CreateUploadLinkMediaRequest.d.mts +7 -0
  172. package/esm/api/resources/media/client/requests/CreateUploadLinkMediaRequest.mjs +2 -0
  173. package/esm/api/resources/media/client/requests/DeleteMediaRequest.d.mts +9 -0
  174. package/esm/api/resources/media/client/requests/DeleteMediaRequest.mjs +2 -0
  175. package/esm/api/resources/media/client/requests/UploadMediaRequest.d.mts +13 -0
  176. package/esm/api/resources/media/client/requests/UploadMediaRequest.mjs +2 -0
  177. package/esm/api/resources/media/client/requests/index.d.mts +4 -0
  178. package/esm/api/resources/platforms/client/Client.d.mts +28 -0
  179. package/esm/api/resources/platforms/client/Client.mjs +74 -0
  180. package/esm/api/resources/platforms/client/index.d.mts +1 -0
  181. package/esm/api/resources/platforms/client/index.mjs +1 -0
  182. package/esm/api/resources/platforms/exports.d.mts +2 -0
  183. package/esm/api/resources/platforms/exports.mjs +3 -0
  184. package/esm/api/resources/platforms/index.d.mts +2 -0
  185. package/esm/api/resources/platforms/index.mjs +2 -0
  186. package/esm/api/resources/platforms/types/ListPlatformsResponse.d.mts +56 -0
  187. package/esm/api/resources/platforms/types/ListPlatformsResponse.mjs +21 -0
  188. package/esm/api/resources/platforms/types/index.d.mts +1 -0
  189. package/esm/api/resources/platforms/types/index.mjs +1 -0
  190. package/esm/api/resources/posts/client/Client.d.mts +22 -18
  191. package/esm/api/resources/posts/client/Client.mjs +30 -62
  192. package/esm/api/resources/posts/client/requests/ListPostsRequest.d.mts +1 -0
  193. package/esm/api/resources/posts/client/requests/PostCreate.d.mts +64 -0
  194. package/esm/api/resources/posts/client/requests/PostCreate.mjs +63 -0
  195. package/esm/api/resources/posts/client/requests/UpdatePostsRequest.d.mts +0 -2
  196. package/esm/api/resources/posts/client/requests/UpdatePostsRequest.mjs +0 -2
  197. package/esm/api/resources/posts/client/requests/index.d.mts +0 -1
  198. package/esm/api/resources/posts/types/CreatePostsResponse.d.mts +21 -0
  199. package/esm/api/resources/posts/types/CreatePostsResponse.mjs +21 -0
  200. package/esm/api/resources/posts/types/ListPostsRequestStatusesItem.d.mts +8 -0
  201. package/esm/api/resources/posts/types/ListPostsRequestStatusesItem.mjs +8 -0
  202. package/esm/api/resources/posts/types/index.d.mts +1 -0
  203. package/esm/api/resources/posts/types/index.mjs +1 -0
  204. package/esm/api/resources/socialAccounts/client/Client.d.mts +68 -1
  205. package/esm/api/resources/socialAccounts/client/Client.mjs +210 -4
  206. package/esm/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.d.mts +9 -0
  207. package/esm/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.mjs +2 -0
  208. package/esm/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.d.mts +11 -0
  209. package/esm/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.mjs +2 -0
  210. package/esm/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.d.mts +11 -0
  211. package/esm/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.mjs +2 -0
  212. package/esm/api/resources/socialAccounts/client/requests/index.d.mts +3 -0
  213. package/esm/api/resources/socialAccounts/types/ListSocialAccountsResponse.d.mts +22 -0
  214. package/esm/api/resources/socialAccounts/types/ListSocialAccountsResponse.mjs +21 -0
  215. package/esm/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.d.mts +12 -0
  216. package/esm/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.mjs +2 -0
  217. package/esm/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.d.mts +12 -0
  218. package/esm/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.mjs +2 -0
  219. package/esm/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.d.mts +3 -0
  220. package/esm/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.mjs +2 -0
  221. package/esm/api/resources/socialAccounts/types/index.d.mts +3 -0
  222. package/esm/api/resources/socialAccounts/types/index.mjs +3 -0
  223. package/esm/api/resources/tags/client/Client.d.mts +8 -0
  224. package/esm/api/resources/tags/client/Client.mjs +12 -3
  225. package/esm/api/resources/webhooks/client/Client.d.mts +155 -0
  226. package/esm/api/resources/webhooks/client/Client.mjs +501 -0
  227. package/esm/api/resources/webhooks/client/index.d.mts +1 -0
  228. package/esm/api/resources/webhooks/client/index.mjs +1 -0
  229. package/esm/api/resources/webhooks/client/requests/CreateWebhooksRequest.d.mts +24 -0
  230. package/esm/api/resources/webhooks/client/requests/CreateWebhooksRequest.mjs +13 -0
  231. package/esm/api/resources/webhooks/client/requests/DeleteWebhooksRequest.d.mts +9 -0
  232. package/esm/api/resources/webhooks/client/requests/DeleteWebhooksRequest.mjs +2 -0
  233. package/esm/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.d.mts +11 -0
  234. package/esm/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.mjs +2 -0
  235. package/esm/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.d.mts +9 -0
  236. package/esm/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.mjs +2 -0
  237. package/esm/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.d.mts +9 -0
  238. package/esm/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.mjs +2 -0
  239. package/esm/api/resources/webhooks/client/requests/TestWebhooksRequest.d.mts +9 -0
  240. package/esm/api/resources/webhooks/client/requests/TestWebhooksRequest.mjs +2 -0
  241. package/esm/api/resources/webhooks/client/requests/UpdateWebhooksRequest.d.mts +25 -0
  242. package/esm/api/resources/webhooks/client/requests/UpdateWebhooksRequest.mjs +13 -0
  243. package/esm/api/resources/webhooks/client/requests/index.d.mts +7 -0
  244. package/esm/api/resources/webhooks/client/requests/index.mjs +2 -0
  245. package/esm/api/resources/webhooks/exports.d.mts +2 -0
  246. package/esm/api/resources/webhooks/exports.mjs +3 -0
  247. package/esm/api/resources/webhooks/index.d.mts +1 -0
  248. package/esm/api/resources/webhooks/index.mjs +1 -0
  249. package/esm/api/types/OauthScope.d.mts +12 -0
  250. package/esm/api/types/OauthScope.mjs +12 -0
  251. package/esm/api/types/PostSearch.d.mts +12 -0
  252. package/esm/api/types/PostSearch.mjs +10 -0
  253. package/esm/api/types/PostWithRelations.d.mts +21 -0
  254. package/esm/api/types/PostWithRelations.mjs +21 -0
  255. package/esm/api/types/SocialAccountDisconnectedReason.d.mts +1 -0
  256. package/esm/api/types/SocialAccountDisconnectedReason.mjs +1 -0
  257. package/esm/api/types/SocialPlatform.d.mts +21 -0
  258. package/esm/api/types/SocialPlatform.mjs +21 -0
  259. package/esm/core/exports.d.mts +1 -0
  260. package/esm/core/exports.mjs +1 -0
  261. package/esm/core/fetcher/Fetcher.mjs +1 -84
  262. package/esm/core/fetcher/makePassthroughRequest.mjs +26 -4
  263. package/esm/core/fetcher/redactUrl.d.mts +2 -0
  264. package/esm/core/fetcher/redactUrl.mjs +84 -0
  265. package/esm/core/file/exports.d.mts +1 -0
  266. package/esm/core/file/exports.mjs +1 -0
  267. package/esm/core/file/file.d.mts +10 -0
  268. package/esm/core/file/file.mjs +188 -0
  269. package/esm/core/file/index.d.mts +2 -0
  270. package/esm/core/file/index.mjs +2 -0
  271. package/esm/core/file/types.d.mts +66 -0
  272. package/esm/core/file/types.mjs +1 -0
  273. package/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
  274. package/esm/core/form-data-utils/FormDataWrapper.mjs +150 -0
  275. package/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
  276. package/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
  277. package/esm/core/form-data-utils/index.d.mts +2 -0
  278. package/esm/core/form-data-utils/index.mjs +2 -0
  279. package/esm/core/index.d.mts +2 -0
  280. package/esm/core/index.mjs +2 -0
  281. package/esm/core/requestBody.d.mts +12 -0
  282. package/esm/core/requestBody.mjs +23 -0
  283. package/esm/core/runtime/index.d.mts +1 -1
  284. package/esm/core/runtime/index.mjs +1 -1
  285. package/esm/core/runtime/runtime.d.mts +19 -0
  286. package/esm/core/runtime/runtime.mjs +73 -2
  287. package/esm/core/url/qs.mjs +2 -2
  288. package/esm/errors/SchedulinError.d.mts +1 -0
  289. package/esm/errors/SchedulinError.mjs +4 -0
  290. package/esm/errors/SchedulinTimeoutError.d.mts +2 -2
  291. package/esm/errors/SchedulinTimeoutError.mjs +6 -5
  292. package/package.json +1 -1
  293. /package/cjs/api/resources/{posts/client/requests/GetJobStatusPostsRequest.js → ai/client/requests/GetGenerationAiRequest.js} +0 -0
  294. /package/esm/api/resources/{posts/client/requests/GetJobStatusPostsRequest.mjs → ai/client/requests/GetGenerationAiRequest.mjs} +0 -0
@@ -1,6 +1,8 @@
1
1
  export * from "./auth/index.js";
2
2
  export * from "./base64.js";
3
3
  export * from "./fetcher/index.js";
4
+ export * as file from "./file/index.js";
5
+ export * from "./form-data-utils/index.js";
4
6
  export * as logging from "./logging/index.js";
5
7
  export * from "./runtime/index.js";
6
8
  export * as url from "./url/index.js";
package/cjs/core/index.js CHANGED
@@ -36,10 +36,12 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.url = exports.logging = void 0;
39
+ exports.url = exports.logging = exports.file = void 0;
40
40
  __exportStar(require("./auth/index.js"), exports);
41
41
  __exportStar(require("./base64.js"), exports);
42
42
  __exportStar(require("./fetcher/index.js"), exports);
43
+ exports.file = __importStar(require("./file/index.js"));
44
+ __exportStar(require("./form-data-utils/index.js"), exports);
43
45
  exports.logging = __importStar(require("./logging/index.js"));
44
46
  __exportStar(require("./runtime/index.js"), exports);
45
47
  exports.url = __importStar(require("./url/index.js"));
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
3
+ * on top of the request body. Caller-supplied properties win over the endpoint body. When no
4
+ * additional body parameters are provided, the original body is returned unchanged so serialization
5
+ * is unaffected.
6
+ *
7
+ * The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
8
+ * the additional parameters become the body; when the body is an array or a primitive JSON value it
9
+ * is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
10
+ * SDK, which only merges additional body parameters into mapping bodies.
11
+ */
12
+ export declare function mergeAdditionalBodyParameters(body: unknown, additionalBodyParameters: Record<string, unknown> | undefined): unknown;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeAdditionalBodyParameters = mergeAdditionalBodyParameters;
4
+ /**
5
+ * Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
6
+ * on top of the request body. Caller-supplied properties win over the endpoint body. When no
7
+ * additional body parameters are provided, the original body is returned unchanged so serialization
8
+ * is unaffected.
9
+ *
10
+ * The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
11
+ * the additional parameters become the body; when the body is an array or a primitive JSON value it
12
+ * is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
13
+ * SDK, which only merges additional body parameters into mapping bodies.
14
+ */
15
+ function mergeAdditionalBodyParameters(body, additionalBodyParameters) {
16
+ if (additionalBodyParameters == null) {
17
+ return body;
18
+ }
19
+ if (body == null) {
20
+ return Object.assign({}, additionalBodyParameters);
21
+ }
22
+ if (typeof body === "object" && !Array.isArray(body)) {
23
+ return Object.assign(Object.assign({}, body), additionalBodyParameters);
24
+ }
25
+ return body;
26
+ }
@@ -1 +1 @@
1
- export { RUNTIME } from "./runtime.js";
1
+ export { getUserAgent, RUNTIME } from "./runtime.js";
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RUNTIME = void 0;
3
+ exports.RUNTIME = exports.getUserAgent = void 0;
4
4
  var runtime_js_1 = require("./runtime.js");
5
+ Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return runtime_js_1.getUserAgent; } });
5
6
  Object.defineProperty(exports, "RUNTIME", { enumerable: true, get: function () { return runtime_js_1.RUNTIME; } });
@@ -6,4 +6,23 @@ export interface Runtime {
6
6
  type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
7
7
  version?: string;
8
8
  parsedVersion?: number;
9
+ /**
10
+ * The operating system the SDK is running on, when it can be determined
11
+ * (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in
12
+ * environments where the OS is not observable (e.g. browsers).
13
+ */
14
+ os?: string;
15
+ /**
16
+ * The CPU architecture the SDK is running on, when it can be determined
17
+ * (e.g. "x64", "arm64" on server runtimes). Undefined in environments where
18
+ * the architecture is not observable (e.g. browsers).
19
+ */
20
+ arch?: string;
9
21
  }
22
+ /**
23
+ * Builds a structured User-Agent string of the form
24
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
25
+ * where the platform group and runtime segment are omitted gracefully when the
26
+ * underlying values cannot be determined (e.g. in a browser).
27
+ */
28
+ export declare function getUserAgent(sdkName: string, sdkVersion: string): string;
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RUNTIME = void 0;
4
+ exports.getUserAgent = getUserAgent;
4
5
  /**
5
6
  * A constant that indicates which environment and version the SDK is running in.
6
7
  */
7
8
  exports.RUNTIME = evaluateRuntime();
8
9
  function evaluateRuntime() {
9
- var _a, _b, _c, _d, _e;
10
+ var _a, _b, _c, _d, _e, _f, _g;
10
11
  /**
11
12
  * A constant that indicates whether the environment the code is running is a Web Browser.
12
13
  */
@@ -59,6 +60,8 @@ function evaluateRuntime() {
59
60
  return {
60
61
  type: "deno",
61
62
  version: Deno.version.deno,
63
+ os: (_e = Deno.build) === null || _e === void 0 ? void 0 : _e.os,
64
+ arch: (_f = Deno.build) === null || _f === void 0 ? void 0 : _f.arch,
62
65
  };
63
66
  }
64
67
  /**
@@ -69,6 +72,8 @@ function evaluateRuntime() {
69
72
  return {
70
73
  type: "bun",
71
74
  version: Bun.version,
75
+ os: typeof process !== "undefined" ? process.platform : undefined,
76
+ arch: typeof process !== "undefined" ? process.arch : undefined,
72
77
  };
73
78
  }
74
79
  /**
@@ -90,15 +95,82 @@ function evaluateRuntime() {
90
95
  * Edge Runtime warns about Node.js APIs even when they are guarded).
91
96
  */
92
97
  const _process = typeof process !== "undefined" ? process : undefined;
93
- const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) === null || _e === void 0 ? void 0 : _e.node) === "string";
98
+ const isNode = typeof _process !== "undefined" && typeof ((_g = _process.versions) === null || _g === void 0 ? void 0 : _g.node) === "string";
94
99
  if (isNode) {
95
100
  return {
96
101
  type: "node",
97
102
  version: _process.versions.node,
98
103
  parsedVersion: Number(_process.versions.node.split(".")[0]),
104
+ os: _process.platform,
105
+ arch: _process.arch,
99
106
  };
100
107
  }
101
108
  return {
102
109
  type: "unknown",
103
110
  };
104
111
  }
112
+ /**
113
+ * Display names for the language runtimes whose version is meaningful to encode
114
+ * in a User-Agent. Environments where a version string is not useful (e.g.
115
+ * browsers, where `version` is the full navigator UA) are intentionally mapped
116
+ * to `undefined` so they are omitted from the User-Agent.
117
+ */
118
+ const RUNTIME_DISPLAY_NAMES = {
119
+ node: "Node",
120
+ deno: "Deno",
121
+ bun: "Bun",
122
+ browser: undefined,
123
+ "web-worker": undefined,
124
+ "react-native": undefined,
125
+ workerd: undefined,
126
+ "edge-runtime": undefined,
127
+ unknown: undefined,
128
+ };
129
+ /**
130
+ * CPU architecture aliases that all refer to 64-bit x86. They are normalized to
131
+ * the single canonical token `x86_64` so the User-Agent architecture label is
132
+ * consistent regardless of which runtime reports it (Node reports `x64`, others
133
+ * report `amd64` or `x86_64`).
134
+ */
135
+ const X86_64_ARCH_ALIASES = new Set(["x64", "amd64", "x86_64"]);
136
+ /**
137
+ * Normalizes a CPU architecture token, collapsing the 64-bit x86 aliases
138
+ * (`x64`, `amd64`, `x86_64`) to `x86_64`. Other architectures are returned
139
+ * unchanged.
140
+ */
141
+ function normalizeArch(arch) {
142
+ if (arch == null) {
143
+ return arch;
144
+ }
145
+ return X86_64_ARCH_ALIASES.has(arch.toLowerCase()) ? "x86_64" : arch;
146
+ }
147
+ /**
148
+ * Percent-encodes the `@` and `/` characters in an npm package name so the
149
+ * User-Agent product token stays within the RFC 7230 token grammar. The
150
+ * original scoped package name can be recovered by URL-decoding (e.g.
151
+ * `@dummy/sdk` becomes `%40dummy%2Fsdk`).
152
+ */
153
+ function encodeProductName(sdkName) {
154
+ return sdkName.replace(/@/g, "%40").replace(/\//g, "%2F");
155
+ }
156
+ /**
157
+ * Builds a structured User-Agent string of the form
158
+ * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
159
+ * where the platform group and runtime segment are omitted gracefully when the
160
+ * underlying values cannot be determined (e.g. in a browser).
161
+ */
162
+ function getUserAgent(sdkName, sdkVersion) {
163
+ let userAgent = `${encodeProductName(sdkName)}/${sdkVersion}`;
164
+ const platform = [exports.RUNTIME.os, normalizeArch(exports.RUNTIME.arch)].filter((part) => part != null && part.length > 0);
165
+ if (platform.length > 0) {
166
+ userAgent += ` (${platform.join("; ")})`;
167
+ }
168
+ const runtimeName = RUNTIME_DISPLAY_NAMES[exports.RUNTIME.type];
169
+ if (runtimeName != null) {
170
+ userAgent += ` ${runtimeName}`;
171
+ if (exports.RUNTIME.version != null && exports.RUNTIME.version.length > 0) {
172
+ userAgent += `/${exports.RUNTIME.version}`;
173
+ }
174
+ }
175
+ return userAgent;
176
+ }
@@ -19,7 +19,7 @@ function stringifyObject(obj, prefix = "", options) {
19
19
  const parts = [];
20
20
  for (const [key, value] of Object.entries(obj)) {
21
21
  const fullKey = prefix ? `${prefix}[${key}]` : key;
22
- if (value === undefined) {
22
+ if (value == null) {
23
23
  continue;
24
24
  }
25
25
  if (Array.isArray(value)) {
@@ -39,7 +39,7 @@ function stringifyObject(obj, prefix = "", options) {
39
39
  else {
40
40
  for (let i = 0; i < value.length; i++) {
41
41
  const item = value[i];
42
- if (item === undefined) {
42
+ if (item == null) {
43
43
  continue;
44
44
  }
45
45
  if (typeof item === "object" && !Array.isArray(item) && item !== null) {
@@ -11,4 +11,5 @@ export declare class SchedulinError extends Error {
11
11
  rawResponse?: core.RawResponse;
12
12
  cause?: unknown;
13
13
  });
14
+ get requestId(): string | undefined;
14
15
  }
@@ -18,6 +18,10 @@ class SchedulinError extends Error {
18
18
  this.cause = cause;
19
19
  }
20
20
  }
21
+ get requestId() {
22
+ var _a, _b, _c;
23
+ return (_c = (_b = (_a = this.rawResponse) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.get("x-request-id")) !== null && _c !== void 0 ? _c : undefined;
24
+ }
21
25
  }
22
26
  exports.SchedulinError = SchedulinError;
23
27
  function buildMessage({ message, statusCode, body, }) {
@@ -1,5 +1,5 @@
1
- export declare class SchedulinTimeoutError extends Error {
2
- readonly cause?: unknown;
1
+ import * as errors from "./index.js";
2
+ export declare class SchedulinTimeoutError extends errors.SchedulinError {
3
3
  constructor(message: string, opts?: {
4
4
  cause?: unknown;
5
5
  });
@@ -1,18 +1,52 @@
1
1
  "use strict";
2
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
+ })();
3
36
  Object.defineProperty(exports, "__esModule", { value: true });
4
37
  exports.SchedulinTimeoutError = void 0;
5
- class SchedulinTimeoutError extends Error {
38
+ const errors = __importStar(require("./index.js"));
39
+ class SchedulinTimeoutError extends errors.SchedulinError {
6
40
  constructor(message, opts) {
7
- super(message);
41
+ super({
42
+ message: message,
43
+ cause: opts === null || opts === void 0 ? void 0 : opts.cause,
44
+ });
8
45
  Object.setPrototypeOf(this, new.target.prototype);
9
46
  if (Error.captureStackTrace) {
10
47
  Error.captureStackTrace(this, this.constructor);
11
48
  }
12
49
  this.name = "SchedulinTimeoutError";
13
- if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
14
- this.cause = opts.cause;
15
- }
16
50
  }
17
51
  }
18
52
  exports.SchedulinTimeoutError = SchedulinTimeoutError;
@@ -16,6 +16,11 @@ export type BaseClientOptions = {
16
16
  fetch?: typeof fetch;
17
17
  /** Configure logging for the client. */
18
18
  logging?: core.logging.LogConfig | core.logging.Logger;
19
+ /** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
20
+ stream?: {
21
+ reconnectionEnabled?: boolean;
22
+ maxReconnectionAttempts?: number;
23
+ };
19
24
  /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
20
25
  auth?: AuthOption;
21
26
  } & HeaderAuthProvider.AuthOptions;
@@ -28,8 +33,15 @@ export interface BaseRequestOptions {
28
33
  abortSignal?: AbortSignal;
29
34
  /** Additional query string parameters to include in the request. */
30
35
  queryParams?: Record<string, unknown>;
36
+ /** A dictionary containing additional parameters to spread into the request's body. */
37
+ additionalBodyParameters?: Record<string, unknown>;
31
38
  /** Additional headers to include in the request. */
32
39
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
40
+ /** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
41
+ stream?: {
42
+ reconnectionEnabled?: boolean;
43
+ maxReconnectionAttempts?: number;
44
+ };
33
45
  }
34
46
  export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
35
47
  logging: core.logging.Logger;
package/esm/Client.d.mts CHANGED
@@ -1,7 +1,10 @@
1
+ import { AiClient } from "./api/resources/ai/client/Client.mjs";
1
2
  import { MediaClient } from "./api/resources/media/client/Client.mjs";
3
+ import { PlatformsClient } from "./api/resources/platforms/client/Client.mjs";
2
4
  import { PostsClient } from "./api/resources/posts/client/Client.mjs";
3
5
  import { SocialAccountsClient } from "./api/resources/socialAccounts/client/Client.mjs";
4
6
  import { TagsClient } from "./api/resources/tags/client/Client.mjs";
7
+ import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
5
8
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
6
9
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
7
10
  import * as core from "./core/index.mjs";
@@ -16,11 +19,17 @@ export declare class SchedulinClient {
16
19
  protected _socialAccounts: SocialAccountsClient | undefined;
17
20
  protected _tags: TagsClient | undefined;
18
21
  protected _media: MediaClient | undefined;
22
+ protected _platforms: PlatformsClient | undefined;
23
+ protected _ai: AiClient | undefined;
24
+ protected _webhooks: WebhooksClient | undefined;
19
25
  constructor(options: SchedulinClient.Options);
20
26
  get posts(): PostsClient;
21
27
  get socialAccounts(): SocialAccountsClient;
22
28
  get tags(): TagsClient;
23
29
  get media(): MediaClient;
30
+ get platforms(): PlatformsClient;
31
+ get ai(): AiClient;
32
+ get webhooks(): WebhooksClient;
24
33
  /**
25
34
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
26
35
  * This is useful for making requests to endpoints not yet supported in the SDK.
package/esm/Client.mjs CHANGED
@@ -8,10 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ import { AiClient } from "./api/resources/ai/client/Client.mjs";
11
12
  import { MediaClient } from "./api/resources/media/client/Client.mjs";
13
+ import { PlatformsClient } from "./api/resources/platforms/client/Client.mjs";
12
14
  import { PostsClient } from "./api/resources/posts/client/Client.mjs";
13
15
  import { SocialAccountsClient } from "./api/resources/socialAccounts/client/Client.mjs";
14
16
  import { TagsClient } from "./api/resources/tags/client/Client.mjs";
17
+ import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
15
18
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
16
19
  import * as core from "./core/index.mjs";
17
20
  export class SchedulinClient {
@@ -34,6 +37,18 @@ export class SchedulinClient {
34
37
  var _a;
35
38
  return ((_a = this._media) !== null && _a !== void 0 ? _a : (this._media = new MediaClient(this._options)));
36
39
  }
40
+ get platforms() {
41
+ var _a;
42
+ return ((_a = this._platforms) !== null && _a !== void 0 ? _a : (this._platforms = new PlatformsClient(this._options)));
43
+ }
44
+ get ai() {
45
+ var _a;
46
+ return ((_a = this._ai) !== null && _a !== void 0 ? _a : (this._ai = new AiClient(this._options)));
47
+ }
48
+ get webhooks() {
49
+ var _a;
50
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new WebhooksClient(this._options)));
51
+ }
37
52
  /**
38
53
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
39
54
  * This is useful for making requests to endpoints not yet supported in the SDK.
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.mjs";
2
2
  import * as errors from "../../errors/index.mjs";
3
3
  import type * as Schedulin from "../index.mjs";
4
4
  export declare class InternalServerError extends errors.SchedulinError {
5
+ readonly body: Schedulin.ErrorResponse;
5
6
  constructor(body: Schedulin.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.mjs";
2
2
  import * as errors from "../../errors/index.mjs";
3
3
  import type * as Schedulin from "../index.mjs";
4
4
  export declare class UnauthorizedError extends errors.SchedulinError {
5
+ readonly body: Schedulin.ErrorResponse;
5
6
  constructor(body: Schedulin.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -0,0 +1,49 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
+ import * as core from "../../../../core/index.mjs";
4
+ import * as Schedulin from "../../../index.mjs";
5
+ export declare namespace AiClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class AiClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<AiClient.Options>;
12
+ constructor(options: AiClient.Options);
13
+ /**
14
+ * Submit an AI image generation job
15
+ *
16
+ * @param {Schedulin.GenerateImageAiRequest} request
17
+ * @param {AiClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Schedulin.UnauthorizedError}
20
+ * @throws {@link Schedulin.InternalServerError}
21
+ * @throws {@link errors.SchedulinError}
22
+ * @throws {@link errors.SchedulinTimeoutError}
23
+ *
24
+ * @example
25
+ * await client.ai.generateImage({
26
+ * prompt: "prompt"
27
+ * })
28
+ */
29
+ generateImage(request: Schedulin.GenerateImageAiRequest, requestOptions?: AiClient.RequestOptions): core.HttpResponsePromise<unknown>;
30
+ private __generateImage;
31
+ /**
32
+ * Get the status and details of a generation job
33
+ *
34
+ * @param {Schedulin.GetGenerationAiRequest} request
35
+ * @param {AiClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Schedulin.UnauthorizedError}
38
+ * @throws {@link Schedulin.InternalServerError}
39
+ * @throws {@link errors.SchedulinError}
40
+ * @throws {@link errors.SchedulinTimeoutError}
41
+ *
42
+ * @example
43
+ * await client.ai.getGeneration({
44
+ * id: "id"
45
+ * })
46
+ */
47
+ getGeneration(request: Schedulin.GetGenerationAiRequest, requestOptions?: AiClient.RequestOptions): core.HttpResponsePromise<unknown>;
48
+ private __getGeneration;
49
+ }
@@ -0,0 +1,144 @@
1
+ // This file was auto-generated by Fern from our API Definition.
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
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../core/headers.mjs";
13
+ import * as core from "../../../../core/index.mjs";
14
+ import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.mjs";
15
+ import * as environments from "../../../../environments.mjs";
16
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
17
+ import * as errors from "../../../../errors/index.mjs";
18
+ import * as Schedulin from "../../../index.mjs";
19
+ export class AiClient {
20
+ constructor(options) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * Submit an AI image generation job
25
+ *
26
+ * @param {Schedulin.GenerateImageAiRequest} request
27
+ * @param {AiClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @throws {@link Schedulin.UnauthorizedError}
30
+ * @throws {@link Schedulin.InternalServerError}
31
+ * @throws {@link errors.SchedulinError}
32
+ * @throws {@link errors.SchedulinTimeoutError}
33
+ *
34
+ * @example
35
+ * await client.ai.generateImage({
36
+ * prompt: "prompt"
37
+ * })
38
+ */
39
+ generateImage(request, requestOptions) {
40
+ return core.HttpResponsePromise.fromPromise(this.__generateImage(request, requestOptions));
41
+ }
42
+ __generateImage(request, requestOptions) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
46
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
47
+ const _response = yield core.fetcher({
48
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SchedulinEnvironment.Default, "v0/studio/generateImage"),
49
+ method: "POST",
50
+ headers: _headers,
51
+ contentType: "application/json",
52
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
53
+ requestType: "json",
54
+ body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
55
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
56
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
57
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
58
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
59
+ logging: this._options.logging,
60
+ });
61
+ if (_response.ok) {
62
+ return { data: _response.body, rawResponse: _response.rawResponse };
63
+ }
64
+ if (_response.error.reason === "status-code") {
65
+ switch (_response.error.statusCode) {
66
+ case 401:
67
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
68
+ case 500:
69
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
70
+ default:
71
+ throw new errors.SchedulinError({
72
+ statusCode: _response.error.statusCode,
73
+ body: _response.error.body,
74
+ rawResponse: _response.rawResponse,
75
+ });
76
+ }
77
+ }
78
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/studio/generateImage");
79
+ });
80
+ }
81
+ /**
82
+ * Get the status and details of a generation job
83
+ *
84
+ * @param {Schedulin.GetGenerationAiRequest} request
85
+ * @param {AiClient.RequestOptions} requestOptions - Request-specific configuration.
86
+ *
87
+ * @throws {@link Schedulin.UnauthorizedError}
88
+ * @throws {@link Schedulin.InternalServerError}
89
+ * @throws {@link errors.SchedulinError}
90
+ * @throws {@link errors.SchedulinTimeoutError}
91
+ *
92
+ * @example
93
+ * await client.ai.getGeneration({
94
+ * id: "id"
95
+ * })
96
+ */
97
+ getGeneration(request, requestOptions) {
98
+ return core.HttpResponsePromise.fromPromise(this.__getGeneration(request, requestOptions));
99
+ }
100
+ __getGeneration(request, requestOptions) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
103
+ const { id } = request;
104
+ const _queryParams = {
105
+ id,
106
+ };
107
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
108
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
109
+ const _response = yield core.fetcher({
110
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SchedulinEnvironment.Default, "v0/studio/getGeneration"),
111
+ method: "GET",
112
+ headers: _headers,
113
+ queryString: core.url
114
+ .queryBuilder()
115
+ .addMany(_queryParams)
116
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
117
+ .build(),
118
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
119
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
120
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
121
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
122
+ logging: this._options.logging,
123
+ });
124
+ if (_response.ok) {
125
+ return { data: _response.body, rawResponse: _response.rawResponse };
126
+ }
127
+ if (_response.error.reason === "status-code") {
128
+ switch (_response.error.statusCode) {
129
+ case 401:
130
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
131
+ case 500:
132
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
133
+ default:
134
+ throw new errors.SchedulinError({
135
+ statusCode: _response.error.statusCode,
136
+ body: _response.error.body,
137
+ rawResponse: _response.rawResponse,
138
+ });
139
+ }
140
+ }
141
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/studio/getGeneration");
142
+ });
143
+ }
144
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * prompt: "prompt"
5
+ * }
6
+ */
7
+ export interface GenerateImageAiRequest {
8
+ prompt: string;
9
+ modelKey?: GenerateImageAiRequest.ModelKey;
10
+ width?: number;
11
+ height?: number;
12
+ }
13
+ export declare namespace GenerateImageAiRequest {
14
+ const ModelKey: {
15
+ readonly FluxSchnell: "flux_schnell";
16
+ readonly FluxDev: "flux_dev";
17
+ readonly FluxProUltra: "flux_pro_ultra";
18
+ };
19
+ type ModelKey = (typeof ModelKey)[keyof typeof ModelKey];
20
+ }