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