appwrite 30.1.0 → 30.2.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.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +16 -2
- data/lib/appwrite/enums/appwrite_migration_resource.rb +1 -0
- data/lib/appwrite/enums/o_auth_provider.rb +2 -0
- data/lib/appwrite/enums/project_key_scopes.rb +6 -0
- data/lib/appwrite/enums/project_o_auth_provider_id.rb +2 -0
- data/lib/appwrite/enums/project_policy_id.rb +1 -0
- data/lib/appwrite/models/activity_event.rb +9 -4
- data/lib/appwrite/models/device.rb +58 -0
- data/lib/appwrite/models/environment.rb +48 -0
- data/lib/appwrite/models/environment_list.rb +33 -0
- data/lib/appwrite/models/o_auth2_vipps.rb +43 -0
- data/lib/appwrite/models/organization.rb +16 -1
- data/lib/appwrite/models/policy_account_devices.rb +33 -0
- data/lib/appwrite/models/project.rb +10 -0
- data/lib/appwrite/models/proxy_rule.rb +11 -1
- data/lib/appwrite/models/session.rb +6 -1
- data/lib/appwrite/models/waf_rule_bypass.rb +8 -3
- data/lib/appwrite/models/waf_rule_challenge.rb +5 -0
- data/lib/appwrite/models/waf_rule_deny.rb +8 -3
- data/lib/appwrite/models/waf_rule_rate_limit.rb +5 -0
- data/lib/appwrite/models/waf_rule_redirect.rb +5 -0
- data/lib/appwrite/services/account.rb +156 -1
- data/lib/appwrite/services/domains.rb +2 -2
- data/lib/appwrite/services/project.rb +217 -20
- data/lib/appwrite/services/proxy.rb +154 -1
- data/lib/appwrite/services/storage.rb +2 -2
- data/lib/appwrite/services/waf.rb +40 -10
- data/lib/appwrite.rb +5 -0
- metadata +7 -2
|
@@ -17,6 +17,7 @@ module Appwrite
|
|
|
17
17
|
attr_reader :enabled
|
|
18
18
|
attr_reader :conditions
|
|
19
19
|
attr_reader :config
|
|
20
|
+
attr_reader :schedule
|
|
20
21
|
|
|
21
22
|
def initialize(
|
|
22
23
|
id:,
|
|
@@ -32,7 +33,8 @@ module Appwrite
|
|
|
32
33
|
priority:,
|
|
33
34
|
enabled:,
|
|
34
35
|
conditions:,
|
|
35
|
-
config
|
|
36
|
+
config:,
|
|
37
|
+
schedule: nil
|
|
36
38
|
)
|
|
37
39
|
@id = id
|
|
38
40
|
@created_at = created_at
|
|
@@ -48,6 +50,7 @@ module Appwrite
|
|
|
48
50
|
@enabled = enabled
|
|
49
51
|
@conditions = conditions
|
|
50
52
|
@config = config
|
|
53
|
+
@schedule = schedule
|
|
51
54
|
end
|
|
52
55
|
|
|
53
56
|
def self.from(map:)
|
|
@@ -66,7 +69,8 @@ module Appwrite
|
|
|
66
69
|
priority: map["priority"],
|
|
67
70
|
enabled: map["enabled"],
|
|
68
71
|
conditions: map["conditions"],
|
|
69
|
-
config: map["config"]
|
|
72
|
+
config: map["config"],
|
|
73
|
+
schedule: map["schedule"]
|
|
70
74
|
)
|
|
71
75
|
end
|
|
72
76
|
|
|
@@ -85,7 +89,8 @@ module Appwrite
|
|
|
85
89
|
"priority": @priority,
|
|
86
90
|
"enabled": @enabled,
|
|
87
91
|
"conditions": @conditions,
|
|
88
|
-
"config": @config
|
|
92
|
+
"config": @config,
|
|
93
|
+
"schedule": @schedule
|
|
89
94
|
}
|
|
90
95
|
end
|
|
91
96
|
|
|
@@ -17,6 +17,7 @@ module Appwrite
|
|
|
17
17
|
attr_reader :enabled
|
|
18
18
|
attr_reader :conditions
|
|
19
19
|
attr_reader :config
|
|
20
|
+
attr_reader :schedule
|
|
20
21
|
attr_reader :challenge_type
|
|
21
22
|
attr_reader :difficulty
|
|
22
23
|
attr_reader :ttl
|
|
@@ -36,6 +37,7 @@ module Appwrite
|
|
|
36
37
|
enabled:,
|
|
37
38
|
conditions:,
|
|
38
39
|
config:,
|
|
40
|
+
schedule: nil,
|
|
39
41
|
challenge_type:,
|
|
40
42
|
difficulty:,
|
|
41
43
|
ttl:
|
|
@@ -54,6 +56,7 @@ module Appwrite
|
|
|
54
56
|
@enabled = enabled
|
|
55
57
|
@conditions = conditions
|
|
56
58
|
@config = config
|
|
59
|
+
@schedule = schedule
|
|
57
60
|
@challenge_type = challenge_type
|
|
58
61
|
@difficulty = difficulty
|
|
59
62
|
@ttl = ttl
|
|
@@ -76,6 +79,7 @@ module Appwrite
|
|
|
76
79
|
enabled: map["enabled"],
|
|
77
80
|
conditions: map["conditions"],
|
|
78
81
|
config: map["config"],
|
|
82
|
+
schedule: map["schedule"],
|
|
79
83
|
challenge_type: map["challengeType"],
|
|
80
84
|
difficulty: map["difficulty"],
|
|
81
85
|
ttl: map["ttl"]
|
|
@@ -98,6 +102,7 @@ module Appwrite
|
|
|
98
102
|
"enabled": @enabled,
|
|
99
103
|
"conditions": @conditions,
|
|
100
104
|
"config": @config,
|
|
105
|
+
"schedule": @schedule,
|
|
101
106
|
"challengeType": @challenge_type,
|
|
102
107
|
"difficulty": @difficulty,
|
|
103
108
|
"ttl": @ttl
|
|
@@ -17,6 +17,7 @@ module Appwrite
|
|
|
17
17
|
attr_reader :enabled
|
|
18
18
|
attr_reader :conditions
|
|
19
19
|
attr_reader :config
|
|
20
|
+
attr_reader :schedule
|
|
20
21
|
|
|
21
22
|
def initialize(
|
|
22
23
|
id:,
|
|
@@ -32,7 +33,8 @@ module Appwrite
|
|
|
32
33
|
priority:,
|
|
33
34
|
enabled:,
|
|
34
35
|
conditions:,
|
|
35
|
-
config
|
|
36
|
+
config:,
|
|
37
|
+
schedule: nil
|
|
36
38
|
)
|
|
37
39
|
@id = id
|
|
38
40
|
@created_at = created_at
|
|
@@ -48,6 +50,7 @@ module Appwrite
|
|
|
48
50
|
@enabled = enabled
|
|
49
51
|
@conditions = conditions
|
|
50
52
|
@config = config
|
|
53
|
+
@schedule = schedule
|
|
51
54
|
end
|
|
52
55
|
|
|
53
56
|
def self.from(map:)
|
|
@@ -66,7 +69,8 @@ module Appwrite
|
|
|
66
69
|
priority: map["priority"],
|
|
67
70
|
enabled: map["enabled"],
|
|
68
71
|
conditions: map["conditions"],
|
|
69
|
-
config: map["config"]
|
|
72
|
+
config: map["config"],
|
|
73
|
+
schedule: map["schedule"]
|
|
70
74
|
)
|
|
71
75
|
end
|
|
72
76
|
|
|
@@ -85,7 +89,8 @@ module Appwrite
|
|
|
85
89
|
"priority": @priority,
|
|
86
90
|
"enabled": @enabled,
|
|
87
91
|
"conditions": @conditions,
|
|
88
|
-
"config": @config
|
|
92
|
+
"config": @config,
|
|
93
|
+
"schedule": @schedule
|
|
89
94
|
}
|
|
90
95
|
end
|
|
91
96
|
|
|
@@ -17,6 +17,7 @@ module Appwrite
|
|
|
17
17
|
attr_reader :enabled
|
|
18
18
|
attr_reader :conditions
|
|
19
19
|
attr_reader :config
|
|
20
|
+
attr_reader :schedule
|
|
20
21
|
attr_reader :limit
|
|
21
22
|
attr_reader :interval
|
|
22
23
|
attr_reader :key
|
|
@@ -38,6 +39,7 @@ module Appwrite
|
|
|
38
39
|
enabled:,
|
|
39
40
|
conditions:,
|
|
40
41
|
config:,
|
|
42
|
+
schedule: nil,
|
|
41
43
|
limit:,
|
|
42
44
|
interval:,
|
|
43
45
|
key:,
|
|
@@ -58,6 +60,7 @@ module Appwrite
|
|
|
58
60
|
@enabled = enabled
|
|
59
61
|
@conditions = conditions
|
|
60
62
|
@config = config
|
|
63
|
+
@schedule = schedule
|
|
61
64
|
@limit = limit
|
|
62
65
|
@interval = interval
|
|
63
66
|
@key = key
|
|
@@ -82,6 +85,7 @@ module Appwrite
|
|
|
82
85
|
enabled: map["enabled"],
|
|
83
86
|
conditions: map["conditions"],
|
|
84
87
|
config: map["config"],
|
|
88
|
+
schedule: map["schedule"],
|
|
85
89
|
limit: map["limit"],
|
|
86
90
|
interval: map["interval"],
|
|
87
91
|
key: map["key"],
|
|
@@ -106,6 +110,7 @@ module Appwrite
|
|
|
106
110
|
"enabled": @enabled,
|
|
107
111
|
"conditions": @conditions,
|
|
108
112
|
"config": @config,
|
|
113
|
+
"schedule": @schedule,
|
|
109
114
|
"limit": @limit,
|
|
110
115
|
"interval": @interval,
|
|
111
116
|
"key": @key,
|
|
@@ -17,6 +17,7 @@ module Appwrite
|
|
|
17
17
|
attr_reader :enabled
|
|
18
18
|
attr_reader :conditions
|
|
19
19
|
attr_reader :config
|
|
20
|
+
attr_reader :schedule
|
|
20
21
|
attr_reader :location
|
|
21
22
|
attr_reader :status_code
|
|
22
23
|
|
|
@@ -35,6 +36,7 @@ module Appwrite
|
|
|
35
36
|
enabled:,
|
|
36
37
|
conditions:,
|
|
37
38
|
config:,
|
|
39
|
+
schedule: nil,
|
|
38
40
|
location:,
|
|
39
41
|
status_code:
|
|
40
42
|
)
|
|
@@ -52,6 +54,7 @@ module Appwrite
|
|
|
52
54
|
@enabled = enabled
|
|
53
55
|
@conditions = conditions
|
|
54
56
|
@config = config
|
|
57
|
+
@schedule = schedule
|
|
55
58
|
@location = location
|
|
56
59
|
@status_code = status_code
|
|
57
60
|
end
|
|
@@ -73,6 +76,7 @@ module Appwrite
|
|
|
73
76
|
enabled: map["enabled"],
|
|
74
77
|
conditions: map["conditions"],
|
|
75
78
|
config: map["config"],
|
|
79
|
+
schedule: map["schedule"],
|
|
76
80
|
location: map["location"],
|
|
77
81
|
status_code: map["statusCode"]
|
|
78
82
|
)
|
|
@@ -94,6 +98,7 @@ module Appwrite
|
|
|
94
98
|
"enabled": @enabled,
|
|
95
99
|
"conditions": @conditions,
|
|
96
100
|
"config": @config,
|
|
101
|
+
"schedule": @schedule,
|
|
97
102
|
"location": @location,
|
|
98
103
|
"statusCode": @status_code
|
|
99
104
|
}
|
|
@@ -301,6 +301,161 @@ module Appwrite
|
|
|
301
301
|
)
|
|
302
302
|
end
|
|
303
303
|
|
|
304
|
+
# Create an account switching device. A device is a container, scoped to one
|
|
305
|
+
# browser or app install, that holds multiple sessions and tracks which one
|
|
306
|
+
# is active. Once a device exists, session creation endpoints attach the new
|
|
307
|
+
# session to it automatically, so a single browser can stay signed in to
|
|
308
|
+
# several accounts and switch between them. A device holds at most one
|
|
309
|
+
# session per user: signing in again as a user it already holds replaces that
|
|
310
|
+
# user's session. The device lives as long as its newest session.
|
|
311
|
+
#
|
|
312
|
+
# The device secret is returned in a cookie. Run this on app start: if the
|
|
313
|
+
# browser already has a valid device, the existing one is returned with the
|
|
314
|
+
# same status code instead of an error, so it is always safe to call.
|
|
315
|
+
#
|
|
316
|
+
# Every session that joins the device rotates the device secret and re-issues
|
|
317
|
+
# the cookie, so an earlier copy of the secret stops working. A client that
|
|
318
|
+
# keeps the secret itself, rather than relying on the cookie, must replace it
|
|
319
|
+
# from each session response.
|
|
320
|
+
#
|
|
321
|
+
#
|
|
322
|
+
# @return [Device]
|
|
323
|
+
def create_device()
|
|
324
|
+
api_path = '/account/devices'
|
|
325
|
+
|
|
326
|
+
api_params = {}
|
|
327
|
+
|
|
328
|
+
api_headers = {
|
|
329
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
330
|
+
"content-type": 'application/json',
|
|
331
|
+
"accept": 'application/json',
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
@client.call(
|
|
335
|
+
method: 'POST',
|
|
336
|
+
path: api_path,
|
|
337
|
+
headers: api_headers,
|
|
338
|
+
params: api_params,
|
|
339
|
+
response_type: Models::Device
|
|
340
|
+
)
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Get the account switching device for the current browser, including every
|
|
344
|
+
# session it holds, the name of the user each session belongs to, and the ID
|
|
345
|
+
# of the active session. Use the string 'current' to reference the current
|
|
346
|
+
# browser's device.
|
|
347
|
+
#
|
|
348
|
+
# @param [String] device_id Device ID. Use the string 'current' to reference the device of the current browser.
|
|
349
|
+
#
|
|
350
|
+
# @return [Device]
|
|
351
|
+
def get_device(
|
|
352
|
+
device_id:
|
|
353
|
+
)
|
|
354
|
+
if device_id.nil? || device_id == ''
|
|
355
|
+
raise Appwrite::Exception.new('Missing required parameter: "deviceId"')
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
api_path = '/account/devices/{deviceId}'
|
|
359
|
+
.gsub('{deviceId}', @client.encode_path(device_id))
|
|
360
|
+
|
|
361
|
+
api_params = {}
|
|
362
|
+
|
|
363
|
+
api_headers = {
|
|
364
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
365
|
+
"accept": 'application/json',
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@client.call(
|
|
369
|
+
method: 'GET',
|
|
370
|
+
path: api_path,
|
|
371
|
+
headers: api_headers,
|
|
372
|
+
params: api_params,
|
|
373
|
+
response_type: Models::Device
|
|
374
|
+
)
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Delete the account switching device for the current browser. Every session
|
|
378
|
+
# the device holds is signed out, each firing its own session delete event,
|
|
379
|
+
# the device is removed, and both the device and session cookies are cleared.
|
|
380
|
+
# Use the string 'current' to reference the current browser's device.
|
|
381
|
+
#
|
|
382
|
+
# @param [String] device_id Device ID. Use the string 'current' to reference the device of the current browser.
|
|
383
|
+
#
|
|
384
|
+
# @return []
|
|
385
|
+
def delete_device(
|
|
386
|
+
device_id:
|
|
387
|
+
)
|
|
388
|
+
if device_id.nil? || device_id == ''
|
|
389
|
+
raise Appwrite::Exception.new('Missing required parameter: "deviceId"')
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
api_path = '/account/devices/{deviceId}'
|
|
393
|
+
.gsub('{deviceId}', @client.encode_path(device_id))
|
|
394
|
+
|
|
395
|
+
api_params = {}
|
|
396
|
+
|
|
397
|
+
api_headers = {
|
|
398
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
399
|
+
"content-type": 'application/json',
|
|
400
|
+
"accept": 'application/json',
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@client.call(
|
|
404
|
+
method: 'DELETE',
|
|
405
|
+
path: api_path,
|
|
406
|
+
headers: api_headers,
|
|
407
|
+
params: api_params,
|
|
408
|
+
)
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Switch the active account on an account switching device to one of the
|
|
412
|
+
# sessions it holds. The chosen session becomes active and its secret is
|
|
413
|
+
# written to the browser's session cookie, so subsequent requests
|
|
414
|
+
# authenticate as that account. Use the string 'current' to reference the
|
|
415
|
+
# current browser's device.
|
|
416
|
+
#
|
|
417
|
+
# Switching rotates the chosen session's secret. Any other holder of that
|
|
418
|
+
# session, such as a copy kept elsewhere, stops working, so a session should
|
|
419
|
+
# not be shared across devices.
|
|
420
|
+
#
|
|
421
|
+
# @param [String] device_id Device ID. Use the string 'current' to reference the device of the current browser.
|
|
422
|
+
# @param [String] session_id ID of the session, held by the device, to make active.
|
|
423
|
+
#
|
|
424
|
+
# @return [Session]
|
|
425
|
+
def update_device_session(
|
|
426
|
+
device_id:,
|
|
427
|
+
session_id:
|
|
428
|
+
)
|
|
429
|
+
if device_id.nil? || device_id == ''
|
|
430
|
+
raise Appwrite::Exception.new('Missing required parameter: "deviceId"')
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
if session_id.nil?
|
|
434
|
+
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
api_path = '/account/devices/{deviceId}/session'
|
|
438
|
+
.gsub('{deviceId}', @client.encode_path(device_id))
|
|
439
|
+
|
|
440
|
+
api_params = {
|
|
441
|
+
sessionId: session_id,
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
api_headers = {
|
|
445
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
446
|
+
"content-type": 'application/json',
|
|
447
|
+
"accept": 'application/json',
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
@client.call(
|
|
451
|
+
method: 'PATCH',
|
|
452
|
+
path: api_path,
|
|
453
|
+
headers: api_headers,
|
|
454
|
+
params: api_params,
|
|
455
|
+
response_type: Models::Session
|
|
456
|
+
)
|
|
457
|
+
end
|
|
458
|
+
|
|
304
459
|
# Update currently logged in user account email address. After changing user
|
|
305
460
|
# address, the user confirmation status will get reset. A new confirmation
|
|
306
461
|
# email is not sent automatically however you can use the send confirmation
|
|
@@ -2006,7 +2161,7 @@ module Appwrite
|
|
|
2006
2161
|
# about session
|
|
2007
2162
|
# limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2008
2163
|
#
|
|
2009
|
-
# @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
2164
|
+
# @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, vipps, vippsSandbox, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
2010
2165
|
# @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2011
2166
|
# @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2012
2167
|
# @param [Array] scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
@@ -1262,7 +1262,7 @@ module Appwrite
|
|
|
1262
1262
|
# to 'example.wordpress.com'.
|
|
1263
1263
|
#
|
|
1264
1264
|
# @param [String] domain_id Domain unique ID.
|
|
1265
|
-
# @param [String] name Record name relative to the domain, such as `www
|
|
1265
|
+
# @param [String] name Record name relative to the domain, such as `www`. A CNAME cannot be at the domain itself; use an ALIAS record there. A full name ending in the domain is also accepted and stored relative to it.
|
|
1266
1266
|
# @param [String] value Canonical target for this CNAME record.
|
|
1267
1267
|
# @param [Integer] ttl Time to live, in seconds. Must be between 1 and 2147483647.
|
|
1268
1268
|
# @param [String] comment A comment for this record.
|
|
@@ -1320,7 +1320,7 @@ module Appwrite
|
|
|
1320
1320
|
#
|
|
1321
1321
|
# @param [String] domain_id Domain unique ID.
|
|
1322
1322
|
# @param [String] record_id DNS record unique ID.
|
|
1323
|
-
# @param [String] name Record name relative to the domain, such as `www
|
|
1323
|
+
# @param [String] name Record name relative to the domain, such as `www`. A CNAME cannot be at the domain itself; use an ALIAS record there. A full name ending in the domain is also accepted and stored relative to it.
|
|
1324
1324
|
# @param [String] value Canonical target for this CNAME record.
|
|
1325
1325
|
# @param [Integer] ttl Time to live, in seconds. Must be between 1 and 2147483647.
|
|
1326
1326
|
# @param [String] comment A comment for this record.
|