@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
@@ -0,0 +1,538 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.WebhooksClient = void 0;
58
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
59
+ const headers_js_1 = require("../../../../core/headers.js");
60
+ const core = __importStar(require("../../../../core/index.js"));
61
+ const requestBody_js_1 = require("../../../../core/requestBody.js");
62
+ const environments = __importStar(require("../../../../environments.js"));
63
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
64
+ const errors = __importStar(require("../../../../errors/index.js"));
65
+ const Schedulin = __importStar(require("../../../index.js"));
66
+ class WebhooksClient {
67
+ constructor(options) {
68
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
69
+ }
70
+ /**
71
+ * List the organization's webhook endpoints. Signing secrets are masked.
72
+ *
73
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link Schedulin.UnauthorizedError}
76
+ * @throws {@link Schedulin.InternalServerError}
77
+ * @throws {@link errors.SchedulinError}
78
+ * @throws {@link errors.SchedulinTimeoutError}
79
+ *
80
+ * @example
81
+ * await client.webhooks.list()
82
+ */
83
+ list(requestOptions) {
84
+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
85
+ }
86
+ __list(requestOptions) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
90
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
91
+ const _response = yield core.fetcher({
92
+ 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/webhooks"),
93
+ method: "GET",
94
+ headers: _headers,
95
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
96
+ 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,
97
+ 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,
98
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
99
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
100
+ logging: this._options.logging,
101
+ });
102
+ if (_response.ok) {
103
+ return { data: _response.body, rawResponse: _response.rawResponse };
104
+ }
105
+ if (_response.error.reason === "status-code") {
106
+ switch (_response.error.statusCode) {
107
+ case 401:
108
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
109
+ case 500:
110
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
111
+ default:
112
+ throw new errors.SchedulinError({
113
+ statusCode: _response.error.statusCode,
114
+ body: _response.error.body,
115
+ rawResponse: _response.rawResponse,
116
+ });
117
+ }
118
+ }
119
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks");
120
+ });
121
+ }
122
+ /**
123
+ * Register an HTTPS endpoint for event deliveries. The response includes the signing secret ONCE — store it; later reads return a masked value.
124
+ *
125
+ * @param {Schedulin.CreateWebhooksRequest} request
126
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
127
+ *
128
+ * @throws {@link Schedulin.UnauthorizedError}
129
+ * @throws {@link Schedulin.InternalServerError}
130
+ * @throws {@link errors.SchedulinError}
131
+ * @throws {@link errors.SchedulinTimeoutError}
132
+ *
133
+ * @example
134
+ * await client.webhooks.create({
135
+ * url: "url",
136
+ * events: ["post.published"]
137
+ * })
138
+ */
139
+ create(request, requestOptions) {
140
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
141
+ }
142
+ __create(request, requestOptions) {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
145
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
146
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
147
+ const _response = yield core.fetcher({
148
+ 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/webhooks"),
149
+ method: "POST",
150
+ headers: _headers,
151
+ contentType: "application/json",
152
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
153
+ requestType: "json",
154
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
155
+ 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,
156
+ 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,
157
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
158
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
159
+ logging: this._options.logging,
160
+ });
161
+ if (_response.ok) {
162
+ return { data: _response.body, rawResponse: _response.rawResponse };
163
+ }
164
+ if (_response.error.reason === "status-code") {
165
+ switch (_response.error.statusCode) {
166
+ case 401:
167
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
168
+ case 500:
169
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
170
+ default:
171
+ throw new errors.SchedulinError({
172
+ statusCode: _response.error.statusCode,
173
+ body: _response.error.body,
174
+ rawResponse: _response.rawResponse,
175
+ });
176
+ }
177
+ }
178
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/webhooks");
179
+ });
180
+ }
181
+ /**
182
+ * Retrieve one webhook endpoint, including failure counters. The signing secret is masked.
183
+ *
184
+ * @param {Schedulin.RetrieveWebhooksRequest} request
185
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
186
+ *
187
+ * @throws {@link Schedulin.UnauthorizedError}
188
+ * @throws {@link Schedulin.InternalServerError}
189
+ * @throws {@link errors.SchedulinError}
190
+ * @throws {@link errors.SchedulinTimeoutError}
191
+ *
192
+ * @example
193
+ * await client.webhooks.retrieve({
194
+ * id: "id"
195
+ * })
196
+ */
197
+ retrieve(request, requestOptions) {
198
+ return core.HttpResponsePromise.fromPromise(this.__retrieve(request, requestOptions));
199
+ }
200
+ __retrieve(request, requestOptions) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
203
+ const { id } = request;
204
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
205
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
206
+ const _response = yield core.fetcher({
207
+ 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/webhooks/${core.url.encodePathParam(id)}`),
208
+ method: "GET",
209
+ headers: _headers,
210
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
211
+ 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,
212
+ 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,
213
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
214
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
215
+ logging: this._options.logging,
216
+ });
217
+ if (_response.ok) {
218
+ return { data: _response.body, rawResponse: _response.rawResponse };
219
+ }
220
+ if (_response.error.reason === "status-code") {
221
+ switch (_response.error.statusCode) {
222
+ case 401:
223
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
224
+ case 500:
225
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
226
+ default:
227
+ throw new errors.SchedulinError({
228
+ statusCode: _response.error.statusCode,
229
+ body: _response.error.body,
230
+ rawResponse: _response.rawResponse,
231
+ });
232
+ }
233
+ }
234
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{id}");
235
+ });
236
+ }
237
+ /**
238
+ * Delete a webhook endpoint and its delivery history. Deliveries already in flight are dropped.
239
+ *
240
+ * @param {Schedulin.DeleteWebhooksRequest} request
241
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
242
+ *
243
+ * @throws {@link Schedulin.UnauthorizedError}
244
+ * @throws {@link Schedulin.InternalServerError}
245
+ * @throws {@link errors.SchedulinError}
246
+ * @throws {@link errors.SchedulinTimeoutError}
247
+ *
248
+ * @example
249
+ * await client.webhooks.delete({
250
+ * id: "id"
251
+ * })
252
+ */
253
+ delete(request, requestOptions) {
254
+ return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
255
+ }
256
+ __delete(request, requestOptions) {
257
+ return __awaiter(this, void 0, void 0, function* () {
258
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
259
+ const { id } = request, _body = __rest(request, ["id"]);
260
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
261
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
262
+ const _response = yield core.fetcher({
263
+ 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/webhooks/${core.url.encodePathParam(id)}`),
264
+ method: "DELETE",
265
+ headers: _headers,
266
+ contentType: "application/json",
267
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
268
+ requestType: "json",
269
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
270
+ 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,
271
+ 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,
272
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
273
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
274
+ logging: this._options.logging,
275
+ });
276
+ if (_response.ok) {
277
+ return { data: _response.body, rawResponse: _response.rawResponse };
278
+ }
279
+ if (_response.error.reason === "status-code") {
280
+ switch (_response.error.statusCode) {
281
+ case 401:
282
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
283
+ case 500:
284
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
285
+ default:
286
+ throw new errors.SchedulinError({
287
+ statusCode: _response.error.statusCode,
288
+ body: _response.error.body,
289
+ rawResponse: _response.rawResponse,
290
+ });
291
+ }
292
+ }
293
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/webhooks/{id}");
294
+ });
295
+ }
296
+ /**
297
+ * Update URL, subscribed events, description, or enabled state. Re-enabling resets the failure streak.
298
+ *
299
+ * @param {Schedulin.UpdateWebhooksRequest} request
300
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
301
+ *
302
+ * @throws {@link Schedulin.UnauthorizedError}
303
+ * @throws {@link Schedulin.InternalServerError}
304
+ * @throws {@link errors.SchedulinError}
305
+ * @throws {@link errors.SchedulinTimeoutError}
306
+ *
307
+ * @example
308
+ * await client.webhooks.update({
309
+ * id: "id"
310
+ * })
311
+ */
312
+ update(request, requestOptions) {
313
+ return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
314
+ }
315
+ __update(request, requestOptions) {
316
+ return __awaiter(this, void 0, void 0, function* () {
317
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
318
+ const { id } = request, _body = __rest(request, ["id"]);
319
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
320
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
321
+ const _response = yield core.fetcher({
322
+ 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/webhooks/${core.url.encodePathParam(id)}`),
323
+ method: "PATCH",
324
+ headers: _headers,
325
+ contentType: "application/json",
326
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
327
+ requestType: "json",
328
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
329
+ 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,
330
+ 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,
331
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
332
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
333
+ logging: this._options.logging,
334
+ });
335
+ if (_response.ok) {
336
+ return { data: _response.body, rawResponse: _response.rawResponse };
337
+ }
338
+ if (_response.error.reason === "status-code") {
339
+ switch (_response.error.statusCode) {
340
+ case 401:
341
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
342
+ case 500:
343
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
344
+ default:
345
+ throw new errors.SchedulinError({
346
+ statusCode: _response.error.statusCode,
347
+ body: _response.error.body,
348
+ rawResponse: _response.rawResponse,
349
+ });
350
+ }
351
+ }
352
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v0/webhooks/{id}");
353
+ });
354
+ }
355
+ /**
356
+ * Generate a new signing secret for the endpoint and return it ONCE. The old secret stops signing immediately.
357
+ *
358
+ * @param {Schedulin.RotateSecretWebhooksRequest} request
359
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
360
+ *
361
+ * @throws {@link Schedulin.UnauthorizedError}
362
+ * @throws {@link Schedulin.InternalServerError}
363
+ * @throws {@link errors.SchedulinError}
364
+ * @throws {@link errors.SchedulinTimeoutError}
365
+ *
366
+ * @example
367
+ * await client.webhooks.rotateSecret({
368
+ * id: "id"
369
+ * })
370
+ */
371
+ rotateSecret(request, requestOptions) {
372
+ return core.HttpResponsePromise.fromPromise(this.__rotateSecret(request, requestOptions));
373
+ }
374
+ __rotateSecret(request, requestOptions) {
375
+ return __awaiter(this, void 0, void 0, function* () {
376
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
377
+ const { id } = request, _body = __rest(request, ["id"]);
378
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
379
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
380
+ const _response = yield core.fetcher({
381
+ 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/webhooks/${core.url.encodePathParam(id)}/rotate-secret`),
382
+ method: "POST",
383
+ headers: _headers,
384
+ contentType: "application/json",
385
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
386
+ requestType: "json",
387
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
388
+ 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,
389
+ 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,
390
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
391
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
392
+ logging: this._options.logging,
393
+ });
394
+ if (_response.ok) {
395
+ return { data: _response.body, rawResponse: _response.rawResponse };
396
+ }
397
+ if (_response.error.reason === "status-code") {
398
+ switch (_response.error.statusCode) {
399
+ case 401:
400
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
401
+ case 500:
402
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
403
+ default:
404
+ throw new errors.SchedulinError({
405
+ statusCode: _response.error.statusCode,
406
+ body: _response.error.body,
407
+ rawResponse: _response.rawResponse,
408
+ });
409
+ }
410
+ }
411
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/webhooks/{id}/rotate-secret");
412
+ });
413
+ }
414
+ /**
415
+ * Send a signed `ping` event to the endpoint URL and record it in the delivery history.
416
+ *
417
+ * @param {Schedulin.TestWebhooksRequest} request
418
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
419
+ *
420
+ * @throws {@link Schedulin.UnauthorizedError}
421
+ * @throws {@link Schedulin.InternalServerError}
422
+ * @throws {@link errors.SchedulinError}
423
+ * @throws {@link errors.SchedulinTimeoutError}
424
+ *
425
+ * @example
426
+ * await client.webhooks.test({
427
+ * id: "id"
428
+ * })
429
+ */
430
+ test(request, requestOptions) {
431
+ return core.HttpResponsePromise.fromPromise(this.__test(request, requestOptions));
432
+ }
433
+ __test(request, requestOptions) {
434
+ return __awaiter(this, void 0, void 0, function* () {
435
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
436
+ const { id } = request, _body = __rest(request, ["id"]);
437
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
438
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
439
+ const _response = yield core.fetcher({
440
+ 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/webhooks/${core.url.encodePathParam(id)}/test`),
441
+ method: "POST",
442
+ headers: _headers,
443
+ contentType: "application/json",
444
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
445
+ requestType: "json",
446
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
447
+ 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,
448
+ 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,
449
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
450
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
451
+ logging: this._options.logging,
452
+ });
453
+ if (_response.ok) {
454
+ return { data: _response.body, rawResponse: _response.rawResponse };
455
+ }
456
+ if (_response.error.reason === "status-code") {
457
+ switch (_response.error.statusCode) {
458
+ case 401:
459
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
460
+ case 500:
461
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
462
+ default:
463
+ throw new errors.SchedulinError({
464
+ statusCode: _response.error.statusCode,
465
+ body: _response.error.body,
466
+ rawResponse: _response.rawResponse,
467
+ });
468
+ }
469
+ }
470
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/webhooks/{id}/test");
471
+ });
472
+ }
473
+ /**
474
+ * Delivery history for a webhook endpoint: event, status, attempts, last response code, and payload.
475
+ *
476
+ * @param {Schedulin.ListDeliveriesWebhooksRequest} request
477
+ * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
478
+ *
479
+ * @throws {@link Schedulin.UnauthorizedError}
480
+ * @throws {@link Schedulin.InternalServerError}
481
+ * @throws {@link errors.SchedulinError}
482
+ * @throws {@link errors.SchedulinTimeoutError}
483
+ *
484
+ * @example
485
+ * await client.webhooks.listDeliveries({
486
+ * id: "id"
487
+ * })
488
+ */
489
+ listDeliveries(request, requestOptions) {
490
+ return core.HttpResponsePromise.fromPromise(this.__listDeliveries(request, requestOptions));
491
+ }
492
+ __listDeliveries(request, requestOptions) {
493
+ return __awaiter(this, void 0, void 0, function* () {
494
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
495
+ const { id, limit, page } = request;
496
+ const _queryParams = {
497
+ limit,
498
+ page,
499
+ };
500
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
501
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
502
+ const _response = yield core.fetcher({
503
+ 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/webhooks/${core.url.encodePathParam(id)}/deliveries`),
504
+ method: "GET",
505
+ headers: _headers,
506
+ queryString: core.url
507
+ .queryBuilder()
508
+ .addMany(_queryParams)
509
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
510
+ .build(),
511
+ 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,
512
+ 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,
513
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
514
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
515
+ logging: this._options.logging,
516
+ });
517
+ if (_response.ok) {
518
+ return { data: _response.body, rawResponse: _response.rawResponse };
519
+ }
520
+ if (_response.error.reason === "status-code") {
521
+ switch (_response.error.statusCode) {
522
+ case 401:
523
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
524
+ case 500:
525
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
526
+ default:
527
+ throw new errors.SchedulinError({
528
+ statusCode: _response.error.statusCode,
529
+ body: _response.error.body,
530
+ rawResponse: _response.rawResponse,
531
+ });
532
+ }
533
+ }
534
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/webhooks/{id}/deliveries");
535
+ });
536
+ }
537
+ }
538
+ exports.WebhooksClient = WebhooksClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * url: "url",
5
+ * events: ["post.published"]
6
+ * }
7
+ */
8
+ export interface CreateWebhooksRequest {
9
+ url: string;
10
+ events: CreateWebhooksRequest.Events.Item[];
11
+ description?: string;
12
+ }
13
+ export declare namespace CreateWebhooksRequest {
14
+ type Events = Events.Item[];
15
+ namespace Events {
16
+ const Item: {
17
+ readonly PostPublished: "post.published";
18
+ readonly PostFailed: "post.failed";
19
+ readonly GenerationCompleted: "generation.completed";
20
+ readonly GenerationFailed: "generation.failed";
21
+ };
22
+ type Item = (typeof Item)[keyof typeof Item];
23
+ }
24
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreateWebhooksRequest = void 0;
5
+ var CreateWebhooksRequest;
6
+ (function (CreateWebhooksRequest) {
7
+ let Events;
8
+ (function (Events) {
9
+ Events.Item = {
10
+ PostPublished: "post.published",
11
+ PostFailed: "post.failed",
12
+ GenerationCompleted: "generation.completed",
13
+ GenerationFailed: "generation.failed",
14
+ };
15
+ })(Events = CreateWebhooksRequest.Events || (CreateWebhooksRequest.Events = {}));
16
+ })(CreateWebhooksRequest || (exports.CreateWebhooksRequest = CreateWebhooksRequest = {}));
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface DeleteWebhooksRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface ListDeliveriesWebhooksRequest {
8
+ id: string;
9
+ limit?: number;
10
+ page?: number;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface RetrieveWebhooksRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });