bereach 1.4.2 → 1.5.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 (288) hide show
  1. package/README.md +71 -5
  2. package/esm/funcs/actions-connect-profile.d.ts +1 -1
  3. package/esm/funcs/actions-connect-profile.js +1 -1
  4. package/esm/funcs/actions-edit-profile.d.ts +18 -0
  5. package/esm/funcs/actions-edit-profile.d.ts.map +1 -0
  6. package/esm/funcs/actions-edit-profile.js +97 -0
  7. package/esm/funcs/actions-edit-profile.js.map +1 -0
  8. package/esm/funcs/chat-get-conversation-summary.d.ts +18 -0
  9. package/esm/funcs/chat-get-conversation-summary.d.ts.map +1 -0
  10. package/esm/funcs/chat-get-conversation-summary.js +100 -0
  11. package/esm/funcs/chat-get-conversation-summary.js.map +1 -0
  12. package/esm/funcs/chat-list-inbox.d.ts +1 -1
  13. package/esm/funcs/chat-list-inbox.js +1 -1
  14. package/esm/funcs/chat-save-conversation-summary.d.ts +18 -0
  15. package/esm/funcs/chat-save-conversation-summary.d.ts.map +1 -0
  16. package/esm/funcs/chat-save-conversation-summary.js +97 -0
  17. package/esm/funcs/chat-save-conversation-summary.js.map +1 -0
  18. package/esm/funcs/company-pages-get-analytics.d.ts +1 -1
  19. package/esm/funcs/company-pages-get-analytics.js +1 -1
  20. package/esm/funcs/connectors-agent-snapshot.d.ts +18 -0
  21. package/esm/funcs/connectors-agent-snapshot.d.ts.map +1 -0
  22. package/esm/funcs/connectors-agent-snapshot.js +86 -0
  23. package/esm/funcs/connectors-agent-snapshot.js.map +1 -0
  24. package/esm/funcs/connectors-connector-heartbeat.d.ts +18 -0
  25. package/esm/funcs/connectors-connector-heartbeat.d.ts.map +1 -0
  26. package/esm/funcs/connectors-connector-heartbeat.js +99 -0
  27. package/esm/funcs/connectors-connector-heartbeat.js.map +1 -0
  28. package/esm/funcs/connectors-list-connectors.d.ts +18 -0
  29. package/esm/funcs/connectors-list-connectors.d.ts.map +1 -0
  30. package/esm/funcs/connectors-list-connectors.js +86 -0
  31. package/esm/funcs/connectors-list-connectors.js.map +1 -0
  32. package/esm/funcs/connectors-pull-task.d.ts +18 -0
  33. package/esm/funcs/connectors-pull-task.d.ts.map +1 -0
  34. package/esm/funcs/connectors-pull-task.js +86 -0
  35. package/esm/funcs/connectors-pull-task.js.map +1 -0
  36. package/esm/funcs/connectors-submit-task-result.d.ts +18 -0
  37. package/esm/funcs/connectors-submit-task-result.d.ts.map +1 -0
  38. package/esm/funcs/connectors-submit-task-result.js +103 -0
  39. package/esm/funcs/connectors-submit-task-result.js.map +1 -0
  40. package/esm/funcs/contacts-global-activities.d.ts +18 -0
  41. package/esm/funcs/contacts-global-activities.d.ts.map +1 -0
  42. package/esm/funcs/contacts-global-activities.js +105 -0
  43. package/esm/funcs/contacts-global-activities.js.map +1 -0
  44. package/esm/funcs/profile-create-api-token.d.ts +18 -0
  45. package/esm/funcs/profile-create-api-token.d.ts.map +1 -0
  46. package/esm/funcs/profile-create-api-token.js +99 -0
  47. package/esm/funcs/profile-create-api-token.js.map +1 -0
  48. package/esm/funcs/profile-delete-api-token.d.ts +18 -0
  49. package/esm/funcs/profile-delete-api-token.d.ts.map +1 -0
  50. package/esm/funcs/profile-delete-api-token.js +99 -0
  51. package/esm/funcs/profile-delete-api-token.js.map +1 -0
  52. package/esm/funcs/profile-get-api-token.d.ts +18 -0
  53. package/esm/funcs/profile-get-api-token.d.ts.map +1 -0
  54. package/esm/funcs/profile-get-api-token.js +100 -0
  55. package/esm/funcs/profile-get-api-token.js.map +1 -0
  56. package/esm/funcs/profile-get-my-activity.d.ts +18 -0
  57. package/esm/funcs/profile-get-my-activity.d.ts.map +1 -0
  58. package/esm/funcs/profile-get-my-activity.js +104 -0
  59. package/esm/funcs/profile-get-my-activity.js.map +1 -0
  60. package/esm/funcs/profile-get-settings.d.ts +18 -0
  61. package/esm/funcs/profile-get-settings.d.ts.map +1 -0
  62. package/esm/funcs/profile-get-settings.js +86 -0
  63. package/esm/funcs/profile-get-settings.js.map +1 -0
  64. package/esm/funcs/profile-patch-settings.d.ts +18 -0
  65. package/esm/funcs/profile-patch-settings.d.ts.map +1 -0
  66. package/esm/funcs/profile-patch-settings.js +97 -0
  67. package/esm/funcs/profile-patch-settings.js.map +1 -0
  68. package/esm/funcs/profile-revalidate-linkedin.d.ts +18 -0
  69. package/esm/funcs/profile-revalidate-linkedin.d.ts.map +1 -0
  70. package/esm/funcs/profile-revalidate-linkedin.js +86 -0
  71. package/esm/funcs/profile-revalidate-linkedin.js.map +1 -0
  72. package/esm/funcs/sales-nav-search.d.ts +1 -1
  73. package/esm/funcs/sales-nav-search.js +1 -1
  74. package/esm/funcs/scheduled-messages-review-drafts.d.ts +18 -0
  75. package/esm/funcs/scheduled-messages-review-drafts.d.ts.map +1 -0
  76. package/esm/funcs/scheduled-messages-review-drafts.js +97 -0
  77. package/esm/funcs/scheduled-messages-review-drafts.js.map +1 -0
  78. package/esm/funcs/scrapers-collect-comment-replies.d.ts +1 -1
  79. package/esm/funcs/scrapers-collect-comment-replies.js +1 -1
  80. package/esm/funcs/scrapers-collect-comments.d.ts +1 -1
  81. package/esm/funcs/scrapers-collect-comments.js +1 -1
  82. package/esm/funcs/scrapers-collect-likes.d.ts +1 -1
  83. package/esm/funcs/scrapers-collect-likes.js +1 -1
  84. package/esm/funcs/scrapers-visit-profile.d.ts +2 -0
  85. package/esm/funcs/scrapers-visit-profile.d.ts.map +1 -1
  86. package/esm/funcs/scrapers-visit-profile.js +2 -0
  87. package/esm/funcs/scrapers-visit-profile.js.map +1 -1
  88. package/esm/funcs/search-people.d.ts +2 -2
  89. package/esm/funcs/search-people.js +2 -2
  90. package/esm/funcs/search-search.d.ts +1 -1
  91. package/esm/funcs/search-search.js +1 -1
  92. package/esm/funcs/settings-get-dm-polling-settings.d.ts +18 -0
  93. package/esm/funcs/settings-get-dm-polling-settings.d.ts.map +1 -0
  94. package/esm/funcs/settings-get-dm-polling-settings.js +86 -0
  95. package/esm/funcs/settings-get-dm-polling-settings.js.map +1 -0
  96. package/esm/funcs/settings-patch-dm-polling-settings.d.ts +18 -0
  97. package/esm/funcs/settings-patch-dm-polling-settings.d.ts.map +1 -0
  98. package/esm/funcs/settings-patch-dm-polling-settings.js +97 -0
  99. package/esm/funcs/settings-patch-dm-polling-settings.js.map +1 -0
  100. package/esm/funcs/tasks-cancel-chain.d.ts +18 -0
  101. package/esm/funcs/tasks-cancel-chain.d.ts.map +1 -0
  102. package/esm/funcs/tasks-cancel-chain.js +102 -0
  103. package/esm/funcs/tasks-cancel-chain.js.map +1 -0
  104. package/esm/funcs/tasks-cancel-task.d.ts +18 -0
  105. package/esm/funcs/tasks-cancel-task.d.ts.map +1 -0
  106. package/esm/funcs/tasks-cancel-task.js +102 -0
  107. package/esm/funcs/tasks-cancel-task.js.map +1 -0
  108. package/esm/funcs/tasks-events-feed.d.ts +18 -0
  109. package/esm/funcs/tasks-events-feed.d.ts.map +1 -0
  110. package/esm/funcs/tasks-events-feed.js +101 -0
  111. package/esm/funcs/tasks-events-feed.js.map +1 -0
  112. package/esm/funcs/tasks-list-tasks.d.ts +18 -0
  113. package/esm/funcs/tasks-list-tasks.d.ts.map +1 -0
  114. package/esm/funcs/tasks-list-tasks.js +104 -0
  115. package/esm/funcs/tasks-list-tasks.js.map +1 -0
  116. package/esm/funcs/workspace-create-workspace-invite.d.ts +18 -0
  117. package/esm/funcs/workspace-create-workspace-invite.d.ts.map +1 -0
  118. package/esm/funcs/workspace-create-workspace-invite.js +97 -0
  119. package/esm/funcs/workspace-create-workspace-invite.js.map +1 -0
  120. package/esm/funcs/workspace-delete-workspace-account.d.ts +18 -0
  121. package/esm/funcs/workspace-delete-workspace-account.d.ts.map +1 -0
  122. package/esm/funcs/workspace-delete-workspace-account.js +102 -0
  123. package/esm/funcs/workspace-delete-workspace-account.js.map +1 -0
  124. package/esm/funcs/workspace-delete-workspace-invite.d.ts +18 -0
  125. package/esm/funcs/workspace-delete-workspace-invite.d.ts.map +1 -0
  126. package/esm/funcs/workspace-delete-workspace-invite.js +97 -0
  127. package/esm/funcs/workspace-delete-workspace-invite.js.map +1 -0
  128. package/esm/funcs/workspace-upgrade-workspace-account.d.ts +18 -0
  129. package/esm/funcs/workspace-upgrade-workspace-account.d.ts.map +1 -0
  130. package/esm/funcs/workspace-upgrade-workspace-account.js +97 -0
  131. package/esm/funcs/workspace-upgrade-workspace-account.js.map +1 -0
  132. package/esm/hooks/hooks.d.ts.map +1 -1
  133. package/esm/hooks/hooks.js +0 -2
  134. package/esm/hooks/hooks.js.map +1 -1
  135. package/esm/lib/config.d.ts +5 -5
  136. package/esm/lib/config.d.ts.map +1 -1
  137. package/esm/lib/config.js +6 -6
  138. package/esm/lib/config.js.map +1 -1
  139. package/esm/lib/encodings.d.ts.map +1 -1
  140. package/esm/lib/encodings.js +20 -5
  141. package/esm/lib/encodings.js.map +1 -1
  142. package/esm/lib/security.d.ts +1 -1
  143. package/esm/lib/security.d.ts.map +1 -1
  144. package/esm/lib/security.js +19 -8
  145. package/esm/lib/security.js.map +1 -1
  146. package/esm/models/operations/{search-contacts-campaign.d.ts → archive-response.d.ts} +1174 -1151
  147. package/esm/models/operations/archive-response.d.ts.map +1 -0
  148. package/esm/models/operations/{search-contacts-campaign.js → archive-response.js} +456 -461
  149. package/esm/models/operations/archive-response.js.map +1 -0
  150. package/esm/models/operations/delete-workspace-invite-response.d.ts +1374 -0
  151. package/esm/models/operations/delete-workspace-invite-response.d.ts.map +1 -0
  152. package/esm/models/operations/delete-workspace-invite-response.js +901 -0
  153. package/esm/models/operations/delete-workspace-invite-response.js.map +1 -0
  154. package/esm/models/operations/{update-schedule-response.d.ts → get-by-url-campaign.d.ts} +1629 -1291
  155. package/esm/models/operations/get-by-url-campaign.d.ts.map +1 -0
  156. package/esm/models/operations/{update-schedule-response.js → get-by-url-campaign.js} +534 -341
  157. package/esm/models/operations/get-by-url-campaign.js.map +1 -0
  158. package/esm/models/operations/index.d.ts +4 -3
  159. package/esm/models/operations/index.d.ts.map +1 -1
  160. package/esm/models/operations/index.js +4 -3
  161. package/esm/models/operations/index.js.map +1 -1
  162. package/esm/models/operations/search-companies-response.d.ts +45 -12
  163. package/esm/models/operations/search-companies-response.d.ts.map +1 -1
  164. package/esm/models/operations/search-companies-response.js +10 -2
  165. package/esm/models/operations/search-companies-response.js.map +1 -1
  166. package/esm/models/operations/{update-account-response.d.ts → update-account-proxy-config-response.d.ts} +70 -38
  167. package/esm/models/operations/update-account-proxy-config-response.d.ts.map +1 -0
  168. package/esm/models/operations/{update-account-response.js → update-account-proxy-config-response.js} +27 -28
  169. package/esm/models/operations/update-account-proxy-config-response.js.map +1 -0
  170. package/esm/sdk/actions.d.ts +8 -1
  171. package/esm/sdk/actions.d.ts.map +1 -1
  172. package/esm/sdk/actions.js +11 -1
  173. package/esm/sdk/actions.js.map +1 -1
  174. package/esm/sdk/chat.d.ts +15 -1
  175. package/esm/sdk/chat.d.ts.map +1 -1
  176. package/esm/sdk/chat.js +21 -1
  177. package/esm/sdk/chat.js.map +1 -1
  178. package/esm/sdk/company-pages.d.ts +1 -1
  179. package/esm/sdk/company-pages.js +1 -1
  180. package/esm/sdk/connectors.d.ts +40 -0
  181. package/esm/sdk/connectors.d.ts.map +1 -0
  182. package/esm/sdk/connectors.js +58 -0
  183. package/esm/sdk/connectors.js.map +1 -0
  184. package/esm/sdk/contacts.d.ts +7 -0
  185. package/esm/sdk/contacts.d.ts.map +1 -1
  186. package/esm/sdk/contacts.js +10 -0
  187. package/esm/sdk/contacts.js.map +1 -1
  188. package/esm/sdk/profile.d.ts +49 -0
  189. package/esm/sdk/profile.d.ts.map +1 -1
  190. package/esm/sdk/profile.js +70 -0
  191. package/esm/sdk/profile.js.map +1 -1
  192. package/esm/sdk/sales-nav.d.ts +1 -1
  193. package/esm/sdk/sales-nav.js +1 -1
  194. package/esm/sdk/scheduled-messages.d.ts +7 -0
  195. package/esm/sdk/scheduled-messages.d.ts.map +1 -1
  196. package/esm/sdk/scheduled-messages.js +10 -0
  197. package/esm/sdk/scheduled-messages.js.map +1 -1
  198. package/esm/sdk/scrapers.d.ts +5 -3
  199. package/esm/sdk/scrapers.d.ts.map +1 -1
  200. package/esm/sdk/scrapers.js +5 -3
  201. package/esm/sdk/scrapers.js.map +1 -1
  202. package/esm/sdk/sdk.d.ts +12 -0
  203. package/esm/sdk/sdk.d.ts.map +1 -1
  204. package/esm/sdk/sdk.js +20 -0
  205. package/esm/sdk/sdk.js.map +1 -1
  206. package/esm/sdk/search.d.ts +3 -3
  207. package/esm/sdk/search.js +3 -3
  208. package/esm/sdk/settings.d.ts +19 -0
  209. package/esm/sdk/settings.d.ts.map +1 -0
  210. package/esm/sdk/settings.js +28 -0
  211. package/esm/sdk/settings.js.map +1 -0
  212. package/esm/sdk/tasks.d.ts +33 -0
  213. package/esm/sdk/tasks.d.ts.map +1 -0
  214. package/esm/sdk/tasks.js +48 -0
  215. package/esm/sdk/tasks.js.map +1 -0
  216. package/esm/sdk/workspace.d.ts +33 -0
  217. package/esm/sdk/workspace.d.ts.map +1 -0
  218. package/esm/sdk/workspace.js +48 -0
  219. package/esm/sdk/workspace.js.map +1 -0
  220. package/jsr.json +1 -1
  221. package/package.json +1 -1
  222. package/src/funcs/actions-connect-profile.ts +1 -1
  223. package/src/funcs/actions-edit-profile.ts +224 -0
  224. package/src/funcs/chat-get-conversation-summary.ts +229 -0
  225. package/src/funcs/chat-list-inbox.ts +1 -1
  226. package/src/funcs/chat-save-conversation-summary.ts +225 -0
  227. package/src/funcs/company-pages-get-analytics.ts +1 -1
  228. package/src/funcs/connectors-agent-snapshot.ts +205 -0
  229. package/src/funcs/connectors-connector-heartbeat.ts +230 -0
  230. package/src/funcs/connectors-list-connectors.ts +205 -0
  231. package/src/funcs/connectors-pull-task.ts +205 -0
  232. package/src/funcs/connectors-submit-task-result.ts +231 -0
  233. package/src/funcs/contacts-global-activities.ts +237 -0
  234. package/src/funcs/profile-create-api-token.ts +230 -0
  235. package/src/funcs/profile-delete-api-token.ts +230 -0
  236. package/src/funcs/profile-get-api-token.ts +229 -0
  237. package/src/funcs/profile-get-my-activity.ts +236 -0
  238. package/src/funcs/profile-get-settings.ts +205 -0
  239. package/src/funcs/profile-patch-settings.ts +224 -0
  240. package/src/funcs/profile-revalidate-linkedin.ts +205 -0
  241. package/src/funcs/sales-nav-search.ts +1 -1
  242. package/src/funcs/scheduled-messages-review-drafts.ts +224 -0
  243. package/src/funcs/scrapers-collect-comment-replies.ts +1 -1
  244. package/src/funcs/scrapers-collect-comments.ts +1 -1
  245. package/src/funcs/scrapers-collect-likes.ts +1 -1
  246. package/src/funcs/scrapers-visit-profile.ts +2 -0
  247. package/src/funcs/search-people.ts +2 -2
  248. package/src/funcs/search-search.ts +1 -1
  249. package/src/funcs/settings-get-dm-polling-settings.ts +205 -0
  250. package/src/funcs/settings-patch-dm-polling-settings.ts +225 -0
  251. package/src/funcs/tasks-cancel-chain.ts +229 -0
  252. package/src/funcs/tasks-cancel-task.ts +229 -0
  253. package/src/funcs/tasks-events-feed.ts +230 -0
  254. package/src/funcs/tasks-list-tasks.ts +233 -0
  255. package/src/funcs/workspace-create-workspace-invite.ts +225 -0
  256. package/src/funcs/workspace-delete-workspace-account.ts +230 -0
  257. package/src/funcs/workspace-delete-workspace-invite.ts +225 -0
  258. package/src/funcs/workspace-upgrade-workspace-account.ts +225 -0
  259. package/src/hooks/hooks.ts +0 -3
  260. package/src/lib/config.ts +6 -6
  261. package/src/lib/encodings.ts +23 -4
  262. package/src/lib/security.ts +14 -2
  263. package/src/models/operations/{search-contacts-campaign.ts → archive-response.ts} +2503 -2362
  264. package/src/models/operations/delete-workspace-invite-response.ts +2783 -0
  265. package/src/models/operations/{update-schedule-response.ts → get-by-url-campaign.ts} +3591 -2939
  266. package/src/models/operations/index.ts +4 -3
  267. package/src/models/operations/search-companies-response.ts +55 -14
  268. package/src/models/operations/{update-account-response.ts → update-account-proxy-config-response.ts} +112 -84
  269. package/src/sdk/actions.ts +19 -1
  270. package/src/sdk/chat.ts +37 -1
  271. package/src/sdk/company-pages.ts +1 -1
  272. package/src/sdk/connectors.ts +93 -0
  273. package/src/sdk/contacts.ts +18 -0
  274. package/src/sdk/profile.ts +122 -0
  275. package/src/sdk/sales-nav.ts +1 -1
  276. package/src/sdk/scheduled-messages.ts +18 -0
  277. package/src/sdk/scrapers.ts +5 -3
  278. package/src/sdk/sdk.ts +24 -0
  279. package/src/sdk/search.ts +3 -3
  280. package/src/sdk/settings.ts +43 -0
  281. package/src/sdk/tasks.ts +81 -0
  282. package/src/sdk/workspace.ts +81 -0
  283. package/esm/models/operations/search-contacts-campaign.d.ts.map +0 -1
  284. package/esm/models/operations/search-contacts-campaign.js.map +0 -1
  285. package/esm/models/operations/update-account-response.d.ts.map +0 -1
  286. package/esm/models/operations/update-account-response.js.map +0 -1
  287. package/esm/models/operations/update-schedule-response.d.ts.map +0 -1
  288. package/esm/models/operations/update-schedule-response.js.map +0 -1
