@linqapp/sdk 0.1.0-alpha.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 (433) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +7 -0
  3. package/README.md +393 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +193 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +193 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +479 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +475 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +2 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +2 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +40 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +37 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/request-options.d.mts +75 -0
  109. package/internal/request-options.d.mts.map +1 -0
  110. package/internal/request-options.d.ts +75 -0
  111. package/internal/request-options.d.ts.map +1 -0
  112. package/internal/request-options.js +14 -0
  113. package/internal/request-options.js.map +1 -0
  114. package/internal/request-options.mjs +10 -0
  115. package/internal/request-options.mjs.map +1 -0
  116. package/internal/shim-types.d.mts +17 -0
  117. package/internal/shim-types.d.mts.map +1 -0
  118. package/internal/shim-types.d.ts +17 -0
  119. package/internal/shim-types.d.ts.map +1 -0
  120. package/internal/shim-types.js +4 -0
  121. package/internal/shim-types.js.map +1 -0
  122. package/internal/shim-types.mjs +3 -0
  123. package/internal/shim-types.mjs.map +1 -0
  124. package/internal/shims.d.mts +20 -0
  125. package/internal/shims.d.mts.map +1 -0
  126. package/internal/shims.d.ts +20 -0
  127. package/internal/shims.d.ts.map +1 -0
  128. package/internal/shims.js +92 -0
  129. package/internal/shims.js.map +1 -0
  130. package/internal/shims.mjs +85 -0
  131. package/internal/shims.mjs.map +1 -0
  132. package/internal/to-file.d.mts +45 -0
  133. package/internal/to-file.d.mts.map +1 -0
  134. package/internal/to-file.d.ts +45 -0
  135. package/internal/to-file.d.ts.map +1 -0
  136. package/internal/to-file.js +91 -0
  137. package/internal/to-file.js.map +1 -0
  138. package/internal/to-file.mjs +88 -0
  139. package/internal/to-file.mjs.map +1 -0
  140. package/internal/tslib.js +81 -0
  141. package/internal/tslib.mjs +17 -0
  142. package/internal/types.d.mts +69 -0
  143. package/internal/types.d.mts.map +1 -0
  144. package/internal/types.d.ts +69 -0
  145. package/internal/types.d.ts.map +1 -0
  146. package/internal/types.js +4 -0
  147. package/internal/types.js.map +1 -0
  148. package/internal/types.mjs +3 -0
  149. package/internal/types.mjs.map +1 -0
  150. package/internal/uploads.d.mts +42 -0
  151. package/internal/uploads.d.mts.map +1 -0
  152. package/internal/uploads.d.ts +42 -0
  153. package/internal/uploads.d.ts.map +1 -0
  154. package/internal/uploads.js +141 -0
  155. package/internal/uploads.js.map +1 -0
  156. package/internal/uploads.mjs +131 -0
  157. package/internal/uploads.mjs.map +1 -0
  158. package/internal/utils/base64.d.mts +3 -0
  159. package/internal/utils/base64.d.mts.map +1 -0
  160. package/internal/utils/base64.d.ts +3 -0
  161. package/internal/utils/base64.d.ts.map +1 -0
  162. package/internal/utils/base64.js +38 -0
  163. package/internal/utils/base64.js.map +1 -0
  164. package/internal/utils/base64.mjs +33 -0
  165. package/internal/utils/base64.mjs.map +1 -0
  166. package/internal/utils/bytes.d.mts +4 -0
  167. package/internal/utils/bytes.d.mts.map +1 -0
  168. package/internal/utils/bytes.d.ts +4 -0
  169. package/internal/utils/bytes.d.ts.map +1 -0
  170. package/internal/utils/bytes.js +31 -0
  171. package/internal/utils/bytes.js.map +1 -0
  172. package/internal/utils/bytes.mjs +26 -0
  173. package/internal/utils/bytes.mjs.map +1 -0
  174. package/internal/utils/env.d.mts +9 -0
  175. package/internal/utils/env.d.mts.map +1 -0
  176. package/internal/utils/env.d.ts +9 -0
  177. package/internal/utils/env.d.ts.map +1 -0
  178. package/internal/utils/env.js +22 -0
  179. package/internal/utils/env.js.map +1 -0
  180. package/internal/utils/env.mjs +18 -0
  181. package/internal/utils/env.mjs.map +1 -0
  182. package/internal/utils/log.d.mts +37 -0
  183. package/internal/utils/log.d.mts.map +1 -0
  184. package/internal/utils/log.d.ts +37 -0
  185. package/internal/utils/log.d.ts.map +1 -0
  186. package/internal/utils/log.js +85 -0
  187. package/internal/utils/log.js.map +1 -0
  188. package/internal/utils/log.mjs +79 -0
  189. package/internal/utils/log.mjs.map +1 -0
  190. package/internal/utils/path.d.mts +15 -0
  191. package/internal/utils/path.d.mts.map +1 -0
  192. package/internal/utils/path.d.ts +15 -0
  193. package/internal/utils/path.d.ts.map +1 -0
  194. package/internal/utils/path.js +79 -0
  195. package/internal/utils/path.js.map +1 -0
  196. package/internal/utils/path.mjs +74 -0
  197. package/internal/utils/path.mjs.map +1 -0
  198. package/internal/utils/sleep.d.mts +2 -0
  199. package/internal/utils/sleep.d.mts.map +1 -0
  200. package/internal/utils/sleep.d.ts +2 -0
  201. package/internal/utils/sleep.d.ts.map +1 -0
  202. package/internal/utils/sleep.js +7 -0
  203. package/internal/utils/sleep.js.map +1 -0
  204. package/internal/utils/sleep.mjs +3 -0
  205. package/internal/utils/sleep.mjs.map +1 -0
  206. package/internal/utils/uuid.d.mts +5 -0
  207. package/internal/utils/uuid.d.mts.map +1 -0
  208. package/internal/utils/uuid.d.ts +5 -0
  209. package/internal/utils/uuid.d.ts.map +1 -0
  210. package/internal/utils/uuid.js +19 -0
  211. package/internal/utils/uuid.js.map +1 -0
  212. package/internal/utils/uuid.mjs +15 -0
  213. package/internal/utils/uuid.mjs.map +1 -0
  214. package/internal/utils/values.d.mts +18 -0
  215. package/internal/utils/values.d.mts.map +1 -0
  216. package/internal/utils/values.d.ts +18 -0
  217. package/internal/utils/values.d.ts.map +1 -0
  218. package/internal/utils/values.js +112 -0
  219. package/internal/utils/values.js.map +1 -0
  220. package/internal/utils/values.mjs +94 -0
  221. package/internal/utils/values.mjs.map +1 -0
  222. package/internal/utils.d.mts +7 -0
  223. package/internal/utils.d.mts.map +1 -0
  224. package/internal/utils.d.ts +7 -0
  225. package/internal/utils.d.ts.map +1 -0
  226. package/internal/utils.js +11 -0
  227. package/internal/utils.js.map +1 -0
  228. package/internal/utils.mjs +8 -0
  229. package/internal/utils.mjs.map +1 -0
  230. package/package.json +137 -0
  231. package/resource.d.mts +2 -0
  232. package/resource.d.mts.map +1 -0
  233. package/resource.d.ts +2 -0
  234. package/resource.d.ts.map +1 -0
  235. package/resource.js +6 -0
  236. package/resource.js.map +1 -0
  237. package/resource.mjs +2 -0
  238. package/resource.mjs.map +1 -0
  239. package/resources/attachments.d.mts +215 -0
  240. package/resources/attachments.d.mts.map +1 -0
  241. package/resources/attachments.d.ts +215 -0
  242. package/resources/attachments.d.ts.map +1 -0
  243. package/resources/attachments.js +102 -0
  244. package/resources/attachments.js.map +1 -0
  245. package/resources/attachments.mjs +98 -0
  246. package/resources/attachments.mjs.map +1 -0
  247. package/resources/chats/chats.d.mts +1040 -0
  248. package/resources/chats/chats.d.mts.map +1 -0
  249. package/resources/chats/chats.d.ts +1040 -0
  250. package/resources/chats/chats.d.ts.map +1 -0
  251. package/resources/chats/chats.js +182 -0
  252. package/resources/chats/chats.js.map +1 -0
  253. package/resources/chats/chats.mjs +177 -0
  254. package/resources/chats/chats.mjs.map +1 -0
  255. package/resources/chats/index.d.mts +5 -0
  256. package/resources/chats/index.d.mts.map +1 -0
  257. package/resources/chats/index.d.ts +5 -0
  258. package/resources/chats/index.d.ts.map +1 -0
  259. package/resources/chats/index.js +13 -0
  260. package/resources/chats/index.js.map +1 -0
  261. package/resources/chats/index.mjs +6 -0
  262. package/resources/chats/index.mjs.map +1 -0
  263. package/resources/chats/messages.d.mts +813 -0
  264. package/resources/chats/messages.d.mts.map +1 -0
  265. package/resources/chats/messages.d.ts +813 -0
  266. package/resources/chats/messages.d.ts.map +1 -0
  267. package/resources/chats/messages.js +56 -0
  268. package/resources/chats/messages.js.map +1 -0
  269. package/resources/chats/messages.mjs +52 -0
  270. package/resources/chats/messages.mjs.map +1 -0
  271. package/resources/chats/participants.d.mts +68 -0
  272. package/resources/chats/participants.d.mts.map +1 -0
  273. package/resources/chats/participants.d.ts +68 -0
  274. package/resources/chats/participants.d.ts.map +1 -0
  275. package/resources/chats/participants.js +51 -0
  276. package/resources/chats/participants.js.map +1 -0
  277. package/resources/chats/participants.mjs +47 -0
  278. package/resources/chats/participants.mjs.map +1 -0
  279. package/resources/chats/typing.d.mts +35 -0
  280. package/resources/chats/typing.d.mts.map +1 -0
  281. package/resources/chats/typing.d.ts +35 -0
  282. package/resources/chats/typing.d.ts.map +1 -0
  283. package/resources/chats/typing.js +50 -0
  284. package/resources/chats/typing.js.map +1 -0
  285. package/resources/chats/typing.mjs +46 -0
  286. package/resources/chats/typing.mjs.map +1 -0
  287. package/resources/chats.d.mts +2 -0
  288. package/resources/chats.d.mts.map +1 -0
  289. package/resources/chats.d.ts +2 -0
  290. package/resources/chats.d.ts.map +1 -0
  291. package/resources/chats.js +6 -0
  292. package/resources/chats.js.map +1 -0
  293. package/resources/chats.mjs +3 -0
  294. package/resources/chats.mjs.map +1 -0
  295. package/resources/index.d.mts +6 -0
  296. package/resources/index.d.mts.map +1 -0
  297. package/resources/index.d.ts +6 -0
  298. package/resources/index.d.ts.map +1 -0
  299. package/resources/index.js +15 -0
  300. package/resources/index.js.map +1 -0
  301. package/resources/index.mjs +7 -0
  302. package/resources/index.mjs.map +1 -0
  303. package/resources/messages.d.mts +761 -0
  304. package/resources/messages.d.mts.map +1 -0
  305. package/resources/messages.d.ts +761 -0
  306. package/resources/messages.d.ts.map +1 -0
  307. package/resources/messages.js +90 -0
  308. package/resources/messages.js.map +1 -0
  309. package/resources/messages.mjs +86 -0
  310. package/resources/messages.mjs.map +1 -0
  311. package/resources/phone-numbers.d.mts +58 -0
  312. package/resources/phone-numbers.d.mts.map +1 -0
  313. package/resources/phone-numbers.d.ts +58 -0
  314. package/resources/phone-numbers.d.ts.map +1 -0
  315. package/resources/phone-numbers.js +17 -0
  316. package/resources/phone-numbers.js.map +1 -0
  317. package/resources/phone-numbers.mjs +13 -0
  318. package/resources/phone-numbers.mjs.map +1 -0
  319. package/resources/webhooks/events.d.mts +30 -0
  320. package/resources/webhooks/events.d.mts.map +1 -0
  321. package/resources/webhooks/events.d.ts +30 -0
  322. package/resources/webhooks/events.d.ts.map +1 -0
  323. package/resources/webhooks/events.js +22 -0
  324. package/resources/webhooks/events.js.map +1 -0
  325. package/resources/webhooks/events.mjs +18 -0
  326. package/resources/webhooks/events.mjs.map +1 -0
  327. package/resources/webhooks/index.d.mts +4 -0
  328. package/resources/webhooks/index.d.mts.map +1 -0
  329. package/resources/webhooks/index.d.ts +4 -0
  330. package/resources/webhooks/index.d.ts.map +1 -0
  331. package/resources/webhooks/index.js +11 -0
  332. package/resources/webhooks/index.js.map +1 -0
  333. package/resources/webhooks/index.mjs +5 -0
  334. package/resources/webhooks/index.mjs.map +1 -0
  335. package/resources/webhooks/subscriptions.d.mts +237 -0
  336. package/resources/webhooks/subscriptions.d.mts.map +1 -0
  337. package/resources/webhooks/subscriptions.d.ts +237 -0
  338. package/resources/webhooks/subscriptions.d.ts.map +1 -0
  339. package/resources/webhooks/subscriptions.js +107 -0
  340. package/resources/webhooks/subscriptions.js.map +1 -0
  341. package/resources/webhooks/subscriptions.mjs +103 -0
  342. package/resources/webhooks/subscriptions.mjs.map +1 -0
  343. package/resources/webhooks/webhooks.d.mts +14 -0
  344. package/resources/webhooks/webhooks.d.mts.map +1 -0
  345. package/resources/webhooks/webhooks.d.ts +14 -0
  346. package/resources/webhooks/webhooks.d.ts.map +1 -0
  347. package/resources/webhooks/webhooks.js +21 -0
  348. package/resources/webhooks/webhooks.js.map +1 -0
  349. package/resources/webhooks/webhooks.mjs +16 -0
  350. package/resources/webhooks/webhooks.mjs.map +1 -0
  351. package/resources/webhooks.d.mts +2 -0
  352. package/resources/webhooks.d.mts.map +1 -0
  353. package/resources/webhooks.d.ts +2 -0
  354. package/resources/webhooks.d.ts.map +1 -0
  355. package/resources/webhooks.js +6 -0
  356. package/resources/webhooks.js.map +1 -0
  357. package/resources/webhooks.mjs +3 -0
  358. package/resources/webhooks.mjs.map +1 -0
  359. package/resources.d.mts +2 -0
  360. package/resources.d.mts.map +1 -0
  361. package/resources.d.ts +2 -0
  362. package/resources.d.ts.map +1 -0
  363. package/resources.js +5 -0
  364. package/resources.js.map +1 -0
  365. package/resources.mjs +2 -0
  366. package/resources.mjs.map +1 -0
  367. package/src/api-promise.ts +2 -0
  368. package/src/client.ts +801 -0
  369. package/src/core/README.md +3 -0
  370. package/src/core/api-promise.ts +92 -0
  371. package/src/core/error.ts +130 -0
  372. package/src/core/resource.ts +11 -0
  373. package/src/core/uploads.ts +2 -0
  374. package/src/error.ts +2 -0
  375. package/src/index.ts +22 -0
  376. package/src/internal/README.md +3 -0
  377. package/src/internal/builtin-types.ts +93 -0
  378. package/src/internal/detect-platform.ts +196 -0
  379. package/src/internal/errors.ts +33 -0
  380. package/src/internal/headers.ts +97 -0
  381. package/src/internal/parse.ts +56 -0
  382. package/src/internal/request-options.ts +91 -0
  383. package/src/internal/shim-types.ts +26 -0
  384. package/src/internal/shims.ts +107 -0
  385. package/src/internal/to-file.ts +154 -0
  386. package/src/internal/types.ts +95 -0
  387. package/src/internal/uploads.ts +187 -0
  388. package/src/internal/utils/base64.ts +40 -0
  389. package/src/internal/utils/bytes.ts +32 -0
  390. package/src/internal/utils/env.ts +18 -0
  391. package/src/internal/utils/log.ts +126 -0
  392. package/src/internal/utils/path.ts +88 -0
  393. package/src/internal/utils/sleep.ts +3 -0
  394. package/src/internal/utils/uuid.ts +17 -0
  395. package/src/internal/utils/values.ts +105 -0
  396. package/src/internal/utils.ts +8 -0
  397. package/src/lib/.keep +4 -0
  398. package/src/resource.ts +2 -0
  399. package/src/resources/attachments.ts +344 -0
  400. package/src/resources/chats/chats.ts +1285 -0
  401. package/src/resources/chats/index.ts +29 -0
  402. package/src/resources/chats/messages.ts +968 -0
  403. package/src/resources/chats/participants.ts +98 -0
  404. package/src/resources/chats/typing.ts +50 -0
  405. package/src/resources/chats.ts +3 -0
  406. package/src/resources/index.ts +31 -0
  407. package/src/resources/messages.ts +937 -0
  408. package/src/resources/phone-numbers.ts +72 -0
  409. package/src/resources/webhooks/events.ts +55 -0
  410. package/src/resources/webhooks/index.ts +13 -0
  411. package/src/resources/webhooks/subscriptions.ts +409 -0
  412. package/src/resources/webhooks/webhooks.ts +37 -0
  413. package/src/resources/webhooks.ts +3 -0
  414. package/src/resources.ts +1 -0
  415. package/src/tsconfig.json +11 -0
  416. package/src/uploads.ts +2 -0
  417. package/src/version.ts +1 -0
  418. package/uploads.d.mts +2 -0
  419. package/uploads.d.mts.map +1 -0
  420. package/uploads.d.ts +2 -0
  421. package/uploads.d.ts.map +1 -0
  422. package/uploads.js +6 -0
  423. package/uploads.js.map +1 -0
  424. package/uploads.mjs +2 -0
  425. package/uploads.mjs.map +1 -0
  426. package/version.d.mts +2 -0
  427. package/version.d.mts.map +1 -0
  428. package/version.d.ts +2 -0
  429. package/version.d.ts.map +1 -0
  430. package/version.js +5 -0
  431. package/version.js.map +1 -0
  432. package/version.mjs +2 -0
  433. package/version.mjs.map +1 -0
