appwrite 26.0.0 → 26.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +1 -1
  3. data/lib/appwrite/enums/database_status.rb +11 -0
  4. data/lib/appwrite/enums/database_type.rb +3 -0
  5. data/lib/appwrite/enums/organization_key_scopes.rb +2 -0
  6. data/lib/appwrite/enums/project_key_scopes.rb +3 -0
  7. data/lib/appwrite/models/activity_event.rb +58 -3
  8. data/lib/appwrite/models/app.rb +152 -0
  9. data/lib/appwrite/models/app_installation.rb +72 -0
  10. data/lib/appwrite/models/app_installation_list.rb +32 -0
  11. data/lib/appwrite/models/app_key.rb +67 -0
  12. data/lib/appwrite/models/app_key_list.rb +32 -0
  13. data/lib/appwrite/models/app_scope.rb +47 -0
  14. data/lib/appwrite/models/app_scope_list.rb +32 -0
  15. data/lib/appwrite/models/app_secret.rb +67 -0
  16. data/lib/appwrite/models/app_secret_list.rb +32 -0
  17. data/lib/appwrite/models/app_secret_plaintext.rb +67 -0
  18. data/lib/appwrite/models/apps_list.rb +32 -0
  19. data/lib/appwrite/models/billing_plan.rb +5 -0
  20. data/lib/appwrite/models/database.rb +35 -6
  21. data/lib/appwrite/models/database_status.rb +62 -0
  22. data/lib/appwrite/models/database_status_connections.rb +32 -0
  23. data/lib/appwrite/models/database_status_replica.rb +42 -0
  24. data/lib/appwrite/models/database_status_volume.rb +42 -0
  25. data/lib/appwrite/models/dedicated_database.rb +267 -0
  26. data/lib/appwrite/models/dedicated_database_member.rb +42 -0
  27. data/lib/appwrite/models/dedicated_database_replicas.rb +37 -0
  28. data/lib/appwrite/models/dedicated_database_specification.rb +67 -0
  29. data/lib/appwrite/models/dedicated_database_specification_list.rb +37 -0
  30. data/lib/appwrite/models/dedicated_database_specification_pricing.rb +47 -0
  31. data/lib/appwrite/models/oauth2_approve.rb +27 -0
  32. data/lib/appwrite/models/oauth2_authorize.rb +32 -0
  33. data/lib/appwrite/models/oauth2_consent.rb +72 -0
  34. data/lib/appwrite/models/oauth2_consent_list.rb +32 -0
  35. data/lib/appwrite/models/oauth2_consent_token.rb +77 -0
  36. data/lib/appwrite/models/oauth2_consent_token_list.rb +32 -0
  37. data/lib/appwrite/models/oauth2_device_authorization.rb +52 -0
  38. data/lib/appwrite/models/oauth2_grant.rb +82 -0
  39. data/lib/appwrite/models/oauth2_organization.rb +27 -0
  40. data/lib/appwrite/models/oauth2_organization_list.rb +32 -0
  41. data/lib/appwrite/models/oauth2_par.rb +32 -0
  42. data/lib/appwrite/models/oauth2_project.rb +37 -0
  43. data/lib/appwrite/models/oauth2_project_list.rb +32 -0
  44. data/lib/appwrite/models/oauth2_reject.rb +27 -0
  45. data/lib/appwrite/models/oauth2_token.rb +57 -0
  46. data/lib/appwrite/models/project.rb +10 -0
  47. data/lib/appwrite/models/project_auth_method.rb +3 -3
  48. data/lib/appwrite/services/account.rb +209 -0
  49. data/lib/appwrite/services/apps.rb +813 -0
  50. data/lib/appwrite/services/backups.rb +25 -12
  51. data/lib/appwrite/services/oauth2.rb +525 -0
  52. data/lib/appwrite/services/organization.rb +168 -0
  53. data/lib/appwrite/services/project.rb +3 -1
  54. data/lib/appwrite/services/sites.rb +3 -1
  55. data/lib/appwrite/services/tables_db.rb +134 -2
  56. data/lib/appwrite/services/teams.rb +198 -0
  57. data/lib/appwrite.rb +38 -0
  58. metadata +40 -2
