@zavudev/sdk 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +25 -10
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +25 -10
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent-templates.d.mts +97 -0
  12. package/resources/agent-templates.d.mts.map +1 -0
  13. package/resources/agent-templates.d.ts +97 -0
  14. package/resources/agent-templates.d.ts.map +1 -0
  15. package/resources/agent-templates.js +39 -0
  16. package/resources/agent-templates.js.map +1 -0
  17. package/resources/agent-templates.mjs +35 -0
  18. package/resources/agent-templates.mjs.map +1 -0
  19. package/resources/agents/agents.d.mts +462 -0
  20. package/resources/agents/agents.d.mts.map +1 -0
  21. package/resources/agents/agents.d.ts +462 -0
  22. package/resources/agents/agents.d.ts.map +1 -0
  23. package/resources/agents/agents.js +129 -0
  24. package/resources/agents/agents.js.map +1 -0
  25. package/resources/agents/agents.mjs +124 -0
  26. package/resources/agents/agents.mjs.map +1 -0
  27. package/resources/agents/index.d.mts +3 -0
  28. package/resources/agents/index.d.mts.map +1 -0
  29. package/resources/agents/index.d.ts +3 -0
  30. package/resources/agents/index.d.ts.map +1 -0
  31. package/resources/agents/index.js +9 -0
  32. package/resources/agents/index.js.map +1 -0
  33. package/resources/agents/index.mjs +4 -0
  34. package/resources/agents/index.mjs.map +1 -0
  35. package/resources/agents/senders.d.mts +54 -0
  36. package/resources/agents/senders.d.mts.map +1 -0
  37. package/resources/agents/senders.d.ts +54 -0
  38. package/resources/agents/senders.d.ts.map +1 -0
  39. package/resources/agents/senders.js +45 -0
  40. package/resources/agents/senders.js.map +1 -0
  41. package/resources/agents/senders.mjs +41 -0
  42. package/resources/agents/senders.mjs.map +1 -0
  43. package/resources/agents.d.mts +2 -0
  44. package/resources/agents.d.mts.map +1 -0
  45. package/resources/agents.d.ts +2 -0
  46. package/resources/agents.d.ts.map +1 -0
  47. package/resources/agents.js +6 -0
  48. package/resources/agents.js.map +1 -0
  49. package/resources/agents.mjs +3 -0
  50. package/resources/agents.mjs.map +1 -0
  51. package/resources/broadcasts/broadcasts.d.mts +9 -6
  52. package/resources/broadcasts/broadcasts.d.mts.map +1 -1
  53. package/resources/broadcasts/broadcasts.d.ts +9 -6
  54. package/resources/broadcasts/broadcasts.d.ts.map +1 -1
  55. package/resources/broadcasts/broadcasts.js +9 -6
  56. package/resources/broadcasts/broadcasts.js.map +1 -1
  57. package/resources/broadcasts/broadcasts.mjs +9 -6
  58. package/resources/broadcasts/broadcasts.mjs.map +1 -1
  59. package/resources/calls.d.mts +530 -0
  60. package/resources/calls.d.mts.map +1 -0
  61. package/resources/calls.d.ts +530 -0
  62. package/resources/calls.d.ts.map +1 -0
  63. package/resources/calls.js +76 -0
  64. package/resources/calls.js.map +1 -0
  65. package/resources/calls.mjs +72 -0
  66. package/resources/calls.mjs.map +1 -0
  67. package/resources/conversations.d.mts +360 -0
  68. package/resources/conversations.d.mts.map +1 -0
  69. package/resources/conversations.d.ts +360 -0
  70. package/resources/conversations.d.ts.map +1 -0
  71. package/resources/conversations.js +47 -0
  72. package/resources/conversations.js.map +1 -0
  73. package/resources/conversations.mjs +43 -0
  74. package/resources/conversations.mjs.map +1 -0
  75. package/resources/email-domains.d.mts +260 -0
  76. package/resources/email-domains.d.mts.map +1 -0
  77. package/resources/email-domains.d.ts +260 -0
  78. package/resources/email-domains.d.ts.map +1 -0
  79. package/resources/email-domains.js +77 -0
  80. package/resources/email-domains.js.map +1 -0
  81. package/resources/email-domains.mjs +73 -0
  82. package/resources/email-domains.mjs.map +1 -0
  83. package/resources/functions/functions.d.mts +122 -1
  84. package/resources/functions/functions.d.mts.map +1 -1
  85. package/resources/functions/functions.d.ts +122 -1
  86. package/resources/functions/functions.d.ts.map +1 -1
  87. package/resources/functions/functions.js +53 -0
  88. package/resources/functions/functions.js.map +1 -1
  89. package/resources/functions/functions.mjs +53 -0
  90. package/resources/functions/functions.mjs.map +1 -1
  91. package/resources/functions/git-link.d.mts +295 -0
  92. package/resources/functions/git-link.d.mts.map +1 -0
  93. package/resources/functions/git-link.d.ts +295 -0
  94. package/resources/functions/git-link.d.ts.map +1 -0
  95. package/resources/functions/git-link.js +97 -0
  96. package/resources/functions/git-link.js.map +1 -0
  97. package/resources/functions/git-link.mjs +93 -0
  98. package/resources/functions/git-link.mjs.map +1 -0
  99. package/resources/functions/index.d.mts +3 -1
  100. package/resources/functions/index.d.mts.map +1 -1
  101. package/resources/functions/index.d.ts +3 -1
  102. package/resources/functions/index.d.ts.map +1 -1
  103. package/resources/functions/index.js +5 -1
  104. package/resources/functions/index.js.map +1 -1
  105. package/resources/functions/index.mjs +2 -0
  106. package/resources/functions/index.mjs.map +1 -1
  107. package/resources/functions/triggers.d.mts +164 -0
  108. package/resources/functions/triggers.d.mts.map +1 -0
  109. package/resources/functions/triggers.d.ts +164 -0
  110. package/resources/functions/triggers.d.ts.map +1 -0
  111. package/resources/functions/triggers.js +74 -0
  112. package/resources/functions/triggers.js.map +1 -0
  113. package/resources/functions/triggers.mjs +70 -0
  114. package/resources/functions/triggers.mjs.map +1 -0
  115. package/resources/index.d.mts +10 -5
  116. package/resources/index.d.mts.map +1 -1
  117. package/resources/index.d.ts +10 -5
  118. package/resources/index.d.ts.map +1 -1
  119. package/resources/index.js +11 -1
  120. package/resources/index.js.map +1 -1
  121. package/resources/index.mjs +5 -0
  122. package/resources/index.mjs.map +1 -1
  123. package/resources/introspect.d.mts +74 -1
  124. package/resources/introspect.d.mts.map +1 -1
  125. package/resources/introspect.d.ts +74 -1
  126. package/resources/introspect.d.ts.map +1 -1
  127. package/resources/introspect.js +22 -0
  128. package/resources/introspect.js.map +1 -1
  129. package/resources/introspect.mjs +22 -0
  130. package/resources/introspect.mjs.map +1 -1
  131. package/resources/messages.d.mts +123 -1
  132. package/resources/messages.d.mts.map +1 -1
  133. package/resources/messages.d.ts +123 -1
  134. package/resources/messages.d.ts.map +1 -1
  135. package/resources/messages.js +18 -0
  136. package/resources/messages.js.map +1 -1
  137. package/resources/messages.mjs +18 -0
  138. package/resources/messages.mjs.map +1 -1
  139. package/resources/senders/agent/agent.d.mts +4 -3
  140. package/resources/senders/agent/agent.d.mts.map +1 -1
  141. package/resources/senders/agent/agent.d.ts +4 -3
  142. package/resources/senders/agent/agent.d.ts.map +1 -1
  143. package/resources/senders/agent/agent.js +2 -2
  144. package/resources/senders/agent/agent.js.map +1 -1
  145. package/resources/senders/agent/agent.mjs +2 -2
  146. package/resources/senders/agent/agent.mjs.map +1 -1
  147. package/resources/senders/agent/index.d.mts +2 -2
  148. package/resources/senders/agent/index.d.mts.map +1 -1
  149. package/resources/senders/agent/index.d.ts +2 -2
  150. package/resources/senders/agent/index.d.ts.map +1 -1
  151. package/resources/senders/agent/index.js +2 -2
  152. package/resources/senders/agent/index.js.map +1 -1
  153. package/resources/senders/agent/index.mjs +1 -1
  154. package/resources/senders/agent/index.mjs.map +1 -1
  155. package/resources/senders/agent/knowledge-bases/documents.d.mts +56 -1
  156. package/resources/senders/agent/knowledge-bases/documents.d.mts.map +1 -1
  157. package/resources/senders/agent/knowledge-bases/documents.d.ts +56 -1
  158. package/resources/senders/agent/knowledge-bases/documents.d.ts.map +1 -1
  159. package/resources/senders/agent/knowledge-bases/documents.js +33 -0
  160. package/resources/senders/agent/knowledge-bases/documents.js.map +1 -1
  161. package/resources/senders/agent/knowledge-bases/documents.mjs +33 -0
  162. package/resources/senders/agent/knowledge-bases/documents.mjs.map +1 -1
  163. package/resources/senders/agent/knowledge-bases/index.d.mts +1 -1
  164. package/resources/senders/agent/knowledge-bases/index.d.mts.map +1 -1
  165. package/resources/senders/agent/knowledge-bases/index.d.ts +1 -1
  166. package/resources/senders/agent/knowledge-bases/index.d.ts.map +1 -1
  167. package/resources/senders/agent/knowledge-bases/index.js.map +1 -1
  168. package/resources/senders/agent/knowledge-bases/index.mjs.map +1 -1
  169. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts +2 -2
  170. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts.map +1 -1
  171. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts +2 -2
  172. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts.map +1 -1
  173. package/resources/senders/agent/knowledge-bases/knowledge-bases.js.map +1 -1
  174. package/resources/senders/agent/knowledge-bases/knowledge-bases.mjs.map +1 -1
  175. package/resources/senders/agent/tools/index.d.mts +3 -0
  176. package/resources/senders/agent/tools/index.d.mts.map +1 -0
  177. package/resources/senders/agent/tools/index.d.ts +3 -0
  178. package/resources/senders/agent/tools/index.d.ts.map +1 -0
  179. package/resources/senders/agent/tools/index.js +9 -0
  180. package/resources/senders/agent/tools/index.js.map +1 -0
  181. package/resources/senders/agent/tools/index.mjs +4 -0
  182. package/resources/senders/agent/tools/index.mjs.map +1 -0
  183. package/resources/senders/agent/tools/tools.d.mts +338 -0
  184. package/resources/senders/agent/tools/tools.d.mts.map +1 -0
  185. package/resources/senders/agent/tools/tools.d.ts +338 -0
  186. package/resources/senders/agent/tools/tools.d.ts.map +1 -0
  187. package/resources/senders/agent/tools/tools.js +163 -0
  188. package/resources/senders/agent/tools/tools.js.map +1 -0
  189. package/resources/senders/agent/tools/tools.mjs +158 -0
  190. package/resources/senders/agent/tools/tools.mjs.map +1 -0
  191. package/resources/senders/agent/tools/webhook.d.mts +28 -0
  192. package/resources/senders/agent/tools/webhook.d.mts.map +1 -0
  193. package/resources/senders/agent/tools/webhook.d.ts +28 -0
  194. package/resources/senders/agent/tools/webhook.d.ts.map +1 -0
  195. package/resources/senders/agent/tools/webhook.js +28 -0
  196. package/resources/senders/agent/tools/webhook.js.map +1 -0
  197. package/resources/senders/agent/tools/webhook.mjs +24 -0
  198. package/resources/senders/agent/tools/webhook.mjs.map +1 -0
  199. package/resources/senders/agent/tools.d.mts +1 -270
  200. package/resources/senders/agent/tools.d.mts.map +1 -1
  201. package/resources/senders/agent/tools.d.ts +1 -270
  202. package/resources/senders/agent/tools.d.ts.map +1 -1
  203. package/resources/senders/agent/tools.js +2 -131
  204. package/resources/senders/agent/tools.js.map +1 -1
  205. package/resources/senders/agent/tools.mjs +1 -129
  206. package/resources/senders/agent/tools.mjs.map +1 -1
  207. package/resources/senders/index.d.mts +2 -1
  208. package/resources/senders/index.d.mts.map +1 -1
  209. package/resources/senders/index.d.ts +2 -1
  210. package/resources/senders/index.d.ts.map +1 -1
  211. package/resources/senders/index.js +3 -1
  212. package/resources/senders/index.js.map +1 -1
  213. package/resources/senders/index.mjs +1 -0
  214. package/resources/senders/index.mjs.map +1 -1
  215. package/resources/senders/senders.d.mts +10 -1
  216. package/resources/senders/senders.d.mts.map +1 -1
  217. package/resources/senders/senders.d.ts +10 -1
  218. package/resources/senders/senders.d.ts.map +1 -1
  219. package/resources/senders/senders.js +4 -0
  220. package/resources/senders/senders.js.map +1 -1
  221. package/resources/senders/senders.mjs +4 -0
  222. package/resources/senders/senders.mjs.map +1 -1
  223. package/resources/senders/telegram.d.mts +48 -0
  224. package/resources/senders/telegram.d.mts.map +1 -0
  225. package/resources/senders/telegram.d.ts +48 -0
  226. package/resources/senders/telegram.d.ts.map +1 -0
  227. package/resources/senders/telegram.js +41 -0
  228. package/resources/senders/telegram.js.map +1 -0
  229. package/resources/senders/telegram.mjs +37 -0
  230. package/resources/senders/telegram.mjs.map +1 -0
  231. package/resources/templates.d.mts +66 -1
  232. package/resources/templates.d.mts.map +1 -1
  233. package/resources/templates.d.ts +66 -1
  234. package/resources/templates.d.ts.map +1 -1
  235. package/resources/templates.js +31 -0
  236. package/resources/templates.js.map +1 -1
  237. package/resources/templates.mjs +31 -0
  238. package/resources/templates.mjs.map +1 -1
  239. package/resources/urls.d.mts +24 -1
  240. package/resources/urls.d.mts.map +1 -1
  241. package/resources/urls.d.ts +24 -1
  242. package/resources/urls.d.ts.map +1 -1
  243. package/resources/urls.js +15 -0
  244. package/resources/urls.js.map +1 -1
  245. package/resources/urls.mjs +15 -0
  246. package/resources/urls.mjs.map +1 -1
  247. package/src/client.ts +129 -0
  248. package/src/resources/agent-templates.ts +128 -0
  249. package/src/resources/agents/agents.ts +603 -0
  250. package/src/resources/agents/index.ts +21 -0
  251. package/src/resources/agents/senders.ts +79 -0
  252. package/src/resources/agents.ts +3 -0
  253. package/src/resources/broadcasts/broadcasts.ts +9 -6
  254. package/src/resources/calls.ts +638 -0
  255. package/src/resources/conversations.ts +472 -0
  256. package/src/resources/email-domains.ts +337 -0
  257. package/src/resources/functions/functions.ts +202 -0
  258. package/src/resources/functions/git-link.ts +398 -0
  259. package/src/resources/functions/index.ts +22 -0
  260. package/src/resources/functions/triggers.ts +227 -0
  261. package/src/resources/index.ts +57 -0
  262. package/src/resources/introspect.ts +105 -0
  263. package/src/resources/messages.ts +146 -0
  264. package/src/resources/senders/agent/agent.ts +23 -17
  265. package/src/resources/senders/agent/index.ts +4 -1
  266. package/src/resources/senders/agent/knowledge-bases/documents.ts +89 -0
  267. package/src/resources/senders/agent/knowledge-bases/index.ts +4 -0
  268. package/src/resources/senders/agent/knowledge-bases/knowledge-bases.ts +8 -0
  269. package/src/resources/senders/agent/tools/index.ts +21 -0
  270. package/src/resources/senders/agent/tools/tools.ts +460 -0
  271. package/src/resources/senders/agent/tools/webhook.ts +40 -0
  272. package/src/resources/senders/agent/tools.ts +1 -364
  273. package/src/resources/senders/index.ts +2 -0
  274. package/src/resources/senders/senders.ts +16 -1
  275. package/src/resources/senders/telegram.ts +73 -0
  276. package/src/resources/templates.ts +80 -0
  277. package/src/resources/urls.ts +35 -0
  278. package/src/version.ts +1 -1
  279. package/version.d.mts +1 -1
  280. package/version.d.ts +1 -1
  281. package/version.js +1 -1
  282. package/version.mjs +1 -1
