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