@@ -0,0 +1,267 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DedicatedDatabase
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :project_id
10
+ attr_reader :name
11
+ attr_reader :api
12
+ attr_reader :engine
13
+ attr_reader :version
14
+ attr_reader :specification
15
+ attr_reader :backend
16
+ attr_reader :hostname
17
+ attr_reader :connection_port
18
+ attr_reader :connection_user
19
+ attr_reader :connection_password
20
+ attr_reader :connection_string
21
+ attr_reader :ssl
22
+ attr_reader :status
23
+ attr_reader :container_status
24
+ attr_reader :last_accessed_at
25
+ attr_reader :idle_until
26
+ attr_reader :lifecycle_state
27
+ attr_reader :idle_timeout_minutes
28
+ attr_reader :cpu
29
+ attr_reader :memory
30
+ attr_reader :storage
31
+ attr_reader :storage_class
32
+ attr_reader :storage_max_gb
33
+ attr_reader :node_pool
34
+ attr_reader :replicas
35
+ attr_reader :sync_mode
36
+ attr_reader :cross_region_replicas
37
+ attr_reader :network_max_connections
38
+ attr_reader :network_idle_timeout_seconds
39
+ attr_reader :network_ip_allowlist
40
+ attr_reader :backup_enabled
41
+ attr_reader :pitr
42
+ attr_reader :pitr_retention_days
43
+ attr_reader :storage_autoscaling
44
+ attr_reader :storage_autoscaling_threshold_percent
45
+ attr_reader :storage_autoscaling_max_gb
46
+ attr_reader :maintenance_window_day
47
+ attr_reader :maintenance_window_hour_utc
48
+ attr_reader :metrics_enabled
49
+ attr_reader :sql_api_enabled
50
+ attr_reader :sql_api_allowed_statements
51
+ attr_reader :sql_api_max_rows
52
+ attr_reader :sql_api_max_bytes
53
+ attr_reader :sql_api_timeout_seconds
54
+ attr_reader :error
55
+
56
+ def initialize(
57
+ id:,
58
+ created_at:,
59
+ updated_at:,
60
+ project_id:,
61
+ name:,
62
+ api:,
63
+ engine:,
64
+ version:,
65
+ specification:,
66
+ backend:,
67
+ hostname:,
68
+ connection_port:,
69
+ connection_user:,
70
+ connection_password:,
71
+ connection_string:,
72
+ ssl:,
73
+ status:,
74
+ container_status:,
75
+ last_accessed_at: ,
76
+ idle_until: ,
77
+ lifecycle_state:,
78
+ idle_timeout_minutes:,
79
+ cpu:,
80
+ memory:,
81
+ storage:,
82
+ storage_class:,
83
+ storage_max_gb:,
84
+ node_pool:,
85
+ replicas:,
86
+ sync_mode:,
87
+ cross_region_replicas:,
88
+ network_max_connections:,
89
+ network_idle_timeout_seconds:,
90
+ network_ip_allowlist:,
91
+ backup_enabled:,
92
+ pitr:,
93
+ pitr_retention_days:,
94
+ storage_autoscaling:,
95
+ storage_autoscaling_threshold_percent:,
96
+ storage_autoscaling_max_gb:,
97
+ maintenance_window_day:,
98
+ maintenance_window_hour_utc:,
99
+ metrics_enabled:,
100
+ sql_api_enabled:,
101
+ sql_api_allowed_statements:,
102
+ sql_api_max_rows:,
103
+ sql_api_max_bytes:,
104
+ sql_api_timeout_seconds:,
105
+ error:
106
+ )
107
+ @id = id
108
+ @created_at = created_at
109
+ @updated_at = updated_at
110
+ @project_id = project_id
111
+ @name = name
112
+ @api = api
113
+ @engine = engine
114
+ @version = version
115
+ @specification = specification
116
+ @backend = backend
117
+ @hostname = hostname
118
+ @connection_port = connection_port
119
+ @connection_user = connection_user
120
+ @connection_password = connection_password
121
+ @connection_string = connection_string
122
+ @ssl = ssl
123
+ @status = status
124
+ @container_status = container_status
125
+ @last_accessed_at = last_accessed_at
126
+ @idle_until = idle_until
127
+ @lifecycle_state = lifecycle_state
128
+ @idle_timeout_minutes = idle_timeout_minutes
129
+ @cpu = cpu
130
+ @memory = memory
131
+ @storage = storage
132
+ @storage_class = storage_class
133
+ @storage_max_gb = storage_max_gb
134
+ @node_pool = node_pool
135
+ @replicas = replicas
136
+ @sync_mode = sync_mode
137
+ @cross_region_replicas = cross_region_replicas
138
+ @network_max_connections = network_max_connections
139
+ @network_idle_timeout_seconds = network_idle_timeout_seconds
140
+ @network_ip_allowlist = network_ip_allowlist
141
+ @backup_enabled = backup_enabled
142
+ @pitr = pitr
143
+ @pitr_retention_days = pitr_retention_days
144
+ @storage_autoscaling = storage_autoscaling
145
+ @storage_autoscaling_threshold_percent = storage_autoscaling_threshold_percent
146
+ @storage_autoscaling_max_gb = storage_autoscaling_max_gb
147
+ @maintenance_window_day = maintenance_window_day
148
+ @maintenance_window_hour_utc = maintenance_window_hour_utc
149
+ @metrics_enabled = metrics_enabled
150
+ @sql_api_enabled = sql_api_enabled
151
+ @sql_api_allowed_statements = sql_api_allowed_statements
152
+ @sql_api_max_rows = sql_api_max_rows
153
+ @sql_api_max_bytes = sql_api_max_bytes
154
+ @sql_api_timeout_seconds = sql_api_timeout_seconds
155
+ @error = error
156
+ end
157
+
158
+ def self.from(map:)
159
+ DedicatedDatabase.new(
160
+ id: map["$id"],
161
+ created_at: map["$createdAt"],
162
+ updated_at: map["$updatedAt"],
163
+ project_id: map["projectId"],
164
+ name: map["name"],
165
+ api: map["api"],
166
+ engine: map["engine"],
167
+ version: map["version"],
168
+ specification: map["specification"],
169
+ backend: map["backend"],
170
+ hostname: map["hostname"],
171
+ connection_port: map["connectionPort"],
172
+ connection_user: map["connectionUser"],
173
+ connection_password: map["connectionPassword"],
174
+ connection_string: map["connectionString"],
175
+ ssl: map["ssl"],
176
+ status: map["status"],
177
+ container_status: map["containerStatus"],
178
+ last_accessed_at: map["lastAccessedAt"],
179
+ idle_until: map["idleUntil"],
180
+ lifecycle_state: map["lifecycleState"],
181
+ idle_timeout_minutes: map["idleTimeoutMinutes"],
182
+ cpu: map["cpu"],
183
+ memory: map["memory"],
184
+ storage: map["storage"],
185
+ storage_class: map["storageClass"],
186
+ storage_max_gb: map["storageMaxGb"],
187
+ node_pool: map["nodePool"],
188
+ replicas: map["replicas"],
189
+ sync_mode: map["syncMode"],
190
+ cross_region_replicas: map["crossRegionReplicas"],
191
+ network_max_connections: map["networkMaxConnections"],
192
+ network_idle_timeout_seconds: map["networkIdleTimeoutSeconds"],
193
+ network_ip_allowlist: map["networkIPAllowlist"],
194
+ backup_enabled: map["backupEnabled"],
195
+ pitr: map["pitr"],
196
+ pitr_retention_days: map["pitrRetentionDays"],
197
+ storage_autoscaling: map["storageAutoscaling"],
198
+ storage_autoscaling_threshold_percent: map["storageAutoscalingThresholdPercent"],
199
+ storage_autoscaling_max_gb: map["storageAutoscalingMaxGb"],
200
+ maintenance_window_day: map["maintenanceWindowDay"],
201
+ maintenance_window_hour_utc: map["maintenanceWindowHourUtc"],
202
+ metrics_enabled: map["metricsEnabled"],
203
+ sql_api_enabled: map["sqlApiEnabled"],
204
+ sql_api_allowed_statements: map["sqlApiAllowedStatements"],
205
+ sql_api_max_rows: map["sqlApiMaxRows"],
206
+ sql_api_max_bytes: map["sqlApiMaxBytes"],
207
+ sql_api_timeout_seconds: map["sqlApiTimeoutSeconds"],
208
+ error: map["error"]
209
+ )
210
+ end
211
+
212
+ def to_map
213
+ {
214
+ "$id": @id,
215
+ "$createdAt": @created_at,
216
+ "$updatedAt": @updated_at,
217
+ "projectId": @project_id,
218
+ "name": @name,
219
+ "api": @api,
220
+ "engine": @engine,
221
+ "version": @version,
222
+ "specification": @specification,
223
+ "backend": @backend,
224
+ "hostname": @hostname,
225
+ "connectionPort": @connection_port,
226
+ "connectionUser": @connection_user,
227
+ "connectionPassword": @connection_password,
228
+ "connectionString": @connection_string,
229
+ "ssl": @ssl,
230
+ "status": @status,
231
+ "containerStatus": @container_status,
232
+ "lastAccessedAt": @last_accessed_at,
233
+ "idleUntil": @idle_until,
234
+ "lifecycleState": @lifecycle_state,
235
+ "idleTimeoutMinutes": @idle_timeout_minutes,
236
+ "cpu": @cpu,
237
+ "memory": @memory,
238
+ "storage": @storage,
239
+ "storageClass": @storage_class,
240
+ "storageMaxGb": @storage_max_gb,
241
+ "nodePool": @node_pool,
242
+ "replicas": @replicas,
243
+ "syncMode": @sync_mode,
244
+ "crossRegionReplicas": @cross_region_replicas,
245
+ "networkMaxConnections": @network_max_connections,
246
+ "networkIdleTimeoutSeconds": @network_idle_timeout_seconds,
247
+ "networkIPAllowlist": @network_ip_allowlist,
248
+ "backupEnabled": @backup_enabled,
249
+ "pitr": @pitr,
250
+ "pitrRetentionDays": @pitr_retention_days,
251
+ "storageAutoscaling": @storage_autoscaling,
252
+ "storageAutoscalingThresholdPercent": @storage_autoscaling_threshold_percent,
253
+ "storageAutoscalingMaxGb": @storage_autoscaling_max_gb,
254
+ "maintenanceWindowDay": @maintenance_window_day,
255
+ "maintenanceWindowHourUtc": @maintenance_window_hour_utc,
256
+ "metricsEnabled": @metrics_enabled,
257
+ "sqlApiEnabled": @sql_api_enabled,
258
+ "sqlApiAllowedStatements": @sql_api_allowed_statements,
259
+ "sqlApiMaxRows": @sql_api_max_rows,
260
+ "sqlApiMaxBytes": @sql_api_max_bytes,
261
+ "sqlApiTimeoutSeconds": @sql_api_timeout_seconds,
262
+ "error": @error
263
+ }
264
+ end
265
+ end
266
+ end
267
+ end
@@ -0,0 +1,42 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DedicatedDatabaseMember
6
+ attr_reader :id
7
+ attr_reader :role
8
+ attr_reader :status
9
+ attr_reader :lag_seconds
10
+
11
+ def initialize(
12
+ id:,
13
+ role:,
14
+ status:,
15
+ lag_seconds:
16
+ )
17
+ @id = id
18
+ @role = role
19
+ @status = status
20
+ @lag_seconds = lag_seconds
21
+ end
22
+
23
+ def self.from(map:)
24
+ DedicatedDatabaseMember.new(
25
+ id: map["$id"],
26
+ role: map["role"],
27
+ status: map["status"],
28
+ lag_seconds: map["lagSeconds"]
29
+ )
30
+ end
31
+
32
+ def to_map
33
+ {
34
+ "$id": @id,
35
+ "role": @role,
36
+ "status": @status,
37
+ "lagSeconds": @lag_seconds
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,37 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DedicatedDatabaseReplicas
6
+ attr_reader :replicas
7
+ attr_reader :sync_mode
8
+ attr_reader :members
9
+
10
+ def initialize(
11
+ replicas:,
12
+ sync_mode:,
13
+ members:
14
+ )
15
+ @replicas = replicas
16
+ @sync_mode = sync_mode
17
+ @members = members
18
+ end
19
+
20
+ def self.from(map:)
21
+ DedicatedDatabaseReplicas.new(
22
+ replicas: map["replicas"],
23
+ sync_mode: map["syncMode"],
24
+ members: map["members"].map { |it| DedicatedDatabaseMember.from(map: it) }
25
+ )
26
+ end
27
+
28
+ def to_map
29
+ {
30
+ "replicas": @replicas,
31
+ "syncMode": @sync_mode,
32
+ "members": @members.map { |it| it.to_map }
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,67 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DedicatedDatabaseSpecification
6
+ attr_reader :slug
7
+ attr_reader :name
8
+ attr_reader :price
9
+ attr_reader :cpu
10
+ attr_reader :memory
11
+ attr_reader :max_connections
12
+ attr_reader :included_storage
13
+ attr_reader :included_bandwidth
14
+ attr_reader :enabled
15
+
16
+ def initialize(
17
+ slug:,
18
+ name:,
19
+ price:,
20
+ cpu:,
21
+ memory:,
22
+ max_connections:,
23
+ included_storage:,
24
+ included_bandwidth:,
25
+ enabled:
26
+ )
27
+ @slug = slug
28
+ @name = name
29
+ @price = price
30
+ @cpu = cpu
31
+ @memory = memory
32
+ @max_connections = max_connections
33
+ @included_storage = included_storage
34
+ @included_bandwidth = included_bandwidth
35
+ @enabled = enabled
36
+ end
37
+
38
+ def self.from(map:)
39
+ DedicatedDatabaseSpecification.new(
40
+ slug: map["slug"],
41
+ name: map["name"],
42
+ price: map["price"],
43
+ cpu: map["cpu"],
44
+ memory: map["memory"],
45
+ max_connections: map["maxConnections"],
46
+ included_storage: map["includedStorage"],
47
+ included_bandwidth: map["includedBandwidth"],
48
+ enabled: map["enabled"]
49
+ )
50
+ end
51
+
52
+ def to_map
53
+ {
54
+ "slug": @slug,
55
+ "name": @name,
56
+ "price": @price,
57
+ "cpu": @cpu,
58
+ "memory": @memory,
59
+ "maxConnections": @max_connections,
60
+ "includedStorage": @included_storage,
61
+ "includedBandwidth": @included_bandwidth,
62
+ "enabled": @enabled
63
+ }
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,37 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DedicatedDatabaseSpecificationList
6
+ attr_reader :specifications
7
+ attr_reader :total
8
+ attr_reader :pricing
9
+
10
+ def initialize(
11
+ specifications:,
12
+ total:,
13
+ pricing:
14
+ )
15
+ @specifications = specifications
16
+ @total = total
17
+ @pricing = pricing
18
+ end
19
+
20
+ def self.from(map:)
21
+ DedicatedDatabaseSpecificationList.new(
22
+ specifications: map["specifications"].map { |it| DedicatedDatabaseSpecification.from(map: it) },
23
+ total: map["total"],
24
+ pricing: DedicatedDatabaseSpecificationPricing.from(map: map["pricing"])
25
+ )
26
+ end
27
+
28
+ def to_map
29
+ {
30
+ "specifications": @specifications.map { |it| it.to_map },
31
+ "total": @total,
32
+ "pricing": @pricing.to_map
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DedicatedDatabaseSpecificationPricing
6
+ attr_reader :storage_overage_rate
7
+ attr_reader :bandwidth_overage_rate
8
+ attr_reader :replica_rate
9
+ attr_reader :cross_region_replica_rate
10
+ attr_reader :pitr_rate
11
+
12
+ def initialize(
13
+ storage_overage_rate:,
14
+ bandwidth_overage_rate:,
15
+ replica_rate:,
16
+ cross_region_replica_rate:,
17
+ pitr_rate:
18
+ )
19
+ @storage_overage_rate = storage_overage_rate
20
+ @bandwidth_overage_rate = bandwidth_overage_rate
21
+ @replica_rate = replica_rate
22
+ @cross_region_replica_rate = cross_region_replica_rate
23
+ @pitr_rate = pitr_rate
24
+ end
25
+
26
+ def self.from(map:)
27
+ DedicatedDatabaseSpecificationPricing.new(
28
+ storage_overage_rate: map["storageOverageRate"],
29
+ bandwidth_overage_rate: map["bandwidthOverageRate"],
30
+ replica_rate: map["replicaRate"],
31
+ cross_region_replica_rate: map["crossRegionReplicaRate"],
32
+ pitr_rate: map["pitrRate"]
33
+ )
34
+ end
35
+
36
+ def to_map
37
+ {
38
+ "storageOverageRate": @storage_overage_rate,
39
+ "bandwidthOverageRate": @bandwidth_overage_rate,
40
+ "replicaRate": @replica_rate,
41
+ "crossRegionReplicaRate": @cross_region_replica_rate,
42
+ "pitrRate": @pitr_rate
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,27 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Oauth2Approve
6
+ attr_reader :redirect_url
7
+
8
+ def initialize(
9
+ redirect_url:
10
+ )
11
+ @redirect_url = redirect_url
12
+ end
13
+
14
+ def self.from(map:)
15
+ Oauth2Approve.new(
16
+ redirect_url: map["redirectUrl"]
17
+ )
18
+ end
19
+
20
+ def to_map
21
+ {
22
+ "redirectUrl": @redirect_url
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Oauth2Authorize
6
+ attr_reader :grant_id
7
+ attr_reader :redirect_url
8
+
9
+ def initialize(
10
+ grant_id:,
11
+ redirect_url:
12
+ )
13
+ @grant_id = grant_id
14
+ @redirect_url = redirect_url
15
+ end
16
+
17
+ def self.from(map:)
18
+ Oauth2Authorize.new(
19
+ grant_id: map["grantId"],
20
+ redirect_url: map["redirectUrl"]
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "grantId": @grant_id,
27
+ "redirectUrl": @redirect_url
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,72 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Oauth2Consent
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :user_id
10
+ attr_reader :app_id
11
+ attr_reader :cimd_url
12
+ attr_reader :scopes
13
+ attr_reader :resources
14
+ attr_reader :authorization_details
15
+ attr_reader :expire
16
+
17
+ def initialize(
18
+ id:,
19
+ created_at:,
20
+ updated_at:,
21
+ user_id:,
22
+ app_id:,
23
+ cimd_url:,
24
+ scopes:,
25
+ resources:,
26
+ authorization_details:,
27
+ expire:
28
+ )
29
+ @id = id
30
+ @created_at = created_at
31
+ @updated_at = updated_at
32
+ @user_id = user_id
33
+ @app_id = app_id
34
+ @cimd_url = cimd_url
35
+ @scopes = scopes
36
+ @resources = resources
37
+ @authorization_details = authorization_details
38
+ @expire = expire
39
+ end
40
+
41
+ def self.from(map:)
42
+ Oauth2Consent.new(
43
+ id: map["$id"],
44
+ created_at: map["$createdAt"],
45
+ updated_at: map["$updatedAt"],
46
+ user_id: map["userId"],
47
+ app_id: map["appId"],
48
+ cimd_url: map["cimdUrl"],
49
+ scopes: map["scopes"],
50
+ resources: map["resources"],
51
+ authorization_details: map["authorizationDetails"],
52
+ expire: map["expire"]
53
+ )
54
+ end
55
+
56
+ def to_map
57
+ {
58
+ "$id": @id,
59
+ "$createdAt": @created_at,
60
+ "$updatedAt": @updated_at,
61
+ "userId": @user_id,
62
+ "appId": @app_id,
63
+ "cimdUrl": @cimd_url,
64
+ "scopes": @scopes,
65
+ "resources": @resources,
66
+ "authorizationDetails": @authorization_details,
67
+ "expire": @expire
68
+ }
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Oauth2ConsentList
6
+ attr_reader :total
7
+ attr_reader :consents
8
+
9
+ def initialize(
10
+ total:,
11
+ consents:
12
+ )
13
+ @total = total
14
+ @consents = consents
15
+ end
16
+
17
+ def self.from(map:)
18
+ Oauth2ConsentList.new(
19
+ total: map["total"],
20
+ consents: map["consents"].map { |it| Oauth2Consent.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "consents": @consents.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end