@@ -0,0 +1,97 @@
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.GitLink = 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 GitLink extends resource_1.APIResource {
9
+ /**
10
+ * The link and its last deploy. Never returns the webhook secret.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const gitLink = await client.functions.gitLink.retrieve(
15
+ * 'functionId',
16
+ * );
17
+ * ```
18
+ */
19
+ retrieve(functionID, options) {
20
+ return this._client.get((0, path_1.path) `/v1/functions/${functionID}/git-link`, options);
21
+ }
22
+ /**
23
+ * Change the branch, the root directory, or whether pushes deploy. Pass at least
24
+ * one field. `rootDir: null` clears the subdirectory.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const gitLink = await client.functions.gitLink.update(
29
+ * 'functionId',
30
+ * );
31
+ * ```
32
+ */
33
+ update(functionID, body, options) {
34
+ return this._client.patch((0, path_1.path) `/v1/functions/${functionID}/git-link`, { body, ...options });
35
+ }
36
+ /**
37
+ * Fetch the linked branch and deploy it without waiting for a push. Returns
38
+ * immediately; follow the outcome with `GET /v1/functions/{functionId}/git-link`,
39
+ * whose `lastStatus` and `lastError` describe the run.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const response = await client.functions.gitLink.deployNow(
44
+ * 'functionId',
45
+ * );
46
+ * ```
47
+ */
48
+ deployNow(functionID, options) {
49
+ return this._client.post((0, path_1.path) `/v1/functions/${functionID}/git-link/deploy`, options);
50
+ }
51
+ /**
52
+ * Bind a repository to this function so every push to `branch` deploys it. A
53
+ * function holds at most one link; linking again returns 400.
54
+ *
55
+ * **The server decides how the link authenticates.** If the project has the Zavu
56
+ * GitHub App installed, the link uses that installation: private repositories work
57
+ * and there is nothing to configure in the repository. Otherwise it falls back to
58
+ * a manual link and the response carries a `webhookSecret` you add to the
59
+ * repository yourself. `connection` says which one you got.
60
+ *
61
+ * The repository is not checked against GitHub here, because it cannot be: an
62
+ * owner/repo that does not exist, or that the installation cannot see, is accepted
63
+ * and fails on the first deploy with a fetch error.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const response = await client.functions.gitLink.link(
68
+ * 'functionId',
69
+ * {
70
+ * owner: 'acme',
71
+ * repo: 'order-bot',
72
+ * branch: 'main',
73
+ * },
74
+ * );
75
+ * ```
76
+ */
77
+ link(functionID, body, options) {
78
+ return this._client.post((0, path_1.path) `/v1/functions/${functionID}/git-link`, { body, ...options });
79
+ }
80
+ /**
81
+ * Remove the link. The function and its deployments stay. A manual webhook left in
82
+ * the repository stops being accepted, so remove it there too.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * await client.functions.gitLink.unlink('functionId');
87
+ * ```
88
+ */
89
+ unlink(functionID, options) {
90
+ return this._client.delete((0, path_1.path) `/v1/functions/${functionID}/git-link`, {
91
+ ...options,
92
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
93
+ });
94
+ }
95
+ }
96
+ exports.GitLink = GitLink;
97
+ //# sourceMappingURL=git-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-link.js","sourceRoot":"","sources":["../../src/resources/functions/git-link.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,UAAkB,EAClB,IAAyB,EACzB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,UAAkB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,CACF,UAAkB,EAClB,IAAuB,EACvB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,WAAW,EAAE;YACrE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAnGD,0BAmGC"}
@@ -0,0 +1,93 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
4
+ import { path } from "../../internal/utils/path.mjs";
5
+ export class GitLink extends APIResource {
6
+ /**
7
+ * The link and its last deploy. Never returns the webhook secret.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const gitLink = await client.functions.gitLink.retrieve(
12
+ * 'functionId',
13
+ * );
14
+ * ```
15
+ */
16
+ retrieve(functionID, options) {
17
+ return this._client.get(path `/v1/functions/${functionID}/git-link`, options);
18
+ }
19
+ /**
20
+ * Change the branch, the root directory, or whether pushes deploy. Pass at least
21
+ * one field. `rootDir: null` clears the subdirectory.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const gitLink = await client.functions.gitLink.update(
26
+ * 'functionId',
27
+ * );
28
+ * ```
29
+ */
30
+ update(functionID, body, options) {
31
+ return this._client.patch(path `/v1/functions/${functionID}/git-link`, { body, ...options });
32
+ }
33
+ /**
34
+ * Fetch the linked branch and deploy it without waiting for a push. Returns
35
+ * immediately; follow the outcome with `GET /v1/functions/{functionId}/git-link`,
36
+ * whose `lastStatus` and `lastError` describe the run.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const response = await client.functions.gitLink.deployNow(
41
+ * 'functionId',
42
+ * );
43
+ * ```
44
+ */
45
+ deployNow(functionID, options) {
46
+ return this._client.post(path `/v1/functions/${functionID}/git-link/deploy`, options);
47
+ }
48
+ /**
49
+ * Bind a repository to this function so every push to `branch` deploys it. A
50
+ * function holds at most one link; linking again returns 400.
51
+ *
52
+ * **The server decides how the link authenticates.** If the project has the Zavu
53
+ * GitHub App installed, the link uses that installation: private repositories work
54
+ * and there is nothing to configure in the repository. Otherwise it falls back to
55
+ * a manual link and the response carries a `webhookSecret` you add to the
56
+ * repository yourself. `connection` says which one you got.
57
+ *
58
+ * The repository is not checked against GitHub here, because it cannot be: an
59
+ * owner/repo that does not exist, or that the installation cannot see, is accepted
60
+ * and fails on the first deploy with a fetch error.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const response = await client.functions.gitLink.link(
65
+ * 'functionId',
66
+ * {
67
+ * owner: 'acme',
68
+ * repo: 'order-bot',
69
+ * branch: 'main',
70
+ * },
71
+ * );
72
+ * ```
73
+ */
74
+ link(functionID, body, options) {
75
+ return this._client.post(path `/v1/functions/${functionID}/git-link`, { body, ...options });
76
+ }
77
+ /**
78
+ * Remove the link. The function and its deployments stay. A manual webhook left in
79
+ * the repository stops being accepted, so remove it there too.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await client.functions.gitLink.unlink('functionId');
84
+ * ```
85
+ */
86
+ unlink(functionID, options) {
87
+ return this._client.delete(path `/v1/functions/${functionID}/git-link`, {
88
+ ...options,
89
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
90
+ });
91
+ }
92
+ }
93
+ //# sourceMappingURL=git-link.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-link.mjs","sourceRoot":"","sources":["../../src/resources/functions/git-link.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,iBAAiB,UAAU,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,UAAkB,EAClB,IAAyB,EACzB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,iBAAiB,UAAU,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,UAAkB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,CACF,UAAkB,EAClB,IAAuB,EACvB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,iBAAiB,UAAU,WAAW,EAAE;YACrE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,3 +1,5 @@
1
- export { Functions, type FunctionCreateResponse, type FunctionRetrieveResponse, type FunctionUpdateResponse, type FunctionDeleteResponse, type FunctionDeployResponse, type FunctionGetDeploymentResponse, type FunctionTailLogsResponse, type FunctionCreateParams, type FunctionUpdateParams, type FunctionDeployParams, type FunctionTailLogsParams, } from "./functions.mjs";
1
+ export { Functions, type FunctionCreateResponse, type FunctionRetrieveResponse, type FunctionUpdateResponse, type FunctionDeleteResponse, type FunctionDeployResponse, type FunctionGetDeploymentResponse, type FunctionListDeploymentsResponse, type FunctionListEventTypesResponse, type FunctionRollbackDeploymentResponse, type FunctionTailLogsResponse, type FunctionCreateParams, type FunctionUpdateParams, type FunctionDeployParams, type FunctionListDeploymentsParams, type FunctionRollbackDeploymentParams, type FunctionTailLogsParams, } from "./functions.mjs";
2
+ export { GitLink, type GitLinkRetrieveResponse, type GitLinkUpdateResponse, type GitLinkDeployNowResponse, type GitLinkLinkResponse, type GitLinkUpdateParams, type GitLinkLinkParams, } from "./git-link.mjs";
2
3
  export { Secrets, type SecretListResponse, type SecretSetResponse, type SecretSetParams, type SecretUnsetParams, } from "./secrets.mjs";