@@ -0,0 +1,237 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import { APIPromise } from "../../core/api-promise.mjs";
3
+ import { RequestOptions } from "../../internal/request-options.mjs";
4
+ export declare class Subscriptions extends APIResource {
5
+ /**
6
+ * Create a new webhook subscription to receive events at a target URL. Upon
7
+ * creation, a signing secret is generated for verifying webhook authenticity.
8
+ * **Store this secret securely — it cannot be retrieved later.**
9
+ *
10
+ * **Webhook Delivery:**
11
+ *
12
+ * - Events are sent via HTTP POST to the target URL
13
+ * - Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers
14
+ * - Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see
15
+ * [Webhook Events](/docs/webhook-events) for verification details
16
+ * - Failed deliveries (5xx, 429, network errors) are retried up to 6 times with
17
+ * exponential backoff: 2s, 4s, 8s, 16s, 30s
18
+ * - Client errors (4xx except 429) are not retried
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const subscription =
23
+ * await client.webhooks.subscriptions.create({
24
+ * subscribed_events: [
25
+ * 'message.sent',
26
+ * 'message.delivered',
27
+ * 'message.read',
28
+ * ],
29
+ * target_url: 'https://webhooks.example.com/linq/events',
30
+ * });
31
+ * ```
32
+ */
33
+ create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse>;
34
+ /**
35
+ * Retrieve details for a specific webhook subscription including its target URL,
36
+ * subscribed events, and current status.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const subscription =
41
+ * await client.webhooks.subscriptions.retrieve(
42
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
43
+ * );
44
+ * ```
45
+ */
46
+ retrieve(subscriptionID: string, options?: RequestOptions): APIPromise<SubscriptionRetrieveResponse>;
47
+ /**
48
+ * Update an existing webhook subscription. You can modify the target URL,
49
+ * subscribed events, or activate/deactivate the subscription.
50
+ *
51
+ * **Note:** The signing secret cannot be changed via this endpoint.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const subscription =
56
+ * await client.webhooks.subscriptions.update(
57
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
58
+ * {
59
+ * target_url:
60
+ * 'https://webhooks.example.com/linq/events',
61
+ * },
62
+ * );
63
+ * ```
64
+ */
65
+ update(subscriptionID: string, body: SubscriptionUpdateParams, options?: RequestOptions): APIPromise<SubscriptionUpdateResponse>;
66
+ /**
67
+ * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
68
+ * of active and inactive subscriptions with their configuration and status.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const subscriptions =
73
+ * await client.webhooks.subscriptions.list();
74
+ * ```
75
+ */
76
+ list(options?: RequestOptions): APIPromise<SubscriptionListResponse>;
77
+ /**
78
+ * Delete a webhook subscription.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * await client.webhooks.subscriptions.delete(
83
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
84
+ * );
85
+ * ```
86
+ */
87
+ delete(subscriptionID: string, options?: RequestOptions): APIPromise<void>;
88
+ }
89
+ /**
90
+ * Response returned when creating a webhook subscription. Includes the signing
91
+ * secret which is only shown once.
92
+ */
93
+ export interface SubscriptionCreateResponse {
94
+ /**
95
+ * Unique identifier for the webhook subscription
96
+ */
97
+ id: string;
98
+ /**
99
+ * When the subscription was created
100
+ */
101
+ created_at: string;
102
+ /**
103
+ * Whether this subscription is currently active
104
+ */
105
+ is_active: boolean;
106
+ /**
107
+ * Secret for verifying webhook signatures. Store this securely - it cannot be
108
+ * retrieved again.
109
+ */
110
+ signing_secret: string;
111
+ /**
112
+ * List of event types this subscription receives
113
+ */
114
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
115
+ /**
116
+ * URL where webhook events will be sent
117
+ */
118
+ target_url: string;
119
+ /**
120
+ * When the subscription was last updated
121
+ */
122
+ updated_at: string;
123
+ }
124
+ export interface SubscriptionRetrieveResponse {
125
+ /**
126
+ * Unique identifier for the webhook subscription
127
+ */
128
+ id: string;
129
+ /**
130
+ * When the subscription was created
131
+ */
132
+ created_at: string;
133
+ /**
134
+ * Whether this subscription is currently active
135
+ */
136
+ is_active: boolean;
137
+ /**
138
+ * List of event types this subscription receives
139
+ */
140
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
141
+ /**
142
+ * URL where webhook events will be sent
143
+ */
144
+ target_url: string;
145
+ /**
146
+ * When the subscription was last updated
147
+ */
148
+ updated_at: string;
149
+ }
150
+ export interface SubscriptionUpdateResponse {
151
+ /**
152
+ * Unique identifier for the webhook subscription
153
+ */
154
+ id: string;
155
+ /**
156
+ * When the subscription was created
157
+ */
158
+ created_at: string;
159
+ /**
160
+ * Whether this subscription is currently active
161
+ */
162
+ is_active: boolean;
163
+ /**
164
+ * List of event types this subscription receives
165
+ */
166
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
167
+ /**
168
+ * URL where webhook events will be sent
169
+ */
170
+ target_url: string;
171
+ /**
172
+ * When the subscription was last updated
173
+ */
174
+ updated_at: string;
175
+ }
176
+ export interface SubscriptionListResponse {
177
+ /**
178
+ * List of webhook subscriptions
179
+ */
180
+ subscriptions: Array<SubscriptionListResponse.Subscription>;
181
+ }
182
+ export declare namespace SubscriptionListResponse {
183
+ interface Subscription {
184
+ /**
185
+ * Unique identifier for the webhook subscription
186
+ */
187
+ id: string;
188
+ /**
189
+ * When the subscription was created
190
+ */
191
+ created_at: string;
192
+ /**
193
+ * Whether this subscription is currently active
194
+ */
195
+ is_active: boolean;
196
+ /**
197
+ * List of event types this subscription receives
198
+ */
199
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
200
+ /**
201
+ * URL where webhook events will be sent
202
+ */
203
+ target_url: string;
204
+ /**
205
+ * When the subscription was last updated
206
+ */
207
+ updated_at: string;
208
+ }
209
+ }
210
+ export interface SubscriptionCreateParams {
211
+ /**
212
+ * List of event types to subscribe to
213
+ */
214
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
215
+ /**
216
+ * URL where webhook events will be sent. Must be HTTPS.
217
+ */
218
+ target_url: string;
219
+ }
220
+ export interface SubscriptionUpdateParams {
221
+ /**
222
+ * Activate or deactivate the subscription
223
+ */
224
+ is_active?: boolean;
225
+ /**
226
+ * Updated list of event types to subscribe to
227
+ */
228
+ subscribed_events?: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
229
+ /**
230
+ * New target URL for webhook events
231
+ */
232
+ target_url?: string;
233
+ }
234
+ export declare namespace Subscriptions {
235
+ export { type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionRetrieveResponse as SubscriptionRetrieveResponse, type SubscriptionUpdateResponse as SubscriptionUpdateResponse, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, };
236
+ }
237
+ //# sourceMappingURL=subscriptions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.mts","sourceRoot":"","sources":["../../src/resources/webhooks/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC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,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,237 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import { APIPromise } from "../../core/api-promise.js";
3
+ import { RequestOptions } from "../../internal/request-options.js";
4
+ export declare class Subscriptions extends APIResource {
5
+ /**
6
+ * Create a new webhook subscription to receive events at a target URL. Upon
7
+ * creation, a signing secret is generated for verifying webhook authenticity.
8
+ * **Store this secret securely — it cannot be retrieved later.**
9
+ *
10
+ * **Webhook Delivery:**
11
+ *
12
+ * - Events are sent via HTTP POST to the target URL
13
+ * - Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers
14
+ * - Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see
15
+ * [Webhook Events](/docs/webhook-events) for verification details
16
+ * - Failed deliveries (5xx, 429, network errors) are retried up to 6 times with
17
+ * exponential backoff: 2s, 4s, 8s, 16s, 30s
18
+ * - Client errors (4xx except 429) are not retried
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const subscription =
23
+ * await client.webhooks.subscriptions.create({
24
+ * subscribed_events: [
25
+ * 'message.sent',
26
+ * 'message.delivered',
27
+ * 'message.read',
28
+ * ],
29
+ * target_url: 'https://webhooks.example.com/linq/events',
30
+ * });
31
+ * ```
32
+ */
33
+ create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse>;
34
+ /**
35
+ * Retrieve details for a specific webhook subscription including its target URL,
36
+ * subscribed events, and current status.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const subscription =
41
+ * await client.webhooks.subscriptions.retrieve(
42
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
43
+ * );
44
+ * ```
45
+ */
46
+ retrieve(subscriptionID: string, options?: RequestOptions): APIPromise<SubscriptionRetrieveResponse>;
47
+ /**
48
+ * Update an existing webhook subscription. You can modify the target URL,
49
+ * subscribed events, or activate/deactivate the subscription.
50
+ *
51
+ * **Note:** The signing secret cannot be changed via this endpoint.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const subscription =
56
+ * await client.webhooks.subscriptions.update(
57
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
58
+ * {
59
+ * target_url:
60
+ * 'https://webhooks.example.com/linq/events',
61
+ * },
62
+ * );
63
+ * ```
64
+ */
65
+ update(subscriptionID: string, body: SubscriptionUpdateParams, options?: RequestOptions): APIPromise<SubscriptionUpdateResponse>;
66
+ /**
67
+ * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
68
+ * of active and inactive subscriptions with their configuration and status.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const subscriptions =
73
+ * await client.webhooks.subscriptions.list();
74
+ * ```
75
+ */
76
+ list(options?: RequestOptions): APIPromise<SubscriptionListResponse>;
77
+ /**
78
+ * Delete a webhook subscription.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * await client.webhooks.subscriptions.delete(
83
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
84
+ * );
85
+ * ```
86
+ */
87
+ delete(subscriptionID: string, options?: RequestOptions): APIPromise<void>;
88
+ }
89
+ /**
90
+ * Response returned when creating a webhook subscription. Includes the signing
91
+ * secret which is only shown once.
92
+ */
93
+ export interface SubscriptionCreateResponse {
94
+ /**
95
+ * Unique identifier for the webhook subscription
96
+ */
97
+ id: string;
98
+ /**
99
+ * When the subscription was created
100
+ */
101
+ created_at: string;
102
+ /**
103
+ * Whether this subscription is currently active
104
+ */
105
+ is_active: boolean;
106
+ /**
107
+ * Secret for verifying webhook signatures. Store this securely - it cannot be
108
+ * retrieved again.
109
+ */
110
+ signing_secret: string;
111
+ /**
112
+ * List of event types this subscription receives
113
+ */
114
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
115
+ /**
116
+ * URL where webhook events will be sent
117
+ */
118
+ target_url: string;
119
+ /**
120
+ * When the subscription was last updated
121
+ */
122
+ updated_at: string;
123
+ }
124
+ export interface SubscriptionRetrieveResponse {
125
+ /**
126
+ * Unique identifier for the webhook subscription
127
+ */
128
+ id: string;
129
+ /**
130
+ * When the subscription was created
131
+ */
132
+ created_at: string;
133
+ /**
134
+ * Whether this subscription is currently active
135
+ */
136
+ is_active: boolean;
137
+ /**
138
+ * List of event types this subscription receives
139
+ */
140
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
141
+ /**
142
+ * URL where webhook events will be sent
143
+ */
144
+ target_url: string;
145
+ /**
146
+ * When the subscription was last updated
147
+ */
148
+ updated_at: string;
149
+ }
150
+ export interface SubscriptionUpdateResponse {
151
+ /**
152
+ * Unique identifier for the webhook subscription
153
+ */
154
+ id: string;
155
+ /**
156
+ * When the subscription was created
157
+ */
158
+ created_at: string;
159
+ /**
160
+ * Whether this subscription is currently active
161
+ */
162
+ is_active: boolean;
163
+ /**
164
+ * List of event types this subscription receives
165
+ */
166
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
167
+ /**
168
+ * URL where webhook events will be sent
169
+ */
170
+ target_url: string;
171
+ /**
172
+ * When the subscription was last updated
173
+ */
174
+ updated_at: string;
175
+ }
176
+ export interface SubscriptionListResponse {
177
+ /**
178
+ * List of webhook subscriptions
179
+ */
180
+ subscriptions: Array<SubscriptionListResponse.Subscription>;
181
+ }
182
+ export declare namespace SubscriptionListResponse {
183
+ interface Subscription {
184
+ /**
185
+ * Unique identifier for the webhook subscription
186
+ */
187
+ id: string;
188
+ /**
189
+ * When the subscription was created
190
+ */
191
+ created_at: string;
192
+ /**
193
+ * Whether this subscription is currently active
194
+ */
195
+ is_active: boolean;
196
+ /**
197
+ * List of event types this subscription receives
198
+ */
199
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
200
+ /**
201
+ * URL where webhook events will be sent
202
+ */
203
+ target_url: string;
204
+ /**
205
+ * When the subscription was last updated
206
+ */
207
+ updated_at: string;
208
+ }
209
+ }
210
+ export interface SubscriptionCreateParams {
211
+ /**
212
+ * List of event types to subscribe to
213
+ */
214
+ subscribed_events: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
215
+ /**
216
+ * URL where webhook events will be sent. Must be HTTPS.
217
+ */
218
+ target_url: string;
219
+ }
220
+ export interface SubscriptionUpdateParams {
221
+ /**
222
+ * Activate or deactivate the subscription
223
+ */
224
+ is_active?: boolean;
225
+ /**
226
+ * Updated list of event types to subscribe to
227
+ */
228
+ subscribed_events?: Array<'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated'>;
229
+ /**
230
+ * New target URL for webhook events
231
+ */
232
+ target_url?: string;
233
+ }
234
+ export declare namespace Subscriptions {
235
+ export { type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionRetrieveResponse as SubscriptionRetrieveResponse, type SubscriptionUpdateResponse as SubscriptionUpdateResponse, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, };
236
+ }
237
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/resources/webhooks/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,U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,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Subscriptions = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
7
+ const path_1 = require("../../internal/utils/path.js");
8
+ class Subscriptions extends resource_1.APIResource {
9
+ /**
10
+ * Create a new webhook subscription to receive events at a target URL. Upon
11
+ * creation, a signing secret is generated for verifying webhook authenticity.
12
+ * **Store this secret securely — it cannot be retrieved later.**
13
+ *
14
+ * **Webhook Delivery:**
15
+ *
16
+ * - Events are sent via HTTP POST to the target URL
17
+ * - Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers
18
+ * - Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see
19
+ * [Webhook Events](/docs/webhook-events) for verification details
20
+ * - Failed deliveries (5xx, 429, network errors) are retried up to 6 times with
21
+ * exponential backoff: 2s, 4s, 8s, 16s, 30s
22
+ * - Client errors (4xx except 429) are not retried
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const subscription =
27
+ * await client.webhooks.subscriptions.create({
28
+ * subscribed_events: [
29
+ * 'message.sent',
30
+ * 'message.delivered',
31
+ * 'message.read',
32
+ * ],
33
+ * target_url: 'https://webhooks.example.com/linq/events',
34
+ * });
35
+ * ```
36
+ */
37
+ create(body, options) {
38
+ return this._client.post('/v3/webhook-subscriptions', { body, ...options });
39
+ }
40
+ /**
41
+ * Retrieve details for a specific webhook subscription including its target URL,
42
+ * subscribed events, and current status.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const subscription =
47
+ * await client.webhooks.subscriptions.retrieve(
48
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
49
+ * );
50
+ * ```
51
+ */
52
+ retrieve(subscriptionID, options) {
53
+ return this._client.get((0, path_1.path) `/v3/webhook-subscriptions/${subscriptionID}`, options);
54
+ }
55
+ /**
56
+ * Update an existing webhook subscription. You can modify the target URL,
57
+ * subscribed events, or activate/deactivate the subscription.
58
+ *
59
+ * **Note:** The signing secret cannot be changed via this endpoint.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const subscription =
64
+ * await client.webhooks.subscriptions.update(
65
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
66
+ * {
67
+ * target_url:
68
+ * 'https://webhooks.example.com/linq/events',
69
+ * },
70
+ * );
71
+ * ```
72
+ */
73
+ update(subscriptionID, body, options) {
74
+ return this._client.put((0, path_1.path) `/v3/webhook-subscriptions/${subscriptionID}`, { body, ...options });
75
+ }
76
+ /**
77
+ * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
78
+ * of active and inactive subscriptions with their configuration and status.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const subscriptions =
83
+ * await client.webhooks.subscriptions.list();
84
+ * ```
85
+ */
86
+ list(options) {
87
+ return this._client.get('/v3/webhook-subscriptions', options);
88
+ }
89
+ /**
90
+ * Delete a webhook subscription.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * await client.webhooks.subscriptions.delete(
95
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
96
+ * );
97
+ * ```
98
+ */
99
+ delete(subscriptionID, options) {
100
+ return this._client.delete((0, path_1.path) `/v3/webhook-subscriptions/${subscriptionID}`, {
101
+ ...options,
102
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
103
+ });
104
+ }
105
+ }
106
+ exports.Subscriptions = Subscriptions;
107
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/resources/webhooks/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAs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