@airweave/sdk 0.7.20 → 0.8.77

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 (277) hide show
  1. package/README.md +1 -5
  2. package/dist/cjs/Client.d.ts +3 -8
  3. package/dist/cjs/Client.js +7 -4
  4. package/dist/cjs/api/errors/ConflictError.d.ts +9 -0
  5. package/dist/cjs/api/errors/ConflictError.js +52 -0
  6. package/dist/cjs/api/errors/NotFoundError.d.ts +9 -0
  7. package/dist/cjs/api/errors/NotFoundError.js +52 -0
  8. package/dist/cjs/api/errors/TooManyRequestsError.d.ts +9 -0
  9. package/dist/cjs/api/errors/TooManyRequestsError.js +52 -0
  10. package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +1 -2
  11. package/dist/cjs/api/errors/index.d.ts +3 -0
  12. package/dist/cjs/api/errors/index.js +3 -0
  13. package/dist/cjs/api/resources/collections/client/Client.d.ts +107 -42
  14. package/dist/cjs/api/resources/collections/client/Client.js +205 -58
  15. package/dist/cjs/api/resources/collections/client/requests/CollectionCreate.d.ts +3 -0
  16. package/dist/cjs/api/resources/collections/client/requests/CollectionUpdate.d.ts +16 -0
  17. package/dist/cjs/api/resources/collections/client/requests/ListCollectionsGetRequest.d.ts +4 -4
  18. package/dist/cjs/api/resources/collections/client/requests/SearchGetLegacyCollectionsReadableIdSearchGetRequest.d.ts +4 -4
  19. package/dist/cjs/api/resources/collections/client/requests/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/collections/types/index.d.ts +0 -1
  21. package/dist/cjs/api/resources/collections/types/index.js +0 -1
  22. package/dist/cjs/api/resources/index.d.ts +2 -0
  23. package/dist/cjs/api/resources/index.js +3 -1
  24. package/dist/cjs/api/resources/sourceConnections/client/Client.d.ts +96 -62
  25. package/dist/cjs/api/resources/sourceConnections/client/Client.js +152 -78
  26. package/dist/cjs/api/resources/sourceConnections/client/requests/GetSourceConnectionJobsSourceConnectionsSourceConnectionIdJobsGetRequest.d.ts +2 -1
  27. package/dist/cjs/api/resources/sourceConnections/client/requests/ListSourceConnectionsGetRequest.d.ts +4 -2
  28. package/dist/cjs/api/resources/sourceConnections/client/requests/RunSourceConnectionsSourceConnectionIdRunPostRequest.d.ts +2 -2
  29. package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.ts +10 -9
  30. package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.ts +6 -3
  31. package/dist/cjs/api/resources/sources/client/Client.d.ts +24 -13
  32. package/dist/cjs/api/resources/sources/client/Client.js +36 -11
  33. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +231 -0
  34. package/dist/cjs/api/resources/webhooks/client/Client.js +689 -0
  35. package/dist/cjs/api/resources/webhooks/client/index.d.ts +2 -0
  36. package/dist/cjs/api/resources/webhooks/client/index.js +17 -0
  37. package/dist/cjs/api/resources/webhooks/client/requests/CreateSubscriptionRequest.d.ts +19 -0
  38. package/dist/cjs/api/resources/webhooks/client/requests/GetMessageWebhooksMessagesMessageIdGetRequest.d.ts +13 -0
  39. package/dist/cjs/api/resources/webhooks/client/requests/GetMessagesWebhooksMessagesGetRequest.d.ts +11 -0
  40. package/dist/cjs/api/resources/webhooks/client/requests/GetSubscriptionWebhooksSubscriptionsSubscriptionIdGetRequest.d.ts +13 -0
  41. package/dist/cjs/api/resources/webhooks/client/requests/PatchSubscriptionRequest.d.ts +18 -0
  42. package/dist/cjs/api/resources/webhooks/client/requests/RecoverMessagesRequest.d.ts +15 -0
  43. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +6 -0
  44. package/dist/cjs/api/resources/webhooks/client/requests/index.js +2 -0
  45. package/dist/cjs/api/resources/webhooks/index.d.ts +1 -0
  46. package/dist/cjs/api/resources/webhooks/index.js +17 -0
  47. package/dist/cjs/api/types/AdminSearchDestination.d.ts +11 -0
  48. package/dist/cjs/api/types/AdminSearchDestination.js +10 -0
  49. package/dist/cjs/api/types/{SyncWithSourceConnection.d.ts → AdminSyncInfo.d.ts} +14 -3
  50. package/dist/cjs/api/types/BehaviorConfig.d.ts +14 -0
  51. package/dist/cjs/api/types/BodyResyncWithExecutionConfigAdminResyncSyncIdPost.d.ts +10 -0
  52. package/dist/cjs/api/types/Collection.d.ts +4 -2
  53. package/dist/cjs/api/types/ConfigField.d.ts +2 -0
  54. package/dist/cjs/api/types/ConflictErrorResponse.d.ts +13 -0
  55. package/dist/cjs/api/types/CursorConfig.d.ts +12 -0
  56. package/dist/cjs/api/types/DeliveryAttempt.d.ts +28 -0
  57. package/dist/cjs/api/types/DestinationConfig.d.ts +16 -0
  58. package/dist/cjs/api/types/EventType.d.ts +24 -0
  59. package/dist/cjs/api/types/EventType.js +19 -0
  60. package/dist/cjs/api/types/FeatureFlag.d.ts +4 -1
  61. package/dist/cjs/api/types/FeatureFlag.js +3 -0
  62. package/dist/cjs/api/types/HandlerConfig.d.ts +14 -0
  63. package/dist/cjs/api/types/LegacySearchRequest.d.ts +2 -2
  64. package/dist/cjs/api/types/NotFoundErrorResponse.d.ts +10 -0
  65. package/dist/cjs/api/types/RateLimitErrorResponse.d.ts +13 -0
  66. package/dist/cjs/api/types/RecoveryTask.d.ts +16 -0
  67. package/dist/cjs/api/types/S3ConfigRequest.d.ts +5 -9
  68. package/dist/cjs/api/types/SearchRequest.d.ts +15 -12
  69. package/dist/cjs/api/types/SearchResponse.d.ts +6 -3
  70. package/dist/cjs/api/types/Source.d.ts +4 -0
  71. package/dist/cjs/api/types/SourceConnection.d.ts +21 -3
  72. package/dist/cjs/api/types/SourceConnectionJob.d.ts +16 -1
  73. package/dist/cjs/api/types/SourceConnectionListItem.d.ts +13 -2
  74. package/dist/cjs/api/types/Sync.d.ts +1 -0
  75. package/dist/cjs/api/types/SyncConfig.d.ts +17 -0
  76. package/dist/cjs/api/types/SyncCreate.d.ts +1 -0
  77. package/dist/cjs/api/types/SyncJob.d.ts +2 -0
  78. package/dist/cjs/api/types/SyncUpdate.d.ts +1 -0
  79. package/dist/cjs/api/types/ValidationErrorDetail.d.ts +14 -0
  80. package/dist/cjs/api/types/ValidationErrorResponse.d.ts +14 -0
  81. package/dist/cjs/api/types/WebhookMessage.d.ts +22 -0
  82. package/dist/cjs/api/types/WebhookMessageWithAttempts.d.ts +23 -0
  83. package/dist/cjs/api/types/WebhookSubscription.d.ts +27 -0
  84. package/dist/cjs/api/types/index.d.ts +19 -25
  85. package/dist/cjs/api/types/index.js +19 -25
  86. package/dist/cjs/version.d.ts +1 -1
  87. package/dist/cjs/version.js +1 -1
  88. package/dist/esm/Client.d.mts +3 -8
  89. package/dist/esm/Client.mjs +7 -4
  90. package/dist/esm/api/errors/ConflictError.d.mts +9 -0
  91. package/dist/esm/api/errors/ConflictError.mjs +15 -0
  92. package/dist/esm/api/errors/NotFoundError.d.mts +9 -0
  93. package/dist/esm/api/errors/NotFoundError.mjs +15 -0
  94. package/dist/esm/api/errors/TooManyRequestsError.d.mts +9 -0
  95. package/dist/esm/api/errors/TooManyRequestsError.mjs +15 -0
  96. package/dist/esm/api/errors/UnprocessableEntityError.d.mts +1 -2
  97. package/dist/esm/api/errors/index.d.mts +3 -0
  98. package/dist/esm/api/errors/index.mjs +3 -0
  99. package/dist/esm/api/resources/collections/client/Client.d.mts +107 -42
  100. package/dist/esm/api/resources/collections/client/Client.mjs +205 -58
  101. package/dist/esm/api/resources/collections/client/requests/CollectionCreate.d.mts +3 -0
  102. package/dist/esm/api/resources/collections/client/requests/CollectionUpdate.d.mts +16 -0
  103. package/dist/esm/api/resources/collections/client/requests/ListCollectionsGetRequest.d.mts +4 -4
  104. package/dist/esm/api/resources/collections/client/requests/SearchGetLegacyCollectionsReadableIdSearchGetRequest.d.mts +4 -4
  105. package/dist/esm/api/resources/collections/client/requests/index.d.mts +1 -0
  106. package/dist/esm/api/resources/collections/types/index.d.mts +0 -1
  107. package/dist/esm/api/resources/collections/types/index.mjs +0 -1
  108. package/dist/esm/api/resources/index.d.mts +2 -0
  109. package/dist/esm/api/resources/index.mjs +2 -0
  110. package/dist/esm/api/resources/sourceConnections/client/Client.d.mts +96 -62
  111. package/dist/esm/api/resources/sourceConnections/client/Client.mjs +152 -78
  112. package/dist/esm/api/resources/sourceConnections/client/requests/GetSourceConnectionJobsSourceConnectionsSourceConnectionIdJobsGetRequest.d.mts +2 -1
  113. package/dist/esm/api/resources/sourceConnections/client/requests/ListSourceConnectionsGetRequest.d.mts +4 -2
  114. package/dist/esm/api/resources/sourceConnections/client/requests/RunSourceConnectionsSourceConnectionIdRunPostRequest.d.mts +2 -2
  115. package/dist/esm/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.mts +10 -9
  116. package/dist/esm/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.mts +6 -3
  117. package/dist/esm/api/resources/sources/client/Client.d.mts +24 -13
  118. package/dist/esm/api/resources/sources/client/Client.mjs +36 -11
  119. package/dist/esm/api/resources/webhooks/client/Client.d.mts +231 -0
  120. package/dist/esm/api/resources/webhooks/client/Client.mjs +652 -0
  121. package/dist/esm/api/resources/webhooks/client/index.d.mts +2 -0
  122. package/dist/esm/api/resources/webhooks/client/index.mjs +1 -0
  123. package/dist/esm/api/resources/webhooks/client/requests/CreateSubscriptionRequest.d.mts +19 -0
  124. package/dist/esm/api/resources/webhooks/client/requests/GetMessageWebhooksMessagesMessageIdGetRequest.d.mts +13 -0
  125. package/dist/esm/api/resources/webhooks/client/requests/GetMessagesWebhooksMessagesGetRequest.d.mts +11 -0
  126. package/dist/esm/api/resources/webhooks/client/requests/GetSubscriptionWebhooksSubscriptionsSubscriptionIdGetRequest.d.mts +13 -0
  127. package/dist/esm/api/resources/webhooks/client/requests/PatchSubscriptionRequest.d.mts +18 -0
  128. package/dist/esm/api/resources/webhooks/client/requests/RecoverMessagesRequest.d.mts +15 -0
  129. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +6 -0
  130. package/dist/esm/api/resources/webhooks/client/requests/index.mjs +1 -0
  131. package/dist/esm/api/resources/webhooks/index.d.mts +1 -0
  132. package/dist/esm/api/resources/webhooks/index.mjs +1 -0
  133. package/dist/esm/api/types/AdminSearchDestination.d.mts +11 -0
  134. package/dist/esm/api/types/AdminSearchDestination.mjs +7 -0
  135. package/dist/esm/api/types/{SyncWithSourceConnection.d.mts → AdminSyncInfo.d.mts} +14 -3
  136. package/dist/esm/api/types/BehaviorConfig.d.mts +14 -0
  137. package/dist/esm/api/types/BodyResyncWithExecutionConfigAdminResyncSyncIdPost.d.mts +10 -0
  138. package/dist/esm/api/types/Collection.d.mts +4 -2
  139. package/dist/esm/api/types/ConfigField.d.mts +2 -0
  140. package/dist/esm/api/types/ConflictErrorResponse.d.mts +13 -0
  141. package/dist/esm/api/types/CursorConfig.d.mts +12 -0
  142. package/dist/esm/api/types/DeliveryAttempt.d.mts +28 -0
  143. package/dist/esm/api/types/DestinationConfig.d.mts +16 -0
  144. package/dist/esm/api/types/EventType.d.mts +24 -0
  145. package/dist/esm/api/types/EventType.mjs +16 -0
  146. package/dist/esm/api/types/FeatureFlag.d.mts +4 -1
  147. package/dist/esm/api/types/FeatureFlag.mjs +3 -0
  148. package/dist/esm/api/types/HandlerConfig.d.mts +14 -0
  149. package/dist/esm/api/types/LegacySearchRequest.d.mts +2 -2
  150. package/dist/esm/api/types/NotFoundErrorResponse.d.mts +10 -0
  151. package/dist/esm/api/types/RateLimitErrorResponse.d.mts +13 -0
  152. package/dist/esm/api/types/RecoveryTask.d.mts +16 -0
  153. package/dist/esm/api/types/S3ConfigRequest.d.mts +5 -9
  154. package/dist/esm/api/types/SearchRequest.d.mts +15 -12
  155. package/dist/esm/api/types/SearchResponse.d.mts +6 -3
  156. package/dist/esm/api/types/Source.d.mts +4 -0
  157. package/dist/esm/api/types/SourceConnection.d.mts +21 -3
  158. package/dist/esm/api/types/SourceConnectionJob.d.mts +16 -1
  159. package/dist/esm/api/types/SourceConnectionListItem.d.mts +13 -2
  160. package/dist/esm/api/types/Sync.d.mts +1 -0
  161. package/dist/esm/api/types/SyncConfig.d.mts +17 -0
  162. package/dist/esm/api/types/SyncCreate.d.mts +1 -0
  163. package/dist/esm/api/types/SyncJob.d.mts +2 -0
  164. package/dist/esm/api/types/SyncUpdate.d.mts +1 -0
  165. package/dist/esm/api/types/ValidationErrorDetail.d.mts +14 -0
  166. package/dist/esm/api/types/ValidationErrorResponse.d.mts +14 -0
  167. package/dist/esm/api/types/WebhookMessage.d.mts +22 -0
  168. package/dist/esm/api/types/WebhookMessageWithAttempts.d.mts +23 -0
  169. package/dist/esm/api/types/WebhookSubscription.d.mts +27 -0
  170. package/dist/esm/api/types/index.d.mts +19 -25
  171. package/dist/esm/api/types/index.mjs +19 -25
  172. package/dist/esm/version.d.mts +1 -1
  173. package/dist/esm/version.mjs +1 -1
  174. package/package.json +1 -1
  175. package/reference.md +891 -121
  176. package/dist/cjs/api/resources/collections/types/SearchCollectionsReadableIdSearchPostResponse.d.ts +0 -5
  177. package/dist/cjs/api/types/CollectionUpdate.d.ts +0 -13
  178. package/dist/cjs/api/types/DatetimeRange.d.ts +0 -34
  179. package/dist/cjs/api/types/FieldCondition.d.ts +0 -33
  180. package/dist/cjs/api/types/Filter.d.ts +0 -28
  181. package/dist/cjs/api/types/GeoBoundingBox.d.ts +0 -13
  182. package/dist/cjs/api/types/GeoLineString.d.ts +0 -11
  183. package/dist/cjs/api/types/GeoPoint.d.ts +0 -12
  184. package/dist/cjs/api/types/GeoPolygon.d.ts +0 -13
  185. package/dist/cjs/api/types/GeoRadius.d.ts +0 -13
  186. package/dist/cjs/api/types/HasIdCondition.d.ts +0 -16
  187. package/dist/cjs/api/types/HasVectorCondition.d.ts +0 -10
  188. package/dist/cjs/api/types/IsEmptyCondition.d.ts +0 -11
  189. package/dist/cjs/api/types/IsNullCondition.d.ts +0 -11
  190. package/dist/cjs/api/types/MatchAny.d.ts +0 -16
  191. package/dist/cjs/api/types/MatchExcept.d.ts +0 -16
  192. package/dist/cjs/api/types/MatchPhrase.d.ts +0 -10
  193. package/dist/cjs/api/types/MatchText.d.ts +0 -10
  194. package/dist/cjs/api/types/MatchValue.d.ts +0 -16
  195. package/dist/cjs/api/types/MinShould.d.ts +0 -16
  196. package/dist/cjs/api/types/Nested.d.ts +0 -13
  197. package/dist/cjs/api/types/NestedCondition.d.ts +0 -8
  198. package/dist/cjs/api/types/PayloadField.d.ts +0 -10
  199. package/dist/cjs/api/types/Range.d.ts +0 -16
  200. package/dist/cjs/api/types/SyncWithSourceConnection.js +0 -5
  201. package/dist/cjs/api/types/ValuesCount.d.ts +0 -16
  202. package/dist/cjs/api/types/ValuesCount.js +0 -5
  203. package/dist/esm/api/resources/collections/types/SearchCollectionsReadableIdSearchPostResponse.d.mts +0 -5
  204. package/dist/esm/api/types/CollectionUpdate.d.mts +0 -13
  205. package/dist/esm/api/types/DatetimeRange.d.mts +0 -34
  206. package/dist/esm/api/types/FieldCondition.d.mts +0 -33
  207. package/dist/esm/api/types/Filter.d.mts +0 -28
  208. package/dist/esm/api/types/GeoBoundingBox.d.mts +0 -13
  209. package/dist/esm/api/types/GeoLineString.d.mts +0 -11
  210. package/dist/esm/api/types/GeoPoint.d.mts +0 -12
  211. package/dist/esm/api/types/GeoPolygon.d.mts +0 -13
  212. package/dist/esm/api/types/GeoRadius.d.mts +0 -13
  213. package/dist/esm/api/types/HasIdCondition.d.mts +0 -16
  214. package/dist/esm/api/types/HasVectorCondition.d.mts +0 -10
  215. package/dist/esm/api/types/IsEmptyCondition.d.mts +0 -11
  216. package/dist/esm/api/types/IsNullCondition.d.mts +0 -11
  217. package/dist/esm/api/types/MatchAny.d.mts +0 -16
  218. package/dist/esm/api/types/MatchExcept.d.mts +0 -16
  219. package/dist/esm/api/types/MatchPhrase.d.mts +0 -10
  220. package/dist/esm/api/types/MatchText.d.mts +0 -10
  221. package/dist/esm/api/types/MatchValue.d.mts +0 -16
  222. package/dist/esm/api/types/MinShould.d.mts +0 -16
  223. package/dist/esm/api/types/Nested.d.mts +0 -13
  224. package/dist/esm/api/types/NestedCondition.d.mts +0 -8
  225. package/dist/esm/api/types/PayloadField.d.mts +0 -10
  226. package/dist/esm/api/types/Range.d.mts +0 -16
  227. package/dist/esm/api/types/SyncWithSourceConnection.mjs +0 -4
  228. package/dist/esm/api/types/ValuesCount.d.mts +0 -16
  229. package/dist/esm/api/types/ValuesCount.mjs +0 -4
  230. /package/dist/cjs/api/{types → resources/collections/client/requests}/CollectionUpdate.js +0 -0
  231. /package/dist/cjs/api/resources/{collections/types/SearchCollectionsReadableIdSearchPostResponse.js → webhooks/client/requests/CreateSubscriptionRequest.js} +0 -0
  232. /package/dist/cjs/api/{types/DatetimeRange.js → resources/webhooks/client/requests/GetMessageWebhooksMessagesMessageIdGetRequest.js} +0 -0
  233. /package/dist/cjs/api/{types/FieldCondition.js → resources/webhooks/client/requests/GetMessagesWebhooksMessagesGetRequest.js} +0 -0
  234. /package/dist/cjs/api/{types/Filter.js → resources/webhooks/client/requests/GetSubscriptionWebhooksSubscriptionsSubscriptionIdGetRequest.js} +0 -0
  235. /package/dist/cjs/api/{types/GeoBoundingBox.js → resources/webhooks/client/requests/PatchSubscriptionRequest.js} +0 -0
  236. /package/dist/cjs/api/{types/GeoLineString.js → resources/webhooks/client/requests/RecoverMessagesRequest.js} +0 -0
  237. /package/dist/cjs/api/types/{GeoPoint.js → AdminSyncInfo.js} +0 -0
  238. /package/dist/cjs/api/types/{GeoPolygon.js → BehaviorConfig.js} +0 -0
  239. /package/dist/cjs/api/types/{GeoRadius.js → BodyResyncWithExecutionConfigAdminResyncSyncIdPost.js} +0 -0
  240. /package/dist/cjs/api/types/{HasIdCondition.js → ConflictErrorResponse.js} +0 -0
  241. /package/dist/cjs/api/types/{HasVectorCondition.js → CursorConfig.js} +0 -0
  242. /package/dist/cjs/api/types/{IsEmptyCondition.js → DeliveryAttempt.js} +0 -0
  243. /package/dist/cjs/api/types/{IsNullCondition.js → DestinationConfig.js} +0 -0
  244. /package/dist/cjs/api/types/{MatchAny.js → HandlerConfig.js} +0 -0
  245. /package/dist/cjs/api/types/{MatchExcept.js → NotFoundErrorResponse.js} +0 -0
  246. /package/dist/cjs/api/types/{MatchPhrase.js → RateLimitErrorResponse.js} +0 -0
  247. /package/dist/cjs/api/types/{MatchText.js → RecoveryTask.js} +0 -0
  248. /package/dist/cjs/api/types/{MatchValue.js → SyncConfig.js} +0 -0
  249. /package/dist/cjs/api/types/{MinShould.js → ValidationErrorDetail.js} +0 -0
  250. /package/dist/cjs/api/types/{Nested.js → ValidationErrorResponse.js} +0 -0
  251. /package/dist/cjs/api/types/{NestedCondition.js → WebhookMessage.js} +0 -0
  252. /package/dist/cjs/api/types/{PayloadField.js → WebhookMessageWithAttempts.js} +0 -0
  253. /package/dist/cjs/api/types/{Range.js → WebhookSubscription.js} +0 -0
  254. /package/dist/esm/api/{types → resources/collections/client/requests}/CollectionUpdate.mjs +0 -0
  255. /package/dist/esm/api/resources/{collections/types/SearchCollectionsReadableIdSearchPostResponse.mjs → webhooks/client/requests/CreateSubscriptionRequest.mjs} +0 -0
  256. /package/dist/esm/api/{types/DatetimeRange.mjs → resources/webhooks/client/requests/GetMessageWebhooksMessagesMessageIdGetRequest.mjs} +0 -0
  257. /package/dist/esm/api/{types/FieldCondition.mjs → resources/webhooks/client/requests/GetMessagesWebhooksMessagesGetRequest.mjs} +0 -0
  258. /package/dist/esm/api/{types/Filter.mjs → resources/webhooks/client/requests/GetSubscriptionWebhooksSubscriptionsSubscriptionIdGetRequest.mjs} +0 -0
  259. /package/dist/esm/api/{types/GeoBoundingBox.mjs → resources/webhooks/client/requests/PatchSubscriptionRequest.mjs} +0 -0
  260. /package/dist/esm/api/{types/GeoLineString.mjs → resources/webhooks/client/requests/RecoverMessagesRequest.mjs} +0 -0
  261. /package/dist/esm/api/types/{GeoPoint.mjs → AdminSyncInfo.mjs} +0 -0
  262. /package/dist/esm/api/types/{GeoPolygon.mjs → BehaviorConfig.mjs} +0 -0
  263. /package/dist/esm/api/types/{GeoRadius.mjs → BodyResyncWithExecutionConfigAdminResyncSyncIdPost.mjs} +0 -0
  264. /package/dist/esm/api/types/{HasIdCondition.mjs → ConflictErrorResponse.mjs} +0 -0
  265. /package/dist/esm/api/types/{HasVectorCondition.mjs → CursorConfig.mjs} +0 -0
  266. /package/dist/esm/api/types/{IsEmptyCondition.mjs → DeliveryAttempt.mjs} +0 -0
  267. /package/dist/esm/api/types/{IsNullCondition.mjs → DestinationConfig.mjs} +0 -0
  268. /package/dist/esm/api/types/{MatchAny.mjs → HandlerConfig.mjs} +0 -0
  269. /package/dist/esm/api/types/{MatchExcept.mjs → NotFoundErrorResponse.mjs} +0 -0
  270. /package/dist/esm/api/types/{MatchPhrase.mjs → RateLimitErrorResponse.mjs} +0 -0
  271. /package/dist/esm/api/types/{MatchText.mjs → RecoveryTask.mjs} +0 -0
  272. /package/dist/esm/api/types/{MatchValue.mjs → SyncConfig.mjs} +0 -0
  273. /package/dist/esm/api/types/{MinShould.mjs → ValidationErrorDetail.mjs} +0 -0
  274. /package/dist/esm/api/types/{Nested.mjs → ValidationErrorResponse.mjs} +0 -0
  275. /package/dist/esm/api/types/{NestedCondition.mjs → WebhookMessage.mjs} +0 -0
  276. /package/dist/esm/api/types/{PayloadField.mjs → WebhookMessageWithAttempts.mjs} +0 -0
  277. /package/dist/esm/api/types/{Range.mjs → WebhookSubscription.mjs} +0 -0
