@appwrite.io/console 0.5.0 → 0.6.0-rc.2

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