appwrite 10.1.2 → 11.0.0.pre.rc.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +43 -4
- data/lib/appwrite/enums/authentication_factor.rb +9 -0
- data/lib/appwrite/enums/authenticator_type.rb +7 -0
- data/lib/appwrite/enums/browser.rb +20 -0
- data/lib/appwrite/enums/compression.rb +9 -0
- data/lib/appwrite/enums/credit_card.rb +22 -0
- data/lib/appwrite/enums/encryption.rb +9 -0
- data/lib/appwrite/enums/execution_method.rb +12 -0
- data/lib/appwrite/enums/flag.rb +200 -0
- data/lib/appwrite/enums/image_format.rb +11 -0
- data/lib/appwrite/enums/image_gravity.rb +15 -0
- data/lib/appwrite/enums/index_type.rb +10 -0
- data/lib/appwrite/enums/message_status.rb +9 -0
- data/lib/appwrite/enums/messaging_provider_type.rb +9 -0
- data/lib/appwrite/enums/name.rb +18 -0
- data/lib/appwrite/enums/o_auth_provider.rb +45 -0
- data/lib/appwrite/enums/password_hash.rb +17 -0
- data/lib/appwrite/enums/relation_mutate.rb +9 -0
- data/lib/appwrite/enums/relationship_type.rb +10 -0
- data/lib/appwrite/enums/runtime.rb +42 -0
- data/lib/appwrite/models/health_certificate.rb +52 -0
- data/lib/appwrite/models/jwt.rb +27 -0
- data/lib/appwrite/models/membership.rb +5 -0
- data/lib/appwrite/models/message.rb +87 -0
- data/lib/appwrite/models/message_list.rb +32 -0
- data/lib/appwrite/models/mfa_challenge.rb +42 -0
- data/lib/appwrite/models/mfa_factors.rb +37 -0
- data/lib/appwrite/models/mfa_type.rb +37 -0
- data/lib/appwrite/models/provider.rb +67 -0
- data/lib/appwrite/models/provider_list.rb +32 -0
- data/lib/appwrite/models/session.rb +13 -3
- data/lib/appwrite/models/subscriber.rb +67 -0
- data/lib/appwrite/models/subscriber_list.rb +32 -0
- data/lib/appwrite/models/target.rb +62 -0
- data/lib/appwrite/models/target_list.rb +32 -0
- data/lib/appwrite/models/token.rb +8 -3
- data/lib/appwrite/models/topic.rb +62 -0
- data/lib/appwrite/models/topic_list.rb +32 -0
- data/lib/appwrite/models/user.rb +15 -0
- data/lib/appwrite/query.rb +53 -28
- data/lib/appwrite/services/account.rb +650 -12
- data/lib/appwrite/services/avatars.rb +3 -3
- data/lib/appwrite/services/databases.rb +6 -6
- data/lib/appwrite/services/functions.rb +3 -3
- data/lib/appwrite/services/health.rb +59 -0
- data/lib/appwrite/services/messaging.rb +1879 -0
- data/lib/appwrite/services/storage.rb +4 -4
- data/lib/appwrite/services/teams.rb +1 -1
- data/lib/appwrite/services/users.rb +382 -4
- data/lib/appwrite.rb +36 -0
- metadata +39 -4
@@ -0,0 +1,1879 @@
|
|
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 [MessageStatus] status Message Status. Value must be one of: draft, scheduled, processing.
|
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, status: 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
|
+
status: status,
|
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 [MessageStatus] status Message Status. Value must be one of: draft, scheduled, processing.
|
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, status: 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
|
+
status: status,
|
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 [MessageStatus] status Message Status. Value must be one of: draft, scheduled, processing.
|
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, status: 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
|
+
status: status,
|
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 [MessageStatus] status Message Status. Value must be one of: draft, scheduled, processing.
|
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, status: 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
|
+
status: status,
|
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 [MessageStatus] status Message Status. Value must be one of: draft, scheduled, processing.
|
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, status: 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
|
+
status: status,
|
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 [MessageStatus] status Message Status. Value must be one of: draft, scheduled, processing.
|
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, status: 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
|
+
status: status,
|
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
|
+
#
|
399
|
+
#
|
400
|
+
# @param [String] message_id Message ID.
|
401
|
+
#
|
402
|
+
# @return []
|
403
|
+
def delete(message_id:)
|
404
|
+
api_path = '/messaging/messages/{messageId}'
|
405
|
+
.gsub('{messageId}', message_id)
|
406
|
+
|
407
|
+
if message_id.nil?
|
408
|
+
raise Appwrite::Exception.new('Missing required parameter: "messageId"')
|
409
|
+
end
|
410
|
+
|
411
|
+
api_params = {
|
412
|
+
}
|
413
|
+
|
414
|
+
api_headers = {
|
415
|
+
"content-type": 'application/json',
|
416
|
+
}
|
417
|
+
|
418
|
+
@client.call(
|
419
|
+
method: 'DELETE',
|
420
|
+
path: api_path,
|
421
|
+
headers: api_headers,
|
422
|
+
params: api_params,
|
423
|
+
)
|
424
|
+
end
|
425
|
+
|
426
|
+
|
427
|
+
# Get the message activity logs listed by its unique ID.
|
428
|
+
#
|
429
|
+
# @param [String] message_id Message ID.
|
430
|
+
# @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
|
431
|
+
#
|
432
|
+
# @return [LogList]
|
433
|
+
def list_message_logs(message_id:, queries: nil)
|
434
|
+
api_path = '/messaging/messages/{messageId}/logs'
|
435
|
+
.gsub('{messageId}', message_id)
|
436
|
+
|
437
|
+
if message_id.nil?
|
438
|
+
raise Appwrite::Exception.new('Missing required parameter: "messageId"')
|
439
|
+
end
|
440
|
+
|
441
|
+
api_params = {
|
442
|
+
queries: queries,
|
443
|
+
}
|
444
|
+
|
445
|
+
api_headers = {
|
446
|
+
"content-type": 'application/json',
|
447
|
+
}
|
448
|
+
|
449
|
+
@client.call(
|
450
|
+
method: 'GET',
|
451
|
+
path: api_path,
|
452
|
+
headers: api_headers,
|
453
|
+
params: api_params,
|
454
|
+
response_type: Models::LogList
|
455
|
+
)
|
456
|
+
end
|
457
|
+
|
458
|
+
|
459
|
+
# Get a list of the targets associated with a message.
|
460
|
+
#
|
461
|
+
# @param [String] message_id Message ID.
|
462
|
+
# @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
|
463
|
+
#
|
464
|
+
# @return [TargetList]
|
465
|
+
def list_targets(message_id:, queries: nil)
|
466
|
+
api_path = '/messaging/messages/{messageId}/targets'
|
467
|
+
.gsub('{messageId}', message_id)
|
468
|
+
|
469
|
+
if message_id.nil?
|
470
|
+
raise Appwrite::Exception.new('Missing required parameter: "messageId"')
|
471
|
+
end
|
472
|
+
|
473
|
+
api_params = {
|
474
|
+
queries: queries,
|
475
|
+
}
|
476
|
+
|
477
|
+
api_headers = {
|
478
|
+
"content-type": 'application/json',
|
479
|
+
}
|
480
|
+
|
481
|
+
@client.call(
|
482
|
+
method: 'GET',
|
483
|
+
path: api_path,
|
484
|
+
headers: api_headers,
|
485
|
+
params: api_params,
|
486
|
+
response_type: Models::TargetList
|
487
|
+
)
|
488
|
+
end
|
489
|
+
|
490
|
+
|
491
|
+
# Get a list of all providers from the current Appwrite project.
|
492
|
+
#
|
493
|
+
# @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
|
494
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
495
|
+
#
|
496
|
+
# @return [ProviderList]
|
497
|
+
def list_providers(queries: nil, search: nil)
|
498
|
+
api_path = '/messaging/providers'
|
499
|
+
|
500
|
+
api_params = {
|
501
|
+
queries: queries,
|
502
|
+
search: search,
|
503
|
+
}
|
504
|
+
|
505
|
+
api_headers = {
|
506
|
+
"content-type": 'application/json',
|
507
|
+
}
|
508
|
+
|
509
|
+
@client.call(
|
510
|
+
method: 'GET',
|
511
|
+
path: api_path,
|
512
|
+
headers: api_headers,
|
513
|
+
params: api_params,
|
514
|
+
response_type: Models::ProviderList
|
515
|
+
)
|
516
|
+
end
|
517
|
+
|
518
|
+
|
519
|
+
# Create a new Apple Push Notification service provider.
|
520
|
+
#
|
521
|
+
# @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.
|
522
|
+
# @param [String] name Provider name.
|
523
|
+
# @param [String] auth_key APNS authentication key.
|
524
|
+
# @param [String] auth_key_id APNS authentication key ID.
|
525
|
+
# @param [String] team_id APNS team ID.
|
526
|
+
# @param [String] bundle_id APNS bundle ID.
|
527
|
+
# @param [] enabled Set as enabled.
|
528
|
+
#
|
529
|
+
# @return [Provider]
|
530
|
+
def create_apns_provider(provider_id:, name:, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil, enabled: nil)
|
531
|
+
api_path = '/messaging/providers/apns'
|
532
|
+
|
533
|
+
if provider_id.nil?
|
534
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
535
|
+
end
|
536
|
+
|
537
|
+
if name.nil?
|
538
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
539
|
+
end
|
540
|
+
|
541
|
+
api_params = {
|
542
|
+
providerId: provider_id,
|
543
|
+
name: name,
|
544
|
+
authKey: auth_key,
|
545
|
+
authKeyId: auth_key_id,
|
546
|
+
teamId: team_id,
|
547
|
+
bundleId: bundle_id,
|
548
|
+
enabled: enabled,
|
549
|
+
}
|
550
|
+
|
551
|
+
api_headers = {
|
552
|
+
"content-type": 'application/json',
|
553
|
+
}
|
554
|
+
|
555
|
+
@client.call(
|
556
|
+
method: 'POST',
|
557
|
+
path: api_path,
|
558
|
+
headers: api_headers,
|
559
|
+
params: api_params,
|
560
|
+
response_type: Models::Provider
|
561
|
+
)
|
562
|
+
end
|
563
|
+
|
564
|
+
|
565
|
+
# Update a Apple Push Notification service provider by its unique ID.
|
566
|
+
#
|
567
|
+
# @param [String] provider_id Provider ID.
|
568
|
+
# @param [String] name Provider name.
|
569
|
+
# @param [] enabled Set as enabled.
|
570
|
+
# @param [String] auth_key APNS authentication key.
|
571
|
+
# @param [String] auth_key_id APNS authentication key ID.
|
572
|
+
# @param [String] team_id APNS team ID.
|
573
|
+
# @param [String] bundle_id APNS bundle ID.
|
574
|
+
#
|
575
|
+
# @return [Provider]
|
576
|
+
def update_apns_provider(provider_id:, name: nil, enabled: nil, auth_key: nil, auth_key_id: nil, team_id: nil, bundle_id: nil)
|
577
|
+
api_path = '/messaging/providers/apns/{providerId}'
|
578
|
+
.gsub('{providerId}', provider_id)
|
579
|
+
|
580
|
+
if provider_id.nil?
|
581
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
582
|
+
end
|
583
|
+
|
584
|
+
api_params = {
|
585
|
+
name: name,
|
586
|
+
enabled: enabled,
|
587
|
+
authKey: auth_key,
|
588
|
+
authKeyId: auth_key_id,
|
589
|
+
teamId: team_id,
|
590
|
+
bundleId: bundle_id,
|
591
|
+
}
|
592
|
+
|
593
|
+
api_headers = {
|
594
|
+
"content-type": 'application/json',
|
595
|
+
}
|
596
|
+
|
597
|
+
@client.call(
|
598
|
+
method: 'PATCH',
|
599
|
+
path: api_path,
|
600
|
+
headers: api_headers,
|
601
|
+
params: api_params,
|
602
|
+
response_type: Models::Provider
|
603
|
+
)
|
604
|
+
end
|
605
|
+
|
606
|
+
|
607
|
+
# Create a new Firebase Cloud Messaging provider.
|
608
|
+
#
|
609
|
+
# @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.
|
610
|
+
# @param [String] name Provider name.
|
611
|
+
# @param [Hash] service_account_json FCM service account JSON.
|
612
|
+
# @param [] enabled Set as enabled.
|
613
|
+
#
|
614
|
+
# @return [Provider]
|
615
|
+
def create_fcm_provider(provider_id:, name:, service_account_json: nil, enabled: nil)
|
616
|
+
api_path = '/messaging/providers/fcm'
|
617
|
+
|
618
|
+
if provider_id.nil?
|
619
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
620
|
+
end
|
621
|
+
|
622
|
+
if name.nil?
|
623
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
624
|
+
end
|
625
|
+
|
626
|
+
api_params = {
|
627
|
+
providerId: provider_id,
|
628
|
+
name: name,
|
629
|
+
serviceAccountJSON: service_account_json,
|
630
|
+
enabled: enabled,
|
631
|
+
}
|
632
|
+
|
633
|
+
api_headers = {
|
634
|
+
"content-type": 'application/json',
|
635
|
+
}
|
636
|
+
|
637
|
+
@client.call(
|
638
|
+
method: 'POST',
|
639
|
+
path: api_path,
|
640
|
+
headers: api_headers,
|
641
|
+
params: api_params,
|
642
|
+
response_type: Models::Provider
|
643
|
+
)
|
644
|
+
end
|
645
|
+
|
646
|
+
|
647
|
+
# Update a Firebase Cloud Messaging provider by its unique ID.
|
648
|
+
#
|
649
|
+
# @param [String] provider_id Provider ID.
|
650
|
+
# @param [String] name Provider name.
|
651
|
+
# @param [] enabled Set as enabled.
|
652
|
+
# @param [Hash] service_account_json FCM service account JSON.
|
653
|
+
#
|
654
|
+
# @return [Provider]
|
655
|
+
def update_fcm_provider(provider_id:, name: nil, enabled: nil, service_account_json: nil)
|
656
|
+
api_path = '/messaging/providers/fcm/{providerId}'
|
657
|
+
.gsub('{providerId}', provider_id)
|
658
|
+
|
659
|
+
if provider_id.nil?
|
660
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
661
|
+
end
|
662
|
+
|
663
|
+
api_params = {
|
664
|
+
name: name,
|
665
|
+
enabled: enabled,
|
666
|
+
serviceAccountJSON: service_account_json,
|
667
|
+
}
|
668
|
+
|
669
|
+
api_headers = {
|
670
|
+
"content-type": 'application/json',
|
671
|
+
}
|
672
|
+
|
673
|
+
@client.call(
|
674
|
+
method: 'PATCH',
|
675
|
+
path: api_path,
|
676
|
+
headers: api_headers,
|
677
|
+
params: api_params,
|
678
|
+
response_type: Models::Provider
|
679
|
+
)
|
680
|
+
end
|
681
|
+
|
682
|
+
|
683
|
+
# Create a new Mailgun provider.
|
684
|
+
#
|
685
|
+
# @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.
|
686
|
+
# @param [String] name Provider name.
|
687
|
+
# @param [String] api_key Mailgun API Key.
|
688
|
+
# @param [String] domain Mailgun Domain.
|
689
|
+
# @param [] is_eu_region Set as EU region.
|
690
|
+
# @param [String] from_name Sender Name.
|
691
|
+
# @param [String] from_email Sender email address.
|
692
|
+
# @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.
|
693
|
+
# @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.
|
694
|
+
# @param [] enabled Set as enabled.
|
695
|
+
#
|
696
|
+
# @return [Provider]
|
697
|
+
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)
|
698
|
+
api_path = '/messaging/providers/mailgun'
|
699
|
+
|
700
|
+
if provider_id.nil?
|
701
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
702
|
+
end
|
703
|
+
|
704
|
+
if name.nil?
|
705
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
706
|
+
end
|
707
|
+
|
708
|
+
api_params = {
|
709
|
+
providerId: provider_id,
|
710
|
+
name: name,
|
711
|
+
apiKey: api_key,
|
712
|
+
domain: domain,
|
713
|
+
isEuRegion: is_eu_region,
|
714
|
+
fromName: from_name,
|
715
|
+
fromEmail: from_email,
|
716
|
+
replyToName: reply_to_name,
|
717
|
+
replyToEmail: reply_to_email,
|
718
|
+
enabled: enabled,
|
719
|
+
}
|
720
|
+
|
721
|
+
api_headers = {
|
722
|
+
"content-type": 'application/json',
|
723
|
+
}
|
724
|
+
|
725
|
+
@client.call(
|
726
|
+
method: 'POST',
|
727
|
+
path: api_path,
|
728
|
+
headers: api_headers,
|
729
|
+
params: api_params,
|
730
|
+
response_type: Models::Provider
|
731
|
+
)
|
732
|
+
end
|
733
|
+
|
734
|
+
|
735
|
+
# Update a Mailgun provider by its unique ID.
|
736
|
+
#
|
737
|
+
# @param [String] provider_id Provider ID.
|
738
|
+
# @param [String] name Provider name.
|
739
|
+
# @param [String] api_key Mailgun API Key.
|
740
|
+
# @param [String] domain Mailgun Domain.
|
741
|
+
# @param [] is_eu_region Set as EU region.
|
742
|
+
# @param [] enabled Set as enabled.
|
743
|
+
# @param [String] from_name Sender Name.
|
744
|
+
# @param [String] from_email Sender email address.
|
745
|
+
# @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name.
|
746
|
+
# @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email.
|
747
|
+
#
|
748
|
+
# @return [Provider]
|
749
|
+
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)
|
750
|
+
api_path = '/messaging/providers/mailgun/{providerId}'
|
751
|
+
.gsub('{providerId}', provider_id)
|
752
|
+
|
753
|
+
if provider_id.nil?
|
754
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
755
|
+
end
|
756
|
+
|
757
|
+
api_params = {
|
758
|
+
name: name,
|
759
|
+
apiKey: api_key,
|
760
|
+
domain: domain,
|
761
|
+
isEuRegion: is_eu_region,
|
762
|
+
enabled: enabled,
|
763
|
+
fromName: from_name,
|
764
|
+
fromEmail: from_email,
|
765
|
+
replyToName: reply_to_name,
|
766
|
+
replyToEmail: reply_to_email,
|
767
|
+
}
|
768
|
+
|
769
|
+
api_headers = {
|
770
|
+
"content-type": 'application/json',
|
771
|
+
}
|
772
|
+
|
773
|
+
@client.call(
|
774
|
+
method: 'PATCH',
|
775
|
+
path: api_path,
|
776
|
+
headers: api_headers,
|
777
|
+
params: api_params,
|
778
|
+
response_type: Models::Provider
|
779
|
+
)
|
780
|
+
end
|
781
|
+
|
782
|
+
|
783
|
+
# Create a new MSG91 provider.
|
784
|
+
#
|
785
|
+
# @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.
|
786
|
+
# @param [String] name Provider name.
|
787
|
+
# @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
788
|
+
# @param [String] sender_id Msg91 Sender ID.
|
789
|
+
# @param [String] auth_key Msg91 Auth Key.
|
790
|
+
# @param [] enabled Set as enabled.
|
791
|
+
#
|
792
|
+
# @return [Provider]
|
793
|
+
def create_msg91_provider(provider_id:, name:, from: nil, sender_id: nil, auth_key: nil, enabled: nil)
|
794
|
+
api_path = '/messaging/providers/msg91'
|
795
|
+
|
796
|
+
if provider_id.nil?
|
797
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
798
|
+
end
|
799
|
+
|
800
|
+
if name.nil?
|
801
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
802
|
+
end
|
803
|
+
|
804
|
+
api_params = {
|
805
|
+
providerId: provider_id,
|
806
|
+
name: name,
|
807
|
+
from: from,
|
808
|
+
senderId: sender_id,
|
809
|
+
authKey: auth_key,
|
810
|
+
enabled: enabled,
|
811
|
+
}
|
812
|
+
|
813
|
+
api_headers = {
|
814
|
+
"content-type": 'application/json',
|
815
|
+
}
|
816
|
+
|
817
|
+
@client.call(
|
818
|
+
method: 'POST',
|
819
|
+
path: api_path,
|
820
|
+
headers: api_headers,
|
821
|
+
params: api_params,
|
822
|
+
response_type: Models::Provider
|
823
|
+
)
|
824
|
+
end
|
825
|
+
|
826
|
+
|
827
|
+
# Update a MSG91 provider by its unique ID.
|
828
|
+
#
|
829
|
+
# @param [String] provider_id Provider ID.
|
830
|
+
# @param [String] name Provider name.
|
831
|
+
# @param [] enabled Set as enabled.
|
832
|
+
# @param [String] sender_id Msg91 Sender ID.
|
833
|
+
# @param [String] auth_key Msg91 Auth Key.
|
834
|
+
# @param [String] from Sender number.
|
835
|
+
#
|
836
|
+
# @return [Provider]
|
837
|
+
def update_msg91_provider(provider_id:, name: nil, enabled: nil, sender_id: nil, auth_key: nil, from: nil)
|
838
|
+
api_path = '/messaging/providers/msg91/{providerId}'
|
839
|
+
.gsub('{providerId}', provider_id)
|
840
|
+
|
841
|
+
if provider_id.nil?
|
842
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
843
|
+
end
|
844
|
+
|
845
|
+
api_params = {
|
846
|
+
name: name,
|
847
|
+
enabled: enabled,
|
848
|
+
senderId: sender_id,
|
849
|
+
authKey: auth_key,
|
850
|
+
from: from,
|
851
|
+
}
|
852
|
+
|
853
|
+
api_headers = {
|
854
|
+
"content-type": 'application/json',
|
855
|
+
}
|
856
|
+
|
857
|
+
@client.call(
|
858
|
+
method: 'PATCH',
|
859
|
+
path: api_path,
|
860
|
+
headers: api_headers,
|
861
|
+
params: api_params,
|
862
|
+
response_type: Models::Provider
|
863
|
+
)
|
864
|
+
end
|
865
|
+
|
866
|
+
|
867
|
+
#
|
868
|
+
#
|
869
|
+
# @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.
|
870
|
+
# @param [String] name Provider name.
|
871
|
+
# @param [String] api_key Sendgrid API key.
|
872
|
+
# @param [String] from_name Sender Name.
|
873
|
+
# @param [String] from_email Sender email address.
|
874
|
+
# @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name.
|
875
|
+
# @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email.
|
876
|
+
# @param [] enabled Set as enabled.
|
877
|
+
#
|
878
|
+
# @return [Provider]
|
879
|
+
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)
|
880
|
+
api_path = '/messaging/providers/sendgrid'
|
881
|
+
|
882
|
+
if provider_id.nil?
|
883
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
884
|
+
end
|
885
|
+
|
886
|
+
if name.nil?
|
887
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
888
|
+
end
|
889
|
+
|
890
|
+
api_params = {
|
891
|
+
providerId: provider_id,
|
892
|
+
name: name,
|
893
|
+
apiKey: api_key,
|
894
|
+
fromName: from_name,
|
895
|
+
fromEmail: from_email,
|
896
|
+
replyToName: reply_to_name,
|
897
|
+
replyToEmail: reply_to_email,
|
898
|
+
enabled: enabled,
|
899
|
+
}
|
900
|
+
|
901
|
+
api_headers = {
|
902
|
+
"content-type": 'application/json',
|
903
|
+
}
|
904
|
+
|
905
|
+
@client.call(
|
906
|
+
method: 'POST',
|
907
|
+
path: api_path,
|
908
|
+
headers: api_headers,
|
909
|
+
params: api_params,
|
910
|
+
response_type: Models::Provider
|
911
|
+
)
|
912
|
+
end
|
913
|
+
|
914
|
+
|
915
|
+
# Update a Sendgrid provider by its unique ID.
|
916
|
+
#
|
917
|
+
# @param [String] provider_id Provider ID.
|
918
|
+
# @param [String] name Provider name.
|
919
|
+
# @param [] enabled Set as enabled.
|
920
|
+
# @param [String] api_key Sendgrid API key.
|
921
|
+
# @param [String] from_name Sender Name.
|
922
|
+
# @param [String] from_email Sender email address.
|
923
|
+
# @param [String] reply_to_name Name set in the Reply To field for the mail. Default value is Sender Name.
|
924
|
+
# @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email.
|
925
|
+
#
|
926
|
+
# @return [Provider]
|
927
|
+
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)
|
928
|
+
api_path = '/messaging/providers/sendgrid/{providerId}'
|
929
|
+
.gsub('{providerId}', provider_id)
|
930
|
+
|
931
|
+
if provider_id.nil?
|
932
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
933
|
+
end
|
934
|
+
|
935
|
+
api_params = {
|
936
|
+
name: name,
|
937
|
+
enabled: enabled,
|
938
|
+
apiKey: api_key,
|
939
|
+
fromName: from_name,
|
940
|
+
fromEmail: from_email,
|
941
|
+
replyToName: reply_to_name,
|
942
|
+
replyToEmail: reply_to_email,
|
943
|
+
}
|
944
|
+
|
945
|
+
api_headers = {
|
946
|
+
"content-type": 'application/json',
|
947
|
+
}
|
948
|
+
|
949
|
+
@client.call(
|
950
|
+
method: 'PATCH',
|
951
|
+
path: api_path,
|
952
|
+
headers: api_headers,
|
953
|
+
params: api_params,
|
954
|
+
response_type: Models::Provider
|
955
|
+
)
|
956
|
+
end
|
957
|
+
|
958
|
+
|
959
|
+
# Create a new SMTP provider.
|
960
|
+
#
|
961
|
+
# @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.
|
962
|
+
# @param [String] name Provider name.
|
963
|
+
# @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.
|
964
|
+
# @param [Integer] port The default SMTP server port.
|
965
|
+
# @param [String] username Authentication username.
|
966
|
+
# @param [String] password Authentication password.
|
967
|
+
# @param [Encryption] encryption Encryption type. Can be omitted, 'ssl', or 'tls'
|
968
|
+
# @param [] auto_tls Enable SMTP AutoTLS feature.
|
969
|
+
# @param [String] mailer The value to use for the X-Mailer header.
|
970
|
+
# @param [String] from_name Sender Name.
|
971
|
+
# @param [String] from_email Sender email address.
|
972
|
+
# @param [String] reply_to_name Name set in the reply to field for the mail. Default value is sender name.
|
973
|
+
# @param [String] reply_to_email Email set in the reply to field for the mail. Default value is sender email.
|
974
|
+
# @param [] enabled Set as enabled.
|
975
|
+
#
|
976
|
+
# @return [Provider]
|
977
|
+
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)
|
978
|
+
api_path = '/messaging/providers/smtp'
|
979
|
+
|
980
|
+
if provider_id.nil?
|
981
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
982
|
+
end
|
983
|
+
|
984
|
+
if name.nil?
|
985
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
986
|
+
end
|
987
|
+
|
988
|
+
if host.nil?
|
989
|
+
raise Appwrite::Exception.new('Missing required parameter: "host"')
|
990
|
+
end
|
991
|
+
|
992
|
+
api_params = {
|
993
|
+
providerId: provider_id,
|
994
|
+
name: name,
|
995
|
+
host: host,
|
996
|
+
port: port,
|
997
|
+
username: username,
|
998
|
+
password: password,
|
999
|
+
encryption: encryption,
|
1000
|
+
autoTLS: auto_tls,
|
1001
|
+
mailer: mailer,
|
1002
|
+
fromName: from_name,
|
1003
|
+
fromEmail: from_email,
|
1004
|
+
replyToName: reply_to_name,
|
1005
|
+
replyToEmail: reply_to_email,
|
1006
|
+
enabled: enabled,
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
api_headers = {
|
1010
|
+
"content-type": 'application/json',
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
@client.call(
|
1014
|
+
method: 'POST',
|
1015
|
+
path: api_path,
|
1016
|
+
headers: api_headers,
|
1017
|
+
params: api_params,
|
1018
|
+
response_type: Models::Provider
|
1019
|
+
)
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
|
1023
|
+
# Update a SMTP provider by its unique ID.
|
1024
|
+
#
|
1025
|
+
# @param [String] provider_id Provider ID.
|
1026
|
+
# @param [String] name Provider name.
|
1027
|
+
# @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.
|
1028
|
+
# @param [Integer] port SMTP port.
|
1029
|
+
# @param [String] username Authentication username.
|
1030
|
+
# @param [String] password Authentication password.
|
1031
|
+
# @param [Encryption] encryption Encryption type. Can be 'ssl' or 'tls'
|
1032
|
+
# @param [] auto_tls Enable SMTP AutoTLS feature.
|
1033
|
+
# @param [String] mailer The value to use for the X-Mailer header.
|
1034
|
+
# @param [String] from_name Sender Name.
|
1035
|
+
# @param [String] from_email Sender email address.
|
1036
|
+
# @param [String] reply_to_name Name set in the Reply To field for the mail. Default value is Sender Name.
|
1037
|
+
# @param [String] reply_to_email Email set in the Reply To field for the mail. Default value is Sender Email.
|
1038
|
+
# @param [] enabled Set as enabled.
|
1039
|
+
#
|
1040
|
+
# @return [Provider]
|
1041
|
+
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)
|
1042
|
+
api_path = '/messaging/providers/smtp/{providerId}'
|
1043
|
+
.gsub('{providerId}', provider_id)
|
1044
|
+
|
1045
|
+
if provider_id.nil?
|
1046
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
api_params = {
|
1050
|
+
name: name,
|
1051
|
+
host: host,
|
1052
|
+
port: port,
|
1053
|
+
username: username,
|
1054
|
+
password: password,
|
1055
|
+
encryption: encryption,
|
1056
|
+
autoTLS: auto_tls,
|
1057
|
+
mailer: mailer,
|
1058
|
+
fromName: from_name,
|
1059
|
+
fromEmail: from_email,
|
1060
|
+
replyToName: reply_to_name,
|
1061
|
+
replyToEmail: reply_to_email,
|
1062
|
+
enabled: enabled,
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
api_headers = {
|
1066
|
+
"content-type": 'application/json',
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
@client.call(
|
1070
|
+
method: 'PATCH',
|
1071
|
+
path: api_path,
|
1072
|
+
headers: api_headers,
|
1073
|
+
params: api_params,
|
1074
|
+
response_type: Models::Provider
|
1075
|
+
)
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
|
1079
|
+
# Create a new Telesign provider.
|
1080
|
+
#
|
1081
|
+
# @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.
|
1082
|
+
# @param [String] name Provider name.
|
1083
|
+
# @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
1084
|
+
# @param [String] customer_id Telesign customer ID.
|
1085
|
+
# @param [String] api_key Telesign API key.
|
1086
|
+
# @param [] enabled Set as enabled.
|
1087
|
+
#
|
1088
|
+
# @return [Provider]
|
1089
|
+
def create_telesign_provider(provider_id:, name:, from: nil, customer_id: nil, api_key: nil, enabled: nil)
|
1090
|
+
api_path = '/messaging/providers/telesign'
|
1091
|
+
|
1092
|
+
if provider_id.nil?
|
1093
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
if name.nil?
|
1097
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
api_params = {
|
1101
|
+
providerId: provider_id,
|
1102
|
+
name: name,
|
1103
|
+
from: from,
|
1104
|
+
customerId: customer_id,
|
1105
|
+
apiKey: api_key,
|
1106
|
+
enabled: enabled,
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
api_headers = {
|
1110
|
+
"content-type": 'application/json',
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
@client.call(
|
1114
|
+
method: 'POST',
|
1115
|
+
path: api_path,
|
1116
|
+
headers: api_headers,
|
1117
|
+
params: api_params,
|
1118
|
+
response_type: Models::Provider
|
1119
|
+
)
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
|
1123
|
+
# Update a Telesign provider by its unique ID.
|
1124
|
+
#
|
1125
|
+
# @param [String] provider_id Provider ID.
|
1126
|
+
# @param [String] name Provider name.
|
1127
|
+
# @param [] enabled Set as enabled.
|
1128
|
+
# @param [String] customer_id Telesign customer ID.
|
1129
|
+
# @param [String] api_key Telesign API key.
|
1130
|
+
# @param [String] from Sender number.
|
1131
|
+
#
|
1132
|
+
# @return [Provider]
|
1133
|
+
def update_telesign_provider(provider_id:, name: nil, enabled: nil, customer_id: nil, api_key: nil, from: nil)
|
1134
|
+
api_path = '/messaging/providers/telesign/{providerId}'
|
1135
|
+
.gsub('{providerId}', provider_id)
|
1136
|
+
|
1137
|
+
if provider_id.nil?
|
1138
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
api_params = {
|
1142
|
+
name: name,
|
1143
|
+
enabled: enabled,
|
1144
|
+
customerId: customer_id,
|
1145
|
+
apiKey: api_key,
|
1146
|
+
from: from,
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
api_headers = {
|
1150
|
+
"content-type": 'application/json',
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
@client.call(
|
1154
|
+
method: 'PATCH',
|
1155
|
+
path: api_path,
|
1156
|
+
headers: api_headers,
|
1157
|
+
params: api_params,
|
1158
|
+
response_type: Models::Provider
|
1159
|
+
)
|
1160
|
+
end
|
1161
|
+
|
1162
|
+
|
1163
|
+
# Create a new Textmagic provider.
|
1164
|
+
#
|
1165
|
+
# @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.
|
1166
|
+
# @param [String] name Provider name.
|
1167
|
+
# @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
1168
|
+
# @param [String] username Textmagic username.
|
1169
|
+
# @param [String] api_key Textmagic apiKey.
|
1170
|
+
# @param [] enabled Set as enabled.
|
1171
|
+
#
|
1172
|
+
# @return [Provider]
|
1173
|
+
def create_textmagic_provider(provider_id:, name:, from: nil, username: nil, api_key: nil, enabled: nil)
|
1174
|
+
api_path = '/messaging/providers/textmagic'
|
1175
|
+
|
1176
|
+
if provider_id.nil?
|
1177
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1178
|
+
end
|
1179
|
+
|
1180
|
+
if name.nil?
|
1181
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
api_params = {
|
1185
|
+
providerId: provider_id,
|
1186
|
+
name: name,
|
1187
|
+
from: from,
|
1188
|
+
username: username,
|
1189
|
+
apiKey: api_key,
|
1190
|
+
enabled: enabled,
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
api_headers = {
|
1194
|
+
"content-type": 'application/json',
|
1195
|
+
}
|
1196
|
+
|
1197
|
+
@client.call(
|
1198
|
+
method: 'POST',
|
1199
|
+
path: api_path,
|
1200
|
+
headers: api_headers,
|
1201
|
+
params: api_params,
|
1202
|
+
response_type: Models::Provider
|
1203
|
+
)
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
|
1207
|
+
# Update a Textmagic provider by its unique ID.
|
1208
|
+
#
|
1209
|
+
# @param [String] provider_id Provider ID.
|
1210
|
+
# @param [String] name Provider name.
|
1211
|
+
# @param [] enabled Set as enabled.
|
1212
|
+
# @param [String] username Textmagic username.
|
1213
|
+
# @param [String] api_key Textmagic apiKey.
|
1214
|
+
# @param [String] from Sender number.
|
1215
|
+
#
|
1216
|
+
# @return [Provider]
|
1217
|
+
def update_textmagic_provider(provider_id:, name: nil, enabled: nil, username: nil, api_key: nil, from: nil)
|
1218
|
+
api_path = '/messaging/providers/textmagic/{providerId}'
|
1219
|
+
.gsub('{providerId}', provider_id)
|
1220
|
+
|
1221
|
+
if provider_id.nil?
|
1222
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1223
|
+
end
|
1224
|
+
|
1225
|
+
api_params = {
|
1226
|
+
name: name,
|
1227
|
+
enabled: enabled,
|
1228
|
+
username: username,
|
1229
|
+
apiKey: api_key,
|
1230
|
+
from: from,
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
api_headers = {
|
1234
|
+
"content-type": 'application/json',
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
@client.call(
|
1238
|
+
method: 'PATCH',
|
1239
|
+
path: api_path,
|
1240
|
+
headers: api_headers,
|
1241
|
+
params: api_params,
|
1242
|
+
response_type: Models::Provider
|
1243
|
+
)
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
|
1247
|
+
# Create a new Twilio provider.
|
1248
|
+
#
|
1249
|
+
# @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.
|
1250
|
+
# @param [String] name Provider name.
|
1251
|
+
# @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
1252
|
+
# @param [String] account_sid Twilio account secret ID.
|
1253
|
+
# @param [String] auth_token Twilio authentication token.
|
1254
|
+
# @param [] enabled Set as enabled.
|
1255
|
+
#
|
1256
|
+
# @return [Provider]
|
1257
|
+
def create_twilio_provider(provider_id:, name:, from: nil, account_sid: nil, auth_token: nil, enabled: nil)
|
1258
|
+
api_path = '/messaging/providers/twilio'
|
1259
|
+
|
1260
|
+
if provider_id.nil?
|
1261
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
if name.nil?
|
1265
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
api_params = {
|
1269
|
+
providerId: provider_id,
|
1270
|
+
name: name,
|
1271
|
+
from: from,
|
1272
|
+
accountSid: account_sid,
|
1273
|
+
authToken: auth_token,
|
1274
|
+
enabled: enabled,
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
api_headers = {
|
1278
|
+
"content-type": 'application/json',
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
@client.call(
|
1282
|
+
method: 'POST',
|
1283
|
+
path: api_path,
|
1284
|
+
headers: api_headers,
|
1285
|
+
params: api_params,
|
1286
|
+
response_type: Models::Provider
|
1287
|
+
)
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
|
1291
|
+
# Update a Twilio provider by its unique ID.
|
1292
|
+
#
|
1293
|
+
# @param [String] provider_id Provider ID.
|
1294
|
+
# @param [String] name Provider name.
|
1295
|
+
# @param [] enabled Set as enabled.
|
1296
|
+
# @param [String] account_sid Twilio account secret ID.
|
1297
|
+
# @param [String] auth_token Twilio authentication token.
|
1298
|
+
# @param [String] from Sender number.
|
1299
|
+
#
|
1300
|
+
# @return [Provider]
|
1301
|
+
def update_twilio_provider(provider_id:, name: nil, enabled: nil, account_sid: nil, auth_token: nil, from: nil)
|
1302
|
+
api_path = '/messaging/providers/twilio/{providerId}'
|
1303
|
+
.gsub('{providerId}', provider_id)
|
1304
|
+
|
1305
|
+
if provider_id.nil?
|
1306
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
api_params = {
|
1310
|
+
name: name,
|
1311
|
+
enabled: enabled,
|
1312
|
+
accountSid: account_sid,
|
1313
|
+
authToken: auth_token,
|
1314
|
+
from: from,
|
1315
|
+
}
|
1316
|
+
|
1317
|
+
api_headers = {
|
1318
|
+
"content-type": 'application/json',
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
@client.call(
|
1322
|
+
method: 'PATCH',
|
1323
|
+
path: api_path,
|
1324
|
+
headers: api_headers,
|
1325
|
+
params: api_params,
|
1326
|
+
response_type: Models::Provider
|
1327
|
+
)
|
1328
|
+
end
|
1329
|
+
|
1330
|
+
|
1331
|
+
# Create a new Vonage provider.
|
1332
|
+
#
|
1333
|
+
# @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.
|
1334
|
+
# @param [String] name Provider name.
|
1335
|
+
# @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
1336
|
+
# @param [String] api_key Vonage API key.
|
1337
|
+
# @param [String] api_secret Vonage API secret.
|
1338
|
+
# @param [] enabled Set as enabled.
|
1339
|
+
#
|
1340
|
+
# @return [Provider]
|
1341
|
+
def create_vonage_provider(provider_id:, name:, from: nil, api_key: nil, api_secret: nil, enabled: nil)
|
1342
|
+
api_path = '/messaging/providers/vonage'
|
1343
|
+
|
1344
|
+
if provider_id.nil?
|
1345
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1346
|
+
end
|
1347
|
+
|
1348
|
+
if name.nil?
|
1349
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
api_params = {
|
1353
|
+
providerId: provider_id,
|
1354
|
+
name: name,
|
1355
|
+
from: from,
|
1356
|
+
apiKey: api_key,
|
1357
|
+
apiSecret: api_secret,
|
1358
|
+
enabled: enabled,
|
1359
|
+
}
|
1360
|
+
|
1361
|
+
api_headers = {
|
1362
|
+
"content-type": 'application/json',
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
@client.call(
|
1366
|
+
method: 'POST',
|
1367
|
+
path: api_path,
|
1368
|
+
headers: api_headers,
|
1369
|
+
params: api_params,
|
1370
|
+
response_type: Models::Provider
|
1371
|
+
)
|
1372
|
+
end
|
1373
|
+
|
1374
|
+
|
1375
|
+
# Update a Vonage provider by its unique ID.
|
1376
|
+
#
|
1377
|
+
# @param [String] provider_id Provider ID.
|
1378
|
+
# @param [String] name Provider name.
|
1379
|
+
# @param [] enabled Set as enabled.
|
1380
|
+
# @param [String] api_key Vonage API key.
|
1381
|
+
# @param [String] api_secret Vonage API secret.
|
1382
|
+
# @param [String] from Sender number.
|
1383
|
+
#
|
1384
|
+
# @return [Provider]
|
1385
|
+
def update_vonage_provider(provider_id:, name: nil, enabled: nil, api_key: nil, api_secret: nil, from: nil)
|
1386
|
+
api_path = '/messaging/providers/vonage/{providerId}'
|
1387
|
+
.gsub('{providerId}', provider_id)
|
1388
|
+
|
1389
|
+
if provider_id.nil?
|
1390
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1391
|
+
end
|
1392
|
+
|
1393
|
+
api_params = {
|
1394
|
+
name: name,
|
1395
|
+
enabled: enabled,
|
1396
|
+
apiKey: api_key,
|
1397
|
+
apiSecret: api_secret,
|
1398
|
+
from: from,
|
1399
|
+
}
|
1400
|
+
|
1401
|
+
api_headers = {
|
1402
|
+
"content-type": 'application/json',
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
@client.call(
|
1406
|
+
method: 'PATCH',
|
1407
|
+
path: api_path,
|
1408
|
+
headers: api_headers,
|
1409
|
+
params: api_params,
|
1410
|
+
response_type: Models::Provider
|
1411
|
+
)
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
|
1415
|
+
# Get a provider by its unique ID.
|
1416
|
+
#
|
1417
|
+
#
|
1418
|
+
# @param [String] provider_id Provider ID.
|
1419
|
+
#
|
1420
|
+
# @return [Provider]
|
1421
|
+
def get_provider(provider_id:)
|
1422
|
+
api_path = '/messaging/providers/{providerId}'
|
1423
|
+
.gsub('{providerId}', provider_id)
|
1424
|
+
|
1425
|
+
if provider_id.nil?
|
1426
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1427
|
+
end
|
1428
|
+
|
1429
|
+
api_params = {
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
api_headers = {
|
1433
|
+
"content-type": 'application/json',
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
@client.call(
|
1437
|
+
method: 'GET',
|
1438
|
+
path: api_path,
|
1439
|
+
headers: api_headers,
|
1440
|
+
params: api_params,
|
1441
|
+
response_type: Models::Provider
|
1442
|
+
)
|
1443
|
+
end
|
1444
|
+
|
1445
|
+
|
1446
|
+
# Delete a provider by its unique ID.
|
1447
|
+
#
|
1448
|
+
# @param [String] provider_id Provider ID.
|
1449
|
+
#
|
1450
|
+
# @return []
|
1451
|
+
def delete_provider(provider_id:)
|
1452
|
+
api_path = '/messaging/providers/{providerId}'
|
1453
|
+
.gsub('{providerId}', provider_id)
|
1454
|
+
|
1455
|
+
if provider_id.nil?
|
1456
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
api_params = {
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
api_headers = {
|
1463
|
+
"content-type": 'application/json',
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
@client.call(
|
1467
|
+
method: 'DELETE',
|
1468
|
+
path: api_path,
|
1469
|
+
headers: api_headers,
|
1470
|
+
params: api_params,
|
1471
|
+
)
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
|
1475
|
+
# Get the provider activity logs listed by its unique ID.
|
1476
|
+
#
|
1477
|
+
# @param [String] provider_id Provider ID.
|
1478
|
+
# @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
|
1479
|
+
#
|
1480
|
+
# @return [LogList]
|
1481
|
+
def list_provider_logs(provider_id:, queries: nil)
|
1482
|
+
api_path = '/messaging/providers/{providerId}/logs'
|
1483
|
+
.gsub('{providerId}', provider_id)
|
1484
|
+
|
1485
|
+
if provider_id.nil?
|
1486
|
+
raise Appwrite::Exception.new('Missing required parameter: "providerId"')
|
1487
|
+
end
|
1488
|
+
|
1489
|
+
api_params = {
|
1490
|
+
queries: queries,
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
api_headers = {
|
1494
|
+
"content-type": 'application/json',
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
@client.call(
|
1498
|
+
method: 'GET',
|
1499
|
+
path: api_path,
|
1500
|
+
headers: api_headers,
|
1501
|
+
params: api_params,
|
1502
|
+
response_type: Models::LogList
|
1503
|
+
)
|
1504
|
+
end
|
1505
|
+
|
1506
|
+
|
1507
|
+
# Get the subscriber activity logs listed by its unique ID.
|
1508
|
+
#
|
1509
|
+
# @param [String] subscriber_id Subscriber ID.
|
1510
|
+
# @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
|
1511
|
+
#
|
1512
|
+
# @return [LogList]
|
1513
|
+
def list_subscriber_logs(subscriber_id:, queries: nil)
|
1514
|
+
api_path = '/messaging/subscribers/{subscriberId}/logs'
|
1515
|
+
.gsub('{subscriberId}', subscriber_id)
|
1516
|
+
|
1517
|
+
if subscriber_id.nil?
|
1518
|
+
raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
api_params = {
|
1522
|
+
queries: queries,
|
1523
|
+
}
|
1524
|
+
|
1525
|
+
api_headers = {
|
1526
|
+
"content-type": 'application/json',
|
1527
|
+
}
|
1528
|
+
|
1529
|
+
@client.call(
|
1530
|
+
method: 'GET',
|
1531
|
+
path: api_path,
|
1532
|
+
headers: api_headers,
|
1533
|
+
params: api_params,
|
1534
|
+
response_type: Models::LogList
|
1535
|
+
)
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
|
1539
|
+
# Get a list of all topics from the current Appwrite project.
|
1540
|
+
#
|
1541
|
+
# @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
|
1542
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
1543
|
+
#
|
1544
|
+
# @return [TopicList]
|
1545
|
+
def list_topics(queries: nil, search: nil)
|
1546
|
+
api_path = '/messaging/topics'
|
1547
|
+
|
1548
|
+
api_params = {
|
1549
|
+
queries: queries,
|
1550
|
+
search: search,
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
api_headers = {
|
1554
|
+
"content-type": 'application/json',
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
@client.call(
|
1558
|
+
method: 'GET',
|
1559
|
+
path: api_path,
|
1560
|
+
headers: api_headers,
|
1561
|
+
params: api_params,
|
1562
|
+
response_type: Models::TopicList
|
1563
|
+
)
|
1564
|
+
end
|
1565
|
+
|
1566
|
+
|
1567
|
+
# Create a new topic.
|
1568
|
+
#
|
1569
|
+
# @param [String] topic_id Topic ID. Choose a custom Topic ID or a new Topic ID.
|
1570
|
+
# @param [String] name Topic Name.
|
1571
|
+
# @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.
|
1572
|
+
#
|
1573
|
+
# @return [Topic]
|
1574
|
+
def create_topic(topic_id:, name:, subscribe: nil)
|
1575
|
+
api_path = '/messaging/topics'
|
1576
|
+
|
1577
|
+
if topic_id.nil?
|
1578
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1579
|
+
end
|
1580
|
+
|
1581
|
+
if name.nil?
|
1582
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
api_params = {
|
1586
|
+
topicId: topic_id,
|
1587
|
+
name: name,
|
1588
|
+
subscribe: subscribe,
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
api_headers = {
|
1592
|
+
"content-type": 'application/json',
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
@client.call(
|
1596
|
+
method: 'POST',
|
1597
|
+
path: api_path,
|
1598
|
+
headers: api_headers,
|
1599
|
+
params: api_params,
|
1600
|
+
response_type: Models::Topic
|
1601
|
+
)
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
|
1605
|
+
# Get a topic by its unique ID.
|
1606
|
+
#
|
1607
|
+
#
|
1608
|
+
# @param [String] topic_id Topic ID.
|
1609
|
+
#
|
1610
|
+
# @return [Topic]
|
1611
|
+
def get_topic(topic_id:)
|
1612
|
+
api_path = '/messaging/topics/{topicId}'
|
1613
|
+
.gsub('{topicId}', topic_id)
|
1614
|
+
|
1615
|
+
if topic_id.nil?
|
1616
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1617
|
+
end
|
1618
|
+
|
1619
|
+
api_params = {
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
api_headers = {
|
1623
|
+
"content-type": 'application/json',
|
1624
|
+
}
|
1625
|
+
|
1626
|
+
@client.call(
|
1627
|
+
method: 'GET',
|
1628
|
+
path: api_path,
|
1629
|
+
headers: api_headers,
|
1630
|
+
params: api_params,
|
1631
|
+
response_type: Models::Topic
|
1632
|
+
)
|
1633
|
+
end
|
1634
|
+
|
1635
|
+
|
1636
|
+
# Update a topic by its unique ID.
|
1637
|
+
#
|
1638
|
+
#
|
1639
|
+
# @param [String] topic_id Topic ID.
|
1640
|
+
# @param [String] name Topic Name.
|
1641
|
+
#
|
1642
|
+
# @return [Topic]
|
1643
|
+
def update_topic(topic_id:, name: nil)
|
1644
|
+
api_path = '/messaging/topics/{topicId}'
|
1645
|
+
.gsub('{topicId}', topic_id)
|
1646
|
+
|
1647
|
+
if topic_id.nil?
|
1648
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1649
|
+
end
|
1650
|
+
|
1651
|
+
api_params = {
|
1652
|
+
name: name,
|
1653
|
+
}
|
1654
|
+
|
1655
|
+
api_headers = {
|
1656
|
+
"content-type": 'application/json',
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
@client.call(
|
1660
|
+
method: 'PATCH',
|
1661
|
+
path: api_path,
|
1662
|
+
headers: api_headers,
|
1663
|
+
params: api_params,
|
1664
|
+
response_type: Models::Topic
|
1665
|
+
)
|
1666
|
+
end
|
1667
|
+
|
1668
|
+
|
1669
|
+
# Delete a topic by its unique ID.
|
1670
|
+
#
|
1671
|
+
# @param [String] topic_id Topic ID.
|
1672
|
+
#
|
1673
|
+
# @return []
|
1674
|
+
def delete_topic(topic_id:)
|
1675
|
+
api_path = '/messaging/topics/{topicId}'
|
1676
|
+
.gsub('{topicId}', topic_id)
|
1677
|
+
|
1678
|
+
if topic_id.nil?
|
1679
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
api_params = {
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
api_headers = {
|
1686
|
+
"content-type": 'application/json',
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
@client.call(
|
1690
|
+
method: 'DELETE',
|
1691
|
+
path: api_path,
|
1692
|
+
headers: api_headers,
|
1693
|
+
params: api_params,
|
1694
|
+
)
|
1695
|
+
end
|
1696
|
+
|
1697
|
+
|
1698
|
+
# Get the topic activity logs listed by its unique ID.
|
1699
|
+
#
|
1700
|
+
# @param [String] topic_id Topic ID.
|
1701
|
+
# @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
|
1702
|
+
#
|
1703
|
+
# @return [LogList]
|
1704
|
+
def list_topic_logs(topic_id:, queries: nil)
|
1705
|
+
api_path = '/messaging/topics/{topicId}/logs'
|
1706
|
+
.gsub('{topicId}', topic_id)
|
1707
|
+
|
1708
|
+
if topic_id.nil?
|
1709
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
api_params = {
|
1713
|
+
queries: queries,
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
api_headers = {
|
1717
|
+
"content-type": 'application/json',
|
1718
|
+
}
|
1719
|
+
|
1720
|
+
@client.call(
|
1721
|
+
method: 'GET',
|
1722
|
+
path: api_path,
|
1723
|
+
headers: api_headers,
|
1724
|
+
params: api_params,
|
1725
|
+
response_type: Models::LogList
|
1726
|
+
)
|
1727
|
+
end
|
1728
|
+
|
1729
|
+
|
1730
|
+
# Get a list of all subscribers from the current Appwrite project.
|
1731
|
+
#
|
1732
|
+
# @param [String] topic_id Topic ID. The topic ID subscribed to.
|
1733
|
+
# @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
|
1734
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
1735
|
+
#
|
1736
|
+
# @return [SubscriberList]
|
1737
|
+
def list_subscribers(topic_id:, queries: nil, search: nil)
|
1738
|
+
api_path = '/messaging/topics/{topicId}/subscribers'
|
1739
|
+
.gsub('{topicId}', topic_id)
|
1740
|
+
|
1741
|
+
if topic_id.nil?
|
1742
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1743
|
+
end
|
1744
|
+
|
1745
|
+
api_params = {
|
1746
|
+
queries: queries,
|
1747
|
+
search: search,
|
1748
|
+
}
|
1749
|
+
|
1750
|
+
api_headers = {
|
1751
|
+
"content-type": 'application/json',
|
1752
|
+
}
|
1753
|
+
|
1754
|
+
@client.call(
|
1755
|
+
method: 'GET',
|
1756
|
+
path: api_path,
|
1757
|
+
headers: api_headers,
|
1758
|
+
params: api_params,
|
1759
|
+
response_type: Models::SubscriberList
|
1760
|
+
)
|
1761
|
+
end
|
1762
|
+
|
1763
|
+
|
1764
|
+
# Create a new subscriber.
|
1765
|
+
#
|
1766
|
+
# @param [String] topic_id Topic ID. The topic ID to subscribe to.
|
1767
|
+
# @param [String] subscriber_id Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
|
1768
|
+
# @param [String] target_id Target ID. The target ID to link to the specified Topic ID.
|
1769
|
+
#
|
1770
|
+
# @return [Subscriber]
|
1771
|
+
def create_subscriber(topic_id:, subscriber_id:, target_id:)
|
1772
|
+
api_path = '/messaging/topics/{topicId}/subscribers'
|
1773
|
+
.gsub('{topicId}', topic_id)
|
1774
|
+
|
1775
|
+
if topic_id.nil?
|
1776
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
if subscriber_id.nil?
|
1780
|
+
raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
|
1781
|
+
end
|
1782
|
+
|
1783
|
+
if target_id.nil?
|
1784
|
+
raise Appwrite::Exception.new('Missing required parameter: "targetId"')
|
1785
|
+
end
|
1786
|
+
|
1787
|
+
api_params = {
|
1788
|
+
subscriberId: subscriber_id,
|
1789
|
+
targetId: target_id,
|
1790
|
+
}
|
1791
|
+
|
1792
|
+
api_headers = {
|
1793
|
+
"content-type": 'application/json',
|
1794
|
+
}
|
1795
|
+
|
1796
|
+
@client.call(
|
1797
|
+
method: 'POST',
|
1798
|
+
path: api_path,
|
1799
|
+
headers: api_headers,
|
1800
|
+
params: api_params,
|
1801
|
+
response_type: Models::Subscriber
|
1802
|
+
)
|
1803
|
+
end
|
1804
|
+
|
1805
|
+
|
1806
|
+
# Get a subscriber by its unique ID.
|
1807
|
+
#
|
1808
|
+
#
|
1809
|
+
# @param [String] topic_id Topic ID. The topic ID subscribed to.
|
1810
|
+
# @param [String] subscriber_id Subscriber ID.
|
1811
|
+
#
|
1812
|
+
# @return [Subscriber]
|
1813
|
+
def get_subscriber(topic_id:, subscriber_id:)
|
1814
|
+
api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}'
|
1815
|
+
.gsub('{topicId}', topic_id)
|
1816
|
+
.gsub('{subscriberId}', subscriber_id)
|
1817
|
+
|
1818
|
+
if topic_id.nil?
|
1819
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1820
|
+
end
|
1821
|
+
|
1822
|
+
if subscriber_id.nil?
|
1823
|
+
raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
|
1824
|
+
end
|
1825
|
+
|
1826
|
+
api_params = {
|
1827
|
+
}
|
1828
|
+
|
1829
|
+
api_headers = {
|
1830
|
+
"content-type": 'application/json',
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
@client.call(
|
1834
|
+
method: 'GET',
|
1835
|
+
path: api_path,
|
1836
|
+
headers: api_headers,
|
1837
|
+
params: api_params,
|
1838
|
+
response_type: Models::Subscriber
|
1839
|
+
)
|
1840
|
+
end
|
1841
|
+
|
1842
|
+
|
1843
|
+
# Delete a subscriber by its unique ID.
|
1844
|
+
#
|
1845
|
+
# @param [String] topic_id Topic ID. The topic ID subscribed to.
|
1846
|
+
# @param [String] subscriber_id Subscriber ID.
|
1847
|
+
#
|
1848
|
+
# @return []
|
1849
|
+
def delete_subscriber(topic_id:, subscriber_id:)
|
1850
|
+
api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}'
|
1851
|
+
.gsub('{topicId}', topic_id)
|
1852
|
+
.gsub('{subscriberId}', subscriber_id)
|
1853
|
+
|
1854
|
+
if topic_id.nil?
|
1855
|
+
raise Appwrite::Exception.new('Missing required parameter: "topicId"')
|
1856
|
+
end
|
1857
|
+
|
1858
|
+
if subscriber_id.nil?
|
1859
|
+
raise Appwrite::Exception.new('Missing required parameter: "subscriberId"')
|
1860
|
+
end
|
1861
|
+
|
1862
|
+
api_params = {
|
1863
|
+
}
|
1864
|
+
|
1865
|
+
api_headers = {
|
1866
|
+
"content-type": 'application/json',
|
1867
|
+
}
|
1868
|
+
|
1869
|
+
@client.call(
|
1870
|
+
method: 'DELETE',
|
1871
|
+
path: api_path,
|
1872
|
+
headers: api_headers,
|
1873
|
+
params: api_params,
|
1874
|
+
)
|
1875
|
+
end
|
1876
|
+
|
1877
|
+
|
1878
|
+
end
|
1879
|
+
end
|