@macro-inc/sdk 0.0.1

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 (296) hide show
  1. package/README.md +177 -0
  2. package/dist/chunk-5HAKQN23.js +1263 -0
  3. package/dist/chunk-77EI4LSQ.js +2492 -0
  4. package/dist/chunk-CTKR64MY.js +1436 -0
  5. package/dist/chunk-JXIQT5TH.js +1467 -0
  6. package/dist/chunk-P4DTO6VD.js +830 -0
  7. package/dist/chunk-PAAFJYGO.js +967 -0
  8. package/dist/chunk-QNUS5BC5.js +913 -0
  9. package/dist/chunk-SGAHIERJ.js +1235 -0
  10. package/dist/chunk-V45LUJDI.js +838 -0
  11. package/dist/chunk-YRUXFEZM.js +1044 -0
  12. package/dist/generated/agent-harness/client/client.gen.d.ts +2 -0
  13. package/dist/generated/agent-harness/client/index.d.ts +10 -0
  14. package/dist/generated/agent-harness/client/types.gen.d.ts +120 -0
  15. package/dist/generated/agent-harness/client/utils.gen.d.ts +37 -0
  16. package/dist/generated/agent-harness/client.gen.d.ts +12 -0
  17. package/dist/generated/agent-harness/core/auth.gen.d.ts +25 -0
  18. package/dist/generated/agent-harness/core/bodySerializer.gen.d.ts +25 -0
  19. package/dist/generated/agent-harness/core/params.gen.d.ts +43 -0
  20. package/dist/generated/agent-harness/core/pathSerializer.gen.d.ts +33 -0
  21. package/dist/generated/agent-harness/core/queryKeySerializer.gen.d.ts +18 -0
  22. package/dist/generated/agent-harness/core/serverSentEvents.gen.d.ts +71 -0
  23. package/dist/generated/agent-harness/core/types.gen.d.ts +83 -0
  24. package/dist/generated/agent-harness/core/utils.gen.d.ts +19 -0
  25. package/dist/generated/agent-harness/index.d.ts +2 -0
  26. package/dist/generated/agent-harness/index.js +6 -0
  27. package/dist/generated/agent-harness/sdk.gen.d.ts +84 -0
  28. package/dist/generated/agent-harness/types.gen.d.ts +539 -0
  29. package/dist/generated/auth/client/client.gen.d.ts +2 -0
  30. package/dist/generated/auth/client/index.d.ts +10 -0
  31. package/dist/generated/auth/client/types.gen.d.ts +120 -0
  32. package/dist/generated/auth/client/utils.gen.d.ts +37 -0
  33. package/dist/generated/auth/client.gen.d.ts +12 -0
  34. package/dist/generated/auth/core/auth.gen.d.ts +25 -0
  35. package/dist/generated/auth/core/bodySerializer.gen.d.ts +25 -0
  36. package/dist/generated/auth/core/params.gen.d.ts +43 -0
  37. package/dist/generated/auth/core/pathSerializer.gen.d.ts +33 -0
  38. package/dist/generated/auth/core/queryKeySerializer.gen.d.ts +18 -0
  39. package/dist/generated/auth/core/serverSentEvents.gen.d.ts +71 -0
  40. package/dist/generated/auth/core/types.gen.d.ts +83 -0
  41. package/dist/generated/auth/core/utils.gen.d.ts +19 -0
  42. package/dist/generated/auth/index.d.ts +2 -0
  43. package/dist/generated/auth/index.js +6 -0
  44. package/dist/generated/auth/sdk.gen.d.ts +383 -0
  45. package/dist/generated/auth/types.gen.d.ts +2175 -0
  46. package/dist/generated/cognition/client/client.gen.d.ts +2 -0
  47. package/dist/generated/cognition/client/index.d.ts +10 -0
  48. package/dist/generated/cognition/client/types.gen.d.ts +120 -0
  49. package/dist/generated/cognition/client/utils.gen.d.ts +37 -0
  50. package/dist/generated/cognition/client.gen.d.ts +12 -0
  51. package/dist/generated/cognition/core/auth.gen.d.ts +25 -0
  52. package/dist/generated/cognition/core/bodySerializer.gen.d.ts +25 -0
  53. package/dist/generated/cognition/core/params.gen.d.ts +43 -0
  54. package/dist/generated/cognition/core/pathSerializer.gen.d.ts +33 -0
  55. package/dist/generated/cognition/core/queryKeySerializer.gen.d.ts +18 -0
  56. package/dist/generated/cognition/core/serverSentEvents.gen.d.ts +71 -0
  57. package/dist/generated/cognition/core/types.gen.d.ts +83 -0
  58. package/dist/generated/cognition/core/utils.gen.d.ts +19 -0
  59. package/dist/generated/cognition/index.d.ts +2 -0
  60. package/dist/generated/cognition/index.js +6 -0
  61. package/dist/generated/cognition/sdk.gen.d.ts +224 -0
  62. package/dist/generated/cognition/types.gen.d.ts +2484 -0
  63. package/dist/generated/connection/client/client.gen.d.ts +2 -0
  64. package/dist/generated/connection/client/index.d.ts +10 -0
  65. package/dist/generated/connection/client/types.gen.d.ts +120 -0
  66. package/dist/generated/connection/client/utils.gen.d.ts +37 -0
  67. package/dist/generated/connection/client.gen.d.ts +12 -0
  68. package/dist/generated/connection/core/auth.gen.d.ts +25 -0
  69. package/dist/generated/connection/core/bodySerializer.gen.d.ts +25 -0
  70. package/dist/generated/connection/core/params.gen.d.ts +43 -0
  71. package/dist/generated/connection/core/pathSerializer.gen.d.ts +33 -0
  72. package/dist/generated/connection/core/queryKeySerializer.gen.d.ts +18 -0
  73. package/dist/generated/connection/core/serverSentEvents.gen.d.ts +71 -0
  74. package/dist/generated/connection/core/types.gen.d.ts +83 -0
  75. package/dist/generated/connection/core/utils.gen.d.ts +19 -0
  76. package/dist/generated/connection/index.d.ts +2 -0
  77. package/dist/generated/connection/index.js +839 -0
  78. package/dist/generated/connection/sdk.gen.d.ts +38 -0
  79. package/dist/generated/connection/types.gen.d.ts +235 -0
  80. package/dist/generated/contacts/client/client.gen.d.ts +2 -0
  81. package/dist/generated/contacts/client/index.d.ts +10 -0
  82. package/dist/generated/contacts/client/types.gen.d.ts +120 -0
  83. package/dist/generated/contacts/client/utils.gen.d.ts +37 -0
  84. package/dist/generated/contacts/client.gen.d.ts +12 -0
  85. package/dist/generated/contacts/core/auth.gen.d.ts +25 -0
  86. package/dist/generated/contacts/core/bodySerializer.gen.d.ts +25 -0
  87. package/dist/generated/contacts/core/params.gen.d.ts +43 -0
  88. package/dist/generated/contacts/core/pathSerializer.gen.d.ts +33 -0
  89. package/dist/generated/contacts/core/queryKeySerializer.gen.d.ts +18 -0
  90. package/dist/generated/contacts/core/serverSentEvents.gen.d.ts +71 -0
  91. package/dist/generated/contacts/core/types.gen.d.ts +83 -0
  92. package/dist/generated/contacts/core/utils.gen.d.ts +19 -0
  93. package/dist/generated/contacts/index.d.ts +2 -0
  94. package/dist/generated/contacts/index.js +6 -0
  95. package/dist/generated/contacts/sdk.gen.d.ts +43 -0
  96. package/dist/generated/contacts/types.gen.d.ts +52 -0
  97. package/dist/generated/email/client/client.gen.d.ts +2 -0
  98. package/dist/generated/email/client/index.d.ts +10 -0
  99. package/dist/generated/email/client/types.gen.d.ts +120 -0
  100. package/dist/generated/email/client/utils.gen.d.ts +37 -0
  101. package/dist/generated/email/client.gen.d.ts +12 -0
  102. package/dist/generated/email/core/auth.gen.d.ts +25 -0
  103. package/dist/generated/email/core/bodySerializer.gen.d.ts +25 -0
  104. package/dist/generated/email/core/params.gen.d.ts +43 -0
  105. package/dist/generated/email/core/pathSerializer.gen.d.ts +33 -0
  106. package/dist/generated/email/core/queryKeySerializer.gen.d.ts +18 -0
  107. package/dist/generated/email/core/serverSentEvents.gen.d.ts +71 -0
  108. package/dist/generated/email/core/types.gen.d.ts +83 -0
  109. package/dist/generated/email/core/utils.gen.d.ts +19 -0
  110. package/dist/generated/email/index.d.ts +2 -0
  111. package/dist/generated/email/index.js +6 -0
  112. package/dist/generated/email/sdk.gen.d.ts +254 -0
  113. package/dist/generated/email/types.gen.d.ts +2614 -0
  114. package/dist/generated/notification/client/client.gen.d.ts +2 -0
  115. package/dist/generated/notification/client/index.d.ts +10 -0
  116. package/dist/generated/notification/client/types.gen.d.ts +120 -0
  117. package/dist/generated/notification/client/utils.gen.d.ts +37 -0
  118. package/dist/generated/notification/client.gen.d.ts +12 -0
  119. package/dist/generated/notification/core/auth.gen.d.ts +25 -0
  120. package/dist/generated/notification/core/bodySerializer.gen.d.ts +25 -0
  121. package/dist/generated/notification/core/params.gen.d.ts +43 -0
  122. package/dist/generated/notification/core/pathSerializer.gen.d.ts +33 -0
  123. package/dist/generated/notification/core/queryKeySerializer.gen.d.ts +18 -0
  124. package/dist/generated/notification/core/serverSentEvents.gen.d.ts +71 -0
  125. package/dist/generated/notification/core/types.gen.d.ts +83 -0
  126. package/dist/generated/notification/core/utils.gen.d.ts +19 -0
  127. package/dist/generated/notification/index.d.ts +2 -0
  128. package/dist/generated/notification/index.js +6 -0
  129. package/dist/generated/notification/sdk.gen.d.ts +118 -0
  130. package/dist/generated/notification/types.gen.d.ts +1352 -0
  131. package/dist/generated/properties/client/client.gen.d.ts +2 -0
  132. package/dist/generated/properties/client/index.d.ts +10 -0
  133. package/dist/generated/properties/client/types.gen.d.ts +120 -0
  134. package/dist/generated/properties/client/utils.gen.d.ts +37 -0
  135. package/dist/generated/properties/client.gen.d.ts +12 -0
  136. package/dist/generated/properties/core/auth.gen.d.ts +25 -0
  137. package/dist/generated/properties/core/bodySerializer.gen.d.ts +25 -0
  138. package/dist/generated/properties/core/params.gen.d.ts +43 -0
  139. package/dist/generated/properties/core/pathSerializer.gen.d.ts +33 -0
  140. package/dist/generated/properties/core/queryKeySerializer.gen.d.ts +18 -0
  141. package/dist/generated/properties/core/serverSentEvents.gen.d.ts +71 -0
  142. package/dist/generated/properties/core/types.gen.d.ts +83 -0
  143. package/dist/generated/properties/core/utils.gen.d.ts +19 -0
  144. package/dist/generated/properties/index.d.ts +2 -0
  145. package/dist/generated/properties/index.js +6 -0
  146. package/dist/generated/properties/sdk.gen.d.ts +158 -0
  147. package/dist/generated/properties/types.gen.d.ts +1288 -0
  148. package/dist/generated/scheduled-action/client/client.gen.d.ts +2 -0
  149. package/dist/generated/scheduled-action/client/index.d.ts +10 -0
  150. package/dist/generated/scheduled-action/client/types.gen.d.ts +120 -0
  151. package/dist/generated/scheduled-action/client/utils.gen.d.ts +37 -0
  152. package/dist/generated/scheduled-action/client.gen.d.ts +12 -0
  153. package/dist/generated/scheduled-action/core/auth.gen.d.ts +25 -0
  154. package/dist/generated/scheduled-action/core/bodySerializer.gen.d.ts +25 -0
  155. package/dist/generated/scheduled-action/core/params.gen.d.ts +43 -0
  156. package/dist/generated/scheduled-action/core/pathSerializer.gen.d.ts +33 -0
  157. package/dist/generated/scheduled-action/core/queryKeySerializer.gen.d.ts +18 -0
  158. package/dist/generated/scheduled-action/core/serverSentEvents.gen.d.ts +71 -0
  159. package/dist/generated/scheduled-action/core/types.gen.d.ts +83 -0
  160. package/dist/generated/scheduled-action/core/utils.gen.d.ts +19 -0
  161. package/dist/generated/scheduled-action/index.d.ts +2 -0
  162. package/dist/generated/scheduled-action/index.js +845 -0
  163. package/dist/generated/scheduled-action/sdk.gen.d.ts +42 -0
  164. package/dist/generated/scheduled-action/types.gen.d.ts +241 -0
  165. package/dist/generated/search/client/client.gen.d.ts +2 -0
  166. package/dist/generated/search/client/index.d.ts +10 -0
  167. package/dist/generated/search/client/types.gen.d.ts +120 -0
  168. package/dist/generated/search/client/utils.gen.d.ts +37 -0
  169. package/dist/generated/search/client.gen.d.ts +12 -0
  170. package/dist/generated/search/core/auth.gen.d.ts +25 -0
  171. package/dist/generated/search/core/bodySerializer.gen.d.ts +25 -0
  172. package/dist/generated/search/core/params.gen.d.ts +43 -0
  173. package/dist/generated/search/core/pathSerializer.gen.d.ts +33 -0
  174. package/dist/generated/search/core/queryKeySerializer.gen.d.ts +18 -0
  175. package/dist/generated/search/core/serverSentEvents.gen.d.ts +71 -0
  176. package/dist/generated/search/core/types.gen.d.ts +83 -0
  177. package/dist/generated/search/core/utils.gen.d.ts +19 -0
  178. package/dist/generated/search/index.d.ts +2 -0
  179. package/dist/generated/search/index.js +6 -0
  180. package/dist/generated/search/sdk.gen.d.ts +44 -0
  181. package/dist/generated/search/types.gen.d.ts +2194 -0
  182. package/dist/generated/static-files/client/client.gen.d.ts +2 -0
  183. package/dist/generated/static-files/client/index.d.ts +10 -0
  184. package/dist/generated/static-files/client/types.gen.d.ts +120 -0
  185. package/dist/generated/static-files/client/utils.gen.d.ts +37 -0
  186. package/dist/generated/static-files/client.gen.d.ts +12 -0
  187. package/dist/generated/static-files/core/auth.gen.d.ts +25 -0
  188. package/dist/generated/static-files/core/bodySerializer.gen.d.ts +25 -0
  189. package/dist/generated/static-files/core/params.gen.d.ts +43 -0
  190. package/dist/generated/static-files/core/pathSerializer.gen.d.ts +33 -0
  191. package/dist/generated/static-files/core/queryKeySerializer.gen.d.ts +18 -0
  192. package/dist/generated/static-files/core/serverSentEvents.gen.d.ts +71 -0
  193. package/dist/generated/static-files/core/types.gen.d.ts +83 -0
  194. package/dist/generated/static-files/core/utils.gen.d.ts +19 -0
  195. package/dist/generated/static-files/index.d.ts +2 -0
  196. package/dist/generated/static-files/index.js +842 -0
  197. package/dist/generated/static-files/sdk.gen.d.ts +43 -0
  198. package/dist/generated/static-files/types.gen.d.ts +214 -0
  199. package/dist/generated/storage/client/client.gen.d.ts +2 -0
  200. package/dist/generated/storage/client/index.d.ts +10 -0
  201. package/dist/generated/storage/client/types.gen.d.ts +120 -0
  202. package/dist/generated/storage/client/utils.gen.d.ts +37 -0
  203. package/dist/generated/storage/client.gen.d.ts +12 -0
  204. package/dist/generated/storage/core/auth.gen.d.ts +25 -0
  205. package/dist/generated/storage/core/bodySerializer.gen.d.ts +25 -0
  206. package/dist/generated/storage/core/params.gen.d.ts +43 -0
  207. package/dist/generated/storage/core/pathSerializer.gen.d.ts +33 -0
  208. package/dist/generated/storage/core/queryKeySerializer.gen.d.ts +18 -0
  209. package/dist/generated/storage/core/serverSentEvents.gen.d.ts +71 -0
  210. package/dist/generated/storage/core/types.gen.d.ts +83 -0
  211. package/dist/generated/storage/core/utils.gen.d.ts +19 -0
  212. package/dist/generated/storage/index.d.ts +2 -0
  213. package/dist/generated/storage/index.js +6 -0
  214. package/dist/generated/storage/sdk.gen.d.ts +858 -0
  215. package/dist/generated/storage/types.gen.d.ts +12105 -0
  216. package/dist/generated/unfurl/client/client.gen.d.ts +2 -0
  217. package/dist/generated/unfurl/client/index.d.ts +10 -0
  218. package/dist/generated/unfurl/client/types.gen.d.ts +120 -0
  219. package/dist/generated/unfurl/client/utils.gen.d.ts +37 -0
  220. package/dist/generated/unfurl/client.gen.d.ts +12 -0
  221. package/dist/generated/unfurl/core/auth.gen.d.ts +25 -0
  222. package/dist/generated/unfurl/core/bodySerializer.gen.d.ts +25 -0
  223. package/dist/generated/unfurl/core/params.gen.d.ts +43 -0
  224. package/dist/generated/unfurl/core/pathSerializer.gen.d.ts +33 -0
  225. package/dist/generated/unfurl/core/queryKeySerializer.gen.d.ts +18 -0
  226. package/dist/generated/unfurl/core/serverSentEvents.gen.d.ts +71 -0
  227. package/dist/generated/unfurl/core/types.gen.d.ts +83 -0
  228. package/dist/generated/unfurl/core/utils.gen.d.ts +19 -0
  229. package/dist/generated/unfurl/index.d.ts +2 -0
  230. package/dist/generated/unfurl/index.js +835 -0
  231. package/dist/generated/unfurl/sdk.gen.d.ts +47 -0
  232. package/dist/generated/unfurl/types.gen.d.ts +125 -0
  233. package/dist/src/config.d.ts +51 -0
  234. package/dist/src/entities/agent-sessions/agent-session.d.ts +45 -0
  235. package/dist/src/entities/agent-sessions/namespace.d.ts +18 -0
  236. package/dist/src/entities/bots/namespace.d.ts +25 -0
  237. package/dist/src/entities/calls/call-record.d.ts +55 -0
  238. package/dist/src/entities/calls/namespace.d.ts +9 -0
  239. package/dist/src/entities/channels/channel.d.ts +88 -0
  240. package/dist/src/entities/channels/message.d.ts +64 -0
  241. package/dist/src/entities/channels/namespace.d.ts +30 -0
  242. package/dist/src/entities/channels/post.d.ts +20 -0
  243. package/dist/src/entities/channels/thread.d.ts +30 -0
  244. package/dist/src/entities/chats/chat.d.ts +55 -0
  245. package/dist/src/entities/chats/namespace.d.ts +14 -0
  246. package/dist/src/entities/crm/comment.d.ts +43 -0
  247. package/dist/src/entities/crm/company.d.ts +70 -0
  248. package/dist/src/entities/crm/contact.d.ts +48 -0
  249. package/dist/src/entities/crm/namespace.d.ts +22 -0
  250. package/dist/src/entities/documents/comment.d.ts +41 -0
  251. package/dist/src/entities/documents/document.d.ts +130 -0
  252. package/dist/src/entities/documents/namespace.d.ts +43 -0
  253. package/dist/src/entities/documents/system-skill.d.ts +16 -0
  254. package/dist/src/entities/email/attachment.d.ts +36 -0
  255. package/dist/src/entities/email/label.d.ts +31 -0
  256. package/dist/src/entities/email/link.d.ts +29 -0
  257. package/dist/src/entities/email/message.d.ts +58 -0
  258. package/dist/src/entities/email/namespace.d.ts +49 -0
  259. package/dist/src/entities/email/thread.d.ts +88 -0
  260. package/dist/src/entities/entity.d.ts +101 -0
  261. package/dist/src/entities/favorites/namespace.d.ts +19 -0
  262. package/dist/src/entities/foreign/foreign-entity.d.ts +30 -0
  263. package/dist/src/entities/foreign/namespace.d.ts +7 -0
  264. package/dist/src/entities/notifications/namespace.d.ts +29 -0
  265. package/dist/src/entities/notifications/notification.d.ts +50 -0
  266. package/dist/src/entities/pins/namespace.d.ts +19 -0
  267. package/dist/src/entities/projects/namespace.d.ts +13 -0
  268. package/dist/src/entities/projects/project.d.ts +42 -0
  269. package/dist/src/entities/properties/namespace.d.ts +47 -0
  270. package/dist/src/entities/properties/property-definition.d.ts +45 -0
  271. package/dist/src/entities/properties/property-option.d.ts +32 -0
  272. package/dist/src/entities/search.d.ts +23 -0
  273. package/dist/src/entities/tasks/namespace.d.ts +21 -0
  274. package/dist/src/entities/tasks/task.d.ts +34 -0
  275. package/dist/src/entities/teams/namespace.d.ts +12 -0
  276. package/dist/src/entities/teams/team.d.ts +40 -0
  277. package/dist/src/entities/users/namespace.d.ts +10 -0
  278. package/dist/src/entities/users/user.d.ts +43 -0
  279. package/dist/src/entities/webhooks/namespace.d.ts +31 -0
  280. package/dist/src/entities/webhooks/webhook.d.ts +88 -0
  281. package/dist/src/events/hydrate/channel.d.ts +85 -0
  282. package/dist/src/events/hydrate/document.d.ts +54 -0
  283. package/dist/src/events/receiver.d.ts +51 -0
  284. package/dist/src/events/types.d.ts +40 -0
  285. package/dist/src/events/verify.d.ts +13 -0
  286. package/dist/src/local-portmap.d.ts +8 -0
  287. package/dist/src/macro.d.ts +62 -0
  288. package/dist/src/macro.js +4215 -0
  289. package/dist/src/mentions.d.ts +37 -0
  290. package/dist/src/raw.d.ts +12 -0
  291. package/dist/src/utils/client.d.ts +53 -0
  292. package/dist/src/utils/index.d.ts +4 -0
  293. package/dist/src/utils/lazy.d.ts +18 -0
  294. package/dist/src/utils/pagination.d.ts +7 -0
  295. package/dist/src/utils/unwrap.d.ts +23 -0
  296. package/package.json +49 -0
