appwrite 28.3.1 → 28.4.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 +20 -4
- data/lib/appwrite/enums/billing_plan_group.rb +2 -0
- data/lib/appwrite/enums/build_runtime.rb +2 -0
- data/lib/appwrite/enums/databases_index_type.rb +1 -0
- data/lib/appwrite/enums/domain_registration_type.rb +10 -0
- data/lib/appwrite/enums/domain_transfer_status_enum.rb +14 -0
- data/lib/appwrite/enums/framework.rb +1 -0
- data/lib/appwrite/enums/id_token_provider.rb +8 -0
- data/lib/appwrite/enums/image_gravity.rb +1 -0
- data/lib/appwrite/enums/o_auth2_auth0_prompt.rb +9 -0
- data/lib/appwrite/enums/o_auth2_discord_prompt.rb +8 -0
- data/lib/appwrite/enums/o_auth2_github_prompt.rb +7 -0
- data/lib/appwrite/enums/o_auth2_kakao_prompt.rb +10 -0
- data/lib/appwrite/enums/o_auth2_microsoft_prompt.rb +10 -0
- data/lib/appwrite/enums/o_auth2_okta_prompt.rb +9 -0
- data/lib/appwrite/enums/o_auth2_salesforce_prompt.rb +8 -0
- data/lib/appwrite/enums/o_auth2_zoho_prompt.rb +7 -0
- data/lib/appwrite/enums/o_auth_provider.rb +3 -0
- data/lib/appwrite/enums/project_email_template_id.rb +2 -0
- data/lib/appwrite/enums/project_key_scopes.rb +4 -0
- data/lib/appwrite/enums/project_o_auth2_auth0_prompt.rb +9 -0
- data/lib/appwrite/enums/project_o_auth2_discord_prompt.rb +8 -0
- data/lib/appwrite/enums/project_o_auth2_git_hub_prompt.rb +7 -0
- data/lib/appwrite/enums/project_o_auth2_kakao_prompt.rb +10 -0
- data/lib/appwrite/enums/project_o_auth2_microsoft_prompt.rb +10 -0
- data/lib/appwrite/enums/project_o_auth2_okta_prompt.rb +9 -0
- data/lib/appwrite/enums/project_o_auth2_salesforce_prompt.rb +8 -0
- data/lib/appwrite/enums/project_o_auth2_zoho_prompt.rb +7 -0
- data/lib/appwrite/enums/project_o_auth_provider_id.rb +3 -0
- data/lib/appwrite/enums/project_policy_id.rb +2 -0
- data/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +1 -0
- data/lib/appwrite/enums/runtime.rb +2 -0
- data/lib/appwrite/enums/tables_db_index_type.rb +1 -0
- data/lib/appwrite/enums/waf_rule_action.rb +11 -0
- data/lib/appwrite/models/account.rb +143 -0
- data/lib/appwrite/models/billing_plan.rb +12 -0
- data/lib/appwrite/models/dedicated_database.rb +15 -0
- data/lib/appwrite/models/dedicated_database_specification.rb +20 -0
- data/lib/appwrite/models/dns_record.rb +83 -0
- data/lib/appwrite/models/dns_records_list.rb +33 -0
- data/lib/appwrite/models/domain.rb +109 -0
- data/lib/appwrite/models/domain_price.rb +63 -0
- data/lib/appwrite/models/domain_prices_list.rb +33 -0
- data/lib/appwrite/models/domain_transfer_status.rb +59 -0
- data/lib/appwrite/models/domains_list.rb +33 -0
- data/lib/appwrite/models/identity.rb +8 -3
- data/lib/appwrite/models/o_auth2_apple.rb +13 -3
- data/lib/appwrite/models/o_auth2_auth0.rb +23 -0
- data/lib/appwrite/models/o_auth2_discord.rb +25 -3
- data/lib/appwrite/models/o_auth2_github.rb +24 -3
- data/lib/appwrite/models/o_auth2_google.rb +17 -5
- data/lib/appwrite/models/o_auth2_kakao.rb +67 -0
- data/lib/appwrite/models/o_auth2_microsoft.rb +24 -0
- data/lib/appwrite/models/o_auth2_oidc.rb +4 -2
- data/lib/appwrite/models/o_auth2_okta.rb +23 -0
- data/lib/appwrite/models/o_auth2_salesforce.rb +25 -3
- data/lib/appwrite/models/o_auth2_tik_tok.rb +43 -0
- data/lib/appwrite/models/o_auth2_webflow.rb +43 -0
- data/lib/appwrite/models/o_auth2_zoho.rb +24 -3
- data/lib/appwrite/models/oauth2_introspection.rb +83 -0
- data/lib/appwrite/models/platform_android.rb +8 -3
- data/lib/appwrite/models/policy_password_pwned.rb +43 -0
- data/lib/appwrite/models/policy_password_rotation.rb +38 -0
- data/lib/appwrite/models/project.rb +15 -0
- data/lib/appwrite/models/project_service.rb +1 -0
- data/lib/appwrite/models/proxy_rule.rb +1 -0
- data/lib/appwrite/models/topic.rb +13 -3
- data/lib/appwrite/models/user.rb +5 -0
- data/lib/appwrite/models/waf_rule_bypass.rb +111 -0
- data/lib/appwrite/models/waf_rule_challenge.rb +126 -0
- data/lib/appwrite/models/waf_rule_deny.rb +111 -0
- data/lib/appwrite/models/waf_rule_list.rb +33 -0
- data/lib/appwrite/models/waf_rule_rate_limit.rb +136 -0
- data/lib/appwrite/models/waf_rule_redirect.rb +121 -0
- data/lib/appwrite/services/account.rb +301 -5
- data/lib/appwrite/services/avatars.rb +71 -0
- data/lib/appwrite/services/databases.rb +4 -1
- data/lib/appwrite/services/documents_db.rb +4 -1
- data/lib/appwrite/services/domains.rb +2318 -0
- data/lib/appwrite/services/functions.rb +11 -3
- data/lib/appwrite/services/locale.rb +49 -14
- data/lib/appwrite/services/messaging.rb +130 -6
- data/lib/appwrite/services/oauth2.rb +45 -0
- data/lib/appwrite/services/organization.rb +225 -0
- data/lib/appwrite/services/project.rb +439 -15
- data/lib/appwrite/services/sites.rb +11 -3
- data/lib/appwrite/services/tables_db.rb +4 -1
- data/lib/appwrite/services/teams.rb +4 -1
- data/lib/appwrite/services/vectors_db.rb +4 -1
- data/lib/appwrite/services/waf.rb +859 -0
- data/lib/appwrite.rb +42 -0
- metadata +44 -2
|
@@ -7,17 +7,20 @@ module Appwrite
|
|
|
7
7
|
attr_reader :enabled
|
|
8
8
|
attr_reader :client_id
|
|
9
9
|
attr_reader :client_secret
|
|
10
|
+
attr_reader :prompt
|
|
10
11
|
|
|
11
12
|
def initialize(
|
|
12
13
|
id:,
|
|
13
14
|
enabled:,
|
|
14
15
|
client_id:,
|
|
15
|
-
client_secret
|
|
16
|
+
client_secret:,
|
|
17
|
+
prompt:
|
|
16
18
|
)
|
|
17
19
|
@id = id
|
|
18
20
|
@enabled = enabled
|
|
19
21
|
@client_id = client_id
|
|
20
22
|
@client_secret = client_secret
|
|
23
|
+
@prompt = prompt.nil? ? prompt : validate_prompt(prompt)
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
def self.from(map:)
|
|
@@ -25,7 +28,8 @@ module Appwrite
|
|
|
25
28
|
id: map["$id"],
|
|
26
29
|
enabled: map["enabled"],
|
|
27
30
|
client_id: map["clientId"],
|
|
28
|
-
client_secret: map["clientSecret"]
|
|
31
|
+
client_secret: map["clientSecret"],
|
|
32
|
+
prompt: map["prompt"]
|
|
29
33
|
)
|
|
30
34
|
end
|
|
31
35
|
|
|
@@ -34,9 +38,26 @@ module Appwrite
|
|
|
34
38
|
"$id": @id,
|
|
35
39
|
"enabled": @enabled,
|
|
36
40
|
"clientId": @client_id,
|
|
37
|
-
"clientSecret": @client_secret
|
|
41
|
+
"clientSecret": @client_secret,
|
|
42
|
+
"prompt": @prompt
|
|
38
43
|
}
|
|
39
44
|
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def validate_prompt(prompt)
|
|
49
|
+
valid_prompt = [
|
|
50
|
+
Appwrite::Enums::OAuth2ZohoPrompt::CONSENT,
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
(prompt || []).each do |value|
|
|
54
|
+
unless valid_prompt.include?(value)
|
|
55
|
+
raise ArgumentError, "Invalid " + value.to_s + ". Must be one of: " + valid_prompt.join(', ')
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
prompt
|
|
60
|
+
end
|
|
40
61
|
end
|
|
41
62
|
end
|
|
42
63
|
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class Oauth2Introspection
|
|
6
|
+
attr_reader :active
|
|
7
|
+
attr_reader :token_use
|
|
8
|
+
attr_reader :token_type
|
|
9
|
+
attr_reader :scope
|
|
10
|
+
attr_reader :client_id
|
|
11
|
+
attr_reader :sub
|
|
12
|
+
attr_reader :aud
|
|
13
|
+
attr_reader :iss
|
|
14
|
+
attr_reader :exp
|
|
15
|
+
attr_reader :iat
|
|
16
|
+
attr_reader :jti
|
|
17
|
+
attr_reader :authorization_details
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
active:,
|
|
21
|
+
token_use:,
|
|
22
|
+
token_type:,
|
|
23
|
+
scope:,
|
|
24
|
+
client_id:,
|
|
25
|
+
sub:,
|
|
26
|
+
aud:,
|
|
27
|
+
iss:,
|
|
28
|
+
exp:,
|
|
29
|
+
iat:,
|
|
30
|
+
jti:,
|
|
31
|
+
authorization_details:
|
|
32
|
+
)
|
|
33
|
+
@active = active
|
|
34
|
+
@token_use = token_use
|
|
35
|
+
@token_type = token_type
|
|
36
|
+
@scope = scope
|
|
37
|
+
@client_id = client_id
|
|
38
|
+
@sub = sub
|
|
39
|
+
@aud = aud
|
|
40
|
+
@iss = iss
|
|
41
|
+
@exp = exp
|
|
42
|
+
@iat = iat
|
|
43
|
+
@jti = jti
|
|
44
|
+
@authorization_details = authorization_details
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.from(map:)
|
|
48
|
+
map = { "active" => false }.merge(map)
|
|
49
|
+
Oauth2Introspection.new(
|
|
50
|
+
active: map["active"],
|
|
51
|
+
token_use: map["token_use"],
|
|
52
|
+
token_type: map["token_type"],
|
|
53
|
+
scope: map["scope"],
|
|
54
|
+
client_id: map["client_id"],
|
|
55
|
+
sub: map["sub"],
|
|
56
|
+
aud: map["aud"],
|
|
57
|
+
iss: map["iss"],
|
|
58
|
+
exp: map["exp"],
|
|
59
|
+
iat: map["iat"],
|
|
60
|
+
jti: map["jti"],
|
|
61
|
+
authorization_details: map["authorization_details"]
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def to_map
|
|
66
|
+
{
|
|
67
|
+
"active": @active,
|
|
68
|
+
"token_use": @token_use,
|
|
69
|
+
"token_type": @token_type,
|
|
70
|
+
"scope": @scope,
|
|
71
|
+
"client_id": @client_id,
|
|
72
|
+
"sub": @sub,
|
|
73
|
+
"aud": @aud,
|
|
74
|
+
"iss": @iss,
|
|
75
|
+
"exp": @exp,
|
|
76
|
+
"iat": @iat,
|
|
77
|
+
"jti": @jti,
|
|
78
|
+
"authorization_details": @authorization_details
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -9,6 +9,7 @@ module Appwrite
|
|
|
9
9
|
attr_reader :name
|
|
10
10
|
attr_reader :type
|
|
11
11
|
attr_reader :application_id
|
|
12
|
+
attr_reader :fingerprints
|
|
12
13
|
|
|
13
14
|
def initialize(
|
|
14
15
|
id:,
|
|
@@ -16,7 +17,8 @@ module Appwrite
|
|
|
16
17
|
updated_at:,
|
|
17
18
|
name:,
|
|
18
19
|
type:,
|
|
19
|
-
application_id
|
|
20
|
+
application_id:,
|
|
21
|
+
fingerprints:
|
|
20
22
|
)
|
|
21
23
|
@id = id
|
|
22
24
|
@created_at = created_at
|
|
@@ -24,6 +26,7 @@ module Appwrite
|
|
|
24
26
|
@name = name
|
|
25
27
|
@type = validate_type(type)
|
|
26
28
|
@application_id = application_id
|
|
29
|
+
@fingerprints = fingerprints
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
def self.from(map:)
|
|
@@ -33,7 +36,8 @@ module Appwrite
|
|
|
33
36
|
updated_at: map["$updatedAt"],
|
|
34
37
|
name: map["name"],
|
|
35
38
|
type: map["type"],
|
|
36
|
-
application_id: map["applicationId"]
|
|
39
|
+
application_id: map["applicationId"],
|
|
40
|
+
fingerprints: map["fingerprints"]
|
|
37
41
|
)
|
|
38
42
|
end
|
|
39
43
|
|
|
@@ -44,7 +48,8 @@ module Appwrite
|
|
|
44
48
|
"$updatedAt": @updated_at,
|
|
45
49
|
"name": @name,
|
|
46
50
|
"type": @type,
|
|
47
|
-
"applicationId": @application_id
|
|
51
|
+
"applicationId": @application_id,
|
|
52
|
+
"fingerprints": @fingerprints
|
|
48
53
|
}
|
|
49
54
|
end
|
|
50
55
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class PolicyPasswordPwned
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :enabled
|
|
8
|
+
attr_reader :sessions
|
|
9
|
+
attr_reader :users
|
|
10
|
+
|
|
11
|
+
def initialize(
|
|
12
|
+
id:,
|
|
13
|
+
enabled:,
|
|
14
|
+
sessions:,
|
|
15
|
+
users:
|
|
16
|
+
)
|
|
17
|
+
@id = id
|
|
18
|
+
@enabled = enabled
|
|
19
|
+
@sessions = sessions
|
|
20
|
+
@users = users
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.from(map:)
|
|
24
|
+
map = { "$id" => "", "enabled" => true, "sessions" => false, "users" => false }.merge(map)
|
|
25
|
+
PolicyPasswordPwned.new(
|
|
26
|
+
id: map["$id"],
|
|
27
|
+
enabled: map["enabled"],
|
|
28
|
+
sessions: map["sessions"],
|
|
29
|
+
users: map["users"]
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def to_map
|
|
34
|
+
{
|
|
35
|
+
"$id": @id,
|
|
36
|
+
"enabled": @enabled,
|
|
37
|
+
"sessions": @sessions,
|
|
38
|
+
"users": @users
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class PolicyPasswordRotation
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :enabled
|
|
8
|
+
attr_reader :max_age
|
|
9
|
+
|
|
10
|
+
def initialize(
|
|
11
|
+
id:,
|
|
12
|
+
enabled:,
|
|
13
|
+
max_age:
|
|
14
|
+
)
|
|
15
|
+
@id = id
|
|
16
|
+
@enabled = enabled
|
|
17
|
+
@max_age = max_age
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.from(map:)
|
|
21
|
+
map = { "$id" => "", "enabled" => false, "maxAge" => 31536000 }.merge(map)
|
|
22
|
+
PolicyPasswordRotation.new(
|
|
23
|
+
id: map["$id"],
|
|
24
|
+
enabled: map["enabled"],
|
|
25
|
+
max_age: map["maxAge"]
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_map
|
|
30
|
+
{
|
|
31
|
+
"$id": @id,
|
|
32
|
+
"enabled": @enabled,
|
|
33
|
+
"maxAge": @max_age
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -31,7 +31,10 @@ module Appwrite
|
|
|
31
31
|
attr_reader :blocks
|
|
32
32
|
attr_reader :console_accessed_at
|
|
33
33
|
attr_reader :waf_enabled
|
|
34
|
+
attr_reader :parent_id
|
|
34
35
|
attr_reader :billing_limits
|
|
36
|
+
attr_reader :first_accessed_at
|
|
37
|
+
attr_reader :mcp_accessed_at
|
|
35
38
|
attr_reader :o_auth2_server_enabled
|
|
36
39
|
attr_reader :o_auth2_server_authorization_url
|
|
37
40
|
attr_reader :o_auth2_server_scopes
|
|
@@ -79,7 +82,10 @@ module Appwrite
|
|
|
79
82
|
blocks:,
|
|
80
83
|
console_accessed_at:,
|
|
81
84
|
waf_enabled:,
|
|
85
|
+
parent_id:,
|
|
82
86
|
billing_limits:,
|
|
87
|
+
first_accessed_at:,
|
|
88
|
+
mcp_accessed_at:,
|
|
83
89
|
o_auth2_server_enabled:,
|
|
84
90
|
o_auth2_server_authorization_url:,
|
|
85
91
|
o_auth2_server_scopes:,
|
|
@@ -126,7 +132,10 @@ module Appwrite
|
|
|
126
132
|
@blocks = blocks
|
|
127
133
|
@console_accessed_at = console_accessed_at
|
|
128
134
|
@waf_enabled = waf_enabled
|
|
135
|
+
@parent_id = parent_id
|
|
129
136
|
@billing_limits = billing_limits
|
|
137
|
+
@first_accessed_at = first_accessed_at
|
|
138
|
+
@mcp_accessed_at = mcp_accessed_at
|
|
130
139
|
@o_auth2_server_enabled = o_auth2_server_enabled
|
|
131
140
|
@o_auth2_server_authorization_url = o_auth2_server_authorization_url
|
|
132
141
|
@o_auth2_server_scopes = o_auth2_server_scopes
|
|
@@ -176,7 +185,10 @@ module Appwrite
|
|
|
176
185
|
blocks: map["blocks"].map { |it| Block.from(map: it) },
|
|
177
186
|
console_accessed_at: map["consoleAccessedAt"],
|
|
178
187
|
waf_enabled: map["wafEnabled"],
|
|
188
|
+
parent_id: map["parentId"],
|
|
179
189
|
billing_limits: map["billingLimits"].nil? ? nil : BillingLimits.from(map: map["billingLimits"]),
|
|
190
|
+
first_accessed_at: map["firstAccessedAt"],
|
|
191
|
+
mcp_accessed_at: map["mcpAccessedAt"],
|
|
180
192
|
o_auth2_server_enabled: map["oAuth2ServerEnabled"],
|
|
181
193
|
o_auth2_server_authorization_url: map["oAuth2ServerAuthorizationUrl"],
|
|
182
194
|
o_auth2_server_scopes: map["oAuth2ServerScopes"],
|
|
@@ -227,7 +239,10 @@ module Appwrite
|
|
|
227
239
|
"blocks": @blocks.map { |it| it.to_map },
|
|
228
240
|
"consoleAccessedAt": @console_accessed_at,
|
|
229
241
|
"wafEnabled": @waf_enabled,
|
|
242
|
+
"parentId": @parent_id,
|
|
230
243
|
"billingLimits": @billing_limits&.to_map,
|
|
244
|
+
"firstAccessedAt": @first_accessed_at,
|
|
245
|
+
"mcpAccessedAt": @mcp_accessed_at,
|
|
231
246
|
"oAuth2ServerEnabled": @o_auth2_server_enabled,
|
|
232
247
|
"oAuth2ServerAuthorizationUrl": @o_auth2_server_authorization_url,
|
|
233
248
|
"oAuth2ServerScopes": @o_auth2_server_scopes,
|
|
@@ -99,6 +99,7 @@ module Appwrite
|
|
|
99
99
|
valid_deployment_resource_type = [
|
|
100
100
|
Appwrite::Enums::ProxyRuleDeploymentResourceType::FUNCTION,
|
|
101
101
|
Appwrite::Enums::ProxyRuleDeploymentResourceType::SITE,
|
|
102
|
+
Appwrite::Enums::ProxyRuleDeploymentResourceType::DEDICATEDDATABASE,
|
|
102
103
|
]
|
|
103
104
|
|
|
104
105
|
unless valid_deployment_resource_type.include?(deployment_resource_type)
|
|
@@ -11,6 +11,8 @@ module Appwrite
|
|
|
11
11
|
attr_reader :sms_total
|
|
12
12
|
attr_reader :push_total
|
|
13
13
|
attr_reader :subscribe
|
|
14
|
+
attr_reader :qos
|
|
15
|
+
attr_reader :expiry
|
|
14
16
|
|
|
15
17
|
def initialize(
|
|
16
18
|
id:,
|
|
@@ -20,7 +22,9 @@ module Appwrite
|
|
|
20
22
|
email_total:,
|
|
21
23
|
sms_total:,
|
|
22
24
|
push_total:,
|
|
23
|
-
subscribe
|
|
25
|
+
subscribe:,
|
|
26
|
+
qos:,
|
|
27
|
+
expiry:
|
|
24
28
|
)
|
|
25
29
|
@id = id
|
|
26
30
|
@created_at = created_at
|
|
@@ -30,6 +34,8 @@ module Appwrite
|
|
|
30
34
|
@sms_total = sms_total
|
|
31
35
|
@push_total = push_total
|
|
32
36
|
@subscribe = subscribe
|
|
37
|
+
@qos = qos
|
|
38
|
+
@expiry = expiry
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
def self.from(map:)
|
|
@@ -41,7 +47,9 @@ module Appwrite
|
|
|
41
47
|
email_total: map["emailTotal"],
|
|
42
48
|
sms_total: map["smsTotal"],
|
|
43
49
|
push_total: map["pushTotal"],
|
|
44
|
-
subscribe: map["subscribe"]
|
|
50
|
+
subscribe: map["subscribe"],
|
|
51
|
+
qos: map["qos"],
|
|
52
|
+
expiry: map["expiry"]
|
|
45
53
|
)
|
|
46
54
|
end
|
|
47
55
|
|
|
@@ -54,7 +62,9 @@ module Appwrite
|
|
|
54
62
|
"emailTotal": @email_total,
|
|
55
63
|
"smsTotal": @sms_total,
|
|
56
64
|
"pushTotal": @push_total,
|
|
57
|
-
"subscribe": @subscribe
|
|
65
|
+
"subscribe": @subscribe,
|
|
66
|
+
"qos": @qos,
|
|
67
|
+
"expiry": @expiry
|
|
58
68
|
}
|
|
59
69
|
end
|
|
60
70
|
end
|
data/lib/appwrite/models/user.rb
CHANGED
|
@@ -22,6 +22,7 @@ module Appwrite
|
|
|
22
22
|
attr_reader :email_is_disposable
|
|
23
23
|
attr_reader :email_is_corporate
|
|
24
24
|
attr_reader :email_is_canonical
|
|
25
|
+
attr_reader :password_pwned
|
|
25
26
|
attr_reader :phone_verification
|
|
26
27
|
attr_reader :mfa
|
|
27
28
|
attr_reader :prefs
|
|
@@ -50,6 +51,7 @@ module Appwrite
|
|
|
50
51
|
email_is_disposable:,
|
|
51
52
|
email_is_corporate:,
|
|
52
53
|
email_is_canonical:,
|
|
54
|
+
password_pwned:,
|
|
53
55
|
phone_verification:,
|
|
54
56
|
mfa:,
|
|
55
57
|
prefs:,
|
|
@@ -77,6 +79,7 @@ module Appwrite
|
|
|
77
79
|
@email_is_disposable = email_is_disposable
|
|
78
80
|
@email_is_corporate = email_is_corporate
|
|
79
81
|
@email_is_canonical = email_is_canonical
|
|
82
|
+
@password_pwned = password_pwned
|
|
80
83
|
@phone_verification = phone_verification
|
|
81
84
|
@mfa = mfa
|
|
82
85
|
@prefs = prefs
|
|
@@ -107,6 +110,7 @@ module Appwrite
|
|
|
107
110
|
email_is_disposable: map["emailIsDisposable"],
|
|
108
111
|
email_is_corporate: map["emailIsCorporate"],
|
|
109
112
|
email_is_canonical: map["emailIsCanonical"],
|
|
113
|
+
password_pwned: map["passwordPwned"],
|
|
110
114
|
phone_verification: map["phoneVerification"],
|
|
111
115
|
mfa: map["mfa"],
|
|
112
116
|
prefs: Preferences.from(map: map["prefs"]),
|
|
@@ -138,6 +142,7 @@ module Appwrite
|
|
|
138
142
|
"emailIsDisposable": @email_is_disposable,
|
|
139
143
|
"emailIsCorporate": @email_is_corporate,
|
|
140
144
|
"emailIsCanonical": @email_is_canonical,
|
|
145
|
+
"passwordPwned": @password_pwned,
|
|
141
146
|
"phoneVerification": @phone_verification,
|
|
142
147
|
"mfa": @mfa,
|
|
143
148
|
"prefs": @prefs.to_map,
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class WafRuleBypass
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :name
|
|
10
|
+
attr_reader :description
|
|
11
|
+
attr_reader :team_id
|
|
12
|
+
attr_reader :project_id
|
|
13
|
+
attr_reader :resource_type
|
|
14
|
+
attr_reader :resource_id
|
|
15
|
+
attr_reader :action
|
|
16
|
+
attr_reader :priority
|
|
17
|
+
attr_reader :enabled
|
|
18
|
+
attr_reader :conditions
|
|
19
|
+
attr_reader :config
|
|
20
|
+
|
|
21
|
+
def initialize(
|
|
22
|
+
id:,
|
|
23
|
+
created_at:,
|
|
24
|
+
updated_at:,
|
|
25
|
+
name:,
|
|
26
|
+
description:,
|
|
27
|
+
team_id:,
|
|
28
|
+
project_id:,
|
|
29
|
+
resource_type:,
|
|
30
|
+
resource_id:,
|
|
31
|
+
action:,
|
|
32
|
+
priority:,
|
|
33
|
+
enabled:,
|
|
34
|
+
conditions:,
|
|
35
|
+
config:
|
|
36
|
+
)
|
|
37
|
+
@id = id
|
|
38
|
+
@created_at = created_at
|
|
39
|
+
@updated_at = updated_at
|
|
40
|
+
@name = name
|
|
41
|
+
@description = description
|
|
42
|
+
@team_id = team_id
|
|
43
|
+
@project_id = project_id
|
|
44
|
+
@resource_type = resource_type
|
|
45
|
+
@resource_id = resource_id
|
|
46
|
+
@action = validate_action(action)
|
|
47
|
+
@priority = priority
|
|
48
|
+
@enabled = enabled
|
|
49
|
+
@conditions = conditions
|
|
50
|
+
@config = config
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.from(map:)
|
|
54
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "description" => "", "teamId" => "", "projectId" => "", "resourceType" => "api", "resourceId" => "", "priority" => 0, "enabled" => true, "conditions" => [], "config" => {} }.merge(map)
|
|
55
|
+
WafRuleBypass.new(
|
|
56
|
+
id: map["$id"],
|
|
57
|
+
created_at: map["$createdAt"],
|
|
58
|
+
updated_at: map["$updatedAt"],
|
|
59
|
+
name: map["name"],
|
|
60
|
+
description: map["description"],
|
|
61
|
+
team_id: map["teamId"],
|
|
62
|
+
project_id: map["projectId"],
|
|
63
|
+
resource_type: map["resourceType"],
|
|
64
|
+
resource_id: map["resourceId"],
|
|
65
|
+
action: map["action"],
|
|
66
|
+
priority: map["priority"],
|
|
67
|
+
enabled: map["enabled"],
|
|
68
|
+
conditions: map["conditions"],
|
|
69
|
+
config: map["config"]
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def to_map
|
|
74
|
+
{
|
|
75
|
+
"$id": @id,
|
|
76
|
+
"$createdAt": @created_at,
|
|
77
|
+
"$updatedAt": @updated_at,
|
|
78
|
+
"name": @name,
|
|
79
|
+
"description": @description,
|
|
80
|
+
"teamId": @team_id,
|
|
81
|
+
"projectId": @project_id,
|
|
82
|
+
"resourceType": @resource_type,
|
|
83
|
+
"resourceId": @resource_id,
|
|
84
|
+
"action": @action,
|
|
85
|
+
"priority": @priority,
|
|
86
|
+
"enabled": @enabled,
|
|
87
|
+
"conditions": @conditions,
|
|
88
|
+
"config": @config
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
private
|
|
93
|
+
|
|
94
|
+
def validate_action(action)
|
|
95
|
+
valid_action = [
|
|
96
|
+
Appwrite::Enums::WafRuleAction::BYPASS,
|
|
97
|
+
Appwrite::Enums::WafRuleAction::DENY,
|
|
98
|
+
Appwrite::Enums::WafRuleAction::CHALLENGE,
|
|
99
|
+
Appwrite::Enums::WafRuleAction::RATELIMIT,
|
|
100
|
+
Appwrite::Enums::WafRuleAction::REDIRECT,
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
unless valid_action.include?(action)
|
|
104
|
+
raise ArgumentError, "Invalid " + action + ". Must be one of: " + valid_action.join(', ')
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
action
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class WafRuleChallenge
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :name
|
|
10
|
+
attr_reader :description
|
|
11
|
+
attr_reader :team_id
|
|
12
|
+
attr_reader :project_id
|
|
13
|
+
attr_reader :resource_type
|
|
14
|
+
attr_reader :resource_id
|
|
15
|
+
attr_reader :action
|
|
16
|
+
attr_reader :priority
|
|
17
|
+
attr_reader :enabled
|
|
18
|
+
attr_reader :conditions
|
|
19
|
+
attr_reader :config
|
|
20
|
+
attr_reader :challenge_type
|
|
21
|
+
attr_reader :difficulty
|
|
22
|
+
attr_reader :ttl
|
|
23
|
+
|
|
24
|
+
def initialize(
|
|
25
|
+
id:,
|
|
26
|
+
created_at:,
|
|
27
|
+
updated_at:,
|
|
28
|
+
name:,
|
|
29
|
+
description:,
|
|
30
|
+
team_id:,
|
|
31
|
+
project_id:,
|
|
32
|
+
resource_type:,
|
|
33
|
+
resource_id:,
|
|
34
|
+
action:,
|
|
35
|
+
priority:,
|
|
36
|
+
enabled:,
|
|
37
|
+
conditions:,
|
|
38
|
+
config:,
|
|
39
|
+
challenge_type:,
|
|
40
|
+
difficulty:,
|
|
41
|
+
ttl:
|
|
42
|
+
)
|
|
43
|
+
@id = id
|
|
44
|
+
@created_at = created_at
|
|
45
|
+
@updated_at = updated_at
|
|
46
|
+
@name = name
|
|
47
|
+
@description = description
|
|
48
|
+
@team_id = team_id
|
|
49
|
+
@project_id = project_id
|
|
50
|
+
@resource_type = resource_type
|
|
51
|
+
@resource_id = resource_id
|
|
52
|
+
@action = validate_action(action)
|
|
53
|
+
@priority = priority
|
|
54
|
+
@enabled = enabled
|
|
55
|
+
@conditions = conditions
|
|
56
|
+
@config = config
|
|
57
|
+
@challenge_type = challenge_type
|
|
58
|
+
@difficulty = difficulty
|
|
59
|
+
@ttl = ttl
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.from(map:)
|
|
63
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "description" => "", "teamId" => "", "projectId" => "", "resourceType" => "api", "resourceId" => "", "priority" => 0, "enabled" => true, "conditions" => [], "config" => {}, "challengeType" => "compute", "difficulty" => 3, "ttl" => 1800 }.merge(map)
|
|
64
|
+
WafRuleChallenge.new(
|
|
65
|
+
id: map["$id"],
|
|
66
|
+
created_at: map["$createdAt"],
|
|
67
|
+
updated_at: map["$updatedAt"],
|
|
68
|
+
name: map["name"],
|
|
69
|
+
description: map["description"],
|
|
70
|
+
team_id: map["teamId"],
|
|
71
|
+
project_id: map["projectId"],
|
|
72
|
+
resource_type: map["resourceType"],
|
|
73
|
+
resource_id: map["resourceId"],
|
|
74
|
+
action: map["action"],
|
|
75
|
+
priority: map["priority"],
|
|
76
|
+
enabled: map["enabled"],
|
|
77
|
+
conditions: map["conditions"],
|
|
78
|
+
config: map["config"],
|
|
79
|
+
challenge_type: map["challengeType"],
|
|
80
|
+
difficulty: map["difficulty"],
|
|
81
|
+
ttl: map["ttl"]
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def to_map
|
|
86
|
+
{
|
|
87
|
+
"$id": @id,
|
|
88
|
+
"$createdAt": @created_at,
|
|
89
|
+
"$updatedAt": @updated_at,
|
|
90
|
+
"name": @name,
|
|
91
|
+
"description": @description,
|
|
92
|
+
"teamId": @team_id,
|
|
93
|
+
"projectId": @project_id,
|
|
94
|
+
"resourceType": @resource_type,
|
|
95
|
+
"resourceId": @resource_id,
|
|
96
|
+
"action": @action,
|
|
97
|
+
"priority": @priority,
|
|
98
|
+
"enabled": @enabled,
|
|
99
|
+
"conditions": @conditions,
|
|
100
|
+
"config": @config,
|
|
101
|
+
"challengeType": @challenge_type,
|
|
102
|
+
"difficulty": @difficulty,
|
|
103
|
+
"ttl": @ttl
|
|
104
|
+
}
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
private
|
|
108
|
+
|
|
109
|
+
def validate_action(action)
|
|
110
|
+
valid_action = [
|
|
111
|
+
Appwrite::Enums::WafRuleAction::BYPASS,
|
|
112
|
+
Appwrite::Enums::WafRuleAction::DENY,
|
|
113
|
+
Appwrite::Enums::WafRuleAction::CHALLENGE,
|
|
114
|
+
Appwrite::Enums::WafRuleAction::RATELIMIT,
|
|
115
|
+
Appwrite::Enums::WafRuleAction::REDIRECT,
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
unless valid_action.include?(action)
|
|
119
|
+
raise ArgumentError, "Invalid " + action + ". Must be one of: " + valid_action.join(', ')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
action
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|