4
+ export { Triggers, type TriggerCreateResponse, type TriggerUpdateResponse, type TriggerListResponse, type TriggerCreateParams, type TriggerUpdateParams, } from "./triggers.mjs";
3
5
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,wBAAoB;AACrB,OAAO,EACL,OAAO,EACP,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,sBAAkB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,GAC5B,wBAAoB;AACrB,OAAO,EACL,OAAO,EACP,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,uBAAmB;AACpB,OAAO,EACL,OAAO,EACP,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,sBAAkB;AACnB,OAAO,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,uBAAmB"}
@@ -1,3 +1,5 @@
1
- export { Functions, type FunctionCreateResponse, type FunctionRetrieveResponse, type FunctionUpdateResponse, type FunctionDeleteResponse, type FunctionDeployResponse, type FunctionGetDeploymentResponse, type FunctionTailLogsResponse, type FunctionCreateParams, type FunctionUpdateParams, type FunctionDeployParams, type FunctionTailLogsParams, } from "./functions.js";
1
+ export { Functions, type FunctionCreateResponse, type FunctionRetrieveResponse, type FunctionUpdateResponse, type FunctionDeleteResponse, type FunctionDeployResponse, type FunctionGetDeploymentResponse, type FunctionListDeploymentsResponse, type FunctionListEventTypesResponse, type FunctionRollbackDeploymentResponse, type FunctionTailLogsResponse, type FunctionCreateParams, type FunctionUpdateParams, type FunctionDeployParams, type FunctionListDeploymentsParams, type FunctionRollbackDeploymentParams, type FunctionTailLogsParams, } from "./functions.js";
2
+ export { GitLink, type GitLinkRetrieveResponse, type GitLinkUpdateResponse, type GitLinkDeployNowResponse, type GitLinkLinkResponse, type GitLinkUpdateParams, type GitLinkLinkParams, } from "./git-link.js";
2
3
  export { Secrets, type SecretListResponse, type SecretSetResponse, type SecretSetParams, type SecretUnsetParams, } from "./secrets.js";