@@ -0,0 +1,2492 @@
1
+ // generated/storage/core/bodySerializer.gen.ts
2
+ var jsonBodySerializer = {
3
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
4
+ };
5
+
6
+ // generated/storage/core/serverSentEvents.gen.ts
7
+ function createSseClient({
8
+ onRequest,
9
+ onSseError,
10
+ onSseEvent,
11
+ responseTransformer,
12
+ responseValidator,
13
+ sseDefaultRetryDelay,
14
+ sseMaxRetryAttempts,
15
+ sseMaxRetryDelay,
16
+ sseSleepFn,
17
+ url,
18
+ ...options
19
+ }) {
20
+ let lastEventId;
21
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
22
+ const createStream = async function* () {
23
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
24
+ let attempt = 0;
25
+ const signal = options.signal ?? new AbortController().signal;
26
+ while (true) {
27
+ if (signal.aborted) break;
28
+ attempt++;
29
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
30
+ if (lastEventId !== void 0) {
31
+ headers.set("Last-Event-ID", lastEventId);
32
+ }
33
+ try {
34
+ const requestInit = {
35
+ redirect: "follow",
36
+ ...options,
37
+ body: options.serializedBody,
38
+ headers,
39
+ signal
40
+ };
41
+ let request = new Request(url, requestInit);
42
+ if (onRequest) {
43
+ request = await onRequest(url, requestInit);
44
+ }
45
+ const _fetch = options.fetch ?? globalThis.fetch;
46
+ const response = await _fetch(request);
47
+ if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
48
+ if (!response.body) throw new Error("No body in SSE response");
49
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
50
+ let buffer = "";
51
+ const abortHandler = () => {
52
+ try {
53
+ reader.cancel();
54
+ } catch {
55
+ }
56
+ };
57
+ signal.addEventListener("abort", abortHandler);
58
+ try {
59
+ while (true) {
60
+ const { done, value } = await reader.read();
61
+ if (done) break;
62
+ buffer += value;
63
+ buffer = buffer.replace(/\r\n?/g, "\n");
64
+ const chunks = buffer.split("\n\n");
65
+ buffer = chunks.pop() ?? "";
66
+ for (const chunk of chunks) {
67
+ const lines = chunk.split("\n");
68
+ const dataLines = [];
69
+ let eventName;
70
+ for (const line of lines) {
71
+ if (line.startsWith("data:")) {
72
+ dataLines.push(line.replace(/^data:\s*/, ""));
73
+ } else if (line.startsWith("event:")) {
74
+ eventName = line.replace(/^event:\s*/, "");
75
+ } else if (line.startsWith("id:")) {
76
+ lastEventId = line.replace(/^id:\s*/, "");
77
+ } else if (line.startsWith("retry:")) {
78
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
79
+ if (!Number.isNaN(parsed)) {
80
+ retryDelay = parsed;
81
+ }
82
+ }
83
+ }
84
+ let data;
85
+ let parsedJson = false;
86
+ if (dataLines.length) {
87
+ const rawData = dataLines.join("\n");
88
+ try {
89
+ data = JSON.parse(rawData);
90
+ parsedJson = true;
91
+ } catch {
92
+ data = rawData;
93
+ }
94
+ }
95
+ if (parsedJson) {
96
+ if (responseValidator) {
97
+ await responseValidator(data);
98
+ }
99
+ if (responseTransformer) {
100
+ data = await responseTransformer(data);
101
+ }
102
+ }
103
+ onSseEvent?.({
104
+ data,
105
+ event: eventName,
106
+ id: lastEventId,
107
+ retry: retryDelay
108
+ });
109
+ if (dataLines.length) {
110
+ yield data;
111
+ }
112
+ }
113
+ }
114
+ } finally {
115
+ signal.removeEventListener("abort", abortHandler);
116
+ reader.releaseLock();
117
+ }
118
+ break;
119
+ } catch (error) {
120
+ onSseError?.(error);
121
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
122
+ break;
123
+ }
124
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
125
+ await sleep(backoff);
126
+ }
127
+ }
128
+ };
129
+ const stream = createStream();
130
+ return { stream };
131
+ }
132
+
133
+ // generated/storage/core/pathSerializer.gen.ts
134
+ var separatorArrayExplode = (style) => {
135
+ switch (style) {
136
+ case "label":
137
+ return ".";
138
+ case "matrix":
139
+ return ";";
140
+ case "simple":
141
+ return ",";
142
+ default:
143
+ return "&";
144
+ }
145
+ };
146
+ var separatorArrayNoExplode = (style) => {
147
+ switch (style) {
148
+ case "form":
149
+ return ",";
150
+ case "pipeDelimited":
151
+ return "|";
152
+ case "spaceDelimited":
153
+ return "%20";
154
+ default:
155
+ return ",";
156
+ }
157
+ };
158
+ var separatorObjectExplode = (style) => {
159
+ switch (style) {
160
+ case "label":
161
+ return ".";
162
+ case "matrix":
163
+ return ";";
164
+ case "simple":
165
+ return ",";
166
+ default:
167
+ return "&";
168
+ }
169
+ };
170
+ var serializeArrayParam = ({
171
+ allowReserved,
172
+ explode,
173
+ name,
174
+ style,
175
+ value
176
+ }) => {
177
+ if (!explode) {
178
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
179
+ switch (style) {
180
+ case "label":
181
+ return `.${joinedValues2}`;
182
+ case "matrix":
183
+ return `;${name}=${joinedValues2}`;
184
+ case "simple":
185
+ return joinedValues2;
186
+ default:
187
+ return `${name}=${joinedValues2}`;
188
+ }
189
+ }
190
+ const separator = separatorArrayExplode(style);
191
+ const joinedValues = value.map((v) => {
192
+ if (style === "label" || style === "simple") {
193
+ return allowReserved ? v : encodeURIComponent(v);
194
+ }
195
+ return serializePrimitiveParam({
196
+ allowReserved,
197
+ name,
198
+ value: v
199
+ });
200
+ }).join(separator);
201
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
202
+ };
203
+ var serializePrimitiveParam = ({
204
+ allowReserved,
205
+ name,
206
+ value
207
+ }) => {
208
+ if (value === void 0 || value === null) {
209
+ return "";
210
+ }
211
+ if (typeof value === "object") {
212
+ throw new Error(
213
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
214
+ );
215
+ }
216
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
217
+ };
218
+ var serializeObjectParam = ({
219
+ allowReserved,
220
+ explode,
221
+ name,
222
+ style,
223
+ value,
224
+ valueOnly
225
+ }) => {
226
+ if (value instanceof Date) {
227
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
228
+ }
229
+ if (style !== "deepObject" && !explode) {
230
+ let values = [];
231
+ Object.entries(value).forEach(([key, v]) => {
232
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
233
+ });
234
+ const joinedValues2 = values.join(",");
235
+ switch (style) {
236
+ case "form":
237
+ return `${name}=${joinedValues2}`;
238
+ case "label":
239
+ return `.${joinedValues2}`;
240
+ case "matrix":
241
+ return `;${name}=${joinedValues2}`;
242
+ default:
243
+ return joinedValues2;
244
+ }
245
+ }
246
+ const separator = separatorObjectExplode(style);
247
+ const joinedValues = Object.entries(value).map(
248
+ ([key, v]) => serializePrimitiveParam({
249
+ allowReserved,
250
+ name: style === "deepObject" ? `${name}[${key}]` : key,
251
+ value: v
252
+ })
253
+ ).join(separator);
254
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
255
+ };
256
+
257
+ // generated/storage/core/utils.gen.ts
258
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
259
+ var defaultPathSerializer = ({ path, url: _url }) => {
260
+ let url = _url;
261
+ const matches = _url.match(PATH_PARAM_RE);
262
+ if (matches) {
263
+ for (const match of matches) {
264
+ let explode = false;
265
+ let name = match.substring(1, match.length - 1);
266
+ let style = "simple";
267
+ if (name.endsWith("*")) {
268
+ explode = true;
269
+ name = name.substring(0, name.length - 1);
270
+ }
271
+ if (name.startsWith(".")) {
272
+ name = name.substring(1);
273
+ style = "label";
274
+ } else if (name.startsWith(";")) {
275
+ name = name.substring(1);
276
+ style = "matrix";
277
+ }
278
+ const value = path[name];
279
+ if (value === void 0 || value === null) {
280
+ continue;
281
+ }
282
+ if (Array.isArray(value)) {
283
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
284
+ continue;
285
+ }
286
+ if (typeof value === "object") {
287
+ url = url.replace(
288
+ match,
289
+ serializeObjectParam({
290
+ explode,
291
+ name,
292
+ style,
293
+ value,
294
+ valueOnly: true
295
+ })
296
+ );
297
+ continue;
298
+ }
299
+ if (style === "matrix") {
300
+ url = url.replace(
301
+ match,
302
+ `;${serializePrimitiveParam({
303
+ name,
304
+ value
305
+ })}`
306
+ );
307
+ continue;
308
+ }
309
+ const replaceValue = encodeURIComponent(
310
+ style === "label" ? `.${value}` : value
311
+ );
312
+ url = url.replace(match, replaceValue);
313
+ }
314
+ }
315
+ return url;
316
+ };
317
+ var getUrl = ({
318
+ baseUrl,
319
+ path,
320
+ query,
321
+ querySerializer,
322
+ url: _url
323
+ }) => {
324
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
325
+ let url = (baseUrl ?? "") + pathUrl;
326
+ if (path) {
327
+ url = defaultPathSerializer({ path, url });
328
+ }
329
+ let search = query ? querySerializer(query) : "";
330
+ if (search.startsWith("?")) {
331
+ search = search.substring(1);
332
+ }
333
+ if (search) {
334
+ url += `?${search}`;
335
+ }
336
+ return url;
337
+ };
338
+ function getValidRequestBody(options) {
339
+ const hasBody = options.body !== void 0;
340
+ const isSerializedBody = hasBody && options.bodySerializer;
341
+ if (isSerializedBody) {
342
+ if ("serializedBody" in options) {
343
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
344
+ return hasSerializedBody ? options.serializedBody : null;
345
+ }
346
+ return options.body !== "" ? options.body : null;
347
+ }
348
+ if (hasBody) {
349
+ return options.body;
350
+ }
351
+ return void 0;
352
+ }
353
+
354
+ // generated/storage/core/auth.gen.ts
355
+ var getAuthToken = async (auth, callback) => {
356
+ const token = typeof callback === "function" ? await callback(auth) : callback;
357
+ if (!token) {
358
+ return;
359
+ }
360
+ if (auth.scheme === "bearer") {
361
+ return `Bearer ${token}`;
362
+ }
363
+ if (auth.scheme === "basic") {
364
+ return `Basic ${btoa(token)}`;
365
+ }
366
+ return token;
367
+ };
368
+
369
+ // generated/storage/client/utils.gen.ts
370
+ var createQuerySerializer = ({
371
+ parameters = {},
372
+ ...args
373
+ } = {}) => {
374
+ const querySerializer = (queryParams) => {
375
+ const search = [];
376
+ if (queryParams && typeof queryParams === "object") {
377
+ for (const name in queryParams) {
378
+ const value = queryParams[name];
379
+ if (value === void 0 || value === null) {
380
+ continue;
381
+ }
382
+ const options = parameters[name] || args;
383
+ if (Array.isArray(value)) {
384
+ const serializedArray = serializeArrayParam({
385
+ allowReserved: options.allowReserved,
386
+ explode: true,
387
+ name,
388
+ style: "form",
389
+ value,
390
+ ...options.array
391
+ });
392
+ if (serializedArray) search.push(serializedArray);
393
+ } else if (typeof value === "object") {
394
+ const serializedObject = serializeObjectParam({
395
+ allowReserved: options.allowReserved,
396
+ explode: true,
397
+ name,
398
+ style: "deepObject",
399
+ value,
400
+ ...options.object
401
+ });
402
+ if (serializedObject) search.push(serializedObject);
403
+ } else {
404
+ const serializedPrimitive = serializePrimitiveParam({
405
+ allowReserved: options.allowReserved,
406
+ name,
407
+ value
408
+ });
409
+ if (serializedPrimitive) search.push(serializedPrimitive);
410
+ }
411
+ }
412
+ }
413
+ return search.join("&");
414
+ };
415
+ return querySerializer;
416
+ };
417
+ var getParseAs = (contentType) => {
418
+ if (!contentType) {
419
+ return "stream";
420
+ }
421
+ const cleanContent = contentType.split(";")[0]?.trim();
422
+ if (!cleanContent) {
423
+ return;
424
+ }
425
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
426
+ return "json";
427
+ }
428
+ if (cleanContent === "multipart/form-data") {
429
+ return "formData";
430
+ }
431
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
432
+ return "blob";
433
+ }
434
+ if (cleanContent.startsWith("text/")) {
435
+ return "text";
436
+ }
437
+ return;
438
+ };
439
+ var checkForExistence = (options, name) => {
440
+ if (!name) {
441
+ return false;
442
+ }
443
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
444
+ return true;
445
+ }
446
+ return false;
447
+ };
448
+ async function setAuthParams(options) {
449
+ for (const auth of options.security ?? []) {
450
+ if (checkForExistence(options, auth.name)) {
451
+ continue;
452
+ }
453
+ const token = await getAuthToken(auth, options.auth);
454
+ if (!token) {
455
+ continue;
456
+ }
457
+ const name = auth.name ?? "Authorization";
458
+ switch (auth.in) {
459
+ case "query":
460
+ if (!options.query) {
461
+ options.query = {};
462
+ }
463
+ options.query[name] = token;
464
+ break;
465
+ case "cookie":
466
+ options.headers.append("Cookie", `${name}=${token}`);
467
+ break;
468
+ case "header":
469
+ default:
470
+ options.headers.set(name, token);
471
+ break;
472
+ }
473
+ }
474
+ }
475
+ var buildUrl = (options) => getUrl({
476
+ baseUrl: options.baseUrl,
477
+ path: options.path,
478
+ query: options.query,
479
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
480
+ url: options.url
481
+ });
482
+ var mergeConfigs = (a, b) => {
483
+ const config = { ...a, ...b };
484
+ if (config.baseUrl?.endsWith("/")) {
485
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
486
+ }
487
+ config.headers = mergeHeaders(a.headers, b.headers);
488
+ return config;
489
+ };
490
+ var headersEntries = (headers) => {
491
+ const entries = [];
492
+ headers.forEach((value, key) => {
493
+ entries.push([key, value]);
494
+ });
495
+ return entries;
496
+ };
497
+ var mergeHeaders = (...headers) => {
498
+ const mergedHeaders = new Headers();
499
+ for (const header of headers) {
500
+ if (!header) {
501
+ continue;
502
+ }
503
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
504
+ for (const [key, value] of iterator) {
505
+ if (value === null) {
506
+ mergedHeaders.delete(key);
507
+ } else if (Array.isArray(value)) {
508
+ for (const v of value) {
509
+ mergedHeaders.append(key, v);
510
+ }
511
+ } else if (value !== void 0) {
512
+ mergedHeaders.set(
513
+ key,
514
+ typeof value === "object" ? JSON.stringify(value) : value
515
+ );
516
+ }
517
+ }
518
+ }
519
+ return mergedHeaders;
520
+ };
521
+ var Interceptors = class {
522
+ fns = [];
523
+ clear() {
524
+ this.fns = [];
525
+ }
526
+ eject(id) {
527
+ const index = this.getInterceptorIndex(id);
528
+ if (this.fns[index]) {
529
+ this.fns[index] = null;
530
+ }
531
+ }
532
+ exists(id) {
533
+ const index = this.getInterceptorIndex(id);
534
+ return Boolean(this.fns[index]);
535
+ }
536
+ getInterceptorIndex(id) {
537
+ if (typeof id === "number") {
538
+ return this.fns[id] ? id : -1;
539
+ }
540
+ return this.fns.indexOf(id);
541
+ }
542
+ update(id, fn) {
543
+ const index = this.getInterceptorIndex(id);
544
+ if (this.fns[index]) {
545
+ this.fns[index] = fn;
546
+ return id;
547
+ }
548
+ return false;
549
+ }
550
+ use(fn) {
551
+ this.fns.push(fn);
552
+ return this.fns.length - 1;
553
+ }
554
+ };
555
+ var createInterceptors = () => ({
556
+ error: new Interceptors(),
557
+ request: new Interceptors(),
558
+ response: new Interceptors()
559
+ });
560
+ var defaultQuerySerializer = createQuerySerializer({
561
+ allowReserved: false,
562
+ array: {
563
+ explode: true,
564
+ style: "form"
565
+ },
566
+ object: {
567
+ explode: true,
568
+ style: "deepObject"
569
+ }
570
+ });
571
+ var defaultHeaders = {
572
+ "Content-Type": "application/json"
573
+ };
574
+ var createConfig = (override = {}) => ({
575
+ ...jsonBodySerializer,
576
+ headers: defaultHeaders,
577
+ parseAs: "auto",
578
+ querySerializer: defaultQuerySerializer,
579
+ ...override
580
+ });
581
+
582
+ // generated/storage/client/client.gen.ts
583
+ var createClient = (config = {}) => {
584
+ let _config = mergeConfigs(createConfig(), config);
585
+ const getConfig = () => ({ ..._config });
586
+ const setConfig = (config2) => {
587
+ _config = mergeConfigs(_config, config2);
588
+ return getConfig();
589
+ };
590
+ const interceptors = createInterceptors();
591
+ const beforeRequest = async (options) => {
592
+ const opts = {
593
+ ..._config,
594
+ ...options,
595
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
596
+ headers: mergeHeaders(_config.headers, options.headers),
597
+ serializedBody: void 0
598
+ };
599
+ if (opts.security) {
600
+ await setAuthParams(opts);
601
+ }
602
+ if (opts.requestValidator) {
603
+ await opts.requestValidator(opts);
604
+ }
605
+ if (opts.body !== void 0 && opts.bodySerializer) {
606
+ opts.serializedBody = opts.bodySerializer(opts.body);
607
+ }
608
+ if (opts.body === void 0 || opts.serializedBody === "") {
609
+ opts.headers.delete("Content-Type");
610
+ }
611
+ const resolvedOpts = opts;
612
+ const url = buildUrl(resolvedOpts);
613
+ return { opts: resolvedOpts, url };
614
+ };
615
+ const request = async (options) => {
616
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
617
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
618
+ let request2;
619
+ let response;
620
+ try {
621
+ const { opts, url } = await beforeRequest(options);
622
+ const requestInit = {
623
+ redirect: "follow",
624
+ ...opts,
625
+ body: getValidRequestBody(opts)
626
+ };
627
+ request2 = new Request(url, requestInit);
628
+ for (const fn of interceptors.request.fns) {
629
+ if (fn) {
630
+ request2 = await fn(request2, opts);
631
+ }
632
+ }
633
+ const _fetch = opts.fetch;
634
+ response = await _fetch(request2);
635
+ for (const fn of interceptors.response.fns) {
636
+ if (fn) {
637
+ response = await fn(response, request2, opts);
638
+ }
639
+ }
640
+ const result = {
641
+ request: request2,
642
+ response
643
+ };
644
+ if (response.ok) {
645
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
646
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
647
+ let emptyData;
648
+ switch (parseAs) {
649
+ case "arrayBuffer":
650
+ case "blob":
651
+ case "text":
652
+ emptyData = await response[parseAs]();
653
+ break;
654
+ case "formData":
655
+ emptyData = new FormData();
656
+ break;
657
+ case "stream":
658
+ emptyData = response.body;
659
+ break;
660
+ case "json":
661
+ default:
662
+ emptyData = {};
663
+ break;
664
+ }
665
+ return opts.responseStyle === "data" ? emptyData : {
666
+ data: emptyData,
667
+ ...result
668
+ };
669
+ }
670
+ let data;
671
+ switch (parseAs) {
672
+ case "arrayBuffer":
673
+ case "blob":
674
+ case "formData":
675
+ case "text":
676
+ data = await response[parseAs]();
677
+ break;
678
+ case "json": {
679
+ const text = await response.text();
680
+ data = text ? JSON.parse(text) : {};
681
+ break;
682
+ }
683
+ case "stream":
684
+ return opts.responseStyle === "data" ? response.body : {
685
+ data: response.body,
686
+ ...result
687
+ };
688
+ }
689
+ if (parseAs === "json") {
690
+ if (opts.responseValidator) {
691
+ await opts.responseValidator(data);
692
+ }
693
+ if (opts.responseTransformer) {
694
+ data = await opts.responseTransformer(data);
695
+ }
696
+ }
697
+ return opts.responseStyle === "data" ? data : {
698
+ data,
699
+ ...result
700
+ };
701
+ }
702
+ const textError = await response.text();
703
+ let jsonError;
704
+ try {
705
+ jsonError = JSON.parse(textError);
706
+ } catch {
707
+ }
708
+ throw jsonError ?? textError;
709
+ } catch (error) {
710
+ let finalError = error;
711
+ for (const fn of interceptors.error.fns) {
712
+ if (fn) {
713
+ finalError = await fn(finalError, response, request2, options);
714
+ }
715
+ }
716
+ finalError = finalError || {};
717
+ if (throwOnError) {
718
+ throw finalError;
719
+ }
720
+ return responseStyle === "data" ? void 0 : {
721
+ error: finalError,
722
+ request: request2,
723
+ response
724
+ };
725
+ }
726
+ };
727
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
728
+ const makeSseFn = (method) => async (options) => {
729
+ const { opts, url } = await beforeRequest(options);
730
+ return createSseClient({
731
+ ...opts,
732
+ body: opts.body,
733
+ method,
734
+ onRequest: async (url2, init) => {
735
+ let request2 = new Request(url2, init);
736
+ for (const fn of interceptors.request.fns) {
737
+ if (fn) {
738
+ request2 = await fn(request2, opts);
739
+ }
740
+ }
741
+ return request2;
742
+ },
743
+ serializedBody: getValidRequestBody(opts),
744
+ url
745
+ });
746
+ };
747
+ const _buildUrl = (options) => buildUrl({ ..._config, ...options });
748
+ return {
749
+ buildUrl: _buildUrl,
750
+ connect: makeMethodFn("CONNECT"),
751
+ delete: makeMethodFn("DELETE"),
752
+ get: makeMethodFn("GET"),
753
+ getConfig,
754
+ head: makeMethodFn("HEAD"),
755
+ interceptors,
756
+ options: makeMethodFn("OPTIONS"),
757
+ patch: makeMethodFn("PATCH"),
758
+ post: makeMethodFn("POST"),
759
+ put: makeMethodFn("PUT"),
760
+ request,
761
+ setConfig,
762
+ sse: {
763
+ connect: makeSseFn("CONNECT"),
764
+ delete: makeSseFn("DELETE"),
765
+ get: makeSseFn("GET"),
766
+ head: makeSseFn("HEAD"),
767
+ options: makeSseFn("OPTIONS"),
768
+ patch: makeSseFn("PATCH"),
769
+ post: makeSseFn("POST"),
770
+ put: makeSseFn("PUT"),
771
+ trace: makeSseFn("TRACE")
772
+ },
773
+ trace: makeMethodFn("TRACE")
774
+ };
775
+ };
776
+
777
+ // generated/storage/client.gen.ts
778
+ var client = createClient(createConfig());
779
+
780
+ // generated/storage/sdk.gen.ts
781
+ var HeyApiClient = class {
782
+ client;
783
+ constructor(args) {
784
+ this.client = args?.client ?? client;
785
+ }
786
+ };
787
+ var HeyApiRegistry = class {
788
+ defaultKey = "default";
789
+ instances = /* @__PURE__ */ new Map();
790
+ get(key) {
791
+ const instance = this.instances.get(key ?? this.defaultKey);
792
+ if (!instance) {
793
+ throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`);
794
+ }
795
+ return instance;
796
+ }
797
+ set(value, key) {
798
+ this.instances.set(key ?? this.defaultKey, value);
799
+ }
800
+ };
801
+ var Sdk = class _Sdk extends HeyApiClient {
802
+ static __registry = new HeyApiRegistry();
803
+ constructor(args) {
804
+ super(args);
805
+ _Sdk.__registry.set(this, args?.key);
806
+ }
807
+ /**
808
+ * Deletes a single unthreaded anchor for a document
809
+ * If you need to delete a threaded anchor, see the delete comment handler
810
+ */
811
+ deleteAnchor(options) {
812
+ return (options.client ?? this.client).delete({
813
+ url: "/annotations/anchors",
814
+ ...options,
815
+ headers: {
816
+ "Content-Type": "application/json",
817
+ ...options.headers
818
+ }
819
+ });
820
+ }
821
+ /**
822
+ * Edits a single anchor for a document
823
+ */
824
+ editAnchor(options) {
825
+ return (options.client ?? this.client).patch({
826
+ url: "/annotations/anchors",
827
+ ...options,
828
+ headers: {
829
+ "Content-Type": "application/json",
830
+ ...options.headers
831
+ }
832
+ });
833
+ }
834
+ /**
835
+ * Gets a set of comment anchors for a document
836
+ */
837
+ getDocumentAnchors(options) {
838
+ return (options.client ?? this.client).get({ url: "/annotations/anchors/document/{document_id}", ...options });
839
+ }
840
+ /**
841
+ * Creates an unthreaded anchor for a document
842
+ * If you need to create a threaded anchor, see the create comment handler
843
+ */
844
+ createAnchor(options) {
845
+ return (options.client ?? this.client).post({
846
+ url: "/annotations/anchors/document/{document_id}",
847
+ ...options,
848
+ headers: {
849
+ "Content-Type": "application/json",
850
+ ...options.headers
851
+ }
852
+ });
853
+ }
854
+ /**
855
+ * Deletes a single comment for a document
856
+ */
857
+ deleteComment(options) {
858
+ return (options.client ?? this.client).delete({
859
+ url: "/annotations/comments/comment/{comment_id}",
860
+ ...options,
861
+ headers: {
862
+ "Content-Type": "application/json",
863
+ ...options.headers
864
+ }
865
+ });
866
+ }
867
+ /**
868
+ * Edits a single comment for a document
869
+ */
870
+ editComment(options) {
871
+ return (options.client ?? this.client).patch({
872
+ url: "/annotations/comments/comment/{comment_id}",
873
+ ...options,
874
+ headers: {
875
+ "Content-Type": "application/json",
876
+ ...options.headers
877
+ }
878
+ });
879
+ }
880
+ /**
881
+ * Gets a set of comment threads for a document
882
+ */
883
+ getDocumentComments(options) {
884
+ return (options.client ?? this.client).get({ url: "/annotations/comments/document/{document_id}", ...options });
885
+ }
886
+ /**
887
+ * Creates a single comment for a document
888
+ * Optionally creates a new thread/anchor if one does not exist
889
+ */
890
+ createComment(options) {
891
+ return (options.client ?? this.client).post({
892
+ url: "/annotations/comments/document/{document_id}",
893
+ ...options,
894
+ headers: {
895
+ "Content-Type": "application/json",
896
+ ...options.headers
897
+ }
898
+ });
899
+ }
900
+ /**
901
+ * Handler for `GET /bots/me`.
902
+ */
903
+ getSelfBot(options) {
904
+ return (options?.client ?? this.client).get({ url: "/bots/me", ...options });
905
+ }
906
+ /**
907
+ * Handler for `GET /bots/{bot_id}/channels`.
908
+ */
909
+ listBotChannels(options) {
910
+ return (options.client ?? this.client).get({ url: "/bots/{bot_id}/channels", ...options });
911
+ }
912
+ /**
913
+ * Handler for `DELETE /bots/{bot_id}/channels/{channel_id}`.
914
+ */
915
+ removeBotFromChannelByBot(options) {
916
+ return (options.client ?? this.client).delete({ url: "/bots/{bot_id}/channels/{channel_id}", ...options });
917
+ }
918
+ /**
919
+ * Return calendar occurrences visible to the authenticated requester.
920
+ */
921
+ listOccurrences(options) {
922
+ return (options.client ?? this.client).get({ url: "/calendar-events", ...options });
923
+ }
924
+ /**
925
+ * Resolve mentioned calendar events to the requester's own projections.
926
+ */
927
+ mentionPreviews(options) {
928
+ return (options.client ?? this.client).post({
929
+ url: "/calendar-events/preview",
930
+ ...options,
931
+ headers: {
932
+ "Content-Type": "application/json",
933
+ ...options.headers
934
+ }
935
+ });
936
+ }
937
+ /**
938
+ * Handler for `GET /call/active`.
939
+ *
940
+ * Lists all active calls in channels the caller is an active member of,
941
+ * newest first. Calls with no active participants (orphaned by dropped RTC
942
+ * webhooks) are excluded.
943
+ */
944
+ getActiveCalls(options) {
945
+ return (options?.client ?? this.client).get({ url: "/call/active", ...options });
946
+ }
947
+ /**
948
+ * Handler for `POST /call/record/preview`.
949
+ *
950
+ * Batch-fetches lightweight previews for a list of call ids. Mirrors the
951
+ * `POST /documents/preview` endpoint: no per-id access checks, duplicate
952
+ * ids are deduplicated server-side, and missing ids come back as
953
+ * `CallRecordPreview::DoesNotExist` rather than producing an error.
954
+ */
955
+ getBatchCallRecordPreview(options) {
956
+ return (options.client ?? this.client).post({
957
+ url: "/call/record/preview",
958
+ ...options,
959
+ headers: {
960
+ "Content-Type": "application/json",
961
+ ...options.headers
962
+ }
963
+ });
964
+ }
965
+ /**
966
+ * Handler for `DELETE /call/record/{call_id}`.
967
+ *
968
+ * Deletes a call record (and its participants/transcripts via cascade).
969
+ * Access is validated via channel membership (MemberParticipantRole).
970
+ */
971
+ deleteCallRecord(options) {
972
+ return (options.client ?? this.client).delete({ url: "/call/record/{call_id}", ...options });
973
+ }
974
+ /**
975
+ * Handler for `GET /call/record/{call_id}`.
976
+ *
977
+ * Returns the full [`CallRecord`] (metadata + participants + transcript)
978
+ * for a call identified by its own id. Covers both active and archived calls.
979
+ * Access is validated via channel membership (MemberParticipantRole).
980
+ */
981
+ getCallRecord(options) {
982
+ return (options.client ?? this.client).get({ url: "/call/record/{call_id}", ...options });
983
+ }
984
+ /**
985
+ * Handler for `PATCH /call/record/{call_id}`.
986
+ *
987
+ * Edits a call record — currently supports updating the record's share
988
+ * permissions. Access is validated via channel membership
989
+ */
990
+ editCallRecord(options) {
991
+ return (options.client ?? this.client).patch({
992
+ url: "/call/record/{call_id}",
993
+ ...options,
994
+ headers: {
995
+ "Content-Type": "application/json",
996
+ ...options.headers
997
+ }
998
+ });
999
+ }
1000
+ /**
1001
+ * Handler for `POST /call/record/{call_id}/share-with-team/toggle`.
1002
+ *
1003
+ * Toggles the `share_with_team` flag on the active call. Returns the new
1004
+ * value as the JSON body.
1005
+ */
1006
+ toggleShareWithTeam(options) {
1007
+ return (options.client ?? this.client).post({ url: "/call/record/{call_id}/share-with-team/toggle", ...options });
1008
+ }
1009
+ /**
1010
+ * Handler for `PATCH /call/record/{call_id}/transcript`.
1011
+ *
1012
+ * Applies per-diarized-speaker `custom_speaker` overrides to the call's
1013
+ * archived transcript rows. Auth uses the same `EditAccessLevel` extractor
1014
+ * as `edit_call_record_handler`.
1015
+ */
1016
+ editCallTranscript(options) {
1017
+ return (options.client ?? this.client).patch({
1018
+ url: "/call/record/{call_id}/transcript",
1019
+ ...options,
1020
+ headers: {
1021
+ "Content-Type": "application/json",
1022
+ ...options.headers
1023
+ }
1024
+ });
1025
+ }
1026
+ /**
1027
+ * Handler for `GET /call/ring-status/{call_id}`.
1028
+ *
1029
+ * Reports whether the authenticated user should keep ringing for the call.
1030
+ * Polled by native clients while the CallKit incoming-call UI is showing, so
1031
+ * a ring can be cancelled when the user answers on another device
1032
+ * (`answered`) or the call ends before anyone answers (`ended`).
1033
+ *
1034
+ * Outside the user-auth layer: the bearer credential is the recipient's
1035
+ * LiveKit JWT from the VoIP push payload, verified with the LiveKit secret.
1036
+ */
1037
+ getRingStatus(options) {
1038
+ return (options.client ?? this.client).get({ url: "/call/ring-status/{call_id}", ...options });
1039
+ }
1040
+ /**
1041
+ * Handler for `POST /call/webhook`.
1042
+ *
1043
+ * Receives webhook events from the RTC provider (e.g. LiveKit).
1044
+ * The `Authorization` header contains the webhook auth token
1045
+ * and the body contains the raw event payload.
1046
+ */
1047
+ callWebhook(options) {
1048
+ return (options?.client ?? this.client).post({ url: "/call/webhook", ...options });
1049
+ }
1050
+ /**
1051
+ * Handler for `DELETE /call/{channel_id}`.
1052
+ */
1053
+ leaveOrEndCall(options) {
1054
+ return (options.client ?? this.client).delete({ url: "/call/{channel_id}", ...options });
1055
+ }
1056
+ /**
1057
+ * Handler for `GET /call/{channel_id}`.
1058
+ *
1059
+ * Gets or creates a call for the channel. If a call already exists, joins it;
1060
+ * otherwise creates a new one. Always returns a join token.
1061
+ */
1062
+ getOrCreateCall(options) {
1063
+ return (options.client ?? this.client).get({ url: "/call/{channel_id}", ...options });
1064
+ }
1065
+ /**
1066
+ * Handler for `GET /call/{channel_id}/active`.
1067
+ *
1068
+ * Returns 200 with call info if an active call exists, or 204 No Content if not.
1069
+ */
1070
+ checkActiveCall(options) {
1071
+ return (options.client ?? this.client).get({ url: "/call/{channel_id}/active", ...options });
1072
+ }
1073
+ /**
1074
+ * Handler for `POST /call/{channel_id}/transcript`.
1075
+ *
1076
+ * Receives transcript segments from the transcription agent.
1077
+ * Authenticated via the `x-macro-internal-call` shared secret.
1078
+ * Duplicate segments (same `segment_id`) are ignored.
1079
+ */
1080
+ ingestTranscript(options) {
1081
+ return (options.client ?? this.client).post({
1082
+ url: "/call/{channel_id}/transcript",
1083
+ ...options,
1084
+ headers: {
1085
+ "Content-Type": "application/json",
1086
+ ...options.headers
1087
+ }
1088
+ });
1089
+ }
1090
+ /**
1091
+ * Handler for `POST /channels`.
1092
+ */
1093
+ createChannel(options) {
1094
+ return (options.client ?? this.client).post({
1095
+ url: "/channels",
1096
+ ...options,
1097
+ headers: {
1098
+ "Content-Type": "application/json",
1099
+ ...options.headers
1100
+ }
1101
+ });
1102
+ }
1103
+ /**
1104
+ * Handler for `GET /channels/activity`.
1105
+ */
1106
+ getActivity(options) {
1107
+ return (options?.client ?? this.client).get({ url: "/channels/activity", ...options });
1108
+ }
1109
+ /**
1110
+ * Handler for `POST /channels/activity`.
1111
+ */
1112
+ postActivity(options) {
1113
+ return (options.client ?? this.client).post({
1114
+ url: "/channels/activity",
1115
+ ...options,
1116
+ headers: {
1117
+ "Content-Type": "application/json",
1118
+ ...options.headers
1119
+ }
1120
+ });
1121
+ }
1122
+ /**
1123
+ * Handler for `GET /channels/attachments/{entity_type}/{entity_id}/references`.
1124
+ */
1125
+ getAttachmentReferences(options) {
1126
+ return (options.client ?? this.client).get({ url: "/channels/attachments/{entity_type}/{entity_id}/references", ...options });
1127
+ }
1128
+ /**
1129
+ * Handler for `POST /channels/get_or_create_dm`.
1130
+ */
1131
+ getOrCreateDm(options) {
1132
+ return (options.client ?? this.client).post({
1133
+ url: "/channels/get_or_create_dm",
1134
+ ...options,
1135
+ headers: {
1136
+ "Content-Type": "application/json",
1137
+ ...options.headers
1138
+ }
1139
+ });
1140
+ }
1141
+ /**
1142
+ * Handler for `POST /channels/get_or_create_private`.
1143
+ */
1144
+ getOrCreatePrivate(options) {
1145
+ return (options.client ?? this.client).post({
1146
+ url: "/channels/get_or_create_private",
1147
+ ...options,
1148
+ headers: {
1149
+ "Content-Type": "application/json",
1150
+ ...options.headers
1151
+ }
1152
+ });
1153
+ }
1154
+ /**
1155
+ * Handler for `POST /channels/join/{join_code}`.
1156
+ */
1157
+ joinChannelByCode(options) {
1158
+ return (options.client ?? this.client).post({ url: "/channels/join/{join_code}", ...options });
1159
+ }
1160
+ /**
1161
+ * Handler for `POST /channels/mentions`.
1162
+ */
1163
+ createEntityMention(options) {
1164
+ return (options.client ?? this.client).post({
1165
+ url: "/channels/mentions",
1166
+ ...options,
1167
+ headers: {
1168
+ "Content-Type": "application/json",
1169
+ ...options.headers
1170
+ }
1171
+ });
1172
+ }
1173
+ /**
1174
+ * Handler for `DELETE /channels/mentions/{mention_id}`.
1175
+ */
1176
+ deleteEntityMention(options) {
1177
+ return (options.client ?? this.client).delete({ url: "/channels/mentions/{mention_id}", ...options });
1178
+ }
1179
+ /**
1180
+ * Handler for `POST /channels/preview`.
1181
+ */
1182
+ getBatchChannelPreview(options) {
1183
+ return (options.client ?? this.client).post({
1184
+ url: "/channels/preview",
1185
+ ...options,
1186
+ headers: {
1187
+ "Content-Type": "application/json",
1188
+ ...options.headers
1189
+ }
1190
+ });
1191
+ }
1192
+ /**
1193
+ * Handler for `DELETE /channels/{channel_id}`.
1194
+ */
1195
+ deleteChannel(options) {
1196
+ return (options.client ?? this.client).delete({ url: "/channels/{channel_id}", ...options });
1197
+ }
1198
+ /**
1199
+ * Handler for `GET /channels/{channel_id}`.
1200
+ */
1201
+ getChannel(options) {
1202
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}", ...options });
1203
+ }
1204
+ /**
1205
+ * Handler for `PATCH /channels/{channel_id}`.
1206
+ */
1207
+ patchChannel(options) {
1208
+ return (options.client ?? this.client).patch({
1209
+ url: "/channels/{channel_id}",
1210
+ ...options,
1211
+ headers: {
1212
+ "Content-Type": "application/json",
1213
+ ...options.headers
1214
+ }
1215
+ });
1216
+ }
1217
+ /**
1218
+ * Handler for `GET /channels/{channel_id}/attachments`.
1219
+ */
1220
+ getChannelAttachments(options) {
1221
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/attachments", ...options });
1222
+ }
1223
+ /**
1224
+ * Handler for `POST /channels/{channel_id}/bots/scoped`.
1225
+ */
1226
+ createChannelScopedBot(options) {
1227
+ return (options.client ?? this.client).post({
1228
+ url: "/channels/{channel_id}/bots/scoped",
1229
+ ...options,
1230
+ headers: {
1231
+ "Content-Type": "application/json",
1232
+ ...options.headers
1233
+ }
1234
+ });
1235
+ }
1236
+ /**
1237
+ * Handler for `POST /channels/{channel_id}/join`.
1238
+ */
1239
+ joinChannel(options) {
1240
+ return (options.client ?? this.client).post({ url: "/channels/{channel_id}/join", ...options });
1241
+ }
1242
+ /**
1243
+ * Handler for `GET /channels/{channel_id}/join-link`.
1244
+ */
1245
+ getChannelJoinLink(options) {
1246
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/join-link", ...options });
1247
+ }
1248
+ /**
1249
+ * Handler for `POST /channels/{channel_id}/leave`.
1250
+ */
1251
+ leaveChannel(options) {
1252
+ return (options.client ?? this.client).post({ url: "/channels/{channel_id}/leave", ...options });
1253
+ }
1254
+ /**
1255
+ * Handler for `POST /channels/{channel_id}/message`.
1256
+ */
1257
+ postMessage(options) {
1258
+ return (options.client ?? this.client).post({
1259
+ url: "/channels/{channel_id}/message",
1260
+ ...options,
1261
+ headers: {
1262
+ "Content-Type": "application/json",
1263
+ ...options.headers
1264
+ }
1265
+ });
1266
+ }
1267
+ /**
1268
+ * Handler for `DELETE /channels/{channel_id}/message/{message_id}`.
1269
+ */
1270
+ deleteMessage(options) {
1271
+ return (options.client ?? this.client).delete({ url: "/channels/{channel_id}/message/{message_id}", ...options });
1272
+ }
1273
+ /**
1274
+ * Handler for `PATCH /channels/{channel_id}/message/{message_id}`.
1275
+ */
1276
+ patchMessage(options) {
1277
+ return (options.client ?? this.client).patch({
1278
+ url: "/channels/{channel_id}/message/{message_id}",
1279
+ ...options,
1280
+ headers: {
1281
+ "Content-Type": "application/json",
1282
+ ...options.headers
1283
+ }
1284
+ });
1285
+ }
1286
+ /**
1287
+ * Handler for `GET /channels/{channel_id}/messages`.
1288
+ */
1289
+ getChannelMessages(options) {
1290
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/messages", ...options });
1291
+ }
1292
+ /**
1293
+ * Handler for `POST /channels/{channel_id}/messages`.
1294
+ */
1295
+ postChannelMessages(options) {
1296
+ return (options.client ?? this.client).post({
1297
+ url: "/channels/{channel_id}/messages",
1298
+ ...options,
1299
+ headers: {
1300
+ "Content-Type": "application/json",
1301
+ ...options.headers
1302
+ }
1303
+ });
1304
+ }
1305
+ /**
1306
+ * Handler for `GET /channels/{channel_id}/messages/{message_id}/context`.
1307
+ */
1308
+ getMessageWithContext(options) {
1309
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/messages/{message_id}/context", ...options });
1310
+ }
1311
+ /**
1312
+ * Handler for `GET /channels/{channel_id}/messages/{message_id}/replies`.
1313
+ */
1314
+ getThreadReplies(options) {
1315
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/messages/{message_id}/replies", ...options });
1316
+ }
1317
+ /**
1318
+ * Handler for `GET /channels/{channel_id}/messages/{message_id}/resolve`.
1319
+ */
1320
+ resolveChannelMessage(options) {
1321
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/messages/{message_id}/resolve", ...options });
1322
+ }
1323
+ /**
1324
+ * Handler for `DELETE /channels/{channel_id}/participants`.
1325
+ */
1326
+ removeParticipants(options) {
1327
+ return (options.client ?? this.client).delete({
1328
+ url: "/channels/{channel_id}/participants",
1329
+ ...options,
1330
+ headers: {
1331
+ "Content-Type": "application/json",
1332
+ ...options.headers
1333
+ }
1334
+ });
1335
+ }
1336
+ /**
1337
+ * Handler for `GET /channels/{channel_id}/participants`.
1338
+ */
1339
+ getChannelParticipants(options) {
1340
+ return (options.client ?? this.client).get({ url: "/channels/{channel_id}/participants", ...options });
1341
+ }
1342
+ /**
1343
+ * Handler for `POST /channels/{channel_id}/participants`.
1344
+ */
1345
+ addParticipants(options) {
1346
+ return (options.client ?? this.client).post({
1347
+ url: "/channels/{channel_id}/participants",
1348
+ ...options,
1349
+ headers: {
1350
+ "Content-Type": "application/json",
1351
+ ...options.headers
1352
+ }
1353
+ });
1354
+ }
1355
+ /**
1356
+ * Handler for `POST /channels/{channel_id}/reaction`.
1357
+ */
1358
+ postReaction(options) {
1359
+ return (options.client ?? this.client).post({
1360
+ url: "/channels/{channel_id}/reaction",
1361
+ ...options,
1362
+ headers: {
1363
+ "Content-Type": "application/json",
1364
+ ...options.headers
1365
+ }
1366
+ });
1367
+ }
1368
+ /**
1369
+ * Handler for `POST /channels/{channel_id}/typing`.
1370
+ */
1371
+ postTyping(options) {
1372
+ return (options.client ?? this.client).post({
1373
+ url: "/channels/{channel_id}/typing",
1374
+ ...options,
1375
+ headers: {
1376
+ "Content-Type": "application/json",
1377
+ ...options.headers
1378
+ }
1379
+ });
1380
+ }
1381
+ /**
1382
+ * Handler for `POST /channels/{channel_id}/webhook`.
1383
+ */
1384
+ postChannelBotWebhook(options) {
1385
+ return (options.client ?? this.client).post({
1386
+ url: "/channels/{channel_id}/webhook",
1387
+ ...options,
1388
+ headers: {
1389
+ "Content-Type": "application/json",
1390
+ ...options.headers
1391
+ }
1392
+ });
1393
+ }
1394
+ /**
1395
+ * Soft-delete a collab surface.
1396
+ */
1397
+ deleteCollabSurface(options) {
1398
+ return (options.client ?? this.client).delete({ url: "/collab_surfaces/{id}", ...options });
1399
+ }
1400
+ /**
1401
+ * Fetch a collab surface.
1402
+ */
1403
+ getCollabSurface(options) {
1404
+ return (options.client ?? this.client).get({ url: "/collab_surfaces/{id}", ...options });
1405
+ }
1406
+ /**
1407
+ * Idempotently ensure a collab surface exists (load-or-create).
1408
+ *
1409
+ * The id is caller-supplied, so an embedding surface can hold a stable id
1410
+ * and blindly ensure it on mount: the first ensure creates and initializes
1411
+ * the session, every later one (including concurrent ones) returns the same
1412
+ * surface. A soft-deleted id is `410 Gone` and never comes back.
1413
+ */
1414
+ ensureCollabSurface(options) {
1415
+ return (options.client ?? this.client).put({
1416
+ url: "/collab_surfaces/{id}",
1417
+ ...options,
1418
+ headers: {
1419
+ "Content-Type": "application/json",
1420
+ ...options.headers
1421
+ }
1422
+ });
1423
+ }
1424
+ /**
1425
+ * Mint a sync-service connection token for a surface.
1426
+ */
1427
+ createCollabSurfaceToken(options) {
1428
+ return (options.client ?? this.client).post({ url: "/collab_surfaces/{id}/token", ...options });
1429
+ }
1430
+ /**
1431
+ * Handle channel list requests for `GET /comms/channels`.
1432
+ */
1433
+ getChannels(options) {
1434
+ return (options?.client ?? this.client).get({ url: "/comms/channels", ...options });
1435
+ }
1436
+ /**
1437
+ * Soft-delete a CRM comment, scoped to the requesting user's team. When it
1438
+ * was the thread's last live comment, the thread is soft-deleted too
1439
+ * (reported via `threadDeleted`).
1440
+ */
1441
+ deleteCrmComment(options) {
1442
+ return (options.client ?? this.client).delete({ url: "/crm/comment/{comment_id}", ...options });
1443
+ }
1444
+ /**
1445
+ * Edit a CRM comment's text, scoped to the requesting user's team via the
1446
+ * comment's thread → entity → company. Returns the updated comment.
1447
+ */
1448
+ editCrmComment(options) {
1449
+ return (options.client ?? this.client).patch({
1450
+ url: "/crm/comment/{comment_id}",
1451
+ ...options,
1452
+ headers: {
1453
+ "Content-Type": "application/json",
1454
+ ...options.headers
1455
+ }
1456
+ });
1457
+ }
1458
+ /**
1459
+ * List the comment threads on a CRM company or contact. Access is
1460
+ * enforced by [`EntityPermissionExtractor`] against the path's
1461
+ * `crm_company`/`crm_contact` entity type — hidden parents are
1462
+ * invisible to plain members. An accessible entity with no threads
1463
+ * returns `200 []`.
1464
+ */
1465
+ listCrmComments(options) {
1466
+ return (options.client ?? this.client).get({ url: "/crm/comments/{entity_type}/{entity_id}", ...options });
1467
+ }
1468
+ /**
1469
+ * Create a comment on a CRM company or contact — a new thread, or a reply
1470
+ * when `threadId` is supplied. Returns the full thread (with all comments)
1471
+ * after the insert. Team-scoped; 404 when the entity isn't owned by the
1472
+ * team or `threadId` doesn't belong to it.
1473
+ */
1474
+ createCrmComment(options) {
1475
+ return (options.client ?? this.client).post({
1476
+ url: "/crm/comments/{entity_type}/{entity_id}",
1477
+ ...options,
1478
+ headers: {
1479
+ "Content-Type": "application/json",
1480
+ ...options.headers
1481
+ }
1482
+ });
1483
+ }
1484
+ /**
1485
+ * Manually create a CRM company for the caller's team. Any team member
1486
+ * may create one. The domain must not already be tracked by the team
1487
+ * (409), and the team's CRM killswitch must be on (403). Returns the
1488
+ * created company in the same shape as `GET /crm/companies/{id}` (its
1489
+ * contact list is empty until emails populate it).
1490
+ */
1491
+ createCrmCompany(options) {
1492
+ return (options.client ?? this.client).post({
1493
+ url: "/crm/companies",
1494
+ ...options,
1495
+ headers: {
1496
+ "Content-Type": "application/json",
1497
+ ...options.headers
1498
+ }
1499
+ });
1500
+ }
1501
+ /**
1502
+ * Fetch a single CRM company by id, hydrated with its domains, the
1503
+ * primary domain's directory display metadata (name + description),
1504
+ * and the company's contacts. Access is enforced by
1505
+ * [`CrmCompanyAccessLevelExtractor`]: the user must be on the team
1506
+ * that owns the company, and hidden companies are invisible to plain
1507
+ * members. Admin/owner callers see hidden companies and contacts so
1508
+ * they can render the right unhide UI.
1509
+ */
1510
+ getCompany(options) {
1511
+ return (options.client ?? this.client).get({ url: "/crm/companies/{company_id}", ...options });
1512
+ }
1513
+ /**
1514
+ * List the contacts of a CRM company. Access is enforced by
1515
+ * [`CrmCompanyAccessLevelExtractor`]: the user must be on the team that
1516
+ * owns the company. Hidden companies and hidden contacts are invisible
1517
+ * to plain members; admin/owner callers see hidden rows so they can
1518
+ * render the right unhide UI.
1519
+ */
1520
+ listCompanyContacts(options) {
1521
+ return (options.client ?? this.client).get({ url: "/crm/companies/{company_id}/contacts", ...options });
1522
+ }
1523
+ /**
1524
+ * Manually create a contact under a CRM company. Access is enforced by
1525
+ * [`CrmCompanyAccessLevelExtractor`]: the caller must be on the team
1526
+ * that owns the company (hidden companies are reachable for
1527
+ * admin/owner only, and the new contact then inherits `hidden`). The
1528
+ * email's domain must be one of the company's domains (400), the
1529
+ * company must not already track the email (409), and the team's CRM
1530
+ * killswitch must be on (403).
1531
+ */
1532
+ createCrmContact(options) {
1533
+ return (options.client ?? this.client).post({
1534
+ url: "/crm/companies/{company_id}/contacts",
1535
+ ...options,
1536
+ headers: {
1537
+ "Content-Type": "application/json",
1538
+ ...options.headers
1539
+ }
1540
+ });
1541
+ }
1542
+ /**
1543
+ * Toggle `email_sync` on a CRM company. Purely a visibility flag —
1544
+ * it gates whether team members can see each other's emails with
1545
+ * this company. Existing CRM data is unaffected.
1546
+ */
1547
+ setEmailSync(options) {
1548
+ return (options.client ?? this.client).put({
1549
+ url: "/crm/companies/{company_id}/email-sync",
1550
+ ...options,
1551
+ headers: {
1552
+ "Content-Type": "application/json",
1553
+ ...options.headers
1554
+ }
1555
+ });
1556
+ }
1557
+ /**
1558
+ * Toggle `hidden` on a CRM company. Hiding also disables
1559
+ * `email_sync` and soft-hides every contact under the company.
1560
+ * Un-hide restores contact visibility only; `email_sync` is left
1561
+ * untouched (the team must re-enable it explicitly). Contact rows
1562
+ * and contact sources survive the cycle.
1563
+ */
1564
+ setCompanyHidden(options) {
1565
+ return (options.client ?? this.client).put({
1566
+ url: "/crm/companies/{company_id}/hidden",
1567
+ ...options,
1568
+ headers: {
1569
+ "Content-Type": "application/json",
1570
+ ...options.headers
1571
+ }
1572
+ });
1573
+ }
1574
+ /**
1575
+ * Rename a CRM company. Access is enforced by
1576
+ * [`CrmCompanyAccessLevelExtractor`]: the caller must be on the team
1577
+ * that owns the company (hidden companies are reachable for
1578
+ * admin/owner only). The name is a team-scoped override
1579
+ * (`custom_name`) and never touches the global domain directory.
1580
+ */
1581
+ setCrmCompanyName(options) {
1582
+ return (options.client ?? this.client).put({
1583
+ url: "/crm/companies/{company_id}/name",
1584
+ ...options,
1585
+ headers: {
1586
+ "Content-Type": "application/json",
1587
+ ...options.headers
1588
+ }
1589
+ });
1590
+ }
1591
+ /**
1592
+ * Look up a CRM contact by email in the caller's team. Returns a null
1593
+ * `contact` when no visible contact exists. Any team member may resolve a
1594
+ * visible contact; admin/owner callers may also resolve hidden contacts and
1595
+ * contacts under hidden companies.
1596
+ */
1597
+ getContactByEmail(options) {
1598
+ return (options.client ?? this.client).get({ url: "/crm/contacts/by-email", ...options });
1599
+ }
1600
+ /**
1601
+ * Fetch a single CRM contact by id. Access is enforced by
1602
+ * [`CrmContactAccessLevelExtractor`]: the user must be on the team that
1603
+ * owns the contact's parent company, and hidden contacts are invisible
1604
+ * to plain members. Admin/owner callers see hidden contacts so they can
1605
+ * render the right unhide UI.
1606
+ */
1607
+ getContact(options) {
1608
+ return (options.client ?? this.client).get({ url: "/crm/contacts/{contact_id}", ...options });
1609
+ }
1610
+ /**
1611
+ * Toggle `hidden` on a CRM contact. Hiding is a display-only opt-out
1612
+ * scoped to the team that owns the contact's company.
1613
+ */
1614
+ setContactHidden(options) {
1615
+ return (options.client ?? this.client).put({
1616
+ url: "/crm/contacts/{contact_id}/hidden",
1617
+ ...options,
1618
+ headers: {
1619
+ "Content-Type": "application/json",
1620
+ ...options.headers
1621
+ }
1622
+ });
1623
+ }
1624
+ /**
1625
+ * Rename a CRM contact. Access is enforced by
1626
+ * [`CrmContactAccessLevelExtractor`]: the caller must be on the team
1627
+ * that owns the contact's company (hidden contacts are reachable for
1628
+ * admin/owner only). The name overwrites the team-scoped
1629
+ * `crm_contacts.name` column.
1630
+ */
1631
+ setCrmContactName(options) {
1632
+ return (options.client ?? this.client).put({
1633
+ url: "/crm/contacts/{contact_id}/name",
1634
+ ...options,
1635
+ headers: {
1636
+ "Content-Type": "application/json",
1637
+ ...options.headers
1638
+ }
1639
+ });
1640
+ }
1641
+ /**
1642
+ * Read the caller's team CRM configuration. Any team member may read;
1643
+ * teams without a settings row get the defaults.
1644
+ */
1645
+ getCrmTeamSettings(options) {
1646
+ return (options?.client ?? this.client).get({ url: "/crm/settings", ...options });
1647
+ }
1648
+ /**
1649
+ * Partially update the caller's team CRM configuration. Any team
1650
+ * member may update the views fields (`team_views`,
1651
+ * `default_team_view_id`); the governance fields (permission
1652
+ * thresholds, `closed_stage_ids`) require an admin/owner team role
1653
+ * (403 otherwise). Omitted fields keep their current values;
1654
+ * `team_views` is replaced whole. Returns the resulting settings.
1655
+ */
1656
+ putCrmTeamSettings(options) {
1657
+ return (options.client ?? this.client).put({
1658
+ url: "/crm/settings",
1659
+ ...options,
1660
+ headers: {
1661
+ "Content-Type": "application/json",
1662
+ ...options.headers
1663
+ }
1664
+ });
1665
+ }
1666
+ /**
1667
+ * Gets the users documents to populate their recent document list
1668
+ */
1669
+ getUserDocumentsHandler(options) {
1670
+ return (options.client ?? this.client).get({ url: "/documents", ...options });
1671
+ }
1672
+ /**
1673
+ * Handler for `POST /documents`.
1674
+ *
1675
+ * Creates a new document, generates an S3 presigned upload URL, and returns
1676
+ * the document metadata with the URL for the client to upload to.
1677
+ */
1678
+ createDocument(options) {
1679
+ return (options.client ?? this.client).post({
1680
+ url: "/documents",
1681
+ ...options,
1682
+ headers: {
1683
+ "Content-Type": "application/json",
1684
+ ...options.headers
1685
+ }
1686
+ });
1687
+ }
1688
+ /**
1689
+ * Creates and initializes a markdown document in one backend-owned lifecycle.
1690
+ */
1691
+ createMarkdownHandler(options) {
1692
+ return (options.client ?? this.client).post({
1693
+ url: "/documents/create_markdown",
1694
+ ...options,
1695
+ headers: {
1696
+ "Content-Type": "application/json",
1697
+ ...options.headers
1698
+ }
1699
+ });
1700
+ }
1701
+ /**
1702
+ * Creates a skill document with initialized markdown content in one
1703
+ * backend-owned lifecycle. Skills are markdown documents containing
1704
+ * instructions that AI reads and follows when the skill is referenced in an
1705
+ * AI input.
1706
+ */
1707
+ createSkillHandler(options) {
1708
+ return (options.client ?? this.client).post({
1709
+ url: "/documents/create_skill",
1710
+ ...options,
1711
+ headers: {
1712
+ "Content-Type": "application/json",
1713
+ ...options.headers
1714
+ }
1715
+ });
1716
+ }
1717
+ /**
1718
+ * Creates a snippet document with initialized markdown content in one
1719
+ * backend-owned lifecycle. Snippets are created personal; team sharing is
1720
+ * toggled separately via `PUT /documents/{document_id}/team_share`.
1721
+ */
1722
+ createSnippetHandler(options) {
1723
+ return (options.client ?? this.client).post({
1724
+ url: "/documents/create_snippet",
1725
+ ...options,
1726
+ headers: {
1727
+ "Content-Type": "application/json",
1728
+ ...options.headers
1729
+ }
1730
+ });
1731
+ }
1732
+ /**
1733
+ * Creates a task document with properties and initialized markdown content in
1734
+ * one backend-owned lifecycle.
1735
+ */
1736
+ createTaskHandler(options) {
1737
+ return (options.client ?? this.client).post({
1738
+ url: "/documents/create_task",
1739
+ ...options,
1740
+ headers: {
1741
+ "Content-Type": "application/json",
1742
+ ...options.headers
1743
+ }
1744
+ });
1745
+ }
1746
+ initializeUserDocuments(options) {
1747
+ return (options?.client ?? this.client).post({ url: "/documents/initialize_user_documents", ...options });
1748
+ }
1749
+ /**
1750
+ * Gets a list of all the user's documents so they are able to be searched on
1751
+ */
1752
+ getDocumentListHandler(options) {
1753
+ return (options?.client ?? this.client).get({ url: "/documents/list", ...options });
1754
+ }
1755
+ /**
1756
+ * Validates the provided document permissions token
1757
+ */
1758
+ validateDocumentPermissionsToken(options) {
1759
+ return (options.client ?? this.client).post({
1760
+ url: "/documents/permissions_token/validate",
1761
+ ...options,
1762
+ headers: {
1763
+ "Content-Type": "application/json",
1764
+ ...options.headers
1765
+ }
1766
+ });
1767
+ }
1768
+ /**
1769
+ * Generates a document permissions token for a provided document id
1770
+ */
1771
+ getDocumentPermissionsToken(options) {
1772
+ return (options.client ?? this.client).post({ url: "/documents/permissions_token/{document_id}", ...options });
1773
+ }
1774
+ /**
1775
+ * Takes the docx document bom parts and generates presigned urls to upload
1776
+ * any new content
1777
+ *
1778
+ * @deprecated
1779
+ */
1780
+ presaveDocumentHandler(options) {
1781
+ return (options.client ?? this.client).put({
1782
+ url: "/documents/presave/{document_id}",
1783
+ ...options,
1784
+ headers: {
1785
+ "Content-Type": "application/json",
1786
+ ...options.headers
1787
+ }
1788
+ });
1789
+ }
1790
+ getBatchPreviewHandler(options) {
1791
+ return (options.client ?? this.client).post({
1792
+ url: "/documents/preview",
1793
+ ...options,
1794
+ headers: {
1795
+ "Content-Type": "application/json",
1796
+ ...options.headers
1797
+ }
1798
+ });
1799
+ }
1800
+ /**
1801
+ * Handler for `GET /documents/slug/{slug}`.
1802
+ *
1803
+ * Returns document metadata, user access level, and view location.
1804
+ */
1805
+ getDocumentByTeamSlug(options) {
1806
+ return (options.client ?? this.client).get({ url: "/documents/slug/{slug}", ...options });
1807
+ }
1808
+ /**
1809
+ * Resolves the current user's starter documents.
1810
+ */
1811
+ handler(options) {
1812
+ return (options?.client ?? this.client).get({ url: "/documents/starter_docs", ...options });
1813
+ }
1814
+ /**
1815
+ * Lists the built-in system skills. System skills are static, code-defined
1816
+ * AI instructions (see the `system_skills` crate); they surface in the
1817
+ * skills menu and AI skill tools like user skills, but have no document
1818
+ * behind them, so clients must not offer to open them.
1819
+ */
1820
+ getSystemSkillsHandler(options) {
1821
+ return (options?.client ?? this.client).get({ url: "/documents/system_skills", ...options });
1822
+ }
1823
+ /**
1824
+ * Handler for `DELETE /documents/{document_id}`.
1825
+ *
1826
+ * Soft-deletes a document (only owners can delete).
1827
+ */
1828
+ deleteDocument(options) {
1829
+ return (options.client ?? this.client).delete({ url: "/documents/{document_id}", ...options });
1830
+ }
1831
+ /**
1832
+ * Handler for `GET /documents/{document_id}`.
1833
+ *
1834
+ * Returns document metadata, user access level, and view location.
1835
+ */
1836
+ getDocument(options) {
1837
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}", ...options });
1838
+ }
1839
+ /**
1840
+ * Handler for `PATCH /documents/{document_id}`.
1841
+ *
1842
+ * Edits document metadata such as name or project, and modifies
1843
+ * the document's share permissions. Requires edit access to the document,
1844
+ * and edit access to the target project if moving the document.
1845
+ */
1846
+ editDocument(options) {
1847
+ return (options.client ?? this.client).patch({
1848
+ url: "/documents/{document_id}",
1849
+ ...options,
1850
+ headers: {
1851
+ "Content-Type": "application/json",
1852
+ ...options.headers
1853
+ }
1854
+ });
1855
+ }
1856
+ /**
1857
+ * Creates a new version of a document
1858
+ */
1859
+ saveDocumentHandler(options) {
1860
+ return (options.client ?? this.client).put({
1861
+ url: "/documents/{document_id}",
1862
+ ...options,
1863
+ headers: {
1864
+ "Content-Type": "application/json",
1865
+ ...options.headers
1866
+ }
1867
+ });
1868
+ }
1869
+ /**
1870
+ * Handler for `GET /documents/{document_id}/branch_name`.
1871
+ *
1872
+ * Returns the short UUID and git branch name for a task document.
1873
+ * Returns 400 if the document is not a task.
1874
+ */
1875
+ getDocumentBranchName(options) {
1876
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/branch_name", ...options });
1877
+ }
1878
+ /**
1879
+ * Handler for `POST /documents/{document_id}/copy`.
1880
+ *
1881
+ * Copies an existing document, creating a new document with the same content.
1882
+ * Does not require re-uploading the document file.
1883
+ */
1884
+ copyDocument(options) {
1885
+ return (options.client ?? this.client).post({
1886
+ url: "/documents/{document_id}/copy",
1887
+ ...options,
1888
+ headers: {
1889
+ "Content-Type": "application/json",
1890
+ ...options.headers
1891
+ }
1892
+ });
1893
+ }
1894
+ /**
1895
+ * Generates a presigned url to download the raw content of the document
1896
+ * For files with modification layers, they will not be applied in the downloaded file.
1897
+ */
1898
+ exportDocument(options) {
1899
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/export", ...options });
1900
+ }
1901
+ /**
1902
+ * Handler for `GET /documents/{document_id}/github_prs`.
1903
+ *
1904
+ * Returns GitHub pull requests associated with a task document.
1905
+ * Returns 400 if the document is not a task.
1906
+ */
1907
+ getDocumentGithubPullRequests(options) {
1908
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/github_prs", ...options });
1909
+ }
1910
+ /**
1911
+ * Gets the presigned url(s) for the document. aka location
1912
+ */
1913
+ getLocationHandler(options) {
1914
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/location", ...options });
1915
+ }
1916
+ /**
1917
+ * Handler for `GET /documents/{document_id}/location_v3`.
1918
+ *
1919
+ * Returns a presigned URL or sync service content for accessing the document.
1920
+ */
1921
+ getDocumentLocationV3(options) {
1922
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/location_v3", ...options });
1923
+ }
1924
+ /**
1925
+ * Permanently deletes a document.
1926
+ */
1927
+ permanentlyDeleteDocument(options) {
1928
+ return (options.client ?? this.client).delete({ url: "/documents/{document_id}/permanent", ...options });
1929
+ }
1930
+ /**
1931
+ * Fetches the document pdf processing result for a given document id
1932
+ */
1933
+ getDocumentProcessingResult(options) {
1934
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/processing", ...options });
1935
+ }
1936
+ /**
1937
+ * Fetches the document processing result for a given document id and job id
1938
+ */
1939
+ jobProcessingResultHandler(options) {
1940
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/processing/{job_id}", ...options });
1941
+ }
1942
+ /**
1943
+ * Deletes a specific document
1944
+ */
1945
+ revertDeleteDocument(options) {
1946
+ return (options.client ?? this.client).put({ url: "/documents/{document_id}/revert_delete", ...options });
1947
+ }
1948
+ /**
1949
+ * Handler for `GET /documents/{document_id}/short_id`.
1950
+ *
1951
+ * Returns the short UUID for a document.
1952
+ */
1953
+ getDocumentShortId(options) {
1954
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/short_id", ...options });
1955
+ }
1956
+ /**
1957
+ * For any file that isn't PDF or DOCX, use this endpoint for saving.
1958
+ * This endpoint will allow you to save the document by providing the file content as part of a multipart request. Use key 'file' along with the file bytes.
1959
+ * simple_save is different than the save_document endpoint because it does not return a presigned URL, Instead, it simply saves the file to S3 directly (and returns the document metadata).
1960
+ */
1961
+ simpleSave(options) {
1962
+ return (options.client ?? this.client).put({ url: "/documents/{document_id}/simple_save", ...options });
1963
+ }
1964
+ /**
1965
+ * Gets the team-share state of a document. The team is resolved from the
1966
+ * document owner's team membership; `teamId` is omitted when the owner does
1967
+ * not belong to a team.
1968
+ */
1969
+ getDocumentTeamShare(options) {
1970
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/team_share", ...options });
1971
+ }
1972
+ /**
1973
+ * Sets the team-share state of a document. Sharing grants the document
1974
+ * owner's team Edit access; unsharing removes the team's access. Requires
1975
+ * Edit access on the document.
1976
+ */
1977
+ setDocumentTeamShare(options) {
1978
+ return (options.client ?? this.client).put({
1979
+ url: "/documents/{document_id}/team_share",
1980
+ ...options,
1981
+ headers: {
1982
+ "Content-Type": "application/json",
1983
+ ...options.headers
1984
+ }
1985
+ });
1986
+ }
1987
+ /**
1988
+ * Gets the list of users who have viewed a given document
1989
+ */
1990
+ getDocumentViewsHandler(options) {
1991
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/views", ...options });
1992
+ }
1993
+ /**
1994
+ * Gets a particular document by its id
1995
+ */
1996
+ getDocumentVersion(options) {
1997
+ return (options.client ?? this.client).get({ url: "/documents/{document_id}/{document_version_id}", ...options });
1998
+ }
1999
+ /**
2000
+ * Get the current user's permission for a given entity.
2001
+ */
2002
+ getEntityPermission(options) {
2003
+ return (options.client ?? this.client).get({ url: "/entity/{entity_type}/{entity_id}/permissions", ...options });
2004
+ }
2005
+ /**
2006
+ * List the caller's favorites.
2007
+ */
2008
+ listFavorites(options) {
2009
+ return (options?.client ?? this.client).get({ url: "/favorites", ...options });
2010
+ }
2011
+ /**
2012
+ * Favorite an entity in the caller's collection.
2013
+ */
2014
+ addFavorite(options) {
2015
+ return (options.client ?? this.client).post({
2016
+ url: "/favorites",
2017
+ ...options,
2018
+ headers: {
2019
+ "Content-Type": "application/json",
2020
+ ...options.headers
2021
+ }
2022
+ });
2023
+ }
2024
+ /**
2025
+ * Persist a manual order for the caller's favorites.
2026
+ */
2027
+ reorderFavorites(options) {
2028
+ return (options.client ?? this.client).patch({
2029
+ url: "/favorites/reorder",
2030
+ ...options,
2031
+ headers: {
2032
+ "Content-Type": "application/json",
2033
+ ...options.headers
2034
+ }
2035
+ });
2036
+ }
2037
+ /**
2038
+ * Remove a favorite by entity.
2039
+ */
2040
+ removeFavoriteByEntity(options) {
2041
+ return (options.client ?? this.client).delete({ url: "/favorites/{entity_type}/{entity_id}", ...options });
2042
+ }
2043
+ /**
2044
+ * Get a visible foreign entity by its internal ID.
2045
+ */
2046
+ getForeignEntity(options) {
2047
+ return (options.client ?? this.client).get({ url: "/foreign_entity/{id}", ...options });
2048
+ }
2049
+ /**
2050
+ * Redirects an authenticated user to the github sync app installation page.
2051
+ */
2052
+ installSync(options) {
2053
+ return (options?.client ?? this.client).get({ url: "/github/install-sync", ...options });
2054
+ }
2055
+ /**
2056
+ * Health check
2057
+ */
2058
+ healthHandler(options) {
2059
+ return (options?.client ?? this.client).get({ url: "/health", ...options });
2060
+ }
2061
+ /**
2062
+ * Gets the users history
2063
+ */
2064
+ getHistoryHandler(options) {
2065
+ return (options?.client ?? this.client).get({ url: "/history", ...options });
2066
+ }
2067
+ /**
2068
+ * Deletes an item from the user's history
2069
+ */
2070
+ deleteHistoryHandler(options) {
2071
+ return (options.client ?? this.client).delete({ url: "/history/{item_type}/{item_id}", ...options });
2072
+ }
2073
+ /**
2074
+ * Upserts an item into the user's history and performs other necessary tracking actions
2075
+ */
2076
+ upsertHistoryHandler(options) {
2077
+ return (options.client ?? this.client).post({ url: "/history/{item_type}/{item_id}", ...options });
2078
+ }
2079
+ /**
2080
+ * Gets the instructions document for the current user
2081
+ */
2082
+ getInstructionsHandler(options) {
2083
+ return (options?.client ?? this.client).get({ url: "/instructions", ...options });
2084
+ }
2085
+ /**
2086
+ * Creates an instructions document for the current user
2087
+ */
2088
+ createInstructionsHandler(options) {
2089
+ return (options?.client ?? this.client).post({ url: "/instructions", ...options });
2090
+ }
2091
+ /**
2092
+ * Gets the items the user has access to
2093
+ */
2094
+ getItemsSoup(options) {
2095
+ return (options?.client ?? this.client).get({ url: "/items/soup", ...options });
2096
+ }
2097
+ /**
2098
+ * Gets the items the user has access to
2099
+ */
2100
+ postItemsSoup(options) {
2101
+ return (options.client ?? this.client).post({
2102
+ url: "/items/soup",
2103
+ ...options,
2104
+ headers: {
2105
+ "Content-Type": "application/json",
2106
+ ...options.headers
2107
+ }
2108
+ });
2109
+ }
2110
+ /**
2111
+ * Gets the items the user has access to using AST filters
2112
+ */
2113
+ postItemsSoupAst(options) {
2114
+ return (options.client ?? this.client).post({
2115
+ url: "/items/soup/ast",
2116
+ ...options,
2117
+ headers: {
2118
+ "Content-Type": "application/json",
2119
+ ...options.headers
2120
+ }
2121
+ });
2122
+ }
2123
+ /**
2124
+ * Gets the items grouped by the specified field using AST filters.
2125
+ */
2126
+ postItemsSoupAstGrouped(options) {
2127
+ return (options.client ?? this.client).post({
2128
+ url: "/items/soup/ast/grouped",
2129
+ ...options,
2130
+ headers: {
2131
+ "Content-Type": "application/json",
2132
+ ...options.headers
2133
+ }
2134
+ });
2135
+ }
2136
+ /**
2137
+ * Gets the users pinned items
2138
+ */
2139
+ getPinsHandler(options) {
2140
+ return (options?.client ?? this.client).get({ url: "/pins", ...options });
2141
+ }
2142
+ /**
2143
+ * Saves the updated order of the pins for the user
2144
+ */
2145
+ reorderPinsHandler(options) {
2146
+ return (options.client ?? this.client).patch({
2147
+ url: "/pins",
2148
+ ...options,
2149
+ headers: {
2150
+ "Content-Type": "application/json",
2151
+ ...options.headers
2152
+ }
2153
+ });
2154
+ }
2155
+ /**
2156
+ * Deletes the pin for the user
2157
+ */
2158
+ removePinHandler(options) {
2159
+ return (options.client ?? this.client).delete({
2160
+ url: "/pins/{pinned_item_id}",
2161
+ ...options,
2162
+ headers: {
2163
+ "Content-Type": "application/json",
2164
+ ...options.headers
2165
+ }
2166
+ });
2167
+ }
2168
+ /**
2169
+ * Pins the item for the user
2170
+ */
2171
+ addPinHandler(options) {
2172
+ return (options.client ?? this.client).post({
2173
+ url: "/pins/{pinned_item_id}",
2174
+ ...options,
2175
+ headers: {
2176
+ "Content-Type": "application/json",
2177
+ ...options.headers
2178
+ }
2179
+ });
2180
+ }
2181
+ /**
2182
+ * List projects visible to the authenticated user.
2183
+ */
2184
+ getProjectsHandler(options) {
2185
+ return (options?.client ?? this.client).get({ url: "/projects", ...options });
2186
+ }
2187
+ /**
2188
+ * Create a project, optionally beneath an existing project.
2189
+ */
2190
+ createProjectHandler(options) {
2191
+ return (options.client ?? this.client).post({
2192
+ url: "/projects",
2193
+ ...options,
2194
+ headers: {
2195
+ "Content-Type": "application/json",
2196
+ ...options.headers
2197
+ }
2198
+ });
2199
+ }
2200
+ /**
2201
+ * List pending root projects owned by the authenticated user.
2202
+ */
2203
+ getPendingProjectsHandler(options) {
2204
+ return (options?.client ?? this.client).get({ url: "/projects/pending", ...options });
2205
+ }
2206
+ /**
2207
+ * Get previews for a batch of project IDs.
2208
+ */
2209
+ getBatchProjectPreview(options) {
2210
+ return (options.client ?? this.client).post({
2211
+ url: "/projects/preview",
2212
+ ...options,
2213
+ headers: {
2214
+ "Content-Type": "application/json",
2215
+ ...options.headers
2216
+ }
2217
+ });
2218
+ }
2219
+ /**
2220
+ * Upload a folder tree and create its upload destinations.
2221
+ */
2222
+ uploadFolderHandler(options) {
2223
+ return (options.client ?? this.client).post({
2224
+ url: "/projects/upload",
2225
+ ...options,
2226
+ headers: {
2227
+ "Content-Type": "application/json",
2228
+ ...options.headers
2229
+ }
2230
+ });
2231
+ }
2232
+ /**
2233
+ * Create a request for extracting an uploaded folder archive.
2234
+ */
2235
+ uploadExtractFolderHandler(options) {
2236
+ return (options.client ?? this.client).post({
2237
+ url: "/projects/upload_extract",
2238
+ ...options,
2239
+ headers: {
2240
+ "Content-Type": "application/json",
2241
+ ...options.headers
2242
+ }
2243
+ });
2244
+ }
2245
+ /**
2246
+ * Soft-delete a project and all of its children.
2247
+ */
2248
+ deleteProjectHandler(options) {
2249
+ return (options.client ?? this.client).delete({ url: "/projects/{id}", ...options });
2250
+ }
2251
+ /**
2252
+ * Get project metadata.
2253
+ */
2254
+ getProjectHandler(options) {
2255
+ return (options.client ?? this.client).get({ url: "/projects/{id}", ...options });
2256
+ }
2257
+ /**
2258
+ * Get the caller's project access level.
2259
+ */
2260
+ getProjectUserAccessLevel(options) {
2261
+ return (options.client ?? this.client).get({ url: "/projects/{id}/access_level", ...options });
2262
+ }
2263
+ /**
2264
+ * Get a project's immediate children.
2265
+ */
2266
+ getProjectContentHandler(options) {
2267
+ return (options.client ?? this.client).get({ url: "/projects/{id}/content", ...options });
2268
+ }
2269
+ /**
2270
+ * Permanently delete a soft-deleted project and all of its children.
2271
+ */
2272
+ permanentlyDeleteProject(options) {
2273
+ return (options.client ?? this.client).delete({ url: "/projects/{id}/permanent", ...options });
2274
+ }
2275
+ /**
2276
+ * Get a project's share permissions.
2277
+ */
2278
+ getProjectPermissionsV2(options) {
2279
+ return (options.client ?? this.client).get({ url: "/projects/{id}/permissions", ...options });
2280
+ }
2281
+ /**
2282
+ * Restore a soft-deleted project and its children.
2283
+ */
2284
+ revertDeleteProject(options) {
2285
+ return (options.client ?? this.client).put({ url: "/projects/{id}/revert_delete", ...options });
2286
+ }
2287
+ /**
2288
+ * Gets the users recently deleted items.
2289
+ */
2290
+ recentlyDeleted(options) {
2291
+ return (options?.client ?? this.client).get({ url: "/recents/deleted", ...options });
2292
+ }
2293
+ /**
2294
+ * List the caller's reminders, soonest firing first.
2295
+ */
2296
+ listReminders(options) {
2297
+ return (options?.client ?? this.client).get({ url: "/reminders", ...options });
2298
+ }
2299
+ /**
2300
+ * Create a reminder, optionally attached to an entity the caller can view.
2301
+ */
2302
+ createReminder(options) {
2303
+ return (options.client ?? this.client).post({
2304
+ url: "/reminders",
2305
+ ...options,
2306
+ headers: {
2307
+ "Content-Type": "application/json",
2308
+ ...options.headers
2309
+ }
2310
+ });
2311
+ }
2312
+ /**
2313
+ * Delete one of the caller's reminders.
2314
+ */
2315
+ deleteReminder(options) {
2316
+ return (options.client ?? this.client).delete({ url: "/reminders/{id}", ...options });
2317
+ }
2318
+ /**
2319
+ * Fetch one of the caller's reminders.
2320
+ */
2321
+ getReminder(options) {
2322
+ return (options.client ?? this.client).get({ url: "/reminders/{id}", ...options });
2323
+ }
2324
+ /**
2325
+ * Modify one of the caller's reminders.
2326
+ */
2327
+ updateReminder(options) {
2328
+ return (options.client ?? this.client).patch({
2329
+ url: "/reminders/{id}",
2330
+ ...options,
2331
+ headers: {
2332
+ "Content-Type": "application/json",
2333
+ ...options.headers
2334
+ }
2335
+ });
2336
+ }
2337
+ getViewsHandler(options) {
2338
+ return (options?.client ?? this.client).get({ url: "/saved_views", ...options });
2339
+ }
2340
+ createViewHandler(options) {
2341
+ return (options.client ?? this.client).post({
2342
+ url: "/saved_views",
2343
+ ...options,
2344
+ headers: {
2345
+ "Content-Type": "application/json",
2346
+ ...options.headers
2347
+ }
2348
+ });
2349
+ }
2350
+ excludeDefaultViewHandler(options) {
2351
+ return (options.client ?? this.client).post({
2352
+ url: "/saved_views/exclude_default",
2353
+ ...options,
2354
+ headers: {
2355
+ "Content-Type": "application/json",
2356
+ ...options.headers
2357
+ }
2358
+ });
2359
+ }
2360
+ deleteViewHandler(options) {
2361
+ return (options.client ?? this.client).delete({ url: "/saved_views/{saved_view_id}", ...options });
2362
+ }
2363
+ patchViewHandler(options) {
2364
+ return (options.client ?? this.client).patch({
2365
+ url: "/saved_views/{saved_view_id}",
2366
+ ...options,
2367
+ headers: {
2368
+ "Content-Type": "application/json",
2369
+ ...options.headers
2370
+ }
2371
+ });
2372
+ }
2373
+ bulkWakeupSyncServiceDocuments(options) {
2374
+ return (options.client ?? this.client).post({
2375
+ url: "/sync_service/wakeup",
2376
+ ...options,
2377
+ headers: {
2378
+ "Content-Type": "application/json",
2379
+ ...options.headers
2380
+ }
2381
+ });
2382
+ }
2383
+ /**
2384
+ * Edits the share permissions of a thread.
2385
+ */
2386
+ editThreadV2(options) {
2387
+ return (options.client ?? this.client).patch({
2388
+ url: "/threads/{thread_id}",
2389
+ ...options,
2390
+ headers: {
2391
+ "Content-Type": "application/json",
2392
+ ...options.headers
2393
+ }
2394
+ });
2395
+ }
2396
+ /**
2397
+ * Deletes a document location for the user
2398
+ */
2399
+ deleteUserDocumentViewLocation(options) {
2400
+ return (options.client ?? this.client).delete({ url: "/user_document_view_location/{document_id}", ...options });
2401
+ }
2402
+ /**
2403
+ * Gets a UserPdfDocumentLocation entry
2404
+ */
2405
+ getUserDocumentViewLocation(options) {
2406
+ return (options.client ?? this.client).get({ url: "/user_document_view_location/{document_id}", ...options });
2407
+ }
2408
+ upsertUserDocumentViewLocation(options) {
2409
+ return (options.client ?? this.client).post({
2410
+ url: "/user_document_view_location/{document_id}",
2411
+ ...options,
2412
+ headers: {
2413
+ "Content-Type": "application/json",
2414
+ ...options.headers
2415
+ }
2416
+ });
2417
+ }
2418
+ /**
2419
+ * Gets the current documents share permissions
2420
+ */
2421
+ getDocumentPermissionsV2(options) {
2422
+ return (options.client ?? this.client).get({ url: "/v2/documents/{document_id}/permissions", ...options });
2423
+ }
2424
+ /**
2425
+ * Edit project metadata and sharing settings.
2426
+ */
2427
+ editProjectV2(options) {
2428
+ return (options.client ?? this.client).patch({
2429
+ url: "/v2/projects/{id}",
2430
+ ...options,
2431
+ headers: {
2432
+ "Content-Type": "application/json",
2433
+ ...options.headers
2434
+ }
2435
+ });
2436
+ }
2437
+ /**
2438
+ * List the caller's webhooks.
2439
+ */
2440
+ listWebhooks(options) {
2441
+ return (options?.client ?? this.client).get({ url: "/webhook/webhooks", ...options });
2442
+ }
2443
+ /**
2444
+ * Create a webhook.
2445
+ */
2446
+ createWebhook(options) {
2447
+ return (options.client ?? this.client).post({
2448
+ url: "/webhook/webhooks",
2449
+ ...options,
2450
+ headers: {
2451
+ "Content-Type": "application/json",
2452
+ ...options.headers
2453
+ }
2454
+ });
2455
+ }
2456
+ /**
2457
+ * Delete a webhook.
2458
+ */
2459
+ deleteWebhook(options) {
2460
+ return (options.client ?? this.client).delete({ url: "/webhook/webhooks/{webhook_id}", ...options });
2461
+ }
2462
+ /**
2463
+ * Get a webhook.
2464
+ */
2465
+ getWebhook(options) {
2466
+ return (options.client ?? this.client).get({ url: "/webhook/webhooks/{webhook_id}", ...options });
2467
+ }
2468
+ /**
2469
+ * Patch a webhook.
2470
+ */
2471
+ patchWebhook(options) {
2472
+ return (options.client ?? this.client).patch({
2473
+ url: "/webhook/webhooks/{webhook_id}",
2474
+ ...options,
2475
+ headers: {
2476
+ "Content-Type": "application/json",
2477
+ ...options.headers
2478
+ }
2479
+ });
2480
+ }
2481
+ /**
2482
+ * Validate a webhook endpoint.
2483
+ */
2484
+ validateWebhook(options) {
2485
+ return (options.client ?? this.client).post({ url: "/webhook/webhooks/{webhook_id}/validate", ...options });
2486
+ }
2487
+ };
2488
+
2489
+ export {
2490
+ createClient,
2491
+ Sdk
2492
+ };