@@ -0,0 +1,689 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Webhooks = void 0;
49
+ const environments = __importStar(require("../../../../environments.js"));
50
+ const core = __importStar(require("../../../../core/index.js"));
51
+ const AirweaveSDK = __importStar(require("../../../index.js"));
52
+ const headers_js_1 = require("../../../../core/headers.js");
53
+ const errors = __importStar(require("../../../../errors/index.js"));
54
+ /**
55
+ * API endpoints for managing webhook subscriptions and messages. Subscribe to events like sync completions to receive real-time notifications at your webhook URL
56
+ */
57
+ class Webhooks {
58
+ constructor(_options) {
59
+ this._options = _options;
60
+ }
61
+ /**
62
+ * Retrieve all webhook messages for your organization.
63
+ *
64
+ * Webhook messages represent payloads that were sent (or attempted to be sent)
65
+ * to your subscribed endpoints. Each message contains the event type, payload data,
66
+ * and delivery status information.
67
+ *
68
+ * Use the `event_types` query parameter to filter messages by specific event types,
69
+ * such as `sync.completed` or `sync.failed`.
70
+ *
71
+ * @param {AirweaveSDK.GetMessagesWebhooksMessagesGetRequest} request
72
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
73
+ *
74
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
75
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
76
+ *
77
+ * @example
78
+ * await client.webhooks.getMessages()
79
+ */
80
+ getMessages(request = {}, requestOptions) {
81
+ return core.HttpResponsePromise.fromPromise(this.__getMessages(request, requestOptions));
82
+ }
83
+ __getMessages() {
84
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
85
+ var _a, _b, _c;
86
+ const { event_types: eventTypes } = request;
87
+ const _queryParams = {};
88
+ if (eventTypes != null) {
89
+ if (Array.isArray(eventTypes)) {
90
+ _queryParams["event_types"] = eventTypes.map((item) => item);
91
+ }
92
+ else {
93
+ _queryParams["event_types"] = eventTypes;
94
+ }
95
+ }
96
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
97
+ const _response = yield core.fetcher({
98
+ 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.AirweaveSDKEnvironment.Production, "webhooks/messages"),
99
+ method: "GET",
100
+ headers: _headers,
101
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
102
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
103
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
104
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
105
+ });
106
+ if (_response.ok) {
107
+ return { data: _response.body, rawResponse: _response.rawResponse };
108
+ }
109
+ if (_response.error.reason === "status-code") {
110
+ switch (_response.error.statusCode) {
111
+ case 422:
112
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
113
+ case 429:
114
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
115
+ default:
116
+ throw new errors.AirweaveSDKError({
117
+ statusCode: _response.error.statusCode,
118
+ body: _response.error.body,
119
+ rawResponse: _response.rawResponse,
120
+ });
121
+ }
122
+ }
123
+ switch (_response.error.reason) {
124
+ case "non-json":
125
+ throw new errors.AirweaveSDKError({
126
+ statusCode: _response.error.statusCode,
127
+ body: _response.error.rawBody,
128
+ rawResponse: _response.rawResponse,
129
+ });
130
+ case "timeout":
131
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /webhooks/messages.");
132
+ case "unknown":
133
+ throw new errors.AirweaveSDKError({
134
+ message: _response.error.errorMessage,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ }
138
+ });
139
+ }
140
+ /**
141
+ * Retrieve a specific webhook message by its ID.
142
+ *
143
+ * Returns the full message details including the event type, payload data,
144
+ * timestamp, and delivery channel information. Use this to inspect the
145
+ * exact payload that was sent to your webhook endpoints.
146
+ *
147
+ * Use `include_attempts=true` to also retrieve delivery attempts for this message,
148
+ * which include HTTP response codes, response bodies, and timestamps for debugging
149
+ * delivery failures.
150
+ *
151
+ * @param {string} messageId - The unique identifier of the message to retrieve (UUID).
152
+ * @param {AirweaveSDK.GetMessageWebhooksMessagesMessageIdGetRequest} request
153
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
154
+ *
155
+ * @throws {@link AirweaveSDK.NotFoundError}
156
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
157
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
158
+ *
159
+ * @example
160
+ * await client.webhooks.getMessage("550e8400-e29b-41d4-a716-446655440000", {
161
+ * include_attempts: true
162
+ * })
163
+ */
164
+ getMessage(messageId, request = {}, requestOptions) {
165
+ return core.HttpResponsePromise.fromPromise(this.__getMessage(messageId, request, requestOptions));
166
+ }
167
+ __getMessage(messageId_1) {
168
+ return __awaiter(this, arguments, void 0, function* (messageId, request = {}, requestOptions) {
169
+ var _a, _b, _c;
170
+ const { include_attempts: includeAttempts } = request;
171
+ const _queryParams = {};
172
+ if (includeAttempts != null) {
173
+ _queryParams["include_attempts"] = includeAttempts.toString();
174
+ }
175
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
176
+ const _response = yield core.fetcher({
177
+ 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.AirweaveSDKEnvironment.Production, `webhooks/messages/${encodeURIComponent(messageId)}`),
178
+ method: "GET",
179
+ headers: _headers,
180
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
181
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
182
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
183
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
184
+ });
185
+ if (_response.ok) {
186
+ return {
187
+ data: _response.body,
188
+ rawResponse: _response.rawResponse,
189
+ };
190
+ }
191
+ if (_response.error.reason === "status-code") {
192
+ switch (_response.error.statusCode) {
193
+ case 404:
194
+ throw new AirweaveSDK.NotFoundError(_response.error.body, _response.rawResponse);
195
+ case 422:
196
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
197
+ case 429:
198
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
199
+ default:
200
+ throw new errors.AirweaveSDKError({
201
+ statusCode: _response.error.statusCode,
202
+ body: _response.error.body,
203
+ rawResponse: _response.rawResponse,
204
+ });
205
+ }
206
+ }
207
+ switch (_response.error.reason) {
208
+ case "non-json":
209
+ throw new errors.AirweaveSDKError({
210
+ statusCode: _response.error.statusCode,
211
+ body: _response.error.rawBody,
212
+ rawResponse: _response.rawResponse,
213
+ });
214
+ case "timeout":
215
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /webhooks/messages/{message_id}.");
216
+ case "unknown":
217
+ throw new errors.AirweaveSDKError({
218
+ message: _response.error.errorMessage,
219
+ rawResponse: _response.rawResponse,
220
+ });
221
+ }
222
+ });
223
+ }
224
+ /**
225
+ * List all webhook subscriptions for your organization.
226
+ *
227
+ * Returns all configured webhook endpoints, including their URLs, subscribed
228
+ * event types, and current status (enabled/disabled). Use this to audit
229
+ * your webhook configuration or find a specific subscription.
230
+ *
231
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
232
+ *
233
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
234
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
235
+ *
236
+ * @example
237
+ * await client.webhooks.getSubscriptions()
238
+ */
239
+ getSubscriptions(requestOptions) {
240
+ return core.HttpResponsePromise.fromPromise(this.__getSubscriptions(requestOptions));
241
+ }
242
+ __getSubscriptions(requestOptions) {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ var _a, _b, _c;
245
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
246
+ const _response = yield core.fetcher({
247
+ 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.AirweaveSDKEnvironment.Production, "webhooks/subscriptions"),
248
+ method: "GET",
249
+ headers: _headers,
250
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
251
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
252
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
253
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
254
+ });
255
+ if (_response.ok) {
256
+ return { data: _response.body, rawResponse: _response.rawResponse };
257
+ }
258
+ if (_response.error.reason === "status-code") {
259
+ switch (_response.error.statusCode) {
260
+ case 422:
261
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
262
+ case 429:
263
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
264
+ default:
265
+ throw new errors.AirweaveSDKError({
266
+ statusCode: _response.error.statusCode,
267
+ body: _response.error.body,
268
+ rawResponse: _response.rawResponse,
269
+ });
270
+ }
271
+ }
272
+ switch (_response.error.reason) {
273
+ case "non-json":
274
+ throw new errors.AirweaveSDKError({
275
+ statusCode: _response.error.statusCode,
276
+ body: _response.error.rawBody,
277
+ rawResponse: _response.rawResponse,
278
+ });
279
+ case "timeout":
280
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /webhooks/subscriptions.");
281
+ case "unknown":
282
+ throw new errors.AirweaveSDKError({
283
+ message: _response.error.errorMessage,
284
+ rawResponse: _response.rawResponse,
285
+ });
286
+ }
287
+ });
288
+ }
289
+ /**
290
+ * Create a new webhook subscription.
291
+ *
292
+ * Webhook subscriptions allow you to receive real-time notifications when events
293
+ * occur in Airweave. When you create a subscription, you specify:
294
+ *
295
+ * - **URL**: The HTTPS endpoint where events will be delivered
296
+ * - **Event Types**: Which events you want to receive (e.g., `sync.completed`, `sync.failed`)
297
+ * - **Secret** (optional): A custom signing secret for verifying webhook signatures
298
+ *
299
+ * After creation, Airweave will send HTTP POST requests to your URL whenever
300
+ * matching events occur. Each request includes a signature header for verification.
301
+ *
302
+ * @param {AirweaveSDK.CreateSubscriptionRequest} request
303
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
304
+ *
305
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
306
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
307
+ *
308
+ * @example
309
+ * await client.webhooks.createSubscription({
310
+ * url: "https://api.mycompany.com/webhooks/airweave",
311
+ * event_types: ["sync.completed", "sync.failed"]
312
+ * })
313
+ */
314
+ createSubscription(request, requestOptions) {
315
+ return core.HttpResponsePromise.fromPromise(this.__createSubscription(request, requestOptions));
316
+ }
317
+ __createSubscription(request, requestOptions) {
318
+ return __awaiter(this, void 0, void 0, function* () {
319
+ var _a, _b, _c;
320
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), 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.AirweaveSDKEnvironment.Production, "webhooks/subscriptions"),
323
+ method: "POST",
324
+ headers: _headers,
325
+ contentType: "application/json",
326
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
327
+ requestType: "json",
328
+ body: request,
329
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
330
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
331
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
332
+ });
333
+ if (_response.ok) {
334
+ return { data: _response.body, rawResponse: _response.rawResponse };
335
+ }
336
+ if (_response.error.reason === "status-code") {
337
+ switch (_response.error.statusCode) {
338
+ case 422:
339
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
340
+ case 429:
341
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
342
+ default:
343
+ throw new errors.AirweaveSDKError({
344
+ statusCode: _response.error.statusCode,
345
+ body: _response.error.body,
346
+ rawResponse: _response.rawResponse,
347
+ });
348
+ }
349
+ }
350
+ switch (_response.error.reason) {
351
+ case "non-json":
352
+ throw new errors.AirweaveSDKError({
353
+ statusCode: _response.error.statusCode,
354
+ body: _response.error.rawBody,
355
+ rawResponse: _response.rawResponse,
356
+ });
357
+ case "timeout":
358
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling POST /webhooks/subscriptions.");
359
+ case "unknown":
360
+ throw new errors.AirweaveSDKError({
361
+ message: _response.error.errorMessage,
362
+ rawResponse: _response.rawResponse,
363
+ });
364
+ }
365
+ });
366
+ }
367
+ /**
368
+ * Retrieve a specific webhook subscription with its recent delivery attempts.
369
+ *
370
+ * Returns the subscription configuration along with a history of message delivery
371
+ * attempts. This is useful for debugging delivery issues or verifying that your
372
+ * endpoint is correctly receiving events.
373
+ *
374
+ * Use `include_secret=true` to also retrieve the signing secret for webhook
375
+ * signature verification. Keep this secret secure.
376
+ *
377
+ * @param {string} subscriptionId - The unique identifier of the subscription to retrieve (UUID).
378
+ * @param {AirweaveSDK.GetSubscriptionWebhooksSubscriptionsSubscriptionIdGetRequest} request
379
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
380
+ *
381
+ * @throws {@link AirweaveSDK.NotFoundError}
382
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
383
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
384
+ *
385
+ * @example
386
+ * await client.webhooks.getSubscription("550e8400-e29b-41d4-a716-446655440000", {
387
+ * include_secret: true
388
+ * })
389
+ */
390
+ getSubscription(subscriptionId, request = {}, requestOptions) {
391
+ return core.HttpResponsePromise.fromPromise(this.__getSubscription(subscriptionId, request, requestOptions));
392
+ }
393
+ __getSubscription(subscriptionId_1) {
394
+ return __awaiter(this, arguments, void 0, function* (subscriptionId, request = {}, requestOptions) {
395
+ var _a, _b, _c;
396
+ const { include_secret: includeSecret } = request;
397
+ const _queryParams = {};
398
+ if (includeSecret != null) {
399
+ _queryParams["include_secret"] = includeSecret.toString();
400
+ }
401
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
402
+ const _response = yield core.fetcher({
403
+ 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.AirweaveSDKEnvironment.Production, `webhooks/subscriptions/${encodeURIComponent(subscriptionId)}`),
404
+ method: "GET",
405
+ headers: _headers,
406
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
407
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
408
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
409
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
410
+ });
411
+ if (_response.ok) {
412
+ return { data: _response.body, rawResponse: _response.rawResponse };
413
+ }
414
+ if (_response.error.reason === "status-code") {
415
+ switch (_response.error.statusCode) {
416
+ case 404:
417
+ throw new AirweaveSDK.NotFoundError(_response.error.body, _response.rawResponse);
418
+ case 422:
419
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
420
+ case 429:
421
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
422
+ default:
423
+ throw new errors.AirweaveSDKError({
424
+ statusCode: _response.error.statusCode,
425
+ body: _response.error.body,
426
+ rawResponse: _response.rawResponse,
427
+ });
428
+ }
429
+ }
430
+ switch (_response.error.reason) {
431
+ case "non-json":
432
+ throw new errors.AirweaveSDKError({
433
+ statusCode: _response.error.statusCode,
434
+ body: _response.error.rawBody,
435
+ rawResponse: _response.rawResponse,
436
+ });
437
+ case "timeout":
438
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling GET /webhooks/subscriptions/{subscription_id}.");
439
+ case "unknown":
440
+ throw new errors.AirweaveSDKError({
441
+ message: _response.error.errorMessage,
442
+ rawResponse: _response.rawResponse,
443
+ });
444
+ }
445
+ });
446
+ }
447
+ /**
448
+ * Permanently delete a webhook subscription.
449
+ *
450
+ * Once deleted, Airweave will stop sending events to this endpoint immediately.
451
+ * This action cannot be undone. Any pending message deliveries will be cancelled.
452
+ *
453
+ * If you want to temporarily stop receiving events, consider disabling the
454
+ * subscription instead using the PATCH endpoint.
455
+ *
456
+ * @param {string} subscriptionId - The unique identifier of the subscription to delete (UUID).
457
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
458
+ *
459
+ * @throws {@link AirweaveSDK.NotFoundError}
460
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
461
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
462
+ *
463
+ * @example
464
+ * await client.webhooks.deleteSubscription("550e8400-e29b-41d4-a716-446655440000")
465
+ */
466
+ deleteSubscription(subscriptionId, requestOptions) {
467
+ return core.HttpResponsePromise.fromPromise(this.__deleteSubscription(subscriptionId, requestOptions));
468
+ }
469
+ __deleteSubscription(subscriptionId, requestOptions) {
470
+ return __awaiter(this, void 0, void 0, function* () {
471
+ var _a, _b, _c;
472
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
473
+ const _response = yield core.fetcher({
474
+ 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.AirweaveSDKEnvironment.Production, `webhooks/subscriptions/${encodeURIComponent(subscriptionId)}`),
475
+ method: "DELETE",
476
+ headers: _headers,
477
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
478
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
479
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
480
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
481
+ });
482
+ if (_response.ok) {
483
+ return { data: _response.body, rawResponse: _response.rawResponse };
484
+ }
485
+ if (_response.error.reason === "status-code") {
486
+ switch (_response.error.statusCode) {
487
+ case 404:
488
+ throw new AirweaveSDK.NotFoundError(_response.error.body, _response.rawResponse);
489
+ case 422:
490
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
491
+ case 429:
492
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
493
+ default:
494
+ throw new errors.AirweaveSDKError({
495
+ statusCode: _response.error.statusCode,
496
+ body: _response.error.body,
497
+ rawResponse: _response.rawResponse,
498
+ });
499
+ }
500
+ }
501
+ switch (_response.error.reason) {
502
+ case "non-json":
503
+ throw new errors.AirweaveSDKError({
504
+ statusCode: _response.error.statusCode,
505
+ body: _response.error.rawBody,
506
+ rawResponse: _response.rawResponse,
507
+ });
508
+ case "timeout":
509
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling DELETE /webhooks/subscriptions/{subscription_id}.");
510
+ case "unknown":
511
+ throw new errors.AirweaveSDKError({
512
+ message: _response.error.errorMessage,
513
+ rawResponse: _response.rawResponse,
514
+ });
515
+ }
516
+ });
517
+ }
518
+ /**
519
+ * Update an existing webhook subscription.
520
+ *
521
+ * Use this endpoint to modify a subscription's configuration. You can:
522
+ *
523
+ * - **Change the URL**: Update where events are delivered
524
+ * - **Update event types**: Modify which events trigger notifications
525
+ * - **Enable/disable**: Temporarily pause delivery without deleting the subscription
526
+ * - **Recover messages**: When re-enabling, optionally recover missed messages
527
+ *
528
+ * Only include the fields you want to change. Omitted fields will retain their
529
+ * current values.
530
+ *
531
+ * When re-enabling a subscription (`disabled: false`), you can optionally provide
532
+ * `recover_since` to automatically retry all messages that were generated while
533
+ * the subscription was disabled.
534
+ *
535
+ * @param {string} subscriptionId - The unique identifier of the subscription to update (UUID).
536
+ * @param {AirweaveSDK.PatchSubscriptionRequest} request
537
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
538
+ *
539
+ * @throws {@link AirweaveSDK.NotFoundError}
540
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
541
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
542
+ *
543
+ * @example
544
+ * await client.webhooks.patchSubscription("550e8400-e29b-41d4-a716-446655440000")
545
+ */
546
+ patchSubscription(subscriptionId, request = {}, requestOptions) {
547
+ return core.HttpResponsePromise.fromPromise(this.__patchSubscription(subscriptionId, request, requestOptions));
548
+ }
549
+ __patchSubscription(subscriptionId_1) {
550
+ return __awaiter(this, arguments, void 0, function* (subscriptionId, request = {}, requestOptions) {
551
+ var _a, _b, _c;
552
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
553
+ const _response = yield core.fetcher({
554
+ 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.AirweaveSDKEnvironment.Production, `webhooks/subscriptions/${encodeURIComponent(subscriptionId)}`),
555
+ method: "PATCH",
556
+ headers: _headers,
557
+ contentType: "application/json",
558
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
559
+ requestType: "json",
560
+ body: request,
561
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
562
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
563
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
564
+ });
565
+ if (_response.ok) {
566
+ return { data: _response.body, rawResponse: _response.rawResponse };
567
+ }
568
+ if (_response.error.reason === "status-code") {
569
+ switch (_response.error.statusCode) {
570
+ case 404:
571
+ throw new AirweaveSDK.NotFoundError(_response.error.body, _response.rawResponse);
572
+ case 422:
573
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
574
+ case 429:
575
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
576
+ default:
577
+ throw new errors.AirweaveSDKError({
578
+ statusCode: _response.error.statusCode,
579
+ body: _response.error.body,
580
+ rawResponse: _response.rawResponse,
581
+ });
582
+ }
583
+ }
584
+ switch (_response.error.reason) {
585
+ case "non-json":
586
+ throw new errors.AirweaveSDKError({
587
+ statusCode: _response.error.statusCode,
588
+ body: _response.error.rawBody,
589
+ rawResponse: _response.rawResponse,
590
+ });
591
+ case "timeout":
592
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling PATCH /webhooks/subscriptions/{subscription_id}.");
593
+ case "unknown":
594
+ throw new errors.AirweaveSDKError({
595
+ message: _response.error.errorMessage,
596
+ rawResponse: _response.rawResponse,
597
+ });
598
+ }
599
+ });
600
+ }
601
+ /**
602
+ * Retry failed message deliveries for a webhook subscription.
603
+ *
604
+ * Triggers a recovery process that replays all failed messages within the
605
+ * specified time window. This is useful when:
606
+ *
607
+ * - Your endpoint was temporarily down and you want to catch up
608
+ * - You've fixed a bug in your webhook handler
609
+ * - You want to reprocess events after re-enabling a disabled subscription
610
+ *
611
+ * Messages are retried in chronological order. Successfully delivered messages
612
+ * are skipped; only failed or pending messages are retried.
613
+ *
614
+ * @param {string} subscriptionId - The unique identifier of the subscription to recover messages for (UUID).
615
+ * @param {AirweaveSDK.RecoverMessagesRequest} request
616
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
617
+ *
618
+ * @throws {@link AirweaveSDK.NotFoundError}
619
+ * @throws {@link AirweaveSDK.UnprocessableEntityError}
620
+ * @throws {@link AirweaveSDK.TooManyRequestsError}
621
+ *
622
+ * @example
623
+ * await client.webhooks.recoverFailedMessages("550e8400-e29b-41d4-a716-446655440000", {
624
+ * since: "2024-03-14T00:00:00Z"
625
+ * })
626
+ */
627
+ recoverFailedMessages(subscriptionId, request, requestOptions) {
628
+ return core.HttpResponsePromise.fromPromise(this.__recoverFailedMessages(subscriptionId, request, requestOptions));
629
+ }
630
+ __recoverFailedMessages(subscriptionId, request, requestOptions) {
631
+ return __awaiter(this, void 0, void 0, function* () {
632
+ var _a, _b, _c;
633
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
634
+ const _response = yield core.fetcher({
635
+ 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.AirweaveSDKEnvironment.Production, `webhooks/subscriptions/${encodeURIComponent(subscriptionId)}/recover`),
636
+ method: "POST",
637
+ headers: _headers,
638
+ contentType: "application/json",
639
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
640
+ requestType: "json",
641
+ body: request,
642
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
643
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
644
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
645
+ });
646
+ if (_response.ok) {
647
+ return { data: _response.body, rawResponse: _response.rawResponse };
648
+ }
649
+ if (_response.error.reason === "status-code") {
650
+ switch (_response.error.statusCode) {
651
+ case 404:
652
+ throw new AirweaveSDK.NotFoundError(_response.error.body, _response.rawResponse);
653
+ case 422:
654
+ throw new AirweaveSDK.UnprocessableEntityError(_response.error.body, _response.rawResponse);
655
+ case 429:
656
+ throw new AirweaveSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
657
+ default:
658
+ throw new errors.AirweaveSDKError({
659
+ statusCode: _response.error.statusCode,
660
+ body: _response.error.body,
661
+ rawResponse: _response.rawResponse,
662
+ });
663
+ }
664
+ }
665
+ switch (_response.error.reason) {
666
+ case "non-json":
667
+ throw new errors.AirweaveSDKError({
668
+ statusCode: _response.error.statusCode,
669
+ body: _response.error.rawBody,
670
+ rawResponse: _response.rawResponse,
671
+ });
672
+ case "timeout":
673
+ throw new errors.AirweaveSDKTimeoutError("Timeout exceeded when calling POST /webhooks/subscriptions/{subscription_id}/recover.");
674
+ case "unknown":
675
+ throw new errors.AirweaveSDKError({
676
+ message: _response.error.errorMessage,
677
+ rawResponse: _response.rawResponse,
678
+ });
679
+ }
680
+ });
681
+ }
682
+ _getCustomAuthorizationHeaders() {
683
+ return __awaiter(this, void 0, void 0, function* () {
684
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
685
+ return { "x-api-key": apiKeyValue };
686
+ });
687
+ }
688
+ }
689
+ exports.Webhooks = Webhooks;