appwrite 10.1.2 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +36 -7
  3. data/lib/appwrite/enums/authentication_factor.rb +10 -0
  4. data/lib/appwrite/enums/authenticator_type.rb +7 -0
  5. data/lib/appwrite/enums/browser.rb +20 -0
  6. data/lib/appwrite/enums/compression.rb +9 -0
  7. data/lib/appwrite/enums/credit_card.rb +22 -0
  8. data/lib/appwrite/enums/execution_method.rb +12 -0
  9. data/lib/appwrite/enums/flag.rb +200 -0
  10. data/lib/appwrite/enums/image_format.rb +11 -0
  11. data/lib/appwrite/enums/image_gravity.rb +15 -0
  12. data/lib/appwrite/enums/index_type.rb +9 -0
  13. data/lib/appwrite/enums/messaging_provider_type.rb +9 -0
  14. data/lib/appwrite/enums/name.rb +19 -0
  15. data/lib/appwrite/enums/o_auth_provider.rb +45 -0
  16. data/lib/appwrite/enums/password_hash.rb +17 -0
  17. data/lib/appwrite/enums/relation_mutate.rb +9 -0
  18. data/lib/appwrite/enums/relationship_type.rb +10 -0
  19. data/lib/appwrite/enums/runtime.rb +50 -0
  20. data/lib/appwrite/enums/smtp_encryption.rb +9 -0
  21. data/lib/appwrite/models/health_certificate.rb +52 -0
  22. data/lib/appwrite/models/jwt.rb +27 -0
  23. data/lib/appwrite/models/membership.rb +5 -0
  24. data/lib/appwrite/models/message.rb +87 -0
  25. data/lib/appwrite/models/message_list.rb +32 -0
  26. data/lib/appwrite/models/mfa_challenge.rb +42 -0
  27. data/lib/appwrite/models/mfa_factors.rb +37 -0
  28. data/lib/appwrite/models/mfa_recovery_codes.rb +27 -0
  29. data/lib/appwrite/models/mfa_type.rb +32 -0
  30. data/lib/appwrite/models/provider.rb +67 -0
  31. data/lib/appwrite/models/provider_list.rb +32 -0
  32. data/lib/appwrite/models/session.rb +18 -3
  33. data/lib/appwrite/models/subscriber.rb +67 -0
  34. data/lib/appwrite/models/subscriber_list.rb +32 -0
  35. data/lib/appwrite/models/target.rb +62 -0
  36. data/lib/appwrite/models/target_list.rb +32 -0
  37. data/lib/appwrite/models/token.rb +8 -3
  38. data/lib/appwrite/models/topic.rb +62 -0
  39. data/lib/appwrite/models/topic_list.rb +32 -0
  40. data/lib/appwrite/models/user.rb +10 -0
  41. data/lib/appwrite/query.rb +53 -28
  42. data/lib/appwrite/services/account.rb +935 -168
  43. data/lib/appwrite/services/avatars.rb +3 -3
  44. data/lib/appwrite/services/databases.rb +22 -16
  45. data/lib/appwrite/services/functions.rb +3 -3
  46. data/lib/appwrite/services/health.rb +138 -0
  47. data/lib/appwrite/services/messaging.rb +1886 -0
  48. data/lib/appwrite/services/storage.rb +4 -4
  49. data/lib/appwrite/services/teams.rb +1 -1
  50. data/lib/appwrite/services/users.rb +475 -4
  51. data/lib/appwrite.rb +36 -0
  52. metadata +37 -2
