node-appwrite 12.0.0 → 12.1.0-rc.4

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/.travis.yml +18 -8
  2. package/dist/client.d.mts +131 -0
  3. package/dist/client.d.ts +131 -0
  4. package/dist/client.js +302 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/client.mjs +295 -0
  7. package/dist/client.mjs.map +1 -0
  8. package/dist/enums/authentication-factor.d.mts +8 -0
  9. package/dist/enums/authentication-factor.d.ts +8 -0
  10. package/dist/enums/authentication-factor.js +13 -0
  11. package/dist/enums/authentication-factor.js.map +1 -0
  12. package/dist/enums/authentication-factor.mjs +11 -0
  13. package/dist/enums/authentication-factor.mjs.map +1 -0
  14. package/dist/enums/authenticator-type.d.mts +5 -0
  15. package/dist/enums/authenticator-type.d.ts +5 -0
  16. package/dist/enums/authenticator-type.js +10 -0
  17. package/dist/enums/authenticator-type.js.map +1 -0
  18. package/dist/enums/authenticator-type.mjs +8 -0
  19. package/dist/enums/authenticator-type.mjs.map +1 -0
  20. package/dist/enums/browser.d.mts +18 -0
  21. package/dist/enums/browser.d.ts +18 -0
  22. package/dist/enums/browser.js +23 -0
  23. package/dist/enums/browser.js.map +1 -0
  24. package/dist/enums/browser.mjs +21 -0
  25. package/dist/enums/browser.mjs.map +1 -0
  26. package/dist/enums/compression.d.mts +7 -0
  27. package/dist/enums/compression.d.ts +7 -0
  28. package/dist/enums/compression.js +12 -0
  29. package/dist/enums/compression.js.map +1 -0
  30. package/dist/enums/compression.mjs +10 -0
  31. package/dist/enums/compression.mjs.map +1 -0
  32. package/dist/enums/credit-card.d.mts +20 -0
  33. package/dist/enums/credit-card.d.ts +20 -0
  34. package/dist/enums/credit-card.js +25 -0
  35. package/dist/enums/credit-card.js.map +1 -0
  36. package/dist/enums/credit-card.mjs +23 -0
  37. package/dist/enums/credit-card.mjs.map +1 -0
  38. package/dist/enums/execution-method.d.mts +10 -0
  39. package/dist/enums/execution-method.d.ts +10 -0
  40. package/dist/enums/execution-method.js +15 -0
  41. package/dist/enums/execution-method.js.map +1 -0
  42. package/dist/enums/execution-method.mjs +13 -0
  43. package/dist/enums/execution-method.mjs.map +1 -0
  44. package/dist/enums/flag.d.mts +198 -0
  45. package/dist/enums/flag.d.ts +198 -0
  46. package/dist/enums/flag.js +203 -0
  47. package/dist/enums/flag.js.map +1 -0
  48. package/dist/enums/flag.mjs +201 -0
  49. package/dist/enums/flag.mjs.map +1 -0
  50. package/dist/enums/image-format.d.mts +9 -0
  51. package/dist/enums/image-format.d.ts +9 -0
  52. package/dist/enums/image-format.js +14 -0
  53. package/dist/enums/image-format.js.map +1 -0
  54. package/dist/enums/image-format.mjs +12 -0
  55. package/dist/enums/image-format.mjs.map +1 -0
  56. package/dist/enums/image-gravity.d.mts +13 -0
  57. package/dist/enums/image-gravity.d.ts +13 -0
  58. package/dist/enums/image-gravity.js +18 -0
  59. package/dist/enums/image-gravity.js.map +1 -0
  60. package/dist/enums/image-gravity.mjs +16 -0
  61. package/dist/enums/image-gravity.mjs.map +1 -0
  62. package/dist/enums/index-type.d.mts +7 -0
  63. package/dist/enums/index-type.d.ts +7 -0
  64. package/dist/enums/index-type.js +12 -0
  65. package/dist/enums/index-type.js.map +1 -0
  66. package/dist/enums/index-type.mjs +10 -0
  67. package/dist/enums/index-type.mjs.map +1 -0
  68. package/dist/enums/messaging-provider-type.d.mts +7 -0
  69. package/dist/enums/messaging-provider-type.d.ts +7 -0
  70. package/dist/enums/messaging-provider-type.js +12 -0
  71. package/dist/enums/messaging-provider-type.js.map +1 -0
  72. package/dist/enums/messaging-provider-type.mjs +10 -0
  73. package/dist/enums/messaging-provider-type.mjs.map +1 -0
  74. package/dist/enums/name.d.mts +17 -0
  75. package/dist/enums/name.d.ts +17 -0
  76. package/dist/enums/name.js +22 -0
  77. package/dist/enums/name.js.map +1 -0
  78. package/dist/enums/name.mjs +20 -0
  79. package/dist/enums/name.mjs.map +1 -0
  80. package/dist/enums/o-auth-provider.d.mts +43 -0
  81. package/dist/enums/o-auth-provider.d.ts +43 -0
  82. package/dist/enums/o-auth-provider.js +48 -0
  83. package/dist/enums/o-auth-provider.js.map +1 -0
  84. package/dist/enums/o-auth-provider.mjs +46 -0
  85. package/dist/enums/o-auth-provider.mjs.map +1 -0
  86. package/dist/enums/password-hash.d.mts +15 -0
  87. package/dist/enums/password-hash.d.ts +15 -0
  88. package/dist/enums/password-hash.js +20 -0
  89. package/dist/enums/password-hash.js.map +1 -0
  90. package/dist/enums/password-hash.mjs +18 -0
  91. package/dist/enums/password-hash.mjs.map +1 -0
  92. package/dist/enums/relation-mutate.d.mts +7 -0
  93. package/dist/enums/relation-mutate.d.ts +7 -0
  94. package/dist/enums/relation-mutate.js +12 -0
  95. package/dist/enums/relation-mutate.js.map +1 -0
  96. package/dist/enums/relation-mutate.mjs +10 -0
  97. package/dist/enums/relation-mutate.mjs.map +1 -0
  98. package/dist/enums/relationship-type.d.mts +8 -0
  99. package/dist/enums/relationship-type.d.ts +8 -0
  100. package/dist/enums/relationship-type.js +13 -0
  101. package/dist/enums/relationship-type.js.map +1 -0
  102. package/dist/enums/relationship-type.mjs +11 -0
  103. package/dist/enums/relationship-type.mjs.map +1 -0
  104. package/dist/enums/runtime.d.mts +48 -0
  105. package/dist/enums/runtime.d.ts +48 -0
  106. package/dist/enums/runtime.js +53 -0
  107. package/dist/enums/runtime.js.map +1 -0
  108. package/dist/enums/runtime.mjs +51 -0
  109. package/dist/enums/runtime.mjs.map +1 -0
  110. package/dist/enums/smtp-encryption.d.mts +7 -0
  111. package/dist/enums/smtp-encryption.d.ts +7 -0
  112. package/dist/enums/smtp-encryption.js +12 -0
  113. package/dist/enums/smtp-encryption.js.map +1 -0
  114. package/dist/enums/smtp-encryption.mjs +10 -0
  115. package/dist/enums/smtp-encryption.mjs.map +1 -0
  116. package/dist/id.d.mts +7 -0
  117. package/dist/id.d.ts +7 -0
  118. package/dist/id.js +29 -0
  119. package/dist/id.js.map +1 -0
  120. package/dist/id.mjs +27 -0
  121. package/dist/id.mjs.map +1 -0
  122. package/dist/index.d.mts +35 -0
  123. package/dist/index.d.ts +35 -0
  124. package/dist/index.js +180 -0
  125. package/dist/index.js.map +1 -0
  126. package/dist/index.mjs +35 -0
  127. package/dist/index.mjs.map +1 -0
  128. package/dist/inputFile.d.mts +9 -0
  129. package/dist/inputFile.d.ts +9 -0
  130. package/dist/inputFile.js +23 -0
  131. package/dist/inputFile.js.map +1 -0
  132. package/dist/inputFile.mjs +21 -0
  133. package/dist/inputFile.mjs.map +1 -0
  134. package/dist/models.d.mts +2406 -0
  135. package/dist/models.d.ts +2406 -0
  136. package/dist/models.js +4 -0
  137. package/dist/models.js.map +1 -0
  138. package/dist/models.mjs +3 -0
  139. package/dist/models.mjs.map +1 -0
  140. package/dist/permission.d.mts +9 -0
  141. package/dist/permission.d.ts +9 -0
  142. package/dist/permission.js +23 -0
  143. package/dist/permission.js.map +1 -0
  144. package/dist/permission.mjs +21 -0
  145. package/dist/permission.mjs.map +1 -0
  146. package/dist/query.d.mts +35 -0
  147. package/dist/query.d.ts +35 -0
  148. package/dist/query.js +49 -0
  149. package/dist/query.js.map +1 -0
  150. package/dist/query.mjs +47 -0
  151. package/dist/query.mjs.map +1 -0
  152. package/dist/role.d.mts +72 -0
  153. package/dist/role.d.ts +72 -0
  154. package/dist/role.js +96 -0
  155. package/dist/role.js.map +1 -0
  156. package/dist/role.mjs +94 -0
  157. package/dist/role.mjs.map +1 -0
  158. package/dist/services/account.d.mts +478 -0
  159. package/dist/services/account.d.ts +478 -0
  160. package/dist/services/account.js +1331 -0
  161. package/dist/services/account.js.map +1 -0
  162. package/dist/services/account.mjs +1329 -0
  163. package/dist/services/account.mjs.map +1 -0
  164. package/dist/services/avatars.d.mts +118 -0
  165. package/dist/services/avatars.d.ts +118 -0
  166. package/dist/services/avatars.js +297 -0
  167. package/dist/services/avatars.js.map +1 -0
  168. package/dist/services/avatars.mjs +295 -0
  169. package/dist/services/avatars.mjs.map +1 -0
  170. package/dist/services/databases.d.mts +606 -0
  171. package/dist/services/databases.d.ts +606 -0
  172. package/dist/services/databases.js +1908 -0
  173. package/dist/services/databases.js.map +1 -0
  174. package/dist/services/databases.mjs +1906 -0
  175. package/dist/services/databases.mjs.map +1 -0
  176. package/dist/services/functions.d.mts +287 -0
  177. package/dist/services/functions.d.ts +287 -0
  178. package/dist/services/functions.js +837 -0
  179. package/dist/services/functions.js.map +1 -0
  180. package/dist/services/functions.mjs +835 -0
  181. package/dist/services/functions.mjs.map +1 -0
  182. package/dist/services/graphql.d.mts +30 -0
  183. package/dist/services/graphql.d.ts +30 -0
  184. package/dist/services/graphql.js +73 -0
  185. package/dist/services/graphql.js.map +1 -0
  186. package/dist/services/graphql.mjs +71 -0
  187. package/dist/services/graphql.mjs.map +1 -0
  188. package/dist/services/health.d.mts +235 -0
  189. package/dist/services/health.d.ts +235 -0
  190. package/dist/services/health.js +584 -0
  191. package/dist/services/health.js.map +1 -0
  192. package/dist/services/health.mjs +582 -0
  193. package/dist/services/health.mjs.map +1 -0
  194. package/dist/services/locale.d.mts +84 -0
  195. package/dist/services/locale.d.ts +84 -0
  196. package/dist/services/locale.js +189 -0
  197. package/dist/services/locale.js.map +1 -0
  198. package/dist/services/locale.mjs +187 -0
  199. package/dist/services/locale.mjs.map +1 -0
  200. package/dist/services/messaging.d.mts +688 -0
  201. package/dist/services/messaging.d.ts +688 -0
  202. package/dist/services/messaging.js +2152 -0
  203. package/dist/services/messaging.js.map +1 -0
  204. package/dist/services/messaging.mjs +2150 -0
  205. package/dist/services/messaging.mjs.map +1 -0
  206. package/dist/services/storage.d.mts +193 -0
  207. package/dist/services/storage.d.ts +193 -0
  208. package/dist/services/storage.js +550 -0
  209. package/dist/services/storage.js.map +1 -0
  210. package/dist/services/storage.mjs +548 -0
  211. package/dist/services/storage.mjs.map +1 -0
  212. package/dist/services/teams.d.mts +171 -0
  213. package/dist/services/teams.d.ts +171 -0
  214. package/dist/services/teams.js +466 -0
  215. package/dist/services/teams.js.map +1 -0
  216. package/dist/services/teams.mjs +464 -0
  217. package/dist/services/teams.mjs.map +1 -0
  218. package/dist/services/users.d.mts +490 -0
  219. package/dist/services/users.d.ts +490 -0
  220. package/dist/services/users.js +1464 -0
  221. package/dist/services/users.js.map +1 -0
  222. package/dist/services/users.mjs +1462 -0
  223. package/dist/services/users.mjs.map +1 -0
  224. package/docs/examples/functions/create-deployment.md +1 -1
  225. package/docs/examples/storage/create-file.md +1 -1
  226. package/package.json +35 -5
  227. package/src/client.ts +366 -0
  228. package/src/enums/authentication-factor.ts +6 -0
  229. package/src/enums/authenticator-type.ts +3 -0
  230. package/src/enums/browser.ts +16 -0
  231. package/src/enums/compression.ts +5 -0
  232. package/src/enums/credit-card.ts +18 -0
  233. package/src/enums/execution-method.ts +8 -0
  234. package/src/enums/flag.ts +196 -0
  235. package/src/enums/image-format.ts +7 -0
  236. package/src/enums/image-gravity.ts +11 -0
  237. package/src/enums/index-type.ts +5 -0
  238. package/src/enums/messaging-provider-type.ts +5 -0
  239. package/src/enums/name.ts +15 -0
  240. package/src/enums/o-auth-provider.ts +41 -0
  241. package/src/enums/password-hash.ts +13 -0
  242. package/src/enums/relation-mutate.ts +5 -0
  243. package/src/enums/relationship-type.ts +6 -0
  244. package/src/enums/runtime.ts +46 -0
  245. package/src/enums/smtp-encryption.ts +5 -0
  246. package/src/id.ts +28 -0
  247. package/src/index.ts +35 -0
  248. package/src/inputFile.ts +23 -0
  249. package/src/models.ts +2404 -0
  250. package/src/permission.ts +22 -0
  251. package/src/query.ts +101 -0
  252. package/{lib/role.js → src/role.ts} +23 -25
  253. package/src/services/account.ts +1418 -0
  254. package/src/services/avatars.ts +312 -0
  255. package/{lib/services/databases.js → src/services/databases.ts} +644 -638
  256. package/{lib/services/functions.js → src/services/functions.ts} +317 -369
  257. package/{lib/services/graphql.js → src/services/graphql.ts} +35 -34
  258. package/src/services/health.ts +629 -0
  259. package/src/services/locale.ts +205 -0
  260. package/{lib/services/messaging.js → src/services/messaging.ts} +658 -633
  261. package/{lib/services/storage.js → src/services/storage.ts} +211 -298
  262. package/{lib/services/teams.js → src/services/teams.ts} +211 -200
  263. package/{lib/services/users.js → src/services/users.ts} +603 -519
  264. package/tsconfig.json +18 -0
  265. package/tsup.config.js +19 -0
  266. package/index.d.ts +0 -6656
  267. package/index.js +0 -75
  268. package/lib/client.js +0 -245
  269. package/lib/enums/authentication-factor.js +0 -8
  270. package/lib/enums/authenticator-type.js +0 -5
  271. package/lib/enums/browser.js +0 -18
  272. package/lib/enums/compression.js +0 -7
  273. package/lib/enums/credit-card.js +0 -20
  274. package/lib/enums/execution-method.js +0 -10
  275. package/lib/enums/flag.js +0 -198
  276. package/lib/enums/image-format.js +0 -9
  277. package/lib/enums/image-gravity.js +0 -13
  278. package/lib/enums/index-type.js +0 -7
  279. package/lib/enums/messaging-provider-type.js +0 -7
  280. package/lib/enums/name.js +0 -17
  281. package/lib/enums/o-auth-provider.js +0 -43
  282. package/lib/enums/password-hash.js +0 -15
  283. package/lib/enums/relation-mutate.js +0 -7
  284. package/lib/enums/relationship-type.js +0 -8
  285. package/lib/enums/runtime.js +0 -48
  286. package/lib/enums/smtp-encryption.js +0 -7
  287. package/lib/exception.js +0 -10
  288. package/lib/id.js +0 -12
  289. package/lib/inputFile.js +0 -117
  290. package/lib/permission.js +0 -24
  291. package/lib/query.js +0 -90
  292. package/lib/service.js +0 -10
  293. package/lib/services/account.js +0 -1365
  294. package/lib/services/avatars.js +0 -325
  295. package/lib/services/health.js +0 -513
  296. package/lib/services/locale.js +0 -169