@@ -0,0 +1,230 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { BereachCore } from "../core.js";
7
+ import { encodeJSON } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { BereachError } from "../models/errors/bereach-error.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/http-client-errors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
24
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Connector heartbeat
31
+ *
32
+ * @remarks
33
+ * Called periodically by the connector daemon to report liveness. Returns adaptive poll interval and pending task count.
34
+ */
35
+ export function connectorsConnectorHeartbeat(
36
+ client: BereachCore,
37
+ request?: operations.ConnectorHeartbeatRequest | undefined,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ operations.ConnectorHeartbeatResponse,
42
+ | errors.BadRequestError
43
+ | errors.UnauthorizedError
44
+ | errors.ForbiddenError
45
+ | errors.NotFoundError
46
+ | errors.ConflictError
47
+ | errors.GoneError
48
+ | errors.UnprocessableEntityError
49
+ | errors.TooManyRequestsError
50
+ | errors.InternalServerError
51
+ | errors.BadGatewayError
52
+ | errors.ServiceUnavailableError
53
+ | BereachError
54
+ | ResponseValidationError
55
+ | ConnectionError
56
+ | RequestAbortedError
57
+ | RequestTimeoutError
58
+ | InvalidRequestError
59
+ | UnexpectedClientError
60
+ | SDKValidationError
61
+ >
62
+ > {
63
+ return new APIPromise($do(
64
+ client,
65
+ request,
66
+ options,
67
+ ));
68
+ }
69
+
70
+ async function $do(
71
+ client: BereachCore,
72
+ request?: operations.ConnectorHeartbeatRequest | undefined,
73
+ options?: RequestOptions,
74
+ ): Promise<
75
+ [
76
+ Result<
77
+ operations.ConnectorHeartbeatResponse,
78
+ | errors.BadRequestError
79
+ | errors.UnauthorizedError
80
+ | errors.ForbiddenError
81
+ | errors.NotFoundError
82
+ | errors.ConflictError
83
+ | errors.GoneError
84
+ | errors.UnprocessableEntityError
85
+ | errors.TooManyRequestsError
86
+ | errors.InternalServerError
87
+ | errors.BadGatewayError
88
+ | errors.ServiceUnavailableError
89
+ | BereachError
90
+ | ResponseValidationError
91
+ | ConnectionError
92
+ | RequestAbortedError
93
+ | RequestTimeoutError
94
+ | InvalidRequestError
95
+ | UnexpectedClientError
96
+ | SDKValidationError
97
+ >,
98
+ APICall,
99
+ ]
100
+ > {
101
+ const parsed = safeParse(
102
+ request,
103
+ (value) =>
104
+ z.parse(
105
+ z.optional(operations.ConnectorHeartbeatRequest$outboundSchema),
106
+ value,
107
+ ),
108
+ "Input validation failed",
109
+ );
110
+ if (!parsed.ok) {
111
+ return [parsed, { status: "invalid" }];
112
+ }
113
+ const payload = parsed.value;
114
+ const body = payload === undefined
115
+ ? null
116
+ : encodeJSON("body", payload, { explode: true });
117
+
118
+ const path = pathToFunc("/connectors/heartbeat")();
119
+
120
+ const headers = new Headers(compactMap({
121
+ "Content-Type": "application/json",
122
+ Accept: "application/json",
123
+ }));
124
+
125
+ const secConfig = await extractSecurity(client._options.token);
126
+ const securityInput = secConfig == null ? {} : { token: secConfig };
127
+ const requestSecurity = resolveGlobalSecurity(securityInput);
128
+
129
+ const context = {
130
+ options: client._options,
131
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
132
+ operationID: "connectorHeartbeat",
133
+ oAuth2Scopes: null,
134
+
135
+ resolvedSecurity: requestSecurity,
136
+
137
+ securitySource: client._options.token,
138
+ retryConfig: options?.retries
139
+ || client._options.retryConfig
140
+ || { strategy: "none" },
141
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
142
+ };
143
+
144
+ const requestRes = client._createRequest(context, {
145
+ security: requestSecurity,
146
+ method: "POST",
147
+ baseURL: options?.serverURL,
148
+ path: path,
149
+ headers: headers,
150
+ body: body,
151
+ userAgent: client._options.userAgent,
152
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
153
+ }, options);
154
+ if (!requestRes.ok) {
155
+ return [requestRes, { status: "invalid" }];
156
+ }
157
+ const req = requestRes.value;
158
+
159
+ const doResult = await client._do(req, {
160
+ context,
161
+ errorCodes: [
162
+ "400",
163
+ "401",
164
+ "403",
165
+ "404",
166
+ "409",
167
+ "410",
168
+ "422",
169
+ "429",
170
+ "4XX",
171
+ "500",
172
+ "502",
173
+ "503",
174
+ "5XX",
175
+ ],
176
+ retryConfig: context.retryConfig,
177
+ retryCodes: context.retryCodes,
178
+ });
179
+ if (!doResult.ok) {
180
+ return [doResult, { status: "request-error", request: req }];
181
+ }
182
+ const response = doResult.value;
183
+
184
+ const responseFields = {
185
+ HttpMeta: { Response: response, Request: req },
186
+ };
187
+
188
+ const [result] = await M.match<
189
+ operations.ConnectorHeartbeatResponse,
190
+ | errors.BadRequestError
191
+ | errors.UnauthorizedError
192
+ | errors.ForbiddenError
193
+ | errors.NotFoundError
194
+ | errors.ConflictError
195
+ | errors.GoneError
196
+ | errors.UnprocessableEntityError
197
+ | errors.TooManyRequestsError
198
+ | errors.InternalServerError
199
+ | errors.BadGatewayError
200
+ | errors.ServiceUnavailableError
201
+ | BereachError
202
+ | ResponseValidationError
203
+ | ConnectionError
204
+ | RequestAbortedError
205
+ | RequestTimeoutError
206
+ | InvalidRequestError
207
+ | UnexpectedClientError
208
+ | SDKValidationError
209
+ >(
210
+ M.json(200, operations.ConnectorHeartbeatResponse$inboundSchema),
211
+ M.jsonErr(400, errors.BadRequestError$inboundSchema),
212
+ M.jsonErr(401, errors.UnauthorizedError$inboundSchema),
213
+ M.jsonErr(403, errors.ForbiddenError$inboundSchema),
214
+ M.jsonErr(404, errors.NotFoundError$inboundSchema),
215
+ M.jsonErr(409, errors.ConflictError$inboundSchema),
216
+ M.jsonErr(410, errors.GoneError$inboundSchema),
217
+ M.jsonErr(422, errors.UnprocessableEntityError$inboundSchema),
218
+ M.jsonErr(429, errors.TooManyRequestsError$inboundSchema),
219
+ M.jsonErr(500, errors.InternalServerError$inboundSchema),
220
+ M.jsonErr(502, errors.BadGatewayError$inboundSchema),
221
+ M.jsonErr(503, errors.ServiceUnavailableError$inboundSchema),
222
+ M.fail("4XX"),
223
+ M.fail("5XX"),
224
+ )(response, req, { extraFields: responseFields });
225
+ if (!result.ok) {
226
+ return [result, { status: "complete", request: req, response }];
227
+ }
228
+
229
+ return [result, { status: "complete", request: req, response }];
230
+ }
@@ -0,0 +1,205 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { BereachCore } from "../core.js";
6
+ import * as M from "../lib/matchers.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { RequestOptions } from "../lib/sdks.js";
9
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
10
+ import { pathToFunc } from "../lib/url.js";
11
+ import { BereachError } from "../models/errors/bereach-error.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../models/errors/http-client-errors.js";
19
+ import * as errors from "../models/errors/index.js";
20
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
21
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
22
+ import * as operations from "../models/operations/index.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * List connectors
28
+ *
29
+ * @remarks
30
+ * List all connector daemons for the authenticated user. Includes online/offline status based on last heartbeat. 0 credits.
31
+ */
32
+ export function connectorsListConnectors(
33
+ client: BereachCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ operations.ListConnectorsResponse,
38
+ | errors.BadRequestError
39
+ | errors.UnauthorizedError
40
+ | errors.ForbiddenError
41
+ | errors.NotFoundError
42
+ | errors.ConflictError
43
+ | errors.GoneError
44
+ | errors.UnprocessableEntityError
45
+ | errors.TooManyRequestsError
46
+ | errors.InternalServerError
47
+ | errors.BadGatewayError
48
+ | errors.ServiceUnavailableError
49
+ | BereachError
50
+ | ResponseValidationError
51
+ | ConnectionError
52
+ | RequestAbortedError
53
+ | RequestTimeoutError
54
+ | InvalidRequestError
55
+ | UnexpectedClientError
56
+ | SDKValidationError
57
+ >
58
+ > {
59
+ return new APIPromise($do(
60
+ client,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: BereachCore,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.ListConnectorsResponse,
72
+ | errors.BadRequestError
73
+ | errors.UnauthorizedError
74
+ | errors.ForbiddenError
75
+ | errors.NotFoundError
76
+ | errors.ConflictError
77
+ | errors.GoneError
78
+ | errors.UnprocessableEntityError
79
+ | errors.TooManyRequestsError
80
+ | errors.InternalServerError
81
+ | errors.BadGatewayError
82
+ | errors.ServiceUnavailableError
83
+ | BereachError
84
+ | ResponseValidationError
85
+ | ConnectionError
86
+ | RequestAbortedError
87
+ | RequestTimeoutError
88
+ | InvalidRequestError
89
+ | UnexpectedClientError
90
+ | SDKValidationError
91
+ >,
92
+ APICall,
93
+ ]
94
+ > {
95
+ const path = pathToFunc("/connectors/list")();
96
+
97
+ const headers = new Headers(compactMap({
98
+ Accept: "application/json",
99
+ }));
100
+
101
+ const secConfig = await extractSecurity(client._options.token);
102
+ const securityInput = secConfig == null ? {} : { token: secConfig };
103
+ const requestSecurity = resolveGlobalSecurity(securityInput);
104
+
105
+ const context = {
106
+ options: client._options,
107
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
108
+ operationID: "listConnectors",
109
+ oAuth2Scopes: null,
110
+
111
+ resolvedSecurity: requestSecurity,
112
+
113
+ securitySource: client._options.token,
114
+ retryConfig: options?.retries
115
+ || client._options.retryConfig
116
+ || { strategy: "none" },
117
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
118
+ };
119
+
120
+ const requestRes = client._createRequest(context, {
121
+ security: requestSecurity,
122
+ method: "GET",
123
+ baseURL: options?.serverURL,
124
+ path: path,
125
+ headers: headers,
126
+ userAgent: client._options.userAgent,
127
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
128
+ }, options);
129
+ if (!requestRes.ok) {
130
+ return [requestRes, { status: "invalid" }];
131
+ }
132
+ const req = requestRes.value;
133
+
134
+ const doResult = await client._do(req, {
135
+ context,
136
+ errorCodes: [
137
+ "400",
138
+ "401",
139
+ "403",
140
+ "404",
141
+ "409",
142
+ "410",
143
+ "422",
144
+ "429",
145
+ "4XX",
146
+ "500",
147
+ "502",
148
+ "503",
149
+ "5XX",
150
+ ],
151
+ retryConfig: context.retryConfig,
152
+ retryCodes: context.retryCodes,
153
+ });
154
+ if (!doResult.ok) {
155
+ return [doResult, { status: "request-error", request: req }];
156
+ }
157
+ const response = doResult.value;
158
+
159
+ const responseFields = {
160
+ HttpMeta: { Response: response, Request: req },
161
+ };
162
+
163
+ const [result] = await M.match<
164
+ operations.ListConnectorsResponse,
165
+ | errors.BadRequestError
166
+ | errors.UnauthorizedError
167
+ | errors.ForbiddenError
168
+ | errors.NotFoundError
169
+ | errors.ConflictError
170
+ | errors.GoneError
171
+ | errors.UnprocessableEntityError
172
+ | errors.TooManyRequestsError
173
+ | errors.InternalServerError
174
+ | errors.BadGatewayError
175
+ | errors.ServiceUnavailableError
176
+ | BereachError
177
+ | ResponseValidationError
178
+ | ConnectionError
179
+ | RequestAbortedError
180
+ | RequestTimeoutError
181
+ | InvalidRequestError
182
+ | UnexpectedClientError
183
+ | SDKValidationError
184
+ >(
185
+ M.json(200, operations.ListConnectorsResponse$inboundSchema),
186
+ M.jsonErr(400, errors.BadRequestError$inboundSchema),
187
+ M.jsonErr(401, errors.UnauthorizedError$inboundSchema),
188
+ M.jsonErr(403, errors.ForbiddenError$inboundSchema),
189
+ M.jsonErr(404, errors.NotFoundError$inboundSchema),
190
+ M.jsonErr(409, errors.ConflictError$inboundSchema),
191
+ M.jsonErr(410, errors.GoneError$inboundSchema),
192
+ M.jsonErr(422, errors.UnprocessableEntityError$inboundSchema),
193
+ M.jsonErr(429, errors.TooManyRequestsError$inboundSchema),
194
+ M.jsonErr(500, errors.InternalServerError$inboundSchema),
195
+ M.jsonErr(502, errors.BadGatewayError$inboundSchema),
196
+ M.jsonErr(503, errors.ServiceUnavailableError$inboundSchema),
197
+ M.fail("4XX"),
198
+ M.fail("5XX"),
199
+ )(response, req, { extraFields: responseFields });
200
+ if (!result.ok) {
201
+ return [result, { status: "complete", request: req, response }];
202
+ }
203
+
204
+ return [result, { status: "complete", request: req, response }];
205
+ }
@@ -0,0 +1,205 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { BereachCore } from "../core.js";
6
+ import * as M from "../lib/matchers.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { RequestOptions } from "../lib/sdks.js";
9
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
10
+ import { pathToFunc } from "../lib/url.js";
11
+ import { BereachError } from "../models/errors/bereach-error.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../models/errors/http-client-errors.js";
19
+ import * as errors from "../models/errors/index.js";
20
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
21
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
22
+ import * as operations from "../models/operations/index.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Pull next task (connector)
28
+ *
29
+ * @remarks
30
+ * Called by connector daemons to pull the next available task. Atomically transitions the task from 'queued' to 'dispatched'. Returns null if no tasks are available.
31
+ */
32
+ export function connectorsPullTask(
33
+ client: BereachCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ operations.PullTaskResponse,
38
+ | errors.BadRequestError
39
+ | errors.UnauthorizedError
40
+ | errors.ForbiddenError
41
+ | errors.NotFoundError
42
+ | errors.ConflictError
43
+ | errors.GoneError
44
+ | errors.UnprocessableEntityError
45
+ | errors.TooManyRequestsError
46
+ | errors.InternalServerError
47
+ | errors.BadGatewayError
48
+ | errors.ServiceUnavailableError
49
+ | BereachError
50
+ | ResponseValidationError
51
+ | ConnectionError
52
+ | RequestAbortedError
53
+ | RequestTimeoutError
54
+ | InvalidRequestError
55
+ | UnexpectedClientError
56
+ | SDKValidationError
57
+ >
58
+ > {
59
+ return new APIPromise($do(
60
+ client,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: BereachCore,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.PullTaskResponse,
72
+ | errors.BadRequestError
73
+ | errors.UnauthorizedError
74
+ | errors.ForbiddenError
75
+ | errors.NotFoundError
76
+ | errors.ConflictError
77
+ | errors.GoneError
78
+ | errors.UnprocessableEntityError
79
+ | errors.TooManyRequestsError
80
+ | errors.InternalServerError
81
+ | errors.BadGatewayError
82
+ | errors.ServiceUnavailableError
83
+ | BereachError
84
+ | ResponseValidationError
85
+ | ConnectionError
86
+ | RequestAbortedError
87
+ | RequestTimeoutError
88
+ | InvalidRequestError
89
+ | UnexpectedClientError
90
+ | SDKValidationError
91
+ >,
92
+ APICall,
93
+ ]
94
+ > {
95
+ const path = pathToFunc("/tasks/pull")();
96
+
97
+ const headers = new Headers(compactMap({
98
+ Accept: "application/json",
99
+ }));
100
+
101
+ const secConfig = await extractSecurity(client._options.token);
102
+ const securityInput = secConfig == null ? {} : { token: secConfig };
103
+ const requestSecurity = resolveGlobalSecurity(securityInput);
104
+
105
+ const context = {
106
+ options: client._options,
107
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
108
+ operationID: "pullTask",
109
+ oAuth2Scopes: null,
110
+
111
+ resolvedSecurity: requestSecurity,
112
+
113
+ securitySource: client._options.token,
114
+ retryConfig: options?.retries
115
+ || client._options.retryConfig
116
+ || { strategy: "none" },
117
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
118
+ };
119
+
120
+ const requestRes = client._createRequest(context, {
121
+ security: requestSecurity,
122
+ method: "POST",
123
+ baseURL: options?.serverURL,
124
+ path: path,
125
+ headers: headers,
126
+ userAgent: client._options.userAgent,
127
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
128
+ }, options);
129
+ if (!requestRes.ok) {
130
+ return [requestRes, { status: "invalid" }];
131
+ }
132
+ const req = requestRes.value;
133
+
134
+ const doResult = await client._do(req, {
135
+ context,
136
+ errorCodes: [
137
+ "400",
138
+ "401",
139
+ "403",
140
+ "404",
141
+ "409",
142
+ "410",
143
+ "422",
144
+ "429",
145
+ "4XX",
146
+ "500",
147
+ "502",
148
+ "503",
149
+ "5XX",
150
+ ],
151
+ retryConfig: context.retryConfig,
152
+ retryCodes: context.retryCodes,
153
+ });
154
+ if (!doResult.ok) {
155
+ return [doResult, { status: "request-error", request: req }];
156
+ }
157
+ const response = doResult.value;
158
+
159
+ const responseFields = {
160
+ HttpMeta: { Response: response, Request: req },
161
+ };
162
+
163
+ const [result] = await M.match<
164
+ operations.PullTaskResponse,
165
+ | errors.BadRequestError
166
+ | errors.UnauthorizedError
167
+ | errors.ForbiddenError
168
+ | errors.NotFoundError
169
+ | errors.ConflictError
170
+ | errors.GoneError
171
+ | errors.UnprocessableEntityError
172
+ | errors.TooManyRequestsError
173
+ | errors.InternalServerError
174
+ | errors.BadGatewayError
175
+ | errors.ServiceUnavailableError
176
+ | BereachError
177
+ | ResponseValidationError
178
+ | ConnectionError
179
+ | RequestAbortedError
180
+ | RequestTimeoutError
181
+ | InvalidRequestError
182
+ | UnexpectedClientError
183
+ | SDKValidationError
184
+ >(
185
+ M.json(200, operations.PullTaskResponse$inboundSchema),
186
+ M.jsonErr(400, errors.BadRequestError$inboundSchema),
187
+ M.jsonErr(401, errors.UnauthorizedError$inboundSchema),
188
+ M.jsonErr(403, errors.ForbiddenError$inboundSchema),
189
+ M.jsonErr(404, errors.NotFoundError$inboundSchema),
190
+ M.jsonErr(409, errors.ConflictError$inboundSchema),
191
+ M.jsonErr(410, errors.GoneError$inboundSchema),
192
+ M.jsonErr(422, errors.UnprocessableEntityError$inboundSchema),
193
+ M.jsonErr(429, errors.TooManyRequestsError$inboundSchema),
194
+ M.jsonErr(500, errors.InternalServerError$inboundSchema),
195
+ M.jsonErr(502, errors.BadGatewayError$inboundSchema),
196
+ M.jsonErr(503, errors.ServiceUnavailableError$inboundSchema),
197
+ M.fail("4XX"),
198
+ M.fail("5XX"),
199
+ )(response, req, { extraFields: responseFields });
200
+ if (!result.ok) {
201
+ return [result, { status: "complete", request: req, response }];
202
+ }
203
+
204
+ return [result, { status: "complete", request: req, response }];
205
+ }