4
+ export { Triggers, type TriggerCreateResponse, type TriggerUpdateResponse, type TriggerListResponse, type TriggerCreateParams, type TriggerUpdateParams, } from "./triggers.js";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,uBAAoB;AACrB,OAAO,EACL,OAAO,EACP,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,qBAAkB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,GAC5B,uBAAoB;AACrB,OAAO,EACL,OAAO,EACP,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,sBAAmB;AACpB,OAAO,EACL,OAAO,EACP,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,qBAAkB;AACnB,OAAO,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,sBAAmB"}
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Secrets = exports.Functions = void 0;
4
+ exports.Triggers = exports.Secrets = exports.GitLink = exports.Functions = void 0;
5
5
  var functions_1 = require("./functions.js");
6
6
  Object.defineProperty(exports, "Functions", { enumerable: true, get: function () { return functions_1.Functions; } });
7
+ var git_link_1 = require("./git-link.js");
8
+ Object.defineProperty(exports, "GitLink", { enumerable: true, get: function () { return git_link_1.GitLink; } });
7
9
  var secrets_1 = require("./secrets.js");
8
10
  Object.defineProperty(exports, "Secrets", { enumerable: true, get: function () { return secrets_1.Secrets; } });
11
+ var triggers_1 = require("./triggers.js");
12
+ Object.defineProperty(exports, "Triggers", { enumerable: true, get: function () { return triggers_1.Triggers; } });
9
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAaqB;AAZnB,sGAAA,SAAS,OAAA;AAaX,wCAMmB;AALjB,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAkBqB;AAjBnB,sGAAA,SAAS,OAAA;AAkBX,0CAQoB;AAPlB,mGAAA,OAAO,OAAA;AAQT,wCAMmB;AALjB,kGAAA,OAAO,OAAA;AAMT,0CAOoB;AANlB,oGAAA,QAAQ,OAAA"}
@@ -1,4 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  export { Functions, } from "./functions.mjs";
3
+ export { GitLink, } from "./git-link.mjs";
3
4
  export { Secrets, } from "./secrets.mjs";
5
+ export { Triggers, } from "./triggers.mjs";
4
6
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,SAAS,GAYV,wBAAoB;AACrB,OAAO,EACL,OAAO,GAKR,sBAAkB"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/functions/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,SAAS,GAiBV,wBAAoB;AACrB,OAAO,EACL,OAAO,GAOR,uBAAmB;AACpB,OAAO,EACL,OAAO,GAKR,sBAAkB;AACnB,OAAO,EACL,QAAQ,GAMT,uBAAmB"}
@@ -0,0 +1,164 @@
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 Triggers extends APIResource {
5
+ /**
6
+ * Subscribe a function to one or more event types, optionally scoped to specific
7
+ * senders. Provide eventTypes and senderIds (use null in senderIds for all
8
+ * senders); a trigger is created for each event type and sender combination.
9
+ *
10
+ * The special event type `cron` runs the function on a schedule instead of a
11
+ * messaging event: include a `cron` field with a 5-field UTC cron expression
12
+ * (minimum granularity one minute). A cron trigger ignores the sender axis, and a
13
+ * function may hold several cron triggers with different expressions. The function
14
+ * receives an event with `type: "cron"` and `data.cron`.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const trigger = await client.functions.triggers.create(
19
+ * 'functionId',
20
+ * { eventTypes: ['message.inbound'], senderIds: [null] },
21
+ * );
22
+ * ```
23
+ */
24
+ create(functionID: string, body: TriggerCreateParams, options?: RequestOptions): APIPromise<TriggerCreateResponse>;
25
+ /**
26
+ * Enable or disable a trigger
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const trigger = await client.functions.triggers.update(
31
+ * 'triggerId',
32
+ * { active: true },
33
+ * );
34
+ * ```
35
+ */
36
+ update(triggerID: string, body: TriggerUpdateParams, options?: RequestOptions): APIPromise<TriggerUpdateResponse>;
37
+ /**
38
+ * List function triggers
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const triggers = await client.functions.triggers.list(
43
+ * 'functionId',
44
+ * );
45
+ * ```
46
+ */
47
+ list(functionID: string, options?: RequestOptions): APIPromise<TriggerListResponse>;
48
+ /**
49
+ * Delete a trigger
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * await client.functions.triggers.delete('triggerId');
54
+ * ```
55
+ */
56
+ delete(triggerID: string, options?: RequestOptions): APIPromise<void>;
57
+ }
58
+ export interface TriggerCreateResponse {
59
+ added: number;
60
+ /**
61
+ * Number of triggers that already existed.
62
+ */
63
+ skipped: number;
64
+ triggers: Array<TriggerCreateResponse.Trigger>;
65
+ }
66
+ export declare namespace TriggerCreateResponse {
67
+ /**
68
+ * A subscription that runs a Zavu Function when a messaging event fires.
69
+ */
70
+ interface Trigger {
71
+ id: string;
72
+ active: boolean;
73
+ createdAt: string;
74
+ /**
75
+ * Event type that fires the function. See GET /v1/functions/event-types for the
76
+ * supported list. The special type `cron` fires on a schedule instead of a
77
+ * messaging event and carries a `cron` expression.
78
+ */
79
+ eventType: string;
80
+ functionId: string;
81
+ updatedAt: string;
82
+ /**
83
+ * 5-field cron expression (minute hour day-of-month month day-of-week), evaluated
84
+ * in UTC. Present only on `cron` triggers.
85
+ */
86
+ cron?: string | null;
87
+ /**
88
+ * Last time the schedule fired. Null until the first fire.
89
+ */
90
+ lastRunAt?: string | null;
91
+ /**
92
+ * Next scheduled fire time. Present only on `cron` triggers.
93
+ */
94
+ nextRunAt?: string | null;
95
+ /**
96
+ * Restrict the trigger to a single sender. Null means all senders in the project.
97
+ */
98
+ senderId?: string | null;
99
+ }
100
+ }
101
+ export interface TriggerUpdateResponse {
102
+ active: boolean;
103
+ ok: boolean;
104
+ }
105
+ export interface TriggerListResponse {
106
+ triggers: Array<TriggerListResponse.Trigger>;
107
+ }
108
+ export declare namespace TriggerListResponse {
109
+ /**
110
+ * A subscription that runs a Zavu Function when a messaging event fires.
111
+ */
112
+ interface Trigger {
113
+ id: string;
114
+ active: boolean;
115
+ createdAt: string;
116
+ /**
117
+ * Event type that fires the function. See GET /v1/functions/event-types for the
118
+ * supported list. The special type `cron` fires on a schedule instead of a
119
+ * messaging event and carries a `cron` expression.
120
+ */
121
+ eventType: string;
122
+ functionId: string;
123
+ updatedAt: string;
124
+ /**
125
+ * 5-field cron expression (minute hour day-of-month month day-of-week), evaluated
126
+ * in UTC. Present only on `cron` triggers.
127
+ */
128
+ cron?: string | null;
129
+ /**
130
+ * Last time the schedule fired. Null until the first fire.
131
+ */
132
+ lastRunAt?: string | null;
133
+ /**
134
+ * Next scheduled fire time. Present only on `cron` triggers.
135
+ */
136
+ nextRunAt?: string | null;
137
+ /**
138
+ * Restrict the trigger to a single sender. Null means all senders in the project.
139
+ */
140
+ senderId?: string | null;
141
+ }
142
+ }
143
+ export interface TriggerCreateParams {
144
+ /**
145
+ * Event types to subscribe to.
146
+ */
147
+ eventTypes: Array<string>;
148
+ /**
149
+ * Senders to scope the triggers to. Use null for all senders.
150
+ */
151
+ senderIds: Array<string | null>;
152
+ /**
153
+ * Required when eventTypes includes `cron`: a 5-field cron expression (minute hour
154
+ * day-of-month month day-of-week), evaluated in UTC.
155
+ */
156
+ cron?: string;
157
+ }
158
+ export interface TriggerUpdateParams {
159
+ active: boolean;
160
+ }
161
+ export declare namespace Triggers {
162
+ export { type TriggerCreateResponse as TriggerCreateResponse, type TriggerUpdateResponse as TriggerUpdateResponse, type TriggerListResponse as TriggerListResponse, type TriggerCreateParams as TriggerCreateParams, type TriggerUpdateParams as TriggerUpdateParams, };
163
+ }
164
+ //# sourceMappingURL=triggers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.mts","sourceRoot":"","sources":["../../src/resources/functions/triggers.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,164 @@
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 Triggers extends APIResource {
5
+ /**
6
+ * Subscribe a function to one or more event types, optionally scoped to specific
7
+ * senders. Provide eventTypes and senderIds (use null in senderIds for all
8
+ * senders); a trigger is created for each event type and sender combination.
9
+ *
10
+ * The special event type `cron` runs the function on a schedule instead of a
11
+ * messaging event: include a `cron` field with a 5-field UTC cron expression
12
+ * (minimum granularity one minute). A cron trigger ignores the sender axis, and a
13
+ * function may hold several cron triggers with different expressions. The function
14
+ * receives an event with `type: "cron"` and `data.cron`.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const trigger = await client.functions.triggers.create(
19
+ * 'functionId',
20
+ * { eventTypes: ['message.inbound'], senderIds: [null] },
21
+ * );
22
+ * ```
23
+ */
24
+ create(functionID: string, body: TriggerCreateParams, options?: RequestOptions): APIPromise<TriggerCreateResponse>;
25
+ /**
26
+ * Enable or disable a trigger
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const trigger = await client.functions.triggers.update(
31
+ * 'triggerId',
32
+ * { active: true },
33
+ * );
34
+ * ```
35
+ */
36
+ update(triggerID: string, body: TriggerUpdateParams, options?: RequestOptions): APIPromise<TriggerUpdateResponse>;
37
+ /**
38
+ * List function triggers
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const triggers = await client.functions.triggers.list(
43
+ * 'functionId',
44
+ * );
45
+ * ```
46
+ */
47
+ list(functionID: string, options?: RequestOptions): APIPromise<TriggerListResponse>;
48
+ /**
49
+ * Delete a trigger
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * await client.functions.triggers.delete('triggerId');
54
+ * ```
55
+ */
56
+ delete(triggerID: string, options?: RequestOptions): APIPromise<void>;
57
+ }
58
+ export interface TriggerCreateResponse {
59
+ added: number;
60
+ /**
61
+ * Number of triggers that already existed.
62
+ */
63
+ skipped: number;
64
+ triggers: Array<TriggerCreateResponse.Trigger>;
65
+ }
66
+ export declare namespace TriggerCreateResponse {
67
+ /**
68
+ * A subscription that runs a Zavu Function when a messaging event fires.
69
+ */
70
+ interface Trigger {
71
+ id: string;
72
+ active: boolean;
73
+ createdAt: string;
74
+ /**
75
+ * Event type that fires the function. See GET /v1/functions/event-types for the
76
+ * supported list. The special type `cron` fires on a schedule instead of a
77
+ * messaging event and carries a `cron` expression.
78
+ */
79
+ eventType: string;
80
+ functionId: string;
81
+ updatedAt: string;
82
+ /**
83
+ * 5-field cron expression (minute hour day-of-month month day-of-week), evaluated
84
+ * in UTC. Present only on `cron` triggers.
85
+ */
86
+ cron?: string | null;
87
+ /**
88
+ * Last time the schedule fired. Null until the first fire.
89
+ */
90
+ lastRunAt?: string | null;
91
+ /**
92
+ * Next scheduled fire time. Present only on `cron` triggers.
93
+ */
94
+ nextRunAt?: string | null;
95
+ /**
96
+ * Restrict the trigger to a single sender. Null means all senders in the project.
97
+ */
98
+ senderId?: string | null;
99
+ }
100
+ }
101
+ export interface TriggerUpdateResponse {
102
+ active: boolean;
103
+ ok: boolean;
104
+ }
105
+ export interface TriggerListResponse {
106
+ triggers: Array<TriggerListResponse.Trigger>;
107
+ }
108
+ export declare namespace TriggerListResponse {
109
+ /**
110
+ * A subscription that runs a Zavu Function when a messaging event fires.
111
+ */
112
+ interface Trigger {
113
+ id: string;
114
+ active: boolean;
115
+ createdAt: string;
116
+ /**
117
+ * Event type that fires the function. See GET /v1/functions/event-types for the
118
+ * supported list. The special type `cron` fires on a schedule instead of a
119
+ * messaging event and carries a `cron` expression.
120
+ */
121
+ eventType: string;
122
+ functionId: string;
123
+ updatedAt: string;
124
+ /**
125
+ * 5-field cron expression (minute hour day-of-month month day-of-week), evaluated
126
+ * in UTC. Present only on `cron` triggers.
127
+ */
128
+ cron?: string | null;
129
+ /**
130
+ * Last time the schedule fired. Null until the first fire.
131
+ */
132
+ lastRunAt?: string | null;
133
+ /**
134
+ * Next scheduled fire time. Present only on `cron` triggers.
135
+ */
136
+ nextRunAt?: string | null;
137
+ /**
138
+ * Restrict the trigger to a single sender. Null means all senders in the project.
139
+ */
140
+ senderId?: string | null;
141
+ }
142
+ }
143
+ export interface TriggerCreateParams {
144
+ /**
145
+ * Event types to subscribe to.
146
+ */
147
+ eventTypes: Array<string>;
148
+ /**
149
+ * Senders to scope the triggers to. Use null for all senders.
150
+ */
151
+ senderIds: Array<string | null>;
152
+ /**
153
+ * Required when eventTypes includes `cron`: a 5-field cron expression (minute hour
154
+ * day-of-month month day-of-week), evaluated in UTC.
155
+ */
156
+ cron?: string;
157
+ }
158
+ export interface TriggerUpdateParams {
159
+ active: boolean;
160
+ }
161
+ export declare namespace Triggers {
162
+ export { type TriggerCreateResponse as TriggerCreateResponse, type TriggerUpdateResponse as TriggerUpdateResponse, type TriggerListResponse as TriggerListResponse, type TriggerCreateParams as TriggerCreateParams, type TriggerUpdateParams as TriggerUpdateParams, };
163
+ }
164
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/resources/functions/triggers.ts"],"names":[],"mappings":"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"}