@@ -0,0 +1,2152 @@
1
+ 'use strict';
2
+
3
+ var client = require('../client');
4
+
5
+ class Messaging {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * List messages
11
+ *
12
+ * Get a list of all messages from the current Appwrite project.
13
+ *
14
+ * @param {string[]} queries
15
+ * @param {string} search
16
+ * @throws {AppwriteException}
17
+ * @returns {Promise<Models.MessageList>}
18
+ */
19
+ async listMessages(queries, search) {
20
+ const apiPath = "/messaging/messages";
21
+ const payload = {};
22
+ if (typeof queries !== "undefined") {
23
+ payload["queries"] = queries;
24
+ }
25
+ if (typeof search !== "undefined") {
26
+ payload["search"] = search;
27
+ }
28
+ const uri = new URL(this.client.config.endpoint + apiPath);
29
+ const apiHeaders = {
30
+ "content-type": "application/json"
31
+ };
32
+ return await this.client.call(
33
+ "get",
34
+ uri,
35
+ apiHeaders,
36
+ payload
37
+ );
38
+ }
39
+ /**
40
+ * Create email
41
+ *
42
+ * Create a new email message.
43
+ *
44
+ * @param {string} messageId
45
+ * @param {string} subject
46
+ * @param {string} content
47
+ * @param {string[]} topics
48
+ * @param {string[]} users
49
+ * @param {string[]} targets
50
+ * @param {string[]} cc
51
+ * @param {string[]} bcc
52
+ * @param {string[]} attachments
53
+ * @param {boolean} draft
54
+ * @param {boolean} html
55
+ * @param {string} scheduledAt
56
+ * @throws {AppwriteException}
57
+ * @returns {Promise<Models.Message>}
58
+ */
59
+ async createEmail(messageId, subject, content, topics, users, targets, cc, bcc, attachments, draft, html, scheduledAt) {
60
+ if (typeof messageId === "undefined") {
61
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
62
+ }
63
+ if (typeof subject === "undefined") {
64
+ throw new client.AppwriteException('Missing required parameter: "subject"');
65
+ }
66
+ if (typeof content === "undefined") {
67
+ throw new client.AppwriteException('Missing required parameter: "content"');
68
+ }
69
+ const apiPath = "/messaging/messages/email";
70
+ const payload = {};
71
+ if (typeof messageId !== "undefined") {
72
+ payload["messageId"] = messageId;
73
+ }
74
+ if (typeof subject !== "undefined") {
75
+ payload["subject"] = subject;
76
+ }
77
+ if (typeof content !== "undefined") {
78
+ payload["content"] = content;
79
+ }
80
+ if (typeof topics !== "undefined") {
81
+ payload["topics"] = topics;
82
+ }
83
+ if (typeof users !== "undefined") {
84
+ payload["users"] = users;
85
+ }
86
+ if (typeof targets !== "undefined") {
87
+ payload["targets"] = targets;
88
+ }
89
+ if (typeof cc !== "undefined") {
90
+ payload["cc"] = cc;
91
+ }
92
+ if (typeof bcc !== "undefined") {
93
+ payload["bcc"] = bcc;
94
+ }
95
+ if (typeof attachments !== "undefined") {
96
+ payload["attachments"] = attachments;
97
+ }
98
+ if (typeof draft !== "undefined") {
99
+ payload["draft"] = draft;
100
+ }
101
+ if (typeof html !== "undefined") {
102
+ payload["html"] = html;
103
+ }
104
+ if (typeof scheduledAt !== "undefined") {
105
+ payload["scheduledAt"] = scheduledAt;
106
+ }
107
+ const uri = new URL(this.client.config.endpoint + apiPath);
108
+ const apiHeaders = {
109
+ "content-type": "application/json"
110
+ };
111
+ return await this.client.call(
112
+ "post",
113
+ uri,
114
+ apiHeaders,
115
+ payload
116
+ );
117
+ }
118
+ /**
119
+ * Update email
120
+ *
121
+ * Update an email message by its unique ID.
122
+
123
+ *
124
+ * @param {string} messageId
125
+ * @param {string[]} topics
126
+ * @param {string[]} users
127
+ * @param {string[]} targets
128
+ * @param {string} subject
129
+ * @param {string} content
130
+ * @param {boolean} draft
131
+ * @param {boolean} html
132
+ * @param {string[]} cc
133
+ * @param {string[]} bcc
134
+ * @param {string} scheduledAt
135
+ * @throws {AppwriteException}
136
+ * @returns {Promise<Models.Message>}
137
+ */
138
+ async updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt) {
139
+ if (typeof messageId === "undefined") {
140
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
141
+ }
142
+ const apiPath = "/messaging/messages/email/{messageId}".replace("{messageId}", messageId);
143
+ const payload = {};
144
+ if (typeof topics !== "undefined") {
145
+ payload["topics"] = topics;
146
+ }
147
+ if (typeof users !== "undefined") {
148
+ payload["users"] = users;
149
+ }
150
+ if (typeof targets !== "undefined") {
151
+ payload["targets"] = targets;
152
+ }
153
+ if (typeof subject !== "undefined") {
154
+ payload["subject"] = subject;
155
+ }
156
+ if (typeof content !== "undefined") {
157
+ payload["content"] = content;
158
+ }
159
+ if (typeof draft !== "undefined") {
160
+ payload["draft"] = draft;
161
+ }
162
+ if (typeof html !== "undefined") {
163
+ payload["html"] = html;
164
+ }
165
+ if (typeof cc !== "undefined") {
166
+ payload["cc"] = cc;
167
+ }
168
+ if (typeof bcc !== "undefined") {
169
+ payload["bcc"] = bcc;
170
+ }
171
+ if (typeof scheduledAt !== "undefined") {
172
+ payload["scheduledAt"] = scheduledAt;
173
+ }
174
+ const uri = new URL(this.client.config.endpoint + apiPath);
175
+ const apiHeaders = {
176
+ "content-type": "application/json"
177
+ };
178
+ return await this.client.call(
179
+ "patch",
180
+ uri,
181
+ apiHeaders,
182
+ payload
183
+ );
184
+ }
185
+ /**
186
+ * Create push notification
187
+ *
188
+ * Create a new push notification.
189
+ *
190
+ * @param {string} messageId
191
+ * @param {string} title
192
+ * @param {string} body
193
+ * @param {string[]} topics
194
+ * @param {string[]} users
195
+ * @param {string[]} targets
196
+ * @param {object} data
197
+ * @param {string} action
198
+ * @param {string} image
199
+ * @param {string} icon
200
+ * @param {string} sound
201
+ * @param {string} color
202
+ * @param {string} tag
203
+ * @param {string} badge
204
+ * @param {boolean} draft
205
+ * @param {string} scheduledAt
206
+ * @throws {AppwriteException}
207
+ * @returns {Promise<Models.Message>}
208
+ */
209
+ async createPush(messageId, title, body, topics, users, targets, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt) {
210
+ if (typeof messageId === "undefined") {
211
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
212
+ }
213
+ if (typeof title === "undefined") {
214
+ throw new client.AppwriteException('Missing required parameter: "title"');
215
+ }
216
+ if (typeof body === "undefined") {
217
+ throw new client.AppwriteException('Missing required parameter: "body"');
218
+ }
219
+ const apiPath = "/messaging/messages/push";
220
+ const payload = {};
221
+ if (typeof messageId !== "undefined") {
222
+ payload["messageId"] = messageId;
223
+ }
224
+ if (typeof title !== "undefined") {
225
+ payload["title"] = title;
226
+ }
227
+ if (typeof body !== "undefined") {
228
+ payload["body"] = body;
229
+ }
230
+ if (typeof topics !== "undefined") {
231
+ payload["topics"] = topics;
232
+ }
233
+ if (typeof users !== "undefined") {
234
+ payload["users"] = users;
235
+ }
236
+ if (typeof targets !== "undefined") {
237
+ payload["targets"] = targets;
238
+ }
239
+ if (typeof data !== "undefined") {
240
+ payload["data"] = data;
241
+ }
242
+ if (typeof action !== "undefined") {
243
+ payload["action"] = action;
244
+ }
245
+ if (typeof image !== "undefined") {
246
+ payload["image"] = image;
247
+ }
248
+ if (typeof icon !== "undefined") {
249
+ payload["icon"] = icon;
250
+ }
251
+ if (typeof sound !== "undefined") {
252
+ payload["sound"] = sound;
253
+ }
254
+ if (typeof color !== "undefined") {
255
+ payload["color"] = color;
256
+ }
257
+ if (typeof tag !== "undefined") {
258
+ payload["tag"] = tag;
259
+ }
260
+ if (typeof badge !== "undefined") {
261
+ payload["badge"] = badge;
262
+ }
263
+ if (typeof draft !== "undefined") {
264
+ payload["draft"] = draft;
265
+ }
266
+ if (typeof scheduledAt !== "undefined") {
267
+ payload["scheduledAt"] = scheduledAt;
268
+ }
269
+ const uri = new URL(this.client.config.endpoint + apiPath);
270
+ const apiHeaders = {
271
+ "content-type": "application/json"
272
+ };
273
+ return await this.client.call(
274
+ "post",
275
+ uri,
276
+ apiHeaders,
277
+ payload
278
+ );
279
+ }
280
+ /**
281
+ * Update push notification
282
+ *
283
+ * Update a push notification by its unique ID.
284
+
285
+ *
286
+ * @param {string} messageId
287
+ * @param {string[]} topics
288
+ * @param {string[]} users
289
+ * @param {string[]} targets
290
+ * @param {string} title
291
+ * @param {string} body
292
+ * @param {object} data
293
+ * @param {string} action
294
+ * @param {string} image
295
+ * @param {string} icon
296
+ * @param {string} sound
297
+ * @param {string} color
298
+ * @param {string} tag
299
+ * @param {number} badge
300
+ * @param {boolean} draft
301
+ * @param {string} scheduledAt
302
+ * @throws {AppwriteException}
303
+ * @returns {Promise<Models.Message>}
304
+ */
305
+ async updatePush(messageId, topics, users, targets, title, body, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt) {
306
+ if (typeof messageId === "undefined") {
307
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
308
+ }
309
+ const apiPath = "/messaging/messages/push/{messageId}".replace("{messageId}", messageId);
310
+ const payload = {};
311
+ if (typeof topics !== "undefined") {
312
+ payload["topics"] = topics;
313
+ }
314
+ if (typeof users !== "undefined") {
315
+ payload["users"] = users;
316
+ }
317
+ if (typeof targets !== "undefined") {
318
+ payload["targets"] = targets;
319
+ }
320
+ if (typeof title !== "undefined") {
321
+ payload["title"] = title;
322
+ }
323
+ if (typeof body !== "undefined") {
324
+ payload["body"] = body;
325
+ }
326
+ if (typeof data !== "undefined") {
327
+ payload["data"] = data;
328
+ }
329
+ if (typeof action !== "undefined") {
330
+ payload["action"] = action;
331
+ }
332
+ if (typeof image !== "undefined") {
333
+ payload["image"] = image;
334
+ }
335
+ if (typeof icon !== "undefined") {
336
+ payload["icon"] = icon;
337
+ }
338
+ if (typeof sound !== "undefined") {
339
+ payload["sound"] = sound;
340
+ }
341
+ if (typeof color !== "undefined") {
342
+ payload["color"] = color;
343
+ }
344
+ if (typeof tag !== "undefined") {
345
+ payload["tag"] = tag;
346
+ }
347
+ if (typeof badge !== "undefined") {
348
+ payload["badge"] = badge;
349
+ }
350
+ if (typeof draft !== "undefined") {
351
+ payload["draft"] = draft;
352
+ }
353
+ if (typeof scheduledAt !== "undefined") {
354
+ payload["scheduledAt"] = scheduledAt;
355
+ }
356
+ const uri = new URL(this.client.config.endpoint + apiPath);
357
+ const apiHeaders = {
358
+ "content-type": "application/json"
359
+ };
360
+ return await this.client.call(
361
+ "patch",
362
+ uri,
363
+ apiHeaders,
364
+ payload
365
+ );
366
+ }
367
+ /**
368
+ * Create SMS
369
+ *
370
+ * Create a new SMS message.
371
+ *
372
+ * @param {string} messageId
373
+ * @param {string} content
374
+ * @param {string[]} topics
375
+ * @param {string[]} users
376
+ * @param {string[]} targets
377
+ * @param {boolean} draft
378
+ * @param {string} scheduledAt
379
+ * @throws {AppwriteException}
380
+ * @returns {Promise<Models.Message>}
381
+ */
382
+ async createSms(messageId, content, topics, users, targets, draft, scheduledAt) {
383
+ if (typeof messageId === "undefined") {
384
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
385
+ }
386
+ if (typeof content === "undefined") {
387
+ throw new client.AppwriteException('Missing required parameter: "content"');
388
+ }
389
+ const apiPath = "/messaging/messages/sms";
390
+ const payload = {};
391
+ if (typeof messageId !== "undefined") {
392
+ payload["messageId"] = messageId;
393
+ }
394
+ if (typeof content !== "undefined") {
395
+ payload["content"] = content;
396
+ }
397
+ if (typeof topics !== "undefined") {
398
+ payload["topics"] = topics;
399
+ }
400
+ if (typeof users !== "undefined") {
401
+ payload["users"] = users;
402
+ }
403
+ if (typeof targets !== "undefined") {
404
+ payload["targets"] = targets;
405
+ }
406
+ if (typeof draft !== "undefined") {
407
+ payload["draft"] = draft;
408
+ }
409
+ if (typeof scheduledAt !== "undefined") {
410
+ payload["scheduledAt"] = scheduledAt;
411
+ }
412
+ const uri = new URL(this.client.config.endpoint + apiPath);
413
+ const apiHeaders = {
414
+ "content-type": "application/json"
415
+ };
416
+ return await this.client.call(
417
+ "post",
418
+ uri,
419
+ apiHeaders,
420
+ payload
421
+ );
422
+ }
423
+ /**
424
+ * Update SMS
425
+ *
426
+ * Update an email message by its unique ID.
427
+
428
+ *
429
+ * @param {string} messageId
430
+ * @param {string[]} topics
431
+ * @param {string[]} users
432
+ * @param {string[]} targets
433
+ * @param {string} content
434
+ * @param {boolean} draft
435
+ * @param {string} scheduledAt
436
+ * @throws {AppwriteException}
437
+ * @returns {Promise<Models.Message>}
438
+ */
439
+ async updateSms(messageId, topics, users, targets, content, draft, scheduledAt) {
440
+ if (typeof messageId === "undefined") {
441
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
442
+ }
443
+ const apiPath = "/messaging/messages/sms/{messageId}".replace("{messageId}", messageId);
444
+ const payload = {};
445
+ if (typeof topics !== "undefined") {
446
+ payload["topics"] = topics;
447
+ }
448
+ if (typeof users !== "undefined") {
449
+ payload["users"] = users;
450
+ }
451
+ if (typeof targets !== "undefined") {
452
+ payload["targets"] = targets;
453
+ }
454
+ if (typeof content !== "undefined") {
455
+ payload["content"] = content;
456
+ }
457
+ if (typeof draft !== "undefined") {
458
+ payload["draft"] = draft;
459
+ }
460
+ if (typeof scheduledAt !== "undefined") {
461
+ payload["scheduledAt"] = scheduledAt;
462
+ }
463
+ const uri = new URL(this.client.config.endpoint + apiPath);
464
+ const apiHeaders = {
465
+ "content-type": "application/json"
466
+ };
467
+ return await this.client.call(
468
+ "patch",
469
+ uri,
470
+ apiHeaders,
471
+ payload
472
+ );
473
+ }
474
+ /**
475
+ * Get message
476
+ *
477
+ * Get a message by its unique ID.
478
+
479
+ *
480
+ * @param {string} messageId
481
+ * @throws {AppwriteException}
482
+ * @returns {Promise<Models.Message>}
483
+ */
484
+ async getMessage(messageId) {
485
+ if (typeof messageId === "undefined") {
486
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
487
+ }
488
+ const apiPath = "/messaging/messages/{messageId}".replace("{messageId}", messageId);
489
+ const payload = {};
490
+ const uri = new URL(this.client.config.endpoint + apiPath);
491
+ const apiHeaders = {
492
+ "content-type": "application/json"
493
+ };
494
+ return await this.client.call(
495
+ "get",
496
+ uri,
497
+ apiHeaders,
498
+ payload
499
+ );
500
+ }
501
+ /**
502
+ * Delete message
503
+ *
504
+ * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message.
505
+ *
506
+ * @param {string} messageId
507
+ * @throws {AppwriteException}
508
+ * @returns {Promise<{}>}
509
+ */
510
+ async delete(messageId) {
511
+ if (typeof messageId === "undefined") {
512
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
513
+ }
514
+ const apiPath = "/messaging/messages/{messageId}".replace("{messageId}", messageId);
515
+ const payload = {};
516
+ const uri = new URL(this.client.config.endpoint + apiPath);
517
+ const apiHeaders = {
518
+ "content-type": "application/json"
519
+ };
520
+ return await this.client.call(
521
+ "delete",
522
+ uri,
523
+ apiHeaders,
524
+ payload
525
+ );
526
+ }
527
+ /**
528
+ * List message logs
529
+ *
530
+ * Get the message activity logs listed by its unique ID.
531
+ *
532
+ * @param {string} messageId
533
+ * @param {string[]} queries
534
+ * @throws {AppwriteException}
535
+ * @returns {Promise<Models.LogList>}
536
+ */
537
+ async listMessageLogs(messageId, queries) {
538
+ if (typeof messageId === "undefined") {
539
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
540
+ }
541
+ const apiPath = "/messaging/messages/{messageId}/logs".replace("{messageId}", messageId);
542
+ const payload = {};
543
+ if (typeof queries !== "undefined") {
544
+ payload["queries"] = queries;
545
+ }
546
+ const uri = new URL(this.client.config.endpoint + apiPath);
547
+ const apiHeaders = {
548
+ "content-type": "application/json"
549
+ };
550
+ return await this.client.call(
551
+ "get",
552
+ uri,
553
+ apiHeaders,
554
+ payload
555
+ );
556
+ }
557
+ /**
558
+ * List message targets
559
+ *
560
+ * Get a list of the targets associated with a message.
561
+ *
562
+ * @param {string} messageId
563
+ * @param {string[]} queries
564
+ * @throws {AppwriteException}
565
+ * @returns {Promise<Models.TargetList>}
566
+ */
567
+ async listTargets(messageId, queries) {
568
+ if (typeof messageId === "undefined") {
569
+ throw new client.AppwriteException('Missing required parameter: "messageId"');
570
+ }
571
+ const apiPath = "/messaging/messages/{messageId}/targets".replace("{messageId}", messageId);
572
+ const payload = {};
573
+ if (typeof queries !== "undefined") {
574
+ payload["queries"] = queries;
575
+ }
576
+ const uri = new URL(this.client.config.endpoint + apiPath);
577
+ const apiHeaders = {
578
+ "content-type": "application/json"
579
+ };
580
+ return await this.client.call(
581
+ "get",
582
+ uri,
583
+ apiHeaders,
584
+ payload
585
+ );
586
+ }
587
+ /**
588
+ * List providers
589
+ *
590
+ * Get a list of all providers from the current Appwrite project.
591
+ *
592
+ * @param {string[]} queries
593
+ * @param {string} search
594
+ * @throws {AppwriteException}
595
+ * @returns {Promise<Models.ProviderList>}
596
+ */
597
+ async listProviders(queries, search) {
598
+ const apiPath = "/messaging/providers";
599
+ const payload = {};
600
+ if (typeof queries !== "undefined") {
601
+ payload["queries"] = queries;
602
+ }
603
+ if (typeof search !== "undefined") {
604
+ payload["search"] = search;
605
+ }
606
+ const uri = new URL(this.client.config.endpoint + apiPath);
607
+ const apiHeaders = {
608
+ "content-type": "application/json"
609
+ };
610
+ return await this.client.call(
611
+ "get",
612
+ uri,
613
+ apiHeaders,
614
+ payload
615
+ );
616
+ }
617
+ /**
618
+ * Create APNS provider
619
+ *
620
+ * Create a new Apple Push Notification service provider.
621
+ *
622
+ * @param {string} providerId
623
+ * @param {string} name
624
+ * @param {string} authKey
625
+ * @param {string} authKeyId
626
+ * @param {string} teamId
627
+ * @param {string} bundleId
628
+ * @param {boolean} sandbox
629
+ * @param {boolean} enabled
630
+ * @throws {AppwriteException}
631
+ * @returns {Promise<Models.Provider>}
632
+ */
633
+ async createApnsProvider(providerId, name, authKey, authKeyId, teamId, bundleId, sandbox, enabled) {
634
+ if (typeof providerId === "undefined") {
635
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
636
+ }
637
+ if (typeof name === "undefined") {
638
+ throw new client.AppwriteException('Missing required parameter: "name"');
639
+ }
640
+ const apiPath = "/messaging/providers/apns";
641
+ const payload = {};
642
+ if (typeof providerId !== "undefined") {
643
+ payload["providerId"] = providerId;
644
+ }
645
+ if (typeof name !== "undefined") {
646
+ payload["name"] = name;
647
+ }
648
+ if (typeof authKey !== "undefined") {
649
+ payload["authKey"] = authKey;
650
+ }
651
+ if (typeof authKeyId !== "undefined") {
652
+ payload["authKeyId"] = authKeyId;
653
+ }
654
+ if (typeof teamId !== "undefined") {
655
+ payload["teamId"] = teamId;
656
+ }
657
+ if (typeof bundleId !== "undefined") {
658
+ payload["bundleId"] = bundleId;
659
+ }
660
+ if (typeof sandbox !== "undefined") {
661
+ payload["sandbox"] = sandbox;
662
+ }
663
+ if (typeof enabled !== "undefined") {
664
+ payload["enabled"] = enabled;
665
+ }
666
+ const uri = new URL(this.client.config.endpoint + apiPath);
667
+ const apiHeaders = {
668
+ "content-type": "application/json"
669
+ };
670
+ return await this.client.call(
671
+ "post",
672
+ uri,
673
+ apiHeaders,
674
+ payload
675
+ );
676
+ }
677
+ /**
678
+ * Update APNS provider
679
+ *
680
+ * Update a Apple Push Notification service provider by its unique ID.
681
+ *
682
+ * @param {string} providerId
683
+ * @param {string} name
684
+ * @param {boolean} enabled
685
+ * @param {string} authKey
686
+ * @param {string} authKeyId
687
+ * @param {string} teamId
688
+ * @param {string} bundleId
689
+ * @param {boolean} sandbox
690
+ * @throws {AppwriteException}
691
+ * @returns {Promise<Models.Provider>}
692
+ */
693
+ async updateApnsProvider(providerId, name, enabled, authKey, authKeyId, teamId, bundleId, sandbox) {
694
+ if (typeof providerId === "undefined") {
695
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
696
+ }
697
+ const apiPath = "/messaging/providers/apns/{providerId}".replace("{providerId}", providerId);
698
+ const payload = {};
699
+ if (typeof name !== "undefined") {
700
+ payload["name"] = name;
701
+ }
702
+ if (typeof enabled !== "undefined") {
703
+ payload["enabled"] = enabled;
704
+ }
705
+ if (typeof authKey !== "undefined") {
706
+ payload["authKey"] = authKey;
707
+ }
708
+ if (typeof authKeyId !== "undefined") {
709
+ payload["authKeyId"] = authKeyId;
710
+ }
711
+ if (typeof teamId !== "undefined") {
712
+ payload["teamId"] = teamId;
713
+ }
714
+ if (typeof bundleId !== "undefined") {
715
+ payload["bundleId"] = bundleId;
716
+ }
717
+ if (typeof sandbox !== "undefined") {
718
+ payload["sandbox"] = sandbox;
719
+ }
720
+ const uri = new URL(this.client.config.endpoint + apiPath);
721
+ const apiHeaders = {
722
+ "content-type": "application/json"
723
+ };
724
+ return await this.client.call(
725
+ "patch",
726
+ uri,
727
+ apiHeaders,
728
+ payload
729
+ );
730
+ }
731
+ /**
732
+ * Create FCM provider
733
+ *
734
+ * Create a new Firebase Cloud Messaging provider.
735
+ *
736
+ * @param {string} providerId
737
+ * @param {string} name
738
+ * @param {object} serviceAccountJSON
739
+ * @param {boolean} enabled
740
+ * @throws {AppwriteException}
741
+ * @returns {Promise<Models.Provider>}
742
+ */
743
+ async createFcmProvider(providerId, name, serviceAccountJSON, enabled) {
744
+ if (typeof providerId === "undefined") {
745
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
746
+ }
747
+ if (typeof name === "undefined") {
748
+ throw new client.AppwriteException('Missing required parameter: "name"');
749
+ }
750
+ const apiPath = "/messaging/providers/fcm";
751
+ const payload = {};
752
+ if (typeof providerId !== "undefined") {
753
+ payload["providerId"] = providerId;
754
+ }
755
+ if (typeof name !== "undefined") {
756
+ payload["name"] = name;
757
+ }
758
+ if (typeof serviceAccountJSON !== "undefined") {
759
+ payload["serviceAccountJSON"] = serviceAccountJSON;
760
+ }
761
+ if (typeof enabled !== "undefined") {
762
+ payload["enabled"] = enabled;
763
+ }
764
+ const uri = new URL(this.client.config.endpoint + apiPath);
765
+ const apiHeaders = {
766
+ "content-type": "application/json"
767
+ };
768
+ return await this.client.call(
769
+ "post",
770
+ uri,
771
+ apiHeaders,
772
+ payload
773
+ );
774
+ }
775
+ /**
776
+ * Update FCM provider
777
+ *
778
+ * Update a Firebase Cloud Messaging provider by its unique ID.
779
+ *
780
+ * @param {string} providerId
781
+ * @param {string} name
782
+ * @param {boolean} enabled
783
+ * @param {object} serviceAccountJSON
784
+ * @throws {AppwriteException}
785
+ * @returns {Promise<Models.Provider>}
786
+ */
787
+ async updateFcmProvider(providerId, name, enabled, serviceAccountJSON) {
788
+ if (typeof providerId === "undefined") {
789
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
790
+ }
791
+ const apiPath = "/messaging/providers/fcm/{providerId}".replace("{providerId}", providerId);
792
+ const payload = {};
793
+ if (typeof name !== "undefined") {
794
+ payload["name"] = name;
795
+ }
796
+ if (typeof enabled !== "undefined") {
797
+ payload["enabled"] = enabled;
798
+ }
799
+ if (typeof serviceAccountJSON !== "undefined") {
800
+ payload["serviceAccountJSON"] = serviceAccountJSON;
801
+ }
802
+ const uri = new URL(this.client.config.endpoint + apiPath);
803
+ const apiHeaders = {
804
+ "content-type": "application/json"
805
+ };
806
+ return await this.client.call(
807
+ "patch",
808
+ uri,
809
+ apiHeaders,
810
+ payload
811
+ );
812
+ }
813
+ /**
814
+ * Create Mailgun provider
815
+ *
816
+ * Create a new Mailgun provider.
817
+ *
818
+ * @param {string} providerId
819
+ * @param {string} name
820
+ * @param {string} apiKey
821
+ * @param {string} domain
822
+ * @param {boolean} isEuRegion
823
+ * @param {string} fromName
824
+ * @param {string} fromEmail
825
+ * @param {string} replyToName
826
+ * @param {string} replyToEmail
827
+ * @param {boolean} enabled
828
+ * @throws {AppwriteException}
829
+ * @returns {Promise<Models.Provider>}
830
+ */
831
+ async createMailgunProvider(providerId, name, apiKey, domain, isEuRegion, fromName, fromEmail, replyToName, replyToEmail, enabled) {
832
+ if (typeof providerId === "undefined") {
833
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
834
+ }
835
+ if (typeof name === "undefined") {
836
+ throw new client.AppwriteException('Missing required parameter: "name"');
837
+ }
838
+ const apiPath = "/messaging/providers/mailgun";
839
+ const payload = {};
840
+ if (typeof providerId !== "undefined") {
841
+ payload["providerId"] = providerId;
842
+ }
843
+ if (typeof name !== "undefined") {
844
+ payload["name"] = name;
845
+ }
846
+ if (typeof apiKey !== "undefined") {
847
+ payload["apiKey"] = apiKey;
848
+ }
849
+ if (typeof domain !== "undefined") {
850
+ payload["domain"] = domain;
851
+ }
852
+ if (typeof isEuRegion !== "undefined") {
853
+ payload["isEuRegion"] = isEuRegion;
854
+ }
855
+ if (typeof fromName !== "undefined") {
856
+ payload["fromName"] = fromName;
857
+ }
858
+ if (typeof fromEmail !== "undefined") {
859
+ payload["fromEmail"] = fromEmail;
860
+ }
861
+ if (typeof replyToName !== "undefined") {
862
+ payload["replyToName"] = replyToName;
863
+ }
864
+ if (typeof replyToEmail !== "undefined") {
865
+ payload["replyToEmail"] = replyToEmail;
866
+ }
867
+ if (typeof enabled !== "undefined") {
868
+ payload["enabled"] = enabled;
869
+ }
870
+ const uri = new URL(this.client.config.endpoint + apiPath);
871
+ const apiHeaders = {
872
+ "content-type": "application/json"
873
+ };
874
+ return await this.client.call(
875
+ "post",
876
+ uri,
877
+ apiHeaders,
878
+ payload
879
+ );
880
+ }
881
+ /**
882
+ * Update Mailgun provider
883
+ *
884
+ * Update a Mailgun provider by its unique ID.
885
+ *
886
+ * @param {string} providerId
887
+ * @param {string} name
888
+ * @param {string} apiKey
889
+ * @param {string} domain
890
+ * @param {boolean} isEuRegion
891
+ * @param {boolean} enabled
892
+ * @param {string} fromName
893
+ * @param {string} fromEmail
894
+ * @param {string} replyToName
895
+ * @param {string} replyToEmail
896
+ * @throws {AppwriteException}
897
+ * @returns {Promise<Models.Provider>}
898
+ */
899
+ async updateMailgunProvider(providerId, name, apiKey, domain, isEuRegion, enabled, fromName, fromEmail, replyToName, replyToEmail) {
900
+ if (typeof providerId === "undefined") {
901
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
902
+ }
903
+ const apiPath = "/messaging/providers/mailgun/{providerId}".replace("{providerId}", providerId);
904
+ const payload = {};
905
+ if (typeof name !== "undefined") {
906
+ payload["name"] = name;
907
+ }
908
+ if (typeof apiKey !== "undefined") {
909
+ payload["apiKey"] = apiKey;
910
+ }
911
+ if (typeof domain !== "undefined") {
912
+ payload["domain"] = domain;
913
+ }
914
+ if (typeof isEuRegion !== "undefined") {
915
+ payload["isEuRegion"] = isEuRegion;
916
+ }
917
+ if (typeof enabled !== "undefined") {
918
+ payload["enabled"] = enabled;
919
+ }
920
+ if (typeof fromName !== "undefined") {
921
+ payload["fromName"] = fromName;
922
+ }
923
+ if (typeof fromEmail !== "undefined") {
924
+ payload["fromEmail"] = fromEmail;
925
+ }
926
+ if (typeof replyToName !== "undefined") {
927
+ payload["replyToName"] = replyToName;
928
+ }
929
+ if (typeof replyToEmail !== "undefined") {
930
+ payload["replyToEmail"] = replyToEmail;
931
+ }
932
+ const uri = new URL(this.client.config.endpoint + apiPath);
933
+ const apiHeaders = {
934
+ "content-type": "application/json"
935
+ };
936
+ return await this.client.call(
937
+ "patch",
938
+ uri,
939
+ apiHeaders,
940
+ payload
941
+ );
942
+ }
943
+ /**
944
+ * Create Msg91 provider
945
+ *
946
+ * Create a new MSG91 provider.
947
+ *
948
+ * @param {string} providerId
949
+ * @param {string} name
950
+ * @param {string} from
951
+ * @param {string} senderId
952
+ * @param {string} authKey
953
+ * @param {boolean} enabled
954
+ * @throws {AppwriteException}
955
+ * @returns {Promise<Models.Provider>}
956
+ */
957
+ async createMsg91Provider(providerId, name, from, senderId, authKey, enabled) {
958
+ if (typeof providerId === "undefined") {
959
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
960
+ }
961
+ if (typeof name === "undefined") {
962
+ throw new client.AppwriteException('Missing required parameter: "name"');
963
+ }
964
+ const apiPath = "/messaging/providers/msg91";
965
+ const payload = {};
966
+ if (typeof providerId !== "undefined") {
967
+ payload["providerId"] = providerId;
968
+ }
969
+ if (typeof name !== "undefined") {
970
+ payload["name"] = name;
971
+ }
972
+ if (typeof from !== "undefined") {
973
+ payload["from"] = from;
974
+ }
975
+ if (typeof senderId !== "undefined") {
976
+ payload["senderId"] = senderId;
977
+ }
978
+ if (typeof authKey !== "undefined") {
979
+ payload["authKey"] = authKey;
980
+ }
981
+ if (typeof enabled !== "undefined") {
982
+ payload["enabled"] = enabled;
983
+ }
984
+ const uri = new URL(this.client.config.endpoint + apiPath);
985
+ const apiHeaders = {
986
+ "content-type": "application/json"
987
+ };
988
+ return await this.client.call(
989
+ "post",
990
+ uri,
991
+ apiHeaders,
992
+ payload
993
+ );
994
+ }
995
+ /**
996
+ * Update Msg91 provider
997
+ *
998
+ * Update a MSG91 provider by its unique ID.
999
+ *
1000
+ * @param {string} providerId
1001
+ * @param {string} name
1002
+ * @param {boolean} enabled
1003
+ * @param {string} senderId
1004
+ * @param {string} authKey
1005
+ * @param {string} from
1006
+ * @throws {AppwriteException}
1007
+ * @returns {Promise<Models.Provider>}
1008
+ */
1009
+ async updateMsg91Provider(providerId, name, enabled, senderId, authKey, from) {
1010
+ if (typeof providerId === "undefined") {
1011
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1012
+ }
1013
+ const apiPath = "/messaging/providers/msg91/{providerId}".replace("{providerId}", providerId);
1014
+ const payload = {};
1015
+ if (typeof name !== "undefined") {
1016
+ payload["name"] = name;
1017
+ }
1018
+ if (typeof enabled !== "undefined") {
1019
+ payload["enabled"] = enabled;
1020
+ }
1021
+ if (typeof senderId !== "undefined") {
1022
+ payload["senderId"] = senderId;
1023
+ }
1024
+ if (typeof authKey !== "undefined") {
1025
+ payload["authKey"] = authKey;
1026
+ }
1027
+ if (typeof from !== "undefined") {
1028
+ payload["from"] = from;
1029
+ }
1030
+ const uri = new URL(this.client.config.endpoint + apiPath);
1031
+ const apiHeaders = {
1032
+ "content-type": "application/json"
1033
+ };
1034
+ return await this.client.call(
1035
+ "patch",
1036
+ uri,
1037
+ apiHeaders,
1038
+ payload
1039
+ );
1040
+ }
1041
+ /**
1042
+ * Create Sendgrid provider
1043
+ *
1044
+ * Create a new Sendgrid provider.
1045
+ *
1046
+ * @param {string} providerId
1047
+ * @param {string} name
1048
+ * @param {string} apiKey
1049
+ * @param {string} fromName
1050
+ * @param {string} fromEmail
1051
+ * @param {string} replyToName
1052
+ * @param {string} replyToEmail
1053
+ * @param {boolean} enabled
1054
+ * @throws {AppwriteException}
1055
+ * @returns {Promise<Models.Provider>}
1056
+ */
1057
+ async createSendgridProvider(providerId, name, apiKey, fromName, fromEmail, replyToName, replyToEmail, enabled) {
1058
+ if (typeof providerId === "undefined") {
1059
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1060
+ }
1061
+ if (typeof name === "undefined") {
1062
+ throw new client.AppwriteException('Missing required parameter: "name"');
1063
+ }
1064
+ const apiPath = "/messaging/providers/sendgrid";
1065
+ const payload = {};
1066
+ if (typeof providerId !== "undefined") {
1067
+ payload["providerId"] = providerId;
1068
+ }
1069
+ if (typeof name !== "undefined") {
1070
+ payload["name"] = name;
1071
+ }
1072
+ if (typeof apiKey !== "undefined") {
1073
+ payload["apiKey"] = apiKey;
1074
+ }
1075
+ if (typeof fromName !== "undefined") {
1076
+ payload["fromName"] = fromName;
1077
+ }
1078
+ if (typeof fromEmail !== "undefined") {
1079
+ payload["fromEmail"] = fromEmail;
1080
+ }
1081
+ if (typeof replyToName !== "undefined") {
1082
+ payload["replyToName"] = replyToName;
1083
+ }
1084
+ if (typeof replyToEmail !== "undefined") {
1085
+ payload["replyToEmail"] = replyToEmail;
1086
+ }
1087
+ if (typeof enabled !== "undefined") {
1088
+ payload["enabled"] = enabled;
1089
+ }
1090
+ const uri = new URL(this.client.config.endpoint + apiPath);
1091
+ const apiHeaders = {
1092
+ "content-type": "application/json"
1093
+ };
1094
+ return await this.client.call(
1095
+ "post",
1096
+ uri,
1097
+ apiHeaders,
1098
+ payload
1099
+ );
1100
+ }
1101
+ /**
1102
+ * Update Sendgrid provider
1103
+ *
1104
+ * Update a Sendgrid provider by its unique ID.
1105
+ *
1106
+ * @param {string} providerId
1107
+ * @param {string} name
1108
+ * @param {boolean} enabled
1109
+ * @param {string} apiKey
1110
+ * @param {string} fromName
1111
+ * @param {string} fromEmail
1112
+ * @param {string} replyToName
1113
+ * @param {string} replyToEmail
1114
+ * @throws {AppwriteException}
1115
+ * @returns {Promise<Models.Provider>}
1116
+ */
1117
+ async updateSendgridProvider(providerId, name, enabled, apiKey, fromName, fromEmail, replyToName, replyToEmail) {
1118
+ if (typeof providerId === "undefined") {
1119
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1120
+ }
1121
+ const apiPath = "/messaging/providers/sendgrid/{providerId}".replace("{providerId}", providerId);
1122
+ const payload = {};
1123
+ if (typeof name !== "undefined") {
1124
+ payload["name"] = name;
1125
+ }
1126
+ if (typeof enabled !== "undefined") {
1127
+ payload["enabled"] = enabled;
1128
+ }
1129
+ if (typeof apiKey !== "undefined") {
1130
+ payload["apiKey"] = apiKey;
1131
+ }
1132
+ if (typeof fromName !== "undefined") {
1133
+ payload["fromName"] = fromName;
1134
+ }
1135
+ if (typeof fromEmail !== "undefined") {
1136
+ payload["fromEmail"] = fromEmail;
1137
+ }
1138
+ if (typeof replyToName !== "undefined") {
1139
+ payload["replyToName"] = replyToName;
1140
+ }
1141
+ if (typeof replyToEmail !== "undefined") {
1142
+ payload["replyToEmail"] = replyToEmail;
1143
+ }
1144
+ const uri = new URL(this.client.config.endpoint + apiPath);
1145
+ const apiHeaders = {
1146
+ "content-type": "application/json"
1147
+ };
1148
+ return await this.client.call(
1149
+ "patch",
1150
+ uri,
1151
+ apiHeaders,
1152
+ payload
1153
+ );
1154
+ }
1155
+ /**
1156
+ * Create SMTP provider
1157
+ *
1158
+ * Create a new SMTP provider.
1159
+ *
1160
+ * @param {string} providerId
1161
+ * @param {string} name
1162
+ * @param {string} host
1163
+ * @param {number} port
1164
+ * @param {string} username
1165
+ * @param {string} password
1166
+ * @param {SmtpEncryption} encryption
1167
+ * @param {boolean} autoTLS
1168
+ * @param {string} mailer
1169
+ * @param {string} fromName
1170
+ * @param {string} fromEmail
1171
+ * @param {string} replyToName
1172
+ * @param {string} replyToEmail
1173
+ * @param {boolean} enabled
1174
+ * @throws {AppwriteException}
1175
+ * @returns {Promise<Models.Provider>}
1176
+ */
1177
+ async createSmtpProvider(providerId, name, host, port, username, password, encryption, autoTLS, mailer, fromName, fromEmail, replyToName, replyToEmail, enabled) {
1178
+ if (typeof providerId === "undefined") {
1179
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1180
+ }
1181
+ if (typeof name === "undefined") {
1182
+ throw new client.AppwriteException('Missing required parameter: "name"');
1183
+ }
1184
+ if (typeof host === "undefined") {
1185
+ throw new client.AppwriteException('Missing required parameter: "host"');
1186
+ }
1187
+ const apiPath = "/messaging/providers/smtp";
1188
+ const payload = {};
1189
+ if (typeof providerId !== "undefined") {
1190
+ payload["providerId"] = providerId;
1191
+ }
1192
+ if (typeof name !== "undefined") {
1193
+ payload["name"] = name;
1194
+ }
1195
+ if (typeof host !== "undefined") {
1196
+ payload["host"] = host;
1197
+ }
1198
+ if (typeof port !== "undefined") {
1199
+ payload["port"] = port;
1200
+ }
1201
+ if (typeof username !== "undefined") {
1202
+ payload["username"] = username;
1203
+ }
1204
+ if (typeof password !== "undefined") {
1205
+ payload["password"] = password;
1206
+ }
1207
+ if (typeof encryption !== "undefined") {
1208
+ payload["encryption"] = encryption;
1209
+ }
1210
+ if (typeof autoTLS !== "undefined") {
1211
+ payload["autoTLS"] = autoTLS;
1212
+ }
1213
+ if (typeof mailer !== "undefined") {
1214
+ payload["mailer"] = mailer;
1215
+ }
1216
+ if (typeof fromName !== "undefined") {
1217
+ payload["fromName"] = fromName;
1218
+ }
1219
+ if (typeof fromEmail !== "undefined") {
1220
+ payload["fromEmail"] = fromEmail;
1221
+ }
1222
+ if (typeof replyToName !== "undefined") {
1223
+ payload["replyToName"] = replyToName;
1224
+ }
1225
+ if (typeof replyToEmail !== "undefined") {
1226
+ payload["replyToEmail"] = replyToEmail;
1227
+ }
1228
+ if (typeof enabled !== "undefined") {
1229
+ payload["enabled"] = enabled;
1230
+ }
1231
+ const uri = new URL(this.client.config.endpoint + apiPath);
1232
+ const apiHeaders = {
1233
+ "content-type": "application/json"
1234
+ };
1235
+ return await this.client.call(
1236
+ "post",
1237
+ uri,
1238
+ apiHeaders,
1239
+ payload
1240
+ );
1241
+ }
1242
+ /**
1243
+ * Update SMTP provider
1244
+ *
1245
+ * Update a SMTP provider by its unique ID.
1246
+ *
1247
+ * @param {string} providerId
1248
+ * @param {string} name
1249
+ * @param {string} host
1250
+ * @param {number} port
1251
+ * @param {string} username
1252
+ * @param {string} password
1253
+ * @param {SmtpEncryption} encryption
1254
+ * @param {boolean} autoTLS
1255
+ * @param {string} mailer
1256
+ * @param {string} fromName
1257
+ * @param {string} fromEmail
1258
+ * @param {string} replyToName
1259
+ * @param {string} replyToEmail
1260
+ * @param {boolean} enabled
1261
+ * @throws {AppwriteException}
1262
+ * @returns {Promise<Models.Provider>}
1263
+ */
1264
+ async updateSmtpProvider(providerId, name, host, port, username, password, encryption, autoTLS, mailer, fromName, fromEmail, replyToName, replyToEmail, enabled) {
1265
+ if (typeof providerId === "undefined") {
1266
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1267
+ }
1268
+ const apiPath = "/messaging/providers/smtp/{providerId}".replace("{providerId}", providerId);
1269
+ const payload = {};
1270
+ if (typeof name !== "undefined") {
1271
+ payload["name"] = name;
1272
+ }
1273
+ if (typeof host !== "undefined") {
1274
+ payload["host"] = host;
1275
+ }
1276
+ if (typeof port !== "undefined") {
1277
+ payload["port"] = port;
1278
+ }
1279
+ if (typeof username !== "undefined") {
1280
+ payload["username"] = username;
1281
+ }
1282
+ if (typeof password !== "undefined") {
1283
+ payload["password"] = password;
1284
+ }
1285
+ if (typeof encryption !== "undefined") {
1286
+ payload["encryption"] = encryption;
1287
+ }
1288
+ if (typeof autoTLS !== "undefined") {
1289
+ payload["autoTLS"] = autoTLS;
1290
+ }
1291
+ if (typeof mailer !== "undefined") {
1292
+ payload["mailer"] = mailer;
1293
+ }
1294
+ if (typeof fromName !== "undefined") {
1295
+ payload["fromName"] = fromName;
1296
+ }
1297
+ if (typeof fromEmail !== "undefined") {
1298
+ payload["fromEmail"] = fromEmail;
1299
+ }
1300
+ if (typeof replyToName !== "undefined") {
1301
+ payload["replyToName"] = replyToName;
1302
+ }
1303
+ if (typeof replyToEmail !== "undefined") {
1304
+ payload["replyToEmail"] = replyToEmail;
1305
+ }
1306
+ if (typeof enabled !== "undefined") {
1307
+ payload["enabled"] = enabled;
1308
+ }
1309
+ const uri = new URL(this.client.config.endpoint + apiPath);
1310
+ const apiHeaders = {
1311
+ "content-type": "application/json"
1312
+ };
1313
+ return await this.client.call(
1314
+ "patch",
1315
+ uri,
1316
+ apiHeaders,
1317
+ payload
1318
+ );
1319
+ }
1320
+ /**
1321
+ * Create Telesign provider
1322
+ *
1323
+ * Create a new Telesign provider.
1324
+ *
1325
+ * @param {string} providerId
1326
+ * @param {string} name
1327
+ * @param {string} from
1328
+ * @param {string} customerId
1329
+ * @param {string} apiKey
1330
+ * @param {boolean} enabled
1331
+ * @throws {AppwriteException}
1332
+ * @returns {Promise<Models.Provider>}
1333
+ */
1334
+ async createTelesignProvider(providerId, name, from, customerId, apiKey, enabled) {
1335
+ if (typeof providerId === "undefined") {
1336
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1337
+ }
1338
+ if (typeof name === "undefined") {
1339
+ throw new client.AppwriteException('Missing required parameter: "name"');
1340
+ }
1341
+ const apiPath = "/messaging/providers/telesign";
1342
+ const payload = {};
1343
+ if (typeof providerId !== "undefined") {
1344
+ payload["providerId"] = providerId;
1345
+ }
1346
+ if (typeof name !== "undefined") {
1347
+ payload["name"] = name;
1348
+ }
1349
+ if (typeof from !== "undefined") {
1350
+ payload["from"] = from;
1351
+ }
1352
+ if (typeof customerId !== "undefined") {
1353
+ payload["customerId"] = customerId;
1354
+ }
1355
+ if (typeof apiKey !== "undefined") {
1356
+ payload["apiKey"] = apiKey;
1357
+ }
1358
+ if (typeof enabled !== "undefined") {
1359
+ payload["enabled"] = enabled;
1360
+ }
1361
+ const uri = new URL(this.client.config.endpoint + apiPath);
1362
+ const apiHeaders = {
1363
+ "content-type": "application/json"
1364
+ };
1365
+ return await this.client.call(
1366
+ "post",
1367
+ uri,
1368
+ apiHeaders,
1369
+ payload
1370
+ );
1371
+ }
1372
+ /**
1373
+ * Update Telesign provider
1374
+ *
1375
+ * Update a Telesign provider by its unique ID.
1376
+ *
1377
+ * @param {string} providerId
1378
+ * @param {string} name
1379
+ * @param {boolean} enabled
1380
+ * @param {string} customerId
1381
+ * @param {string} apiKey
1382
+ * @param {string} from
1383
+ * @throws {AppwriteException}
1384
+ * @returns {Promise<Models.Provider>}
1385
+ */
1386
+ async updateTelesignProvider(providerId, name, enabled, customerId, apiKey, from) {
1387
+ if (typeof providerId === "undefined") {
1388
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1389
+ }
1390
+ const apiPath = "/messaging/providers/telesign/{providerId}".replace("{providerId}", providerId);
1391
+ const payload = {};
1392
+ if (typeof name !== "undefined") {
1393
+ payload["name"] = name;
1394
+ }
1395
+ if (typeof enabled !== "undefined") {
1396
+ payload["enabled"] = enabled;
1397
+ }
1398
+ if (typeof customerId !== "undefined") {
1399
+ payload["customerId"] = customerId;
1400
+ }
1401
+ if (typeof apiKey !== "undefined") {
1402
+ payload["apiKey"] = apiKey;
1403
+ }
1404
+ if (typeof from !== "undefined") {
1405
+ payload["from"] = from;
1406
+ }
1407
+ const uri = new URL(this.client.config.endpoint + apiPath);
1408
+ const apiHeaders = {
1409
+ "content-type": "application/json"
1410
+ };
1411
+ return await this.client.call(
1412
+ "patch",
1413
+ uri,
1414
+ apiHeaders,
1415
+ payload
1416
+ );
1417
+ }
1418
+ /**
1419
+ * Create Textmagic provider
1420
+ *
1421
+ * Create a new Textmagic provider.
1422
+ *
1423
+ * @param {string} providerId
1424
+ * @param {string} name
1425
+ * @param {string} from
1426
+ * @param {string} username
1427
+ * @param {string} apiKey
1428
+ * @param {boolean} enabled
1429
+ * @throws {AppwriteException}
1430
+ * @returns {Promise<Models.Provider>}
1431
+ */
1432
+ async createTextmagicProvider(providerId, name, from, username, apiKey, enabled) {
1433
+ if (typeof providerId === "undefined") {
1434
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1435
+ }
1436
+ if (typeof name === "undefined") {
1437
+ throw new client.AppwriteException('Missing required parameter: "name"');
1438
+ }
1439
+ const apiPath = "/messaging/providers/textmagic";
1440
+ const payload = {};
1441
+ if (typeof providerId !== "undefined") {
1442
+ payload["providerId"] = providerId;
1443
+ }
1444
+ if (typeof name !== "undefined") {
1445
+ payload["name"] = name;
1446
+ }
1447
+ if (typeof from !== "undefined") {
1448
+ payload["from"] = from;
1449
+ }
1450
+ if (typeof username !== "undefined") {
1451
+ payload["username"] = username;
1452
+ }
1453
+ if (typeof apiKey !== "undefined") {
1454
+ payload["apiKey"] = apiKey;
1455
+ }
1456
+ if (typeof enabled !== "undefined") {
1457
+ payload["enabled"] = enabled;
1458
+ }
1459
+ const uri = new URL(this.client.config.endpoint + apiPath);
1460
+ const apiHeaders = {
1461
+ "content-type": "application/json"
1462
+ };
1463
+ return await this.client.call(
1464
+ "post",
1465
+ uri,
1466
+ apiHeaders,
1467
+ payload
1468
+ );
1469
+ }
1470
+ /**
1471
+ * Update Textmagic provider
1472
+ *
1473
+ * Update a Textmagic provider by its unique ID.
1474
+ *
1475
+ * @param {string} providerId
1476
+ * @param {string} name
1477
+ * @param {boolean} enabled
1478
+ * @param {string} username
1479
+ * @param {string} apiKey
1480
+ * @param {string} from
1481
+ * @throws {AppwriteException}
1482
+ * @returns {Promise<Models.Provider>}
1483
+ */
1484
+ async updateTextmagicProvider(providerId, name, enabled, username, apiKey, from) {
1485
+ if (typeof providerId === "undefined") {
1486
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1487
+ }
1488
+ const apiPath = "/messaging/providers/textmagic/{providerId}".replace("{providerId}", providerId);
1489
+ const payload = {};
1490
+ if (typeof name !== "undefined") {
1491
+ payload["name"] = name;
1492
+ }
1493
+ if (typeof enabled !== "undefined") {
1494
+ payload["enabled"] = enabled;
1495
+ }
1496
+ if (typeof username !== "undefined") {
1497
+ payload["username"] = username;
1498
+ }
1499
+ if (typeof apiKey !== "undefined") {
1500
+ payload["apiKey"] = apiKey;
1501
+ }
1502
+ if (typeof from !== "undefined") {
1503
+ payload["from"] = from;
1504
+ }
1505
+ const uri = new URL(this.client.config.endpoint + apiPath);
1506
+ const apiHeaders = {
1507
+ "content-type": "application/json"
1508
+ };
1509
+ return await this.client.call(
1510
+ "patch",
1511
+ uri,
1512
+ apiHeaders,
1513
+ payload
1514
+ );
1515
+ }
1516
+ /**
1517
+ * Create Twilio provider
1518
+ *
1519
+ * Create a new Twilio provider.
1520
+ *
1521
+ * @param {string} providerId
1522
+ * @param {string} name
1523
+ * @param {string} from
1524
+ * @param {string} accountSid
1525
+ * @param {string} authToken
1526
+ * @param {boolean} enabled
1527
+ * @throws {AppwriteException}
1528
+ * @returns {Promise<Models.Provider>}
1529
+ */
1530
+ async createTwilioProvider(providerId, name, from, accountSid, authToken, enabled) {
1531
+ if (typeof providerId === "undefined") {
1532
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1533
+ }
1534
+ if (typeof name === "undefined") {
1535
+ throw new client.AppwriteException('Missing required parameter: "name"');
1536
+ }
1537
+ const apiPath = "/messaging/providers/twilio";
1538
+ const payload = {};
1539
+ if (typeof providerId !== "undefined") {
1540
+ payload["providerId"] = providerId;
1541
+ }
1542
+ if (typeof name !== "undefined") {
1543
+ payload["name"] = name;
1544
+ }
1545
+ if (typeof from !== "undefined") {
1546
+ payload["from"] = from;
1547
+ }
1548
+ if (typeof accountSid !== "undefined") {
1549
+ payload["accountSid"] = accountSid;
1550
+ }
1551
+ if (typeof authToken !== "undefined") {
1552
+ payload["authToken"] = authToken;
1553
+ }
1554
+ if (typeof enabled !== "undefined") {
1555
+ payload["enabled"] = enabled;
1556
+ }
1557
+ const uri = new URL(this.client.config.endpoint + apiPath);
1558
+ const apiHeaders = {
1559
+ "content-type": "application/json"
1560
+ };
1561
+ return await this.client.call(
1562
+ "post",
1563
+ uri,
1564
+ apiHeaders,
1565
+ payload
1566
+ );
1567
+ }
1568
+ /**
1569
+ * Update Twilio provider
1570
+ *
1571
+ * Update a Twilio provider by its unique ID.
1572
+ *
1573
+ * @param {string} providerId
1574
+ * @param {string} name
1575
+ * @param {boolean} enabled
1576
+ * @param {string} accountSid
1577
+ * @param {string} authToken
1578
+ * @param {string} from
1579
+ * @throws {AppwriteException}
1580
+ * @returns {Promise<Models.Provider>}
1581
+ */
1582
+ async updateTwilioProvider(providerId, name, enabled, accountSid, authToken, from) {
1583
+ if (typeof providerId === "undefined") {
1584
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1585
+ }
1586
+ const apiPath = "/messaging/providers/twilio/{providerId}".replace("{providerId}", providerId);
1587
+ const payload = {};
1588
+ if (typeof name !== "undefined") {
1589
+ payload["name"] = name;
1590
+ }
1591
+ if (typeof enabled !== "undefined") {
1592
+ payload["enabled"] = enabled;
1593
+ }
1594
+ if (typeof accountSid !== "undefined") {
1595
+ payload["accountSid"] = accountSid;
1596
+ }
1597
+ if (typeof authToken !== "undefined") {
1598
+ payload["authToken"] = authToken;
1599
+ }
1600
+ if (typeof from !== "undefined") {
1601
+ payload["from"] = from;
1602
+ }
1603
+ const uri = new URL(this.client.config.endpoint + apiPath);
1604
+ const apiHeaders = {
1605
+ "content-type": "application/json"
1606
+ };
1607
+ return await this.client.call(
1608
+ "patch",
1609
+ uri,
1610
+ apiHeaders,
1611
+ payload
1612
+ );
1613
+ }
1614
+ /**
1615
+ * Create Vonage provider
1616
+ *
1617
+ * Create a new Vonage provider.
1618
+ *
1619
+ * @param {string} providerId
1620
+ * @param {string} name
1621
+ * @param {string} from
1622
+ * @param {string} apiKey
1623
+ * @param {string} apiSecret
1624
+ * @param {boolean} enabled
1625
+ * @throws {AppwriteException}
1626
+ * @returns {Promise<Models.Provider>}
1627
+ */
1628
+ async createVonageProvider(providerId, name, from, apiKey, apiSecret, enabled) {
1629
+ if (typeof providerId === "undefined") {
1630
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1631
+ }
1632
+ if (typeof name === "undefined") {
1633
+ throw new client.AppwriteException('Missing required parameter: "name"');
1634
+ }
1635
+ const apiPath = "/messaging/providers/vonage";
1636
+ const payload = {};
1637
+ if (typeof providerId !== "undefined") {
1638
+ payload["providerId"] = providerId;
1639
+ }
1640
+ if (typeof name !== "undefined") {
1641
+ payload["name"] = name;
1642
+ }
1643
+ if (typeof from !== "undefined") {
1644
+ payload["from"] = from;
1645
+ }
1646
+ if (typeof apiKey !== "undefined") {
1647
+ payload["apiKey"] = apiKey;
1648
+ }
1649
+ if (typeof apiSecret !== "undefined") {
1650
+ payload["apiSecret"] = apiSecret;
1651
+ }
1652
+ if (typeof enabled !== "undefined") {
1653
+ payload["enabled"] = enabled;
1654
+ }
1655
+ const uri = new URL(this.client.config.endpoint + apiPath);
1656
+ const apiHeaders = {
1657
+ "content-type": "application/json"
1658
+ };
1659
+ return await this.client.call(
1660
+ "post",
1661
+ uri,
1662
+ apiHeaders,
1663
+ payload
1664
+ );
1665
+ }
1666
+ /**
1667
+ * Update Vonage provider
1668
+ *
1669
+ * Update a Vonage provider by its unique ID.
1670
+ *
1671
+ * @param {string} providerId
1672
+ * @param {string} name
1673
+ * @param {boolean} enabled
1674
+ * @param {string} apiKey
1675
+ * @param {string} apiSecret
1676
+ * @param {string} from
1677
+ * @throws {AppwriteException}
1678
+ * @returns {Promise<Models.Provider>}
1679
+ */
1680
+ async updateVonageProvider(providerId, name, enabled, apiKey, apiSecret, from) {
1681
+ if (typeof providerId === "undefined") {
1682
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1683
+ }
1684
+ const apiPath = "/messaging/providers/vonage/{providerId}".replace("{providerId}", providerId);
1685
+ const payload = {};
1686
+ if (typeof name !== "undefined") {
1687
+ payload["name"] = name;
1688
+ }
1689
+ if (typeof enabled !== "undefined") {
1690
+ payload["enabled"] = enabled;
1691
+ }
1692
+ if (typeof apiKey !== "undefined") {
1693
+ payload["apiKey"] = apiKey;
1694
+ }
1695
+ if (typeof apiSecret !== "undefined") {
1696
+ payload["apiSecret"] = apiSecret;
1697
+ }
1698
+ if (typeof from !== "undefined") {
1699
+ payload["from"] = from;
1700
+ }
1701
+ const uri = new URL(this.client.config.endpoint + apiPath);
1702
+ const apiHeaders = {
1703
+ "content-type": "application/json"
1704
+ };
1705
+ return await this.client.call(
1706
+ "patch",
1707
+ uri,
1708
+ apiHeaders,
1709
+ payload
1710
+ );
1711
+ }
1712
+ /**
1713
+ * Get provider
1714
+ *
1715
+ * Get a provider by its unique ID.
1716
+
1717
+ *
1718
+ * @param {string} providerId
1719
+ * @throws {AppwriteException}
1720
+ * @returns {Promise<Models.Provider>}
1721
+ */
1722
+ async getProvider(providerId) {
1723
+ if (typeof providerId === "undefined") {
1724
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1725
+ }
1726
+ const apiPath = "/messaging/providers/{providerId}".replace("{providerId}", providerId);
1727
+ const payload = {};
1728
+ const uri = new URL(this.client.config.endpoint + apiPath);
1729
+ const apiHeaders = {
1730
+ "content-type": "application/json"
1731
+ };
1732
+ return await this.client.call(
1733
+ "get",
1734
+ uri,
1735
+ apiHeaders,
1736
+ payload
1737
+ );
1738
+ }
1739
+ /**
1740
+ * Delete provider
1741
+ *
1742
+ * Delete a provider by its unique ID.
1743
+ *
1744
+ * @param {string} providerId
1745
+ * @throws {AppwriteException}
1746
+ * @returns {Promise<{}>}
1747
+ */
1748
+ async deleteProvider(providerId) {
1749
+ if (typeof providerId === "undefined") {
1750
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1751
+ }
1752
+ const apiPath = "/messaging/providers/{providerId}".replace("{providerId}", providerId);
1753
+ const payload = {};
1754
+ const uri = new URL(this.client.config.endpoint + apiPath);
1755
+ const apiHeaders = {
1756
+ "content-type": "application/json"
1757
+ };
1758
+ return await this.client.call(
1759
+ "delete",
1760
+ uri,
1761
+ apiHeaders,
1762
+ payload
1763
+ );
1764
+ }
1765
+ /**
1766
+ * List provider logs
1767
+ *
1768
+ * Get the provider activity logs listed by its unique ID.
1769
+ *
1770
+ * @param {string} providerId
1771
+ * @param {string[]} queries
1772
+ * @throws {AppwriteException}
1773
+ * @returns {Promise<Models.LogList>}
1774
+ */
1775
+ async listProviderLogs(providerId, queries) {
1776
+ if (typeof providerId === "undefined") {
1777
+ throw new client.AppwriteException('Missing required parameter: "providerId"');
1778
+ }
1779
+ const apiPath = "/messaging/providers/{providerId}/logs".replace("{providerId}", providerId);
1780
+ const payload = {};
1781
+ if (typeof queries !== "undefined") {
1782
+ payload["queries"] = queries;
1783
+ }
1784
+ const uri = new URL(this.client.config.endpoint + apiPath);
1785
+ const apiHeaders = {
1786
+ "content-type": "application/json"
1787
+ };
1788
+ return await this.client.call(
1789
+ "get",
1790
+ uri,
1791
+ apiHeaders,
1792
+ payload
1793
+ );
1794
+ }
1795
+ /**
1796
+ * List subscriber logs
1797
+ *
1798
+ * Get the subscriber activity logs listed by its unique ID.
1799
+ *
1800
+ * @param {string} subscriberId
1801
+ * @param {string[]} queries
1802
+ * @throws {AppwriteException}
1803
+ * @returns {Promise<Models.LogList>}
1804
+ */
1805
+ async listSubscriberLogs(subscriberId, queries) {
1806
+ if (typeof subscriberId === "undefined") {
1807
+ throw new client.AppwriteException('Missing required parameter: "subscriberId"');
1808
+ }
1809
+ const apiPath = "/messaging/subscribers/{subscriberId}/logs".replace("{subscriberId}", subscriberId);
1810
+ const payload = {};
1811
+ if (typeof queries !== "undefined") {
1812
+ payload["queries"] = queries;
1813
+ }
1814
+ const uri = new URL(this.client.config.endpoint + apiPath);
1815
+ const apiHeaders = {
1816
+ "content-type": "application/json"
1817
+ };
1818
+ return await this.client.call(
1819
+ "get",
1820
+ uri,
1821
+ apiHeaders,
1822
+ payload
1823
+ );
1824
+ }
1825
+ /**
1826
+ * List topics
1827
+ *
1828
+ * Get a list of all topics from the current Appwrite project.
1829
+ *
1830
+ * @param {string[]} queries
1831
+ * @param {string} search
1832
+ * @throws {AppwriteException}
1833
+ * @returns {Promise<Models.TopicList>}
1834
+ */
1835
+ async listTopics(queries, search) {
1836
+ const apiPath = "/messaging/topics";
1837
+ const payload = {};
1838
+ if (typeof queries !== "undefined") {
1839
+ payload["queries"] = queries;
1840
+ }
1841
+ if (typeof search !== "undefined") {
1842
+ payload["search"] = search;
1843
+ }
1844
+ const uri = new URL(this.client.config.endpoint + apiPath);
1845
+ const apiHeaders = {
1846
+ "content-type": "application/json"
1847
+ };
1848
+ return await this.client.call(
1849
+ "get",
1850
+ uri,
1851
+ apiHeaders,
1852
+ payload
1853
+ );
1854
+ }
1855
+ /**
1856
+ * Create topic
1857
+ *
1858
+ * Create a new topic.
1859
+ *
1860
+ * @param {string} topicId
1861
+ * @param {string} name
1862
+ * @param {string[]} subscribe
1863
+ * @throws {AppwriteException}
1864
+ * @returns {Promise<Models.Topic>}
1865
+ */
1866
+ async createTopic(topicId, name, subscribe) {
1867
+ if (typeof topicId === "undefined") {
1868
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
1869
+ }
1870
+ if (typeof name === "undefined") {
1871
+ throw new client.AppwriteException('Missing required parameter: "name"');
1872
+ }
1873
+ const apiPath = "/messaging/topics";
1874
+ const payload = {};
1875
+ if (typeof topicId !== "undefined") {
1876
+ payload["topicId"] = topicId;
1877
+ }
1878
+ if (typeof name !== "undefined") {
1879
+ payload["name"] = name;
1880
+ }
1881
+ if (typeof subscribe !== "undefined") {
1882
+ payload["subscribe"] = subscribe;
1883
+ }
1884
+ const uri = new URL(this.client.config.endpoint + apiPath);
1885
+ const apiHeaders = {
1886
+ "content-type": "application/json"
1887
+ };
1888
+ return await this.client.call(
1889
+ "post",
1890
+ uri,
1891
+ apiHeaders,
1892
+ payload
1893
+ );
1894
+ }
1895
+ /**
1896
+ * Get topic
1897
+ *
1898
+ * Get a topic by its unique ID.
1899
+
1900
+ *
1901
+ * @param {string} topicId
1902
+ * @throws {AppwriteException}
1903
+ * @returns {Promise<Models.Topic>}
1904
+ */
1905
+ async getTopic(topicId) {
1906
+ if (typeof topicId === "undefined") {
1907
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
1908
+ }
1909
+ const apiPath = "/messaging/topics/{topicId}".replace("{topicId}", topicId);
1910
+ const payload = {};
1911
+ const uri = new URL(this.client.config.endpoint + apiPath);
1912
+ const apiHeaders = {
1913
+ "content-type": "application/json"
1914
+ };
1915
+ return await this.client.call(
1916
+ "get",
1917
+ uri,
1918
+ apiHeaders,
1919
+ payload
1920
+ );
1921
+ }
1922
+ /**
1923
+ * Update topic
1924
+ *
1925
+ * Update a topic by its unique ID.
1926
+
1927
+ *
1928
+ * @param {string} topicId
1929
+ * @param {string} name
1930
+ * @param {string[]} subscribe
1931
+ * @throws {AppwriteException}
1932
+ * @returns {Promise<Models.Topic>}
1933
+ */
1934
+ async updateTopic(topicId, name, subscribe) {
1935
+ if (typeof topicId === "undefined") {
1936
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
1937
+ }
1938
+ const apiPath = "/messaging/topics/{topicId}".replace("{topicId}", topicId);
1939
+ const payload = {};
1940
+ if (typeof name !== "undefined") {
1941
+ payload["name"] = name;
1942
+ }
1943
+ if (typeof subscribe !== "undefined") {
1944
+ payload["subscribe"] = subscribe;
1945
+ }
1946
+ const uri = new URL(this.client.config.endpoint + apiPath);
1947
+ const apiHeaders = {
1948
+ "content-type": "application/json"
1949
+ };
1950
+ return await this.client.call(
1951
+ "patch",
1952
+ uri,
1953
+ apiHeaders,
1954
+ payload
1955
+ );
1956
+ }
1957
+ /**
1958
+ * Delete topic
1959
+ *
1960
+ * Delete a topic by its unique ID.
1961
+ *
1962
+ * @param {string} topicId
1963
+ * @throws {AppwriteException}
1964
+ * @returns {Promise<{}>}
1965
+ */
1966
+ async deleteTopic(topicId) {
1967
+ if (typeof topicId === "undefined") {
1968
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
1969
+ }
1970
+ const apiPath = "/messaging/topics/{topicId}".replace("{topicId}", topicId);
1971
+ const payload = {};
1972
+ const uri = new URL(this.client.config.endpoint + apiPath);
1973
+ const apiHeaders = {
1974
+ "content-type": "application/json"
1975
+ };
1976
+ return await this.client.call(
1977
+ "delete",
1978
+ uri,
1979
+ apiHeaders,
1980
+ payload
1981
+ );
1982
+ }
1983
+ /**
1984
+ * List topic logs
1985
+ *
1986
+ * Get the topic activity logs listed by its unique ID.
1987
+ *
1988
+ * @param {string} topicId
1989
+ * @param {string[]} queries
1990
+ * @throws {AppwriteException}
1991
+ * @returns {Promise<Models.LogList>}
1992
+ */
1993
+ async listTopicLogs(topicId, queries) {
1994
+ if (typeof topicId === "undefined") {
1995
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
1996
+ }
1997
+ const apiPath = "/messaging/topics/{topicId}/logs".replace("{topicId}", topicId);
1998
+ const payload = {};
1999
+ if (typeof queries !== "undefined") {
2000
+ payload["queries"] = queries;
2001
+ }
2002
+ const uri = new URL(this.client.config.endpoint + apiPath);
2003
+ const apiHeaders = {
2004
+ "content-type": "application/json"
2005
+ };
2006
+ return await this.client.call(
2007
+ "get",
2008
+ uri,
2009
+ apiHeaders,
2010
+ payload
2011
+ );
2012
+ }
2013
+ /**
2014
+ * List subscribers
2015
+ *
2016
+ * Get a list of all subscribers from the current Appwrite project.
2017
+ *
2018
+ * @param {string} topicId
2019
+ * @param {string[]} queries
2020
+ * @param {string} search
2021
+ * @throws {AppwriteException}
2022
+ * @returns {Promise<Models.SubscriberList>}
2023
+ */
2024
+ async listSubscribers(topicId, queries, search) {
2025
+ if (typeof topicId === "undefined") {
2026
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
2027
+ }
2028
+ const apiPath = "/messaging/topics/{topicId}/subscribers".replace("{topicId}", topicId);
2029
+ const payload = {};
2030
+ if (typeof queries !== "undefined") {
2031
+ payload["queries"] = queries;
2032
+ }
2033
+ if (typeof search !== "undefined") {
2034
+ payload["search"] = search;
2035
+ }
2036
+ const uri = new URL(this.client.config.endpoint + apiPath);
2037
+ const apiHeaders = {
2038
+ "content-type": "application/json"
2039
+ };
2040
+ return await this.client.call(
2041
+ "get",
2042
+ uri,
2043
+ apiHeaders,
2044
+ payload
2045
+ );
2046
+ }
2047
+ /**
2048
+ * Create subscriber
2049
+ *
2050
+ * Create a new subscriber.
2051
+ *
2052
+ * @param {string} topicId
2053
+ * @param {string} subscriberId
2054
+ * @param {string} targetId
2055
+ * @throws {AppwriteException}
2056
+ * @returns {Promise<Models.Subscriber>}
2057
+ */
2058
+ async createSubscriber(topicId, subscriberId, targetId) {
2059
+ if (typeof topicId === "undefined") {
2060
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
2061
+ }
2062
+ if (typeof subscriberId === "undefined") {
2063
+ throw new client.AppwriteException('Missing required parameter: "subscriberId"');
2064
+ }
2065
+ if (typeof targetId === "undefined") {
2066
+ throw new client.AppwriteException('Missing required parameter: "targetId"');
2067
+ }
2068
+ const apiPath = "/messaging/topics/{topicId}/subscribers".replace("{topicId}", topicId);
2069
+ const payload = {};
2070
+ if (typeof subscriberId !== "undefined") {
2071
+ payload["subscriberId"] = subscriberId;
2072
+ }
2073
+ if (typeof targetId !== "undefined") {
2074
+ payload["targetId"] = targetId;
2075
+ }
2076
+ const uri = new URL(this.client.config.endpoint + apiPath);
2077
+ const apiHeaders = {
2078
+ "content-type": "application/json"
2079
+ };
2080
+ return await this.client.call(
2081
+ "post",
2082
+ uri,
2083
+ apiHeaders,
2084
+ payload
2085
+ );
2086
+ }
2087
+ /**
2088
+ * Get subscriber
2089
+ *
2090
+ * Get a subscriber by its unique ID.
2091
+
2092
+ *
2093
+ * @param {string} topicId
2094
+ * @param {string} subscriberId
2095
+ * @throws {AppwriteException}
2096
+ * @returns {Promise<Models.Subscriber>}
2097
+ */
2098
+ async getSubscriber(topicId, subscriberId) {
2099
+ if (typeof topicId === "undefined") {
2100
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
2101
+ }
2102
+ if (typeof subscriberId === "undefined") {
2103
+ throw new client.AppwriteException('Missing required parameter: "subscriberId"');
2104
+ }
2105
+ const apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}", topicId).replace("{subscriberId}", subscriberId);
2106
+ const payload = {};
2107
+ const uri = new URL(this.client.config.endpoint + apiPath);
2108
+ const apiHeaders = {
2109
+ "content-type": "application/json"
2110
+ };
2111
+ return await this.client.call(
2112
+ "get",
2113
+ uri,
2114
+ apiHeaders,
2115
+ payload
2116
+ );
2117
+ }
2118
+ /**
2119
+ * Delete subscriber
2120
+ *
2121
+ * Delete a subscriber by its unique ID.
2122
+ *
2123
+ * @param {string} topicId
2124
+ * @param {string} subscriberId
2125
+ * @throws {AppwriteException}
2126
+ * @returns {Promise<{}>}
2127
+ */
2128
+ async deleteSubscriber(topicId, subscriberId) {
2129
+ if (typeof topicId === "undefined") {
2130
+ throw new client.AppwriteException('Missing required parameter: "topicId"');
2131
+ }
2132
+ if (typeof subscriberId === "undefined") {
2133
+ throw new client.AppwriteException('Missing required parameter: "subscriberId"');
2134
+ }
2135
+ const apiPath = "/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}", topicId).replace("{subscriberId}", subscriberId);
2136
+ const payload = {};
2137
+ const uri = new URL(this.client.config.endpoint + apiPath);
2138
+ const apiHeaders = {
2139
+ "content-type": "application/json"
2140
+ };
2141
+ return await this.client.call(
2142
+ "delete",
2143
+ uri,
2144
+ apiHeaders,
2145
+ payload
2146
+ );
2147
+ }
2148
+ }
2149
+
2150
+ exports.Messaging = Messaging;
2151
+ //# sourceMappingURL=out.js.map
2152
+ //# sourceMappingURL=messaging.js.map