@@ -0,0 +1,1886 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Messaging < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Get a list of all messages from the current Appwrite project.
11
+ #
12
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType
13
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
14
+ #
15
+ # @return [MessageList]
16
+ def list_messages(queries: nil, search: nil)
17
+ api_path = '/messaging/messages'
18
+
19
+ api_params = {
20
+ queries: queries,
21
+ search: search,
22
+ }
23
+
24
+ api_headers = {
25
+ "content-type": 'application/json',
26
+ }
27
+
28
+ @client.call(
29
+ method: 'GET',
30
+ path: api_path,
31
+ headers: api_headers,
32
+ params: api_params,
33
+ response_type: Models::MessageList
34
+ )
35
+ end
36
+
37
+
38
+ # Create a new email message.
39
+ #
40
+ # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
41
+ # @param [String] subject Email Subject.
42
+ # @param [String] content Email Content.
43
+ # @param [Array] topics List of Topic IDs.
44
+ # @param [Array] users List of User IDs.
45
+ # @param [Array] targets List of Targets IDs.
46
+ # @param [Array] cc Array of target IDs to be added as CC.
47
+ # @param [Array] bcc Array of target IDs to be added as BCC.
48
+ # @param [Array] attachments Array of compound bucket IDs to file IDs to be attached to the email.
49
+ # @param [] draft Is message a draft
50
+ # @param [] html Is content of type HTML
51
+ # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
52
+ #
53
+ # @return [Message]
54
+ def create_email(message_id:, subject:, content:, topics: nil, users: nil, targets: nil, cc: nil, bcc: nil, attachments: nil, draft: nil, html: nil, scheduled_at: nil)
55
+ api_path = '/messaging/messages/email'
56
+
57
+ if message_id.nil?
58
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
59
+ end
60
+
61
+ if subject.nil?
62
+ raise Appwrite::Exception.new('Missing required parameter: "subject"')
63
+ end
64
+
65
+ if content.nil?
66
+ raise Appwrite::Exception.new('Missing required parameter: "content"')
67
+ end
68
+
69
+ api_params = {
70
+ messageId: message_id,
71
+ subject: subject,
72
+ content: content,
73
+ topics: topics,
74
+ users: users,
75
+ targets: targets,
76
+ cc: cc,
77
+ bcc: bcc,
78
+ attachments: attachments,
79
+ draft: draft,
80
+ html: html,
81
+ scheduledAt: scheduled_at,
82
+ }
83
+
84
+ api_headers = {
85
+ "content-type": 'application/json',
86
+ }
87
+
88
+ @client.call(
89
+ method: 'POST',
90
+ path: api_path,
91
+ headers: api_headers,
92
+ params: api_params,
93
+ response_type: Models::Message
94
+ )
95
+ end
96
+
97
+
98
+ # Update an email message by its unique ID.
99
+ #
100
+ #
101
+ # @param [String] message_id Message ID.
102
+ # @param [Array] topics List of Topic IDs.
103
+ # @param [Array] users List of User IDs.
104
+ # @param [Array] targets List of Targets IDs.
105
+ # @param [String] subject Email Subject.
106
+ # @param [String] content Email Content.
107
+ # @param [] draft Is message a draft
108
+ # @param [] html Is content of type HTML
109
+ # @param [Array] cc Array of target IDs to be added as CC.
110
+ # @param [Array] bcc Array of target IDs to be added as BCC.
111
+ # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
112
+ #
113
+ # @return [Message]
114
+ def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil)
115
+ api_path = '/messaging/messages/email/{messageId}'
116
+ .gsub('{messageId}', message_id)
117
+
118
+ if message_id.nil?
119
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
120
+ end
121
+
122
+ api_params = {
123
+ topics: topics,
124
+ users: users,
125
+ targets: targets,
126
+ subject: subject,
127
+ content: content,
128
+ draft: draft,
129
+ html: html,
130
+ cc: cc,
131
+ bcc: bcc,
132
+ scheduledAt: scheduled_at,
133
+ }
134
+
135
+ api_headers = {
136
+ "content-type": 'application/json',
137
+ }
138
+
139
+ @client.call(
140
+ method: 'PATCH',
141
+ path: api_path,
142
+ headers: api_headers,
143
+ params: api_params,
144
+ response_type: Models::Message
145
+ )
146
+ end
147
+
148
+
149
+ # Create a new push notification.
150
+ #
151
+ # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
152
+ # @param [String] title Title for push notification.
153
+ # @param [String] body Body for push notification.
154
+ # @param [Array] topics List of Topic IDs.
155
+ # @param [Array] users List of User IDs.
156
+ # @param [Array] targets List of Targets IDs.
157
+ # @param [Hash] data Additional Data for push notification.
158
+ # @param [String] action Action for push notification.
159
+ # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
160
+ # @param [String] icon Icon for push notification. Available only for Android and Web Platform.
161
+ # @param [String] sound Sound for push notification. Available only for Android and IOS Platform.
162
+ # @param [String] color Color for push notification. Available only for Android Platform.
163
+ # @param [String] tag Tag for push notification. Available only for Android Platform.
164
+ # @param [String] badge Badge for push notification. Available only for IOS Platform.
165
+ # @param [] draft Is message a draft
166
+ # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
167
+ #
168
+ # @return [Message]
169
+ def create_push(message_id:, title:, body:, topics: nil, users: nil, targets: nil, data: nil, action: nil, image: nil, icon: nil, sound: nil, color: nil, tag: nil, badge: nil, draft: nil, scheduled_at: nil)
170
+ api_path = '/messaging/messages/push'
171
+
172
+ if message_id.nil?
173
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
174
+ end
175
+
176
+ if title.nil?
177
+ raise Appwrite::Exception.new('Missing required parameter: "title"')
178
+ end
179
+
180
+ if body.nil?
181
+ raise Appwrite::Exception.new('Missing required parameter: "body"')
182
+ end
183
+
184
+ api_params = {
185
+ messageId: message_id,
186
+ title: title,
187
+ body: body,
188
+ topics: topics,
189
+ users: users,
190
+ targets: targets,
191
+ data: data,
192
+ action: action,
193
+ image: image,
194
+ icon: icon,
195
+ sound: sound,
196
+ color: color,
197
+ tag: tag,
198
+ badge: badge,
199
+ draft: draft,
200
+ scheduledAt: scheduled_at,
201
+ }
202
+
203
+ api_headers = {
204
+ "content-type": 'application/json',
205
+ }
206
+
207
+ @client.call(
208
+ method: 'POST',
209
+ path: api_path,
210
+ headers: api_headers,
211
+ params: api_params,
212
+ response_type: Models::Message
213
+ )
214
+ end
215
+
216
+
217
+ # Update a push notification by its unique ID.
218
+ #
219
+ #
220
+ # @param [String] message_id Message ID.
221
+ # @param [Array] topics List of Topic IDs.
222
+ # @param [Array] users List of User IDs.
223
+ # @param [Array] targets List of Targets IDs.
224
+ # @param [String] title Title for push notification.
225
+ # @param [String] body Body for push notification.
226
+ # @param [Hash] data Additional Data for push notification.
227
+ # @param [String] action Action for push notification.
228
+ # @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
229
+ # @param [String] icon Icon for push notification. Available only for Android and Web platforms.
230
+ # @param [String] sound Sound for push notification. Available only for Android and iOS platforms.
231
+ # @param [String] color Color for push notification. Available only for Android platforms.
232
+ # @param [String] tag Tag for push notification. Available only for Android platforms.
233
+ # @param [Integer] badge Badge for push notification. Available only for iOS platforms.
234
+ # @param [] draft Is message a draft
235
+ # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
236
+ #
237
+ # @return [Message]
238
+ def update_push(message_id:, topics: nil, users: nil, targets: nil, title: nil, body: nil, data: nil, action: nil, image: nil, icon: nil, sound: nil, color: nil, tag: nil, badge: nil, draft: nil, scheduled_at: nil)
239
+ api_path = '/messaging/messages/push/{messageId}'
240
+ .gsub('{messageId}', message_id)
241
+
242
+ if message_id.nil?
243
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
244
+ end
245
+
246
+ api_params = {
247
+ topics: topics,
248
+ users: users,
249
+ targets: targets,
250
+ title: title,
251
+ body: body,
252
+ data: data,
253
+ action: action,
254
+ image: image,
255
+ icon: icon,
256
+ sound: sound,
257
+ color: color,
258
+ tag: tag,
259
+ badge: badge,
260
+ draft: draft,
261
+ scheduledAt: scheduled_at,
262
+ }
263
+
264
+ api_headers = {
265
+ "content-type": 'application/json',
266
+ }
267
+
268
+ @client.call(
269
+ method: 'PATCH',
270
+ path: api_path,
271
+ headers: api_headers,
272
+ params: api_params,
273
+ response_type: Models::Message
274
+ )
275
+ end
276
+
277
+
278
+ # Create a new SMS message.
279
+ #
280
+ # @param [String] message_id Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
281
+ # @param [String] content SMS Content.
282
+ # @param [Array] topics List of Topic IDs.
283
+ # @param [Array] users List of User IDs.
284
+ # @param [Array] targets List of Targets IDs.
285
+ # @param [] draft Is message a draft
286
+ # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
287
+ #
288
+ # @return [Message]
289
+ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, draft: nil, scheduled_at: nil)
290
+ api_path = '/messaging/messages/sms'
291
+
292
+ if message_id.nil?
293
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
294
+ end
295
+
296
+ if content.nil?
297
+ raise Appwrite::Exception.new('Missing required parameter: "content"')
298
+ end
299
+
300
+ api_params = {
301
+ messageId: message_id,
302
+ content: content,
303
+ topics: topics,
304
+ users: users,
305
+ targets: targets,
306
+ draft: draft,
307
+ scheduledAt: scheduled_at,
308
+ }
309
+
310
+ api_headers = {
311
+ "content-type": 'application/json',
312
+ }
313
+
314
+ @client.call(
315
+ method: 'POST',
316
+ path: api_path,
317
+ headers: api_headers,
318
+ params: api_params,
319
+ response_type: Models::Message
320
+ )
321
+ end
322
+
323
+
324
+ # Update an email message by its unique ID.
325
+ #
326
+ #
327
+ # @param [String] message_id Message ID.
328
+ # @param [Array] topics List of Topic IDs.
329
+ # @param [Array] users List of User IDs.
330
+ # @param [Array] targets List of Targets IDs.
331
+ # @param [String] content Email Content.
332
+ # @param [] draft Is message a draft
333
+ # @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
334
+ #
335
+ # @return [Message]
336
+ def update_sms(message_id:, topics: nil, users: nil, targets: nil, content: nil, draft: nil, scheduled_at: nil)
337
+ api_path = '/messaging/messages/sms/{messageId}'
338
+ .gsub('{messageId}', message_id)
339
+
340
+ if message_id.nil?
341
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
342
+ end
343
+
344
+ api_params = {
345
+ topics: topics,
346
+ users: users,
347
+ targets: targets,
348
+ content: content,
349
+ draft: draft,
350
+ scheduledAt: scheduled_at,
351
+ }
352
+
353
+ api_headers = {
354
+ "content-type": 'application/json',
355
+ }
356
+
357
+ @client.call(
358
+ method: 'PATCH',
359
+ path: api_path,
360
+ headers: api_headers,
361
+ params: api_params,
362
+ response_type: Models::Message
363
+ )
364
+ end
365
+
366
+
367
+ # Get a message by its unique ID.
368
+ #
369
+ #
370
+ # @param [String] message_id Message ID.
371
+ #
372
+ # @return [Message]
373
+ def get_message(message_id:)
374
+ api_path = '/messaging/messages/{messageId}'
375
+ .gsub('{messageId}', message_id)
376
+
377
+ if message_id.nil?
378
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
379
+ end
380
+
381
+ api_params = {
382
+ }
383
+
384
+ api_headers = {
385
+ "content-type": 'application/json',
386
+ }
387
+
388
+ @client.call(
389
+ method: 'GET',
390
+ path: api_path,
391
+ headers: api_headers,
392
+ params: api_params,
393
+ response_type: Models::Message
394
+ )
395
+ end
396
+
397
+
398
+ # Delete a message. If the message is not a draft or scheduled, but has been
399
+ # sent, this will not recall the message.
400
+ #
401
+ # @param [String] message_id Message ID.
402
+ #
403
+ # @return []
404
+ def delete(message_id:)
405
+ api_path = '/messaging/messages/{messageId}'
406
+ .gsub('{messageId}', message_id)
407
+
408
+ if message_id.nil?
409
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
410
+ end
411
+
412
+ api_params = {
413
+ }
414
+
415
+ api_headers = {
416
+ "content-type": 'application/json',
417
+ }
418
+
419
+ @client.call(
420
+ method: 'DELETE',
421
+ path: api_path,
422
+ headers: api_headers,
423
+ params: api_params,
424
+ )
425
+ end
426
+
427
+
428
+ # Get the message activity logs listed by its unique ID.
429
+ #
430
+ # @param [String] message_id Message ID.
431
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
432
+ #
433
+ # @return [LogList]
434
+ def list_message_logs(message_id:, queries: nil)
435
+ api_path = '/messaging/messages/{messageId}/logs'
436
+ .gsub('{messageId}', message_id)
437
+
438
+ if message_id.nil?
439
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
440
+ end
441
+
442
+ api_params = {
443
+ queries: queries,
444
+ }
445
+
446
+ api_headers = {
447
+ "content-type": 'application/json',
448
+ }
449
+
450
+ @client.call(
451
+ method: 'GET',
452
+ path: api_path,
453
+ headers: api_headers,
454
+ params: api_params,
455
+ response_type: Models::LogList
456
+ )
457
+ end
458
+
459
+
460
+ # Get a list of the targets associated with a message.
461
+ #
462
+ # @param [String] message_id Message ID.
463
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType
464
+ #
465
+ # @return [TargetList]
466
+ def list_targets(message_id:, queries: nil)
467
+ api_path = '/messaging/messages/{messageId}/targets'
468
+ .gsub('{messageId}', message_id)
469
+
470
+ if message_id.nil?
471
+ raise Appwrite::Exception.new('Missing required parameter: "messageId"')
472
+ end
473
+
474
+ api_params = {
475
+ queries: queries,
476
+ }
477
+
478
+ api_headers = {
479
+ "content-type": 'application/json',
480
+ }
481
+
482
+ @client.call(
483
+ method: 'GET',
484
+ path: api_path,
485
+ headers: api_headers,
486
+ params: api_params,
487
+ response_type: Models::TargetList
488
+ )
489
+ end
490
+
491
+
492
+ # Get a list of all providers from the current Appwrite project.
493
+ #
494
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled
495
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
496
+ #
497
+ # @return [ProviderList]
498
+ def list_providers(queries: nil, search: nil)
499
+ api_path = '/messaging/providers'
500
+
501
+ api_params = {
502
+ queries: queries,
503
+ search: search,
504
+ }
505
+
506
+ api_headers = {
507
+ "content-type": 'application/json',
508
+ }
509
+
510
+ @client.call(
511
+ method: 'GET',
512
+ path: api_path,
513
+ headers: api_headers,
514
+ params: api_params,
515
+ response_type: Models::ProviderList
516
+ )
517
+ end
518
+
519
+
520
+ # Create a new Apple Push Notification service provider.
521
+ #
522
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
523
+ # @param [String] name Provider name.
524
+ # @param [String] auth_key APNS authentication key.
525
+ # @param [String] auth_key_id APNS authentication key ID.
526
+ # @param [String] team_id APNS team ID.
527
+ # @param [String] bundle_id APNS bundle ID.
528
+ # @param [] sandbox Use APNS sandbox environment.
529
+ # @param [] enabled Set as enabled.
530
+ #
531
+ # @return [Provider]
532
+ def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, sandbox: nil, enabled: nil)
533
+ api_path = '/messaging/providers/apns'
534
+
535
+ if provider_id.nil?
536
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
537
+ end
538
+
539
+ if name.nil?
540
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
541
+ end
542
+
543
+ api_params = {
544
+ providerId: provider_id,
545
+ name: name,
546
+ authKey: auth_key,
547
+ authKeyId: auth_key_id,
548
+ teamId: team_id,
549
+ bundleId: bundle_id,
550
+ sandbox: sandbox,
551
+ enabled: enabled,
552
+ }
553
+
554
+ api_headers = {
555
+ "content-type": 'application/json',
556
+ }
557
+
558
+ @client.call(
559
+ method: 'POST',
560
+ path: api_path,
561
+ headers: api_headers,
562
+ params: api_params,
563
+ response_type: Models::Provider
564
+ )
565
+ end
566
+
567
+
568
+ # Update a Apple Push Notification service provider by its unique ID.
569
+ #
570
+ # @param [String] provider_id Provider ID.
571
+ # @param [String] name Provider name.
572
+ # @param [] enabled Set as enabled.
573
+ # @param [String] auth_key APNS authentication key.
574
+ # @param [String] auth_key_id APNS authentication key ID.
575
+ # @param [String] team_id APNS team ID.
576
+ # @param [String] bundle_id APNS bundle ID.
577
+ # @param [] sandbox Use APNS sandbox environment.
578
+ #
579
+ # @return [Provider]
580
+ def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, sandbox: nil)
581
+ api_path = '/messaging/providers/apns/{providerId}'
582
+ .gsub('{providerId}', provider_id)
583
+
584
+ if provider_id.nil?
585
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
586
+ end
587
+
588
+ api_params = {
589
+ name: name,
590
+ enabled: enabled,
591
+ authKey: auth_key,
592
+ authKeyId: auth_key_id,
593
+ teamId: team_id,
594
+ bundleId: bundle_id,
595
+ sandbox: sandbox,
596
+ }
597
+
598
+ api_headers = {
599
+ "content-type": 'application/json',
600
+ }
601
+
602
+ @client.call(
603
+ method: 'PATCH',
604
+ path: api_path,
605
+ headers: api_headers,
606
+ params: api_params,
607
+ response_type: Models::Provider
608
+ )
609
+ end
610
+
611
+
612
+ # Create a new Firebase Cloud Messaging provider.
613
+ #
614
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
615
+ # @param [String] name Provider name.
616
+ # @param [Hash] service_account_json FCM service account JSON.
617
+ # @param [] enabled Set as enabled.
618
+ #
619
+ # @return [Provider]
620
+ def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: nil)
621
+ api_path = '/messaging/providers/fcm'
622
+
623
+ if provider_id.nil?
624
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
625
+ end
626
+
627
+ if name.nil?
628
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
629
+ end
630
+
631
+ api_params = {
632
+ providerId: provider_id,
633
+ name: name,
634
+ serviceAccountJSON: service_account_json,
635
+ enabled: enabled,
636
+ }
637
+
638
+ api_headers = {
639
+ "content-type": 'application/json',
640
+ }
641
+
642
+ @client.call(
643
+ method: 'POST',
644
+ path: api_path,
645
+ headers: api_headers,
646
+ params: api_params,
647
+ response_type: Models::Provider
648
+ )
649
+ end
650
+
651
+
652
+ # Update a Firebase Cloud Messaging provider by its unique ID.
653
+ #
654
+ # @param [String] provider_id Provider ID.
655
+ # @param [String] name Provider name.
656
+ # @param [] enabled Set as enabled.
657
+ # @param [Hash] service_account_json FCM service account JSON.
658
+ #
659
+ # @return [Provider]
660
+ def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_json: nil)
661
+ api_path = '/messaging/providers/fcm/{providerId}'
662
+ .gsub('{providerId}', provider_id)
663
+
664
+ if provider_id.nil?
665
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
666
+ end
667
+
668
+ api_params = {
669
+ name: name,
670
+ enabled: enabled,
671
+ serviceAccountJSON: service_account_json,
672
+ }
673
+
674
+ api_headers = {
675
+ "content-type": 'application/json',
676
+ }
677
+
678
+ @client.call(
679
+ method: 'PATCH',
680
+ path: api_path,
681
+ headers: api_headers,
682
+ params: api_params,
683
+ response_type: Models::Provider
684
+ )
685
+ end
686
+
687
+
688
+ # Create a new Mailgun provider.
689
+ #
690
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
691
+ # @param [String] name Provider name.
692
+ # @param [String] api_key Mailgun API Key.
693
+ # @param [String] domain Mailgun Domain.
694
+ # @param [] is_eu_region Set as EU region.
695
+ # @param [String] from_name Sender Name.
696
+ # @param [String] from_email Sender email address.
697
+ # @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well.
698
+ # @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.
699
+ # @param [] enabled Set as enabled.
700
+ #
701
+ # @return [Provider]
702
+ def create_mailgun_provider(provider_id:, name:, api_key: nil, domain: nil, is_eu_region: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil)
703
+ api_path = '/messaging/providers/mailgun'
704
+
705
+ if provider_id.nil?
706
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
707
+ end
708
+
709
+ if name.nil?
710
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
711
+ end
712
+
713
+ api_params = {
714
+ providerId: provider_id,
715
+ name: name,
716
+ apiKey: api_key,
717
+ domain: domain,
718
+ isEuRegion: is_eu_region,
719
+ fromName: from_name,
720
+ fromEmail: from_email,
721
+ replyToName: reply_to_name,
722
+ replyToEmail: reply_to_email,
723
+ enabled: enabled,
724
+ }
725
+
726
+ api_headers = {
727
+ "content-type": 'application/json',
728
+ }
729
+
730
+ @client.call(
731
+ method: 'POST',
732
+ path: api_path,
733
+ headers: api_headers,
734
+ params: api_params,
735
+ response_type: Models::Provider
736
+ )
737
+ end
738
+
739
+
740
+ # Update a Mailgun provider by its unique ID.
741
+ #
742
+ # @param [String] provider_id Provider ID.
743
+ # @param [String] name Provider name.
744
+ # @param [String] api_key Mailgun API Key.
745
+ # @param [String] domain Mailgun Domain.
746
+ # @param [] is_eu_region Set as EU region.
747
+ # @param [] enabled Set as enabled.
748
+ # @param [String] from_name Sender Name.
749
+ # @param [String] from_email Sender email address.
750
+ # @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name.
751
+ # @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email.
752
+ #
753
+ # @return [Provider]
754
+ def update_mailgun_provider(provider_id:, name: nil, api_key: nil, domain: nil, is_eu_region: nil, enabled: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil)
755
+ api_path = '/messaging/providers/mailgun/{providerId}'
756
+ .gsub('{providerId}', provider_id)
757
+
758
+ if provider_id.nil?
759
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
760
+ end
761
+
762
+ api_params = {
763
+ name: name,
764
+ apiKey: api_key,
765
+ domain: domain,
766
+ isEuRegion: is_eu_region,
767
+ enabled: enabled,
768
+ fromName: from_name,
769
+ fromEmail: from_email,
770
+ replyToName: reply_to_name,
771
+ replyToEmail: reply_to_email,
772
+ }
773
+
774
+ api_headers = {
775
+ "content-type": 'application/json',
776
+ }
777
+
778
+ @client.call(
779
+ method: 'PATCH',
780
+ path: api_path,
781
+ headers: api_headers,
782
+ params: api_params,
783
+ response_type: Models::Provider
784
+ )
785
+ end
786
+
787
+
788
+ # Create a new MSG91 provider.
789
+ #
790
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
791
+ # @param [String] name Provider name.
792
+ # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
793
+ # @param [String] sender_id Msg91 Sender ID.
794
+ # @param [String] auth_key Msg91 Auth Key.
795
+ # @param [] enabled Set as enabled.
796
+ #
797
+ # @return [Provider]
798
+ def create_msg91_provider(provider_id:, name:, from: nil, sender_id: nil, auth_key: nil, enabled: nil)
799
+ api_path = '/messaging/providers/msg91'
800
+
801
+ if provider_id.nil?
802
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
803
+ end
804
+
805
+ if name.nil?
806
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
807
+ end
808
+
809
+ api_params = {
810
+ providerId: provider_id,
811
+ name: name,
812
+ from: from,
813
+ senderId: sender_id,
814
+ authKey: auth_key,
815
+ enabled: enabled,
816
+ }
817
+
818
+ api_headers = {
819
+ "content-type": 'application/json',
820
+ }
821
+
822
+ @client.call(
823
+ method: 'POST',
824
+ path: api_path,
825
+ headers: api_headers,
826
+ params: api_params,
827
+ response_type: Models::Provider
828
+ )
829
+ end
830
+
831
+
832
+ # Update a MSG91 provider by its unique ID.
833
+ #
834
+ # @param [String] provider_id Provider ID.
835
+ # @param [String] name Provider name.
836
+ # @param [] enabled Set as enabled.
837
+ # @param [String] sender_id Msg91 Sender ID.
838
+ # @param [String] auth_key Msg91 Auth Key.
839
+ # @param [String] from Sender number.
840
+ #
841
+ # @return [Provider]
842
+ def update_msg91_provider(provider_id:, name: nil, enabled: nil, sender_id: nil, auth_key: nil, from: nil)
843
+ api_path = '/messaging/providers/msg91/{providerId}'
844
+ .gsub('{providerId}', provider_id)
845
+
846
+ if provider_id.nil?
847
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
848
+ end
849
+
850
+ api_params = {
851
+ name: name,
852
+ enabled: enabled,
853
+ senderId: sender_id,
854
+ authKey: auth_key,
855
+ from: from,
856
+ }
857
+
858
+ api_headers = {
859
+ "content-type": 'application/json',
860
+ }
861
+
862
+ @client.call(
863
+ method: 'PATCH',
864
+ path: api_path,
865
+ headers: api_headers,
866
+ params: api_params,
867
+ response_type: Models::Provider
868
+ )
869
+ end
870
+
871
+
872
+ # Create a new Sendgrid provider.
873
+ #
874
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
875
+ # @param [String] name Provider name.
876
+ # @param [String] api_key Sendgrid API key.
877
+ # @param [String] from_name Sender Name.
878
+ # @param [String] from_email Sender email address.
879
+ # @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name.
880
+ # @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email.
881
+ # @param [] enabled Set as enabled.
882
+ #
883
+ # @return [Provider]
884
+ def create_sendgrid_provider(provider_id:, name:, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil)
885
+ api_path = '/messaging/providers/sendgrid'
886
+
887
+ if provider_id.nil?
888
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
889
+ end
890
+
891
+ if name.nil?
892
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
893
+ end
894
+
895
+ api_params = {
896
+ providerId: provider_id,
897
+ name: name,
898
+ apiKey: api_key,
899
+ fromName: from_name,
900
+ fromEmail: from_email,
901
+ replyToName: reply_to_name,
902
+ replyToEmail: reply_to_email,
903
+ enabled: enabled,
904
+ }
905
+
906
+ api_headers = {
907
+ "content-type": 'application/json',
908
+ }
909
+
910
+ @client.call(
911
+ method: 'POST',
912
+ path: api_path,
913
+ headers: api_headers,
914
+ params: api_params,
915
+ response_type: Models::Provider
916
+ )
917
+ end
918
+
919
+
920
+ # Update a Sendgrid provider by its unique ID.
921
+ #
922
+ # @param [String] provider_id Provider ID.
923
+ # @param [String] name Provider name.
924
+ # @param [] enabled Set as enabled.
925
+ # @param [String] api_key Sendgrid API key.
926
+ # @param [String] from_name Sender Name.
927
+ # @param [String] from_email Sender email address.
928
+ # @param [String] reply_to_name Name set in the Reply To field for the mail. Default value is Sender Name.
929
+ # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email.
930
+ #
931
+ # @return [Provider]
932
+ def update_sendgrid_provider(provider_id:, name: nil, enabled: nil, api_key: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil)
933
+ api_path = '/messaging/providers/sendgrid/{providerId}'
934
+ .gsub('{providerId}', provider_id)
935
+
936
+ if provider_id.nil?
937
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
938
+ end
939
+
940
+ api_params = {
941
+ name: name,
942
+ enabled: enabled,
943
+ apiKey: api_key,
944
+ fromName: from_name,
945
+ fromEmail: from_email,
946
+ replyToName: reply_to_name,
947
+ replyToEmail: reply_to_email,
948
+ }
949
+
950
+ api_headers = {
951
+ "content-type": 'application/json',
952
+ }
953
+
954
+ @client.call(
955
+ method: 'PATCH',
956
+ path: api_path,
957
+ headers: api_headers,
958
+ params: api_params,
959
+ response_type: Models::Provider
960
+ )
961
+ end
962
+
963
+
964
+ # Create a new SMTP provider.
965
+ #
966
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
967
+ # @param [String] name Provider name.
968
+ # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order.
969
+ # @param [Integer] port The default SMTP server port.
970
+ # @param [String] username Authentication username.
971
+ # @param [String] password Authentication password.
972
+ # @param [SmtpEncryption] encryption Encryption type. Can be omitted, 'ssl', or 'tls'
973
+ # @param [] auto_tls Enable SMTP AutoTLS feature.
974
+ # @param [String] mailer The value to use for the X-Mailer header.
975
+ # @param [String] from_name Sender Name.
976
+ # @param [String] from_email Sender email address.
977
+ # @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name.
978
+ # @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email.
979
+ # @param [] enabled Set as enabled.
980
+ #
981
+ # @return [Provider]
982
+ def create_smtp_provider(provider_id:, name:, host:, port: nil, username: nil, password: nil, encryption: nil, auto_tls: nil, mailer: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil)
983
+ api_path = '/messaging/providers/smtp'
984
+
985
+ if provider_id.nil?
986
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
987
+ end
988
+
989
+ if name.nil?
990
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
991
+ end
992
+
993
+ if host.nil?
994
+ raise Appwrite::Exception.new('Missing required parameter: "host"')
995
+ end
996
+
997
+ api_params = {
998
+ providerId: provider_id,
999
+ name: name,
1000
+ host: host,
1001
+ port: port,
1002
+ username: username,
1003
+ password: password,
1004
+ encryption: encryption,
1005
+ autoTLS: auto_tls,
1006
+ mailer: mailer,
1007
+ fromName: from_name,
1008
+ fromEmail: from_email,
1009
+ replyToName: reply_to_name,
1010
+ replyToEmail: reply_to_email,
1011
+ enabled: enabled,
1012
+ }
1013
+
1014
+ api_headers = {
1015
+ "content-type": 'application/json',
1016
+ }
1017
+
1018
+ @client.call(
1019
+ method: 'POST',
1020
+ path: api_path,
1021
+ headers: api_headers,
1022
+ params: api_params,
1023
+ response_type: Models::Provider
1024
+ )
1025
+ end
1026
+
1027
+
1028
+ # Update a SMTP provider by its unique ID.
1029
+ #
1030
+ # @param [String] provider_id Provider ID.
1031
+ # @param [String] name Provider name.
1032
+ # @param [String] host SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order.
1033
+ # @param [Integer] port SMTP port.
1034
+ # @param [String] username Authentication username.
1035
+ # @param [String] password Authentication password.
1036
+ # @param [SmtpEncryption] encryption Encryption type. Can be 'ssl' or 'tls'
1037
+ # @param [] auto_tls Enable SMTP AutoTLS feature.
1038
+ # @param [String] mailer The value to use for the X-Mailer header.
1039
+ # @param [String] from_name Sender Name.
1040
+ # @param [String] from_email Sender email address.
1041
+ # @param [String] reply_to_name Name set in the Reply To field for the mail. Default value is Sender Name.
1042
+ # @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email.
1043
+ # @param [] enabled Set as enabled.
1044
+ #
1045
+ # @return [Provider]
1046
+ def update_smtp_provider(provider_id:, name: nil, host: nil, port: nil, username: nil, password: nil, encryption: nil, auto_tls: nil, mailer: nil, from_name: nil, from_email: nil, reply_to_name: nil, reply_to_email: nil, enabled: nil)
1047
+ api_path = '/messaging/providers/smtp/{providerId}'
1048
+ .gsub('{providerId}', provider_id)
1049
+
1050
+ if provider_id.nil?
1051
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1052
+ end
1053
+
1054
+ api_params = {
1055
+ name: name,
1056
+ host: host,
1057
+ port: port,
1058
+ username: username,
1059
+ password: password,
1060
+ encryption: encryption,
1061
+ autoTLS: auto_tls,
1062
+ mailer: mailer,
1063
+ fromName: from_name,
1064
+ fromEmail: from_email,
1065
+ replyToName: reply_to_name,
1066
+ replyToEmail: reply_to_email,
1067
+ enabled: enabled,
1068
+ }
1069
+
1070
+ api_headers = {
1071
+ "content-type": 'application/json',
1072
+ }
1073
+
1074
+ @client.call(
1075
+ method: 'PATCH',
1076
+ path: api_path,
1077
+ headers: api_headers,
1078
+ params: api_params,
1079
+ response_type: Models::Provider
1080
+ )
1081
+ end
1082
+
1083
+
1084
+ # Create a new Telesign provider.
1085
+ #
1086
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1087
+ # @param [String] name Provider name.
1088
+ # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
1089
+ # @param [String] customer_id Telesign customer ID.
1090
+ # @param [String] api_key Telesign API key.
1091
+ # @param [] enabled Set as enabled.
1092
+ #
1093
+ # @return [Provider]
1094
+ def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, api_key: nil, enabled: nil)
1095
+ api_path = '/messaging/providers/telesign'
1096
+
1097
+ if provider_id.nil?
1098
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1099
+ end
1100
+
1101
+ if name.nil?
1102
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
1103
+ end
1104
+
1105
+ api_params = {
1106
+ providerId: provider_id,
1107
+ name: name,
1108
+ from: from,
1109
+ customerId: customer_id,
1110
+ apiKey: api_key,
1111
+ enabled: enabled,
1112
+ }
1113
+
1114
+ api_headers = {
1115
+ "content-type": 'application/json',
1116
+ }
1117
+
1118
+ @client.call(
1119
+ method: 'POST',
1120
+ path: api_path,
1121
+ headers: api_headers,
1122
+ params: api_params,
1123
+ response_type: Models::Provider
1124
+ )
1125
+ end
1126
+
1127
+
1128
+ # Update a Telesign provider by its unique ID.
1129
+ #
1130
+ # @param [String] provider_id Provider ID.
1131
+ # @param [String] name Provider name.
1132
+ # @param [] enabled Set as enabled.
1133
+ # @param [String] customer_id Telesign customer ID.
1134
+ # @param [String] api_key Telesign API key.
1135
+ # @param [String] from Sender number.
1136
+ #
1137
+ # @return [Provider]
1138
+ def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: nil, api_key: nil, from: nil)
1139
+ api_path = '/messaging/providers/telesign/{providerId}'
1140
+ .gsub('{providerId}', provider_id)
1141
+
1142
+ if provider_id.nil?
1143
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1144
+ end
1145
+
1146
+ api_params = {
1147
+ name: name,
1148
+ enabled: enabled,
1149
+ customerId: customer_id,
1150
+ apiKey: api_key,
1151
+ from: from,
1152
+ }
1153
+
1154
+ api_headers = {
1155
+ "content-type": 'application/json',
1156
+ }
1157
+
1158
+ @client.call(
1159
+ method: 'PATCH',
1160
+ path: api_path,
1161
+ headers: api_headers,
1162
+ params: api_params,
1163
+ response_type: Models::Provider
1164
+ )
1165
+ end
1166
+
1167
+
1168
+ # Create a new Textmagic provider.
1169
+ #
1170
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1171
+ # @param [String] name Provider name.
1172
+ # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
1173
+ # @param [String] username Textmagic username.
1174
+ # @param [String] api_key Textmagic apiKey.
1175
+ # @param [] enabled Set as enabled.
1176
+ #
1177
+ # @return [Provider]
1178
+ def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api_key: nil, enabled: nil)
1179
+ api_path = '/messaging/providers/textmagic'
1180
+
1181
+ if provider_id.nil?
1182
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1183
+ end
1184
+
1185
+ if name.nil?
1186
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
1187
+ end
1188
+
1189
+ api_params = {
1190
+ providerId: provider_id,
1191
+ name: name,
1192
+ from: from,
1193
+ username: username,
1194
+ apiKey: api_key,
1195
+ enabled: enabled,
1196
+ }
1197
+
1198
+ api_headers = {
1199
+ "content-type": 'application/json',
1200
+ }
1201
+
1202
+ @client.call(
1203
+ method: 'POST',
1204
+ path: api_path,
1205
+ headers: api_headers,
1206
+ params: api_params,
1207
+ response_type: Models::Provider
1208
+ )
1209
+ end
1210
+
1211
+
1212
+ # Update a Textmagic provider by its unique ID.
1213
+ #
1214
+ # @param [String] provider_id Provider ID.
1215
+ # @param [String] name Provider name.
1216
+ # @param [] enabled Set as enabled.
1217
+ # @param [String] username Textmagic username.
1218
+ # @param [String] api_key Textmagic apiKey.
1219
+ # @param [String] from Sender number.
1220
+ #
1221
+ # @return [Provider]
1222
+ def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: nil, api_key: nil, from: nil)
1223
+ api_path = '/messaging/providers/textmagic/{providerId}'
1224
+ .gsub('{providerId}', provider_id)
1225
+
1226
+ if provider_id.nil?
1227
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1228
+ end
1229
+
1230
+ api_params = {
1231
+ name: name,
1232
+ enabled: enabled,
1233
+ username: username,
1234
+ apiKey: api_key,
1235
+ from: from,
1236
+ }
1237
+
1238
+ api_headers = {
1239
+ "content-type": 'application/json',
1240
+ }
1241
+
1242
+ @client.call(
1243
+ method: 'PATCH',
1244
+ path: api_path,
1245
+ headers: api_headers,
1246
+ params: api_params,
1247
+ response_type: Models::Provider
1248
+ )
1249
+ end
1250
+
1251
+
1252
+ # Create a new Twilio provider.
1253
+ #
1254
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1255
+ # @param [String] name Provider name.
1256
+ # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
1257
+ # @param [String] account_sid Twilio account secret ID.
1258
+ # @param [String] auth_token Twilio authentication token.
1259
+ # @param [] enabled Set as enabled.
1260
+ #
1261
+ # @return [Provider]
1262
+ def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, auth_token: nil, enabled: nil)
1263
+ api_path = '/messaging/providers/twilio'
1264
+
1265
+ if provider_id.nil?
1266
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1267
+ end
1268
+
1269
+ if name.nil?
1270
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
1271
+ end
1272
+
1273
+ api_params = {
1274
+ providerId: provider_id,
1275
+ name: name,
1276
+ from: from,
1277
+ accountSid: account_sid,
1278
+ authToken: auth_token,
1279
+ enabled: enabled,
1280
+ }
1281
+
1282
+ api_headers = {
1283
+ "content-type": 'application/json',
1284
+ }
1285
+
1286
+ @client.call(
1287
+ method: 'POST',
1288
+ path: api_path,
1289
+ headers: api_headers,
1290
+ params: api_params,
1291
+ response_type: Models::Provider
1292
+ )
1293
+ end
1294
+
1295
+
1296
+ # Update a Twilio provider by its unique ID.
1297
+ #
1298
+ # @param [String] provider_id Provider ID.
1299
+ # @param [String] name Provider name.
1300
+ # @param [] enabled Set as enabled.
1301
+ # @param [String] account_sid Twilio account secret ID.
1302
+ # @param [String] auth_token Twilio authentication token.
1303
+ # @param [String] from Sender number.
1304
+ #
1305
+ # @return [Provider]
1306
+ def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: nil, auth_token: nil, from: nil)
1307
+ api_path = '/messaging/providers/twilio/{providerId}'
1308
+ .gsub('{providerId}', provider_id)
1309
+
1310
+ if provider_id.nil?
1311
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1312
+ end
1313
+
1314
+ api_params = {
1315
+ name: name,
1316
+ enabled: enabled,
1317
+ accountSid: account_sid,
1318
+ authToken: auth_token,
1319
+ from: from,
1320
+ }
1321
+
1322
+ api_headers = {
1323
+ "content-type": 'application/json',
1324
+ }
1325
+
1326
+ @client.call(
1327
+ method: 'PATCH',
1328
+ path: api_path,
1329
+ headers: api_headers,
1330
+ params: api_params,
1331
+ response_type: Models::Provider
1332
+ )
1333
+ end
1334
+
1335
+
1336
+ # Create a new Vonage provider.
1337
+ #
1338
+ # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1339
+ # @param [String] name Provider name.
1340
+ # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
1341
+ # @param [String] api_key Vonage API key.
1342
+ # @param [String] api_secret Vonage API secret.
1343
+ # @param [] enabled Set as enabled.
1344
+ #
1345
+ # @return [Provider]
1346
+ def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_secret: nil, enabled: nil)
1347
+ api_path = '/messaging/providers/vonage'
1348
+
1349
+ if provider_id.nil?
1350
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1351
+ end
1352
+
1353
+ if name.nil?
1354
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
1355
+ end
1356
+
1357
+ api_params = {
1358
+ providerId: provider_id,
1359
+ name: name,
1360
+ from: from,
1361
+ apiKey: api_key,
1362
+ apiSecret: api_secret,
1363
+ enabled: enabled,
1364
+ }
1365
+
1366
+ api_headers = {
1367
+ "content-type": 'application/json',
1368
+ }
1369
+
1370
+ @client.call(
1371
+ method: 'POST',
1372
+ path: api_path,
1373
+ headers: api_headers,
1374
+ params: api_params,
1375
+ response_type: Models::Provider
1376
+ )
1377
+ end
1378
+
1379
+
1380
+ # Update a Vonage provider by its unique ID.
1381
+ #
1382
+ # @param [String] provider_id Provider ID.
1383
+ # @param [String] name Provider name.
1384
+ # @param [] enabled Set as enabled.
1385
+ # @param [String] api_key Vonage API key.
1386
+ # @param [String] api_secret Vonage API secret.
1387
+ # @param [String] from Sender number.
1388
+ #
1389
+ # @return [Provider]
1390
+ def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, api_secret: nil, from: nil)
1391
+ api_path = '/messaging/providers/vonage/{providerId}'
1392
+ .gsub('{providerId}', provider_id)
1393
+
1394
+ if provider_id.nil?
1395
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1396
+ end
1397
+
1398
+ api_params = {
1399
+ name: name,
1400
+ enabled: enabled,
1401
+ apiKey: api_key,
1402
+ apiSecret: api_secret,
1403
+ from: from,
1404
+ }
1405
+
1406
+ api_headers = {
1407
+ "content-type": 'application/json',
1408
+ }
1409
+
1410
+ @client.call(
1411
+ method: 'PATCH',
1412
+ path: api_path,
1413
+ headers: api_headers,
1414
+ params: api_params,
1415
+ response_type: Models::Provider
1416
+ )
1417
+ end
1418
+
1419
+
1420
+ # Get a provider by its unique ID.
1421
+ #
1422
+ #
1423
+ # @param [String] provider_id Provider ID.
1424
+ #
1425
+ # @return [Provider]
1426
+ def get_provider(provider_id:)
1427
+ api_path = '/messaging/providers/{providerId}'
1428
+ .gsub('{providerId}', provider_id)
1429
+
1430
+ if provider_id.nil?
1431
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1432
+ end
1433
+
1434
+ api_params = {
1435
+ }
1436
+
1437
+ api_headers = {
1438
+ "content-type": 'application/json',
1439
+ }
1440
+
1441
+ @client.call(
1442
+ method: 'GET',
1443
+ path: api_path,
1444
+ headers: api_headers,
1445
+ params: api_params,
1446
+ response_type: Models::Provider
1447
+ )
1448
+ end
1449
+
1450
+
1451
+ # Delete a provider by its unique ID.
1452
+ #
1453
+ # @param [String] provider_id Provider ID.
1454
+ #
1455
+ # @return []
1456
+ def delete_provider(provider_id:)
1457
+ api_path = '/messaging/providers/{providerId}'
1458
+ .gsub('{providerId}', provider_id)
1459
+
1460
+ if provider_id.nil?
1461
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1462
+ end
1463
+
1464
+ api_params = {
1465
+ }
1466
+
1467
+ api_headers = {
1468
+ "content-type": 'application/json',
1469
+ }
1470
+
1471
+ @client.call(
1472
+ method: 'DELETE',
1473
+ path: api_path,
1474
+ headers: api_headers,
1475
+ params: api_params,
1476
+ )
1477
+ end
1478
+
1479
+
1480
+ # Get the provider activity logs listed by its unique ID.
1481
+ #
1482
+ # @param [String] provider_id Provider ID.
1483
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1484
+ #
1485
+ # @return [LogList]
1486
+ def list_provider_logs(provider_id:, queries: nil)
1487
+ api_path = '/messaging/providers/{providerId}/logs'
1488
+ .gsub('{providerId}', provider_id)
1489
+
1490
+ if provider_id.nil?
1491
+ raise Appwrite::Exception.new('Missing required parameter: "providerId"')
1492
+ end
1493
+
1494
+ api_params = {
1495
+ queries: queries,
1496
+ }
1497
+
1498
+ api_headers = {
1499
+ "content-type": 'application/json',
1500
+ }
1501
+
1502
+ @client.call(
1503
+ method: 'GET',
1504
+ path: api_path,
1505
+ headers: api_headers,
1506
+ params: api_params,
1507
+ response_type: Models::LogList
1508
+ )
1509
+ end
1510
+
1511
+
1512
+ # Get the subscriber activity logs listed by its unique ID.
1513
+ #
1514
+ # @param [String] subscriber_id Subscriber ID.
1515
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1516
+ #
1517
+ # @return [LogList]
1518
+ def list_subscriber_logs(subscriber_id:, queries: nil)
1519
+ api_path = '/messaging/subscribers/{subscriberId}/logs'
1520
+ .gsub('{subscriberId}', subscriber_id)
1521
+
1522
+ if subscriber_id.nil?
1523
+ raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
1524
+ end
1525
+
1526
+ api_params = {
1527
+ queries: queries,
1528
+ }
1529
+
1530
+ api_headers = {
1531
+ "content-type": 'application/json',
1532
+ }
1533
+
1534
+ @client.call(
1535
+ method: 'GET',
1536
+ path: api_path,
1537
+ headers: api_headers,
1538
+ params: api_params,
1539
+ response_type: Models::LogList
1540
+ )
1541
+ end
1542
+
1543
+
1544
+ # Get a list of all topics from the current Appwrite project.
1545
+ #
1546
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal
1547
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
1548
+ #
1549
+ # @return [TopicList]
1550
+ def list_topics(queries: nil, search: nil)
1551
+ api_path = '/messaging/topics'
1552
+
1553
+ api_params = {
1554
+ queries: queries,
1555
+ search: search,
1556
+ }
1557
+
1558
+ api_headers = {
1559
+ "content-type": 'application/json',
1560
+ }
1561
+
1562
+ @client.call(
1563
+ method: 'GET',
1564
+ path: api_path,
1565
+ headers: api_headers,
1566
+ params: api_params,
1567
+ response_type: Models::TopicList
1568
+ )
1569
+ end
1570
+
1571
+
1572
+ # Create a new topic.
1573
+ #
1574
+ # @param [String] topic_id Topic ID. Choose a custom Topic ID or a new Topic ID.
1575
+ # @param [String] name Topic Name.
1576
+ # @param [Array] subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
1577
+ #
1578
+ # @return [Topic]
1579
+ def create_topic(topic_id:, name:, subscribe: nil)
1580
+ api_path = '/messaging/topics'
1581
+
1582
+ if topic_id.nil?
1583
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1584
+ end
1585
+
1586
+ if name.nil?
1587
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
1588
+ end
1589
+
1590
+ api_params = {
1591
+ topicId: topic_id,
1592
+ name: name,
1593
+ subscribe: subscribe,
1594
+ }
1595
+
1596
+ api_headers = {
1597
+ "content-type": 'application/json',
1598
+ }
1599
+
1600
+ @client.call(
1601
+ method: 'POST',
1602
+ path: api_path,
1603
+ headers: api_headers,
1604
+ params: api_params,
1605
+ response_type: Models::Topic
1606
+ )
1607
+ end
1608
+
1609
+
1610
+ # Get a topic by its unique ID.
1611
+ #
1612
+ #
1613
+ # @param [String] topic_id Topic ID.
1614
+ #
1615
+ # @return [Topic]
1616
+ def get_topic(topic_id:)
1617
+ api_path = '/messaging/topics/{topicId}'
1618
+ .gsub('{topicId}', topic_id)
1619
+
1620
+ if topic_id.nil?
1621
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1622
+ end
1623
+
1624
+ api_params = {
1625
+ }
1626
+
1627
+ api_headers = {
1628
+ "content-type": 'application/json',
1629
+ }
1630
+
1631
+ @client.call(
1632
+ method: 'GET',
1633
+ path: api_path,
1634
+ headers: api_headers,
1635
+ params: api_params,
1636
+ response_type: Models::Topic
1637
+ )
1638
+ end
1639
+
1640
+
1641
+ # Update a topic by its unique ID.
1642
+ #
1643
+ #
1644
+ # @param [String] topic_id Topic ID.
1645
+ # @param [String] name Topic Name.
1646
+ # @param [Array] subscribe An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
1647
+ #
1648
+ # @return [Topic]
1649
+ def update_topic(topic_id:, name: nil, subscribe: nil)
1650
+ api_path = '/messaging/topics/{topicId}'
1651
+ .gsub('{topicId}', topic_id)
1652
+
1653
+ if topic_id.nil?
1654
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1655
+ end
1656
+
1657
+ api_params = {
1658
+ name: name,
1659
+ subscribe: subscribe,
1660
+ }
1661
+
1662
+ api_headers = {
1663
+ "content-type": 'application/json',
1664
+ }
1665
+
1666
+ @client.call(
1667
+ method: 'PATCH',
1668
+ path: api_path,
1669
+ headers: api_headers,
1670
+ params: api_params,
1671
+ response_type: Models::Topic
1672
+ )
1673
+ end
1674
+
1675
+
1676
+ # Delete a topic by its unique ID.
1677
+ #
1678
+ # @param [String] topic_id Topic ID.
1679
+ #
1680
+ # @return []
1681
+ def delete_topic(topic_id:)
1682
+ api_path = '/messaging/topics/{topicId}'
1683
+ .gsub('{topicId}', topic_id)
1684
+
1685
+ if topic_id.nil?
1686
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1687
+ end
1688
+
1689
+ api_params = {
1690
+ }
1691
+
1692
+ api_headers = {
1693
+ "content-type": 'application/json',
1694
+ }
1695
+
1696
+ @client.call(
1697
+ method: 'DELETE',
1698
+ path: api_path,
1699
+ headers: api_headers,
1700
+ params: api_params,
1701
+ )
1702
+ end
1703
+
1704
+
1705
+ # Get the topic activity logs listed by its unique ID.
1706
+ #
1707
+ # @param [String] topic_id Topic ID.
1708
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1709
+ #
1710
+ # @return [LogList]
1711
+ def list_topic_logs(topic_id:, queries: nil)
1712
+ api_path = '/messaging/topics/{topicId}/logs'
1713
+ .gsub('{topicId}', topic_id)
1714
+
1715
+ if topic_id.nil?
1716
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1717
+ end
1718
+
1719
+ api_params = {
1720
+ queries: queries,
1721
+ }
1722
+
1723
+ api_headers = {
1724
+ "content-type": 'application/json',
1725
+ }
1726
+
1727
+ @client.call(
1728
+ method: 'GET',
1729
+ path: api_path,
1730
+ headers: api_headers,
1731
+ params: api_params,
1732
+ response_type: Models::LogList
1733
+ )
1734
+ end
1735
+
1736
+
1737
+ # Get a list of all subscribers from the current Appwrite project.
1738
+ #
1739
+ # @param [String] topic_id Topic ID. The topic ID subscribed to.
1740
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled
1741
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
1742
+ #
1743
+ # @return [SubscriberList]
1744
+ def list_subscribers(topic_id:, queries: nil, search: nil)
1745
+ api_path = '/messaging/topics/{topicId}/subscribers'
1746
+ .gsub('{topicId}', topic_id)
1747
+
1748
+ if topic_id.nil?
1749
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1750
+ end
1751
+
1752
+ api_params = {
1753
+ queries: queries,
1754
+ search: search,
1755
+ }
1756
+
1757
+ api_headers = {
1758
+ "content-type": 'application/json',
1759
+ }
1760
+
1761
+ @client.call(
1762
+ method: 'GET',
1763
+ path: api_path,
1764
+ headers: api_headers,
1765
+ params: api_params,
1766
+ response_type: Models::SubscriberList
1767
+ )
1768
+ end
1769
+
1770
+
1771
+ # Create a new subscriber.
1772
+ #
1773
+ # @param [String] topic_id Topic ID. The topic ID to subscribe to.
1774
+ # @param [String] subscriber_id Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
1775
+ # @param [String] target_id Target ID. The target ID to link to the specified Topic ID.
1776
+ #
1777
+ # @return [Subscriber]
1778
+ def create_subscriber(topic_id:, subscriber_id:, target_id:)
1779
+ api_path = '/messaging/topics/{topicId}/subscribers'
1780
+ .gsub('{topicId}', topic_id)
1781
+
1782
+ if topic_id.nil?
1783
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1784
+ end
1785
+
1786
+ if subscriber_id.nil?
1787
+ raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
1788
+ end
1789
+
1790
+ if target_id.nil?
1791
+ raise Appwrite::Exception.new('Missing required parameter: "targetId"')
1792
+ end
1793
+
1794
+ api_params = {
1795
+ subscriberId: subscriber_id,
1796
+ targetId: target_id,
1797
+ }
1798
+
1799
+ api_headers = {
1800
+ "content-type": 'application/json',
1801
+ }
1802
+
1803
+ @client.call(
1804
+ method: 'POST',
1805
+ path: api_path,
1806
+ headers: api_headers,
1807
+ params: api_params,
1808
+ response_type: Models::Subscriber
1809
+ )
1810
+ end
1811
+
1812
+
1813
+ # Get a subscriber by its unique ID.
1814
+ #
1815
+ #
1816
+ # @param [String] topic_id Topic ID. The topic ID subscribed to.
1817
+ # @param [String] subscriber_id Subscriber ID.
1818
+ #
1819
+ # @return [Subscriber]
1820
+ def get_subscriber(topic_id:, subscriber_id:)
1821
+ api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}'
1822
+ .gsub('{topicId}', topic_id)
1823
+ .gsub('{subscriberId}', subscriber_id)
1824
+
1825
+ if topic_id.nil?
1826
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1827
+ end
1828
+
1829
+ if subscriber_id.nil?
1830
+ raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
1831
+ end
1832
+
1833
+ api_params = {
1834
+ }
1835
+
1836
+ api_headers = {
1837
+ "content-type": 'application/json',
1838
+ }
1839
+
1840
+ @client.call(
1841
+ method: 'GET',
1842
+ path: api_path,
1843
+ headers: api_headers,
1844
+ params: api_params,
1845
+ response_type: Models::Subscriber
1846
+ )
1847
+ end
1848
+
1849
+
1850
+ # Delete a subscriber by its unique ID.
1851
+ #
1852
+ # @param [String] topic_id Topic ID. The topic ID subscribed to.
1853
+ # @param [String] subscriber_id Subscriber ID.
1854
+ #
1855
+ # @return []
1856
+ def delete_subscriber(topic_id:, subscriber_id:)
1857
+ api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}'
1858
+ .gsub('{topicId}', topic_id)
1859
+ .gsub('{subscriberId}', subscriber_id)
1860
+
1861
+ if topic_id.nil?
1862
+ raise Appwrite::Exception.new('Missing required parameter: "topicId"')
1863
+ end
1864
+
1865
+ if subscriber_id.nil?
1866
+ raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
1867
+ end
1868
+
1869
+ api_params = {
1870
+ }
1871
+
1872
+ api_headers = {
1873
+ "content-type": 'application/json',
1874
+ }
1875
+
1876
+ @client.call(
1877
+ method: 'DELETE',
1878
+ path: api_path,
1879
+ headers: api_headers,
1880
+ params: api_params,
1881
+ )
1882
+ end
1883
+
1884
+
1885
+ end
1886
+ end