appwrite 30.0.1 → 30.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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +44 -24
  3. data/lib/appwrite/enums/appwrite_migration_resource.rb +46 -0
  4. data/lib/appwrite/enums/build_runtime.rb +4 -0
  5. data/lib/appwrite/enums/environment_resource.rb +40 -0
  6. data/lib/appwrite/enums/firebase_migration_resource.rb +16 -0
  7. data/lib/appwrite/enums/n_host_migration_resource.rb +17 -0
  8. data/lib/appwrite/enums/on_duplicate.rb +9 -0
  9. data/lib/appwrite/enums/project_policy_id.rb +1 -0
  10. data/lib/appwrite/enums/runtime.rb +4 -0
  11. data/lib/appwrite/enums/supabase_migration_resource.rb +17 -0
  12. data/lib/appwrite/models/billing_plan.rb +15 -0
  13. data/lib/appwrite/models/migration.rb +128 -0
  14. data/lib/appwrite/models/migration_list.rb +33 -0
  15. data/lib/appwrite/models/policy_deny_realtime_guests.rb +33 -0
  16. data/lib/appwrite/services/account.rb +19 -19
  17. data/lib/appwrite/services/activities.rb +1 -1
  18. data/lib/appwrite/services/advisor.rb +5 -5
  19. data/lib/appwrite/services/apps.rb +25 -25
  20. data/lib/appwrite/services/avatars.rb +3 -3
  21. data/lib/appwrite/services/backups.rb +6 -6
  22. data/lib/appwrite/services/databases.rb +157 -157
  23. data/lib/appwrite/services/documents_db.rb +63 -63
  24. data/lib/appwrite/services/domains.rb +77 -77
  25. data/lib/appwrite/services/functions.rb +33 -33
  26. data/lib/appwrite/services/messaging.rb +30 -30
  27. data/lib/appwrite/services/migrations.rb +653 -0
  28. data/lib/appwrite/services/mongo.rb +37 -37
  29. data/lib/appwrite/services/mysql.rb +40 -40
  30. data/lib/appwrite/services/oauth2.rb +14 -14
  31. data/lib/appwrite/services/organization.rb +17 -17
  32. data/lib/appwrite/services/postgresql.rb +44 -44
  33. data/lib/appwrite/services/presences.rb +4 -4
  34. data/lib/appwrite/services/project.rb +105 -28
  35. data/lib/appwrite/services/proxy.rb +3 -3
  36. data/lib/appwrite/services/sites.rb +32 -32
  37. data/lib/appwrite/services/storage.rb +17 -17
  38. data/lib/appwrite/services/tables_db.rb +169 -169
  39. data/lib/appwrite/services/teams.rb +23 -23
  40. data/lib/appwrite/services/tokens.rb +7 -7
  41. data/lib/appwrite/services/users.rb +50 -50
  42. data/lib/appwrite/services/vectors_db.rb +55 -55
  43. data/lib/appwrite/services/waf.rb +57 -35
  44. data/lib/appwrite/services/webhooks.rb +4 -4
  45. data/lib/appwrite.rb +12 -0
  46. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b6209eb5bb9a474ef36b247e72a8dd4c463cd05d1e476508ca1f65ce56b9af9
4
- data.tar.gz: ae13a30f1c64aecbb4b9eb67f09c96b410b21ebb5494c353815f02c3a6df9482
3
+ metadata.gz: 9c35d8e3c83824afd1e8d35c31bbbfdb33f310a134ff0afbe30fb057e381f2fd
4
+ data.tar.gz: cdd1bc7c83964371ded48d9cfd0e5c90180f3800afee237a93a51b46355a9a77
5
5
  SHA512:
6
- metadata.gz: 8f6567262f1bb8996ba8e1bd157706f153bcc650d536930bd6480a6301b7b3af4bcb326db202a080b6d9025a8d58ada7cfdb390031f1d76d5b86f6ec26c25654
7
- data.tar.gz: 8bb14ef659726eae5d409cb16c8b57eff7928e2c1cf4221ee19b95c8e613d1d0584231fa576fa7ae6df67778d6266611afbdac386786effdc6fbad01776ef830
6
+ metadata.gz: c79caca1aae3712262e673ec9783d45ff5b8ae0ebb228f6f72d16c7bb07560dc3175165b360e963e5a5ddab5b788a9b9deee8561e8474cccd22b6c78bcbfc3f6
7
+ data.tar.gz: f33310aa668ff3bec30525a8d4c9056fb5578c52ae98976113aa2c36ad478f771f343284509b658242b41c454b35dc361bafd50599bce81ebd239eaad18d58c6
@@ -14,8 +14,8 @@ module Appwrite
14
14
  'x-sdk-name' => 'Ruby',
15
15
  'x-sdk-platform' => 'server',
16
16
  'x-sdk-language' => 'ruby',
17
- 'x-sdk-version' => '30.0.1',
18
- 'X-Appwrite-Response-Format' => '2.5.0'
17
+ 'x-sdk-version' => '30.1.0',
18
+ 'X-Appwrite-Response-Format' => '2.6.2'
19
19
  }
20
20
  @endpoint = 'https://cloud.appwrite.io/v1'
21
21
  @config = {}
@@ -235,6 +235,21 @@ module Appwrite
235
235
  @headers.dup
236
236
  end
237
237
 
238
+ # Encode a value as one path segment.
239
+ #
240
+ # Every byte but letters, digits and -_.!~*'() is escaped, as
241
+ # encodeURIComponent does, so a value fills exactly the segment it replaces.
242
+ #
243
+ # @param [String] value The path parameter value
244
+ #
245
+ # @return [String]
246
+ def encode_path(value)
247
+ segment = value.to_s
248
+ raise Appwrite::Exception.new('Path parameter cannot be "." or ".."') if ['.', '..'].include?(segment)
249
+
250
+ segment.b.gsub(/[^A-Za-z0-9\-_.!~*'()]/n) { |byte| format('%%%02X', byte.ord) }
251
+ end
252
+
238
253
  # Send the HTTP request.
239
254
  #
240
255
  # @param [String] method The HTTP method for the request
@@ -314,7 +329,7 @@ module Appwrite
314
329
  begin
315
330
  current = call(
316
331
  method: "GET",
317
- path: "#{path}/#{params[id_param_name]}",
332
+ path: "#{path}/#{encode_path(upload_id)}",
318
333
  headers: headers,
319
334
  params: {}
320
335
  )
@@ -447,27 +462,26 @@ module Appwrite
447
462
  uri,
448
463
  headers,
449
464
  params,
450
- response_type = nil,
451
- limit = 5
465
+ response_type = nil
452
466
  )
453
- raise ArgumentError, 'Too Many HTTP Redirects' if limit == 0
454
-
455
467
  http = Net::HTTP.new(uri.host, uri.port)
456
- http.use_ssl = !@self_signed
468
+ http.use_ssl = uri.scheme == 'https'
469
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @self_signed
457
470
  payload = ''
458
471
 
459
472
  headers = @headers.merge(headers)
460
473
 
461
474
  params.compact!
462
475
 
463
- @boundary = "----A30#3ad1"
464
476
  if method != "GET"
465
477
  case headers[:'content-type']
466
478
  when 'application/json'
467
479
  payload = params.to_json
468
480
  when 'multipart/form-data'
469
- payload = encode_form_data(params) + "--#{@boundary}--\r\n"
470
- headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}"
481
+ # A fixed boundary lets file content end its part and add fields.
482
+ boundary = "----#{SecureRandom.hex(16)}"
483
+ payload = encode_form_data(params, boundary) + "--#{boundary}--\r\n"
484
+ headers[:'content-type'] = "multipart/form-data; boundary=#{boundary}"
471
485
  else
472
486
  payload = encode(params)
473
487
  end
@@ -491,10 +505,10 @@ module Appwrite
491
505
  return location
492
506
  end
493
507
 
494
- # Handle Redirects
495
- if (response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently)
496
- uri = URI.parse(uri.scheme + "://" + uri.host + "" + location)
497
- return fetch(method, uri, headers, {}, response_type, limit - 1)
508
+ # A redirect is reported, not followed: it would carry the API key to
509
+ # wherever it points, possibly another host.
510
+ if response.is_a?(Net::HTTPRedirection)
511
+ raise Appwrite::Exception.new("Redirect to #{location} not followed", response.code, nil, response.body)
498
512
  end
499
513
 
500
514
  if response.content_type == 'application/json'
@@ -541,27 +555,27 @@ module Appwrite
541
555
  String.new(response.body.to_s, encoding: encoding).encode(Encoding::UTF_8)
542
556
  end
543
557
 
544
- def encode_form_data(value, key = nil)
558
+ def encode_form_data(value, boundary, key = nil)
545
559
  case value
546
560
  when Hash
547
- return encode_form_data(value.to_json, key) unless key.nil?
561
+ return encode_form_data(value.to_json, boundary, key) unless key.nil?
548
562
 
549
- value.map { |k, v| encode_form_data(v, k) }.join
563
+ value.map { |k, v| encode_form_data(v, boundary, k) }.join
550
564
  when Array
551
- value.map { |v| encode_form_data(v, "#{key}[]") }.join
565
+ value.map { |v| encode_form_data(v, boundary, "#{key}[]") }.join
552
566
  when nil
553
567
  ''
554
568
  else
555
569
  post_body = []
556
570
  if value.instance_of? InputFile
557
- post_body << "--#{@boundary}"
558
- post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.filename}\""
559
- post_body << "Content-Type: #{value.mime_type}"
571
+ post_body << "--#{boundary}"
572
+ post_body << "Content-Disposition: form-data; name=\"#{escape_form_data_name(key)}\"; filename=\"#{escape_form_data_name(value.filename)}\""
573
+ post_body << "Content-Type: #{value.mime_type.to_s.delete("\r\n")}"
560
574
  post_body << ""
561
575
  post_body << value.data
562
576
  else
563
- post_body << "--#{@boundary}"
564
- post_body << "Content-Disposition: form-data; name=\"#{key}\""
577
+ post_body << "--#{boundary}"
578
+ post_body << "Content-Disposition: form-data; name=\"#{escape_form_data_name(key)}\""
565
579
  post_body << ""
566
580
  post_body << value.to_s
567
581
  end
@@ -569,6 +583,12 @@ module Appwrite
569
583
  end
570
584
  end
571
585
 
586
+ # Field and file names are quoted in the part headers; escape what would
587
+ # end the quoted string or the header line, as browsers do.
588
+ def escape_form_data_name(name)
589
+ name.to_s.gsub("\r", '%0D').gsub("\n", '%0A').gsub('"', '%22')
590
+ end
591
+
572
592
  def encode(value, key = nil)
573
593
  case value
574
594
  when Hash then value.map { |k, v| encode(v, append_key(key, k)) }.join('&')
@@ -0,0 +1,46 @@
1
+ module Appwrite
2
+ module Enums
3
+ module AppwriteMigrationResource
4
+ USER = 'user'
5
+ TEAM = 'team'
6
+ MEMBERSHIP = 'membership'
7
+ AUTH_METHODS = 'auth-methods'
8
+ POLICIES = 'policies'
9
+ OAUTH2_PROVIDER = 'oauth2-provider'
10
+ DATABASE = 'database'
11
+ TABLE = 'table'
12
+ COLUMN = 'column'
13
+ INDEX = 'index'
14
+ ROW = 'row'
15
+ DOCUMENT = 'document'
16
+ ATTRIBUTE = 'attribute'
17
+ COLLECTION = 'collection'
18
+ DOCUMENTSDB = 'documentsdb'
19
+ VECTORSDB = 'vectorsdb'
20
+ BUCKET = 'bucket'
21
+ FILE = 'file'
22
+ FUNCTION = 'function'
23
+ DEPLOYMENT = 'deployment'
24
+ ENVIRONMENT_VARIABLE = 'environment-variable'
25
+ PROVIDER = 'provider'
26
+ TOPIC = 'topic'
27
+ SUBSCRIBER = 'subscriber'
28
+ MESSAGE = 'message'
29
+ SITE = 'site'
30
+ SITE_DEPLOYMENT = 'site-deployment'
31
+ SITE_VARIABLE = 'site-variable'
32
+ PLATFORM = 'platform'
33
+ API_KEY = 'api-key'
34
+ WEBHOOK = 'webhook'
35
+ SMTP = 'smtp'
36
+ BACKUP_POLICY = 'backup-policy'
37
+ PROJECT_VARIABLE = 'project-variable'
38
+ PROJECT_PROTOCOLS = 'project-protocols'
39
+ PROJECT_LABELS = 'project-labels'
40
+ PROJECT_SERVICES = 'project-services'
41
+ PROJECT_EMAIL_TEMPLATE = 'project-email-template'
42
+ PROJECT_ENVIRONMENT = 'project-environment'
43
+ RULE = 'rule'
44
+ end
45
+ end
46
+ end
@@ -30,6 +30,7 @@ module Appwrite
30
30
  PYTHON_3_12 = 'python-3.12'
31
31
  PYTHON_3_13 = 'python-3.13'
32
32
  PYTHON_3_14 = 'python-3.14'
33
+ PYTHON_3_15 = 'python-3.15'
33
34
  PYTHON_ML_3_11 = 'python-ml-3.11'
34
35
  PYTHON_ML_3_12 = 'python-ml-3.12'
35
36
  PYTHON_ML_3_13 = 'python-ml-3.13'
@@ -38,6 +39,7 @@ module Appwrite
38
39
  DENO_2_0 = 'deno-2.0'
39
40
  DENO_2_5 = 'deno-2.5'
40
41
  DENO_2_6 = 'deno-2.6'
42
+ DENO_2_9 = 'deno-2.9'
41
43
  DART_2_15 = 'dart-2.15'
42
44
  DART_2_16 = 'dart-2.16'
43
45
  DART_2_17 = 'dart-2.17'
@@ -85,7 +87,9 @@ module Appwrite
85
87
  GO_1_24 = 'go-1.24'
86
88
  GO_1_25 = 'go-1.25'
87
89
  GO_1_26 = 'go-1.26'
90
+ GO_1_27 = 'go-1.27'
88
91
  RUST_1_83 = 'rust-1.83'
92
+ RUST_1_99 = 'rust-1.99'
89
93
  STATIC_1 = 'static-1'
90
94
  FLUTTER_3_24 = 'flutter-3.24'
91
95
  FLUTTER_3_27 = 'flutter-3.27'
@@ -0,0 +1,40 @@
1
+ module Appwrite
2
+ module Enums
3
+ module EnvironmentResource
4
+ USER = 'user'
5
+ TEAM = 'team'
6
+ MEMBERSHIP = 'membership'
7
+ AUTH_METHODS = 'auth-methods'
8
+ POLICIES = 'policies'
9
+ OAUTH2_PROVIDER = 'oauth2-provider'
10
+ DATABASE = 'database'
11
+ DOCUMENTSDB = 'documentsdb'
12
+ VECTORSDB = 'vectorsdb'
13
+ TABLE = 'table'
14
+ COLLECTION = 'collection'
15
+ COLUMN = 'column'
16
+ ATTRIBUTE = 'attribute'
17
+ INDEX = 'index'
18
+ ROW = 'row'
19
+ DOCUMENT = 'document'
20
+ BUCKET = 'bucket'
21
+ FILE = 'file'
22
+ FUNCTION = 'function'
23
+ ENVIRONMENT_VARIABLE = 'environment-variable'
24
+ DEPLOYMENT = 'deployment'
25
+ SITE = 'site'
26
+ SITE_VARIABLE = 'site-variable'
27
+ SITE_DEPLOYMENT = 'site-deployment'
28
+ PROVIDER = 'provider'
29
+ TOPIC = 'topic'
30
+ SUBSCRIBER = 'subscriber'
31
+ PLATFORM = 'platform'
32
+ SMTP = 'smtp'
33
+ PROJECT_VARIABLE = 'project-variable'
34
+ PROJECT_PROTOCOLS = 'project-protocols'
35
+ PROJECT_LABELS = 'project-labels'
36
+ PROJECT_SERVICES = 'project-services'
37
+ PROJECT_EMAIL_TEMPLATE = 'project-email-template'
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,16 @@
1
+ module Appwrite
2
+ module Enums
3
+ module FirebaseMigrationResource
4
+ USER = 'user'
5
+ DATABASE = 'database'
6
+ TABLE = 'table'
7
+ COLUMN = 'column'
8
+ ROW = 'row'
9
+ DOCUMENT = 'document'
10
+ ATTRIBUTE = 'attribute'
11
+ COLLECTION = 'collection'
12
+ BUCKET = 'bucket'
13
+ FILE = 'file'
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ module Appwrite
2
+ module Enums
3
+ module NHostMigrationResource
4
+ USER = 'user'
5
+ DATABASE = 'database'
6
+ TABLE = 'table'
7
+ COLUMN = 'column'
8
+ INDEX = 'index'
9
+ ROW = 'row'
10
+ DOCUMENT = 'document'
11
+ ATTRIBUTE = 'attribute'
12
+ COLLECTION = 'collection'
13
+ BUCKET = 'bucket'
14
+ FILE = 'file'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module Appwrite
2
+ module Enums
3
+ module OnDuplicate
4
+ FAIL = 'fail'
5
+ SKIP = 'skip'
6
+ OVERWRITE = 'overwrite'
7
+ end
8
+ end
9
+ end
@@ -18,6 +18,7 @@ module Appwrite
18
18
  DENY_DISPOSABLE_EMAIL = 'deny-disposable-email'
19
19
  DENY_FREE_EMAIL = 'deny-free-email'
20
20
  DENY_CORPORATE_EMAIL = 'deny-corporate-email'
21
+ DENY_REALTIME_GUESTS = 'deny-realtime-guests'
21
22
  PASSKEY = 'passkey'
22
23
  end
23
24
  end
@@ -30,6 +30,7 @@ module Appwrite
30
30
  PYTHON_3_12 = 'python-3.12'
31
31
  PYTHON_3_13 = 'python-3.13'
32
32
  PYTHON_3_14 = 'python-3.14'
33
+ PYTHON_3_15 = 'python-3.15'
33
34
  PYTHON_ML_3_11 = 'python-ml-3.11'
34
35
  PYTHON_ML_3_12 = 'python-ml-3.12'
35
36
  PYTHON_ML_3_13 = 'python-ml-3.13'
@@ -38,6 +39,7 @@ module Appwrite
38
39
  DENO_2_0 = 'deno-2.0'
39
40
  DENO_2_5 = 'deno-2.5'
40
41
  DENO_2_6 = 'deno-2.6'
42
+ DENO_2_9 = 'deno-2.9'
41
43
  DART_2_15 = 'dart-2.15'
42
44
  DART_2_16 = 'dart-2.16'
43
45
  DART_2_17 = 'dart-2.17'
@@ -85,7 +87,9 @@ module Appwrite
85
87
  GO_1_24 = 'go-1.24'
86
88
  GO_1_25 = 'go-1.25'
87
89
  GO_1_26 = 'go-1.26'
90
+ GO_1_27 = 'go-1.27'
88
91
  RUST_1_83 = 'rust-1.83'
92
+ RUST_1_99 = 'rust-1.99'
89
93
  STATIC_1 = 'static-1'
90
94
  FLUTTER_3_24 = 'flutter-3.24'
91
95
  FLUTTER_3_27 = 'flutter-3.27'
@@ -0,0 +1,17 @@
1
+ module Appwrite
2
+ module Enums
3
+ module SupabaseMigrationResource
4
+ USER = 'user'
5
+ DATABASE = 'database'
6
+ TABLE = 'table'
7
+ COLUMN = 'column'
8
+ INDEX = 'index'
9
+ ROW = 'row'
10
+ DOCUMENT = 'document'
11
+ ATTRIBUTE = 'attribute'
12
+ COLLECTION = 'collection'
13
+ BUCKET = 'bucket'
14
+ FILE = 'file'
15
+ end
16
+ end
17
+ end
@@ -31,6 +31,9 @@ module Appwrite
31
31
  attr_reader :sites
32
32
  attr_reader :executions
33
33
  attr_reader :executions_retention_count
34
+ attr_reader :deployment_retention
35
+ attr_reader :deployment_retention_max
36
+ attr_reader :deployments_retention_count
34
37
  attr_reader :gb_hours
35
38
  attr_reader :realtime
36
39
  attr_reader :realtime_messages
@@ -109,6 +112,9 @@ module Appwrite
109
112
  sites:,
110
113
  executions:,
111
114
  executions_retention_count:,
115
+ deployment_retention: 0,
116
+ deployment_retention_max: 0,
117
+ deployments_retention_count: 0,
112
118
  gb_hours:,
113
119
  realtime:,
114
120
  realtime_messages:,
@@ -186,6 +192,9 @@ module Appwrite
186
192
  @sites = sites
187
193
  @executions = executions
188
194
  @executions_retention_count = executions_retention_count
195
+ @deployment_retention = deployment_retention
196
+ @deployment_retention_max = deployment_retention_max
197
+ @deployments_retention_count = deployments_retention_count
189
198
  @gb_hours = gb_hours
190
199
  @realtime = realtime
191
200
  @realtime_messages = realtime_messages
@@ -267,6 +276,9 @@ module Appwrite
267
276
  sites: map["sites"],
268
277
  executions: map["executions"],
269
278
  executions_retention_count: map["executionsRetentionCount"],
279
+ deployment_retention: map["deploymentRetention"],
280
+ deployment_retention_max: map["deploymentRetentionMax"],
281
+ deployments_retention_count: map["deploymentsRetentionCount"],
270
282
  gb_hours: map["GBHours"],
271
283
  realtime: map["realtime"],
272
284
  realtime_messages: map["realtimeMessages"],
@@ -348,6 +360,9 @@ module Appwrite
348
360
  "sites": @sites,
349
361
  "executions": @executions,
350
362
  "executionsRetentionCount": @executions_retention_count,
363
+ "deploymentRetention": @deployment_retention,
364
+ "deploymentRetentionMax": @deployment_retention_max,
365
+ "deploymentsRetentionCount": @deployments_retention_count,
351
366
  "GBHours": @gb_hours,
352
367
  "realtime": @realtime,
353
368
  "realtimeMessages": @realtime_messages,
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Migration
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :status
10
+ attr_reader :stage
11
+ attr_reader :source
12
+ attr_reader :destination
13
+ attr_reader :resources
14
+ attr_reader :resource_id
15
+ attr_reader :resource_internal_id
16
+ attr_reader :resource_type
17
+ attr_reader :parent_resource_id
18
+ attr_reader :parent_resource_internal_id
19
+ attr_reader :parent_resource_type
20
+ attr_reader :destination_resource_id
21
+ attr_reader :destination_resource_internal_id
22
+ attr_reader :destination_resource_type
23
+ attr_reader :status_counters
24
+ attr_reader :resource_data
25
+ attr_reader :errors
26
+ attr_reader :options
27
+
28
+ def initialize(
29
+ id:,
30
+ created_at:,
31
+ updated_at:,
32
+ status:,
33
+ stage:,
34
+ source:,
35
+ destination:,
36
+ resources:,
37
+ resource_id:,
38
+ resource_internal_id:,
39
+ resource_type:,
40
+ parent_resource_id:,
41
+ parent_resource_internal_id:,
42
+ parent_resource_type:,
43
+ destination_resource_id:,
44
+ destination_resource_internal_id:,
45
+ destination_resource_type:,
46
+ status_counters:,
47
+ resource_data:,
48
+ errors:,
49
+ options:
50
+ )
51
+ @id = id
52
+ @created_at = created_at
53
+ @updated_at = updated_at
54
+ @status = status
55
+ @stage = stage
56
+ @source = source
57
+ @destination = destination
58
+ @resources = resources
59
+ @resource_id = resource_id
60
+ @resource_internal_id = resource_internal_id
61
+ @resource_type = resource_type
62
+ @parent_resource_id = parent_resource_id
63
+ @parent_resource_internal_id = parent_resource_internal_id
64
+ @parent_resource_type = parent_resource_type
65
+ @destination_resource_id = destination_resource_id
66
+ @destination_resource_internal_id = destination_resource_internal_id
67
+ @destination_resource_type = destination_resource_type
68
+ @status_counters = status_counters
69
+ @resource_data = resource_data
70
+ @errors = errors
71
+ @options = options
72
+ end
73
+
74
+ def self.from(map:)
75
+ map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "status" => "", "stage" => "", "source" => "", "destination" => "Appwrite", "resources" => [], "resourceId" => "", "resourceInternalId" => "", "resourceType" => "", "parentResourceId" => "", "parentResourceInternalId" => "", "parentResourceType" => "", "destinationResourceId" => "", "destinationResourceInternalId" => "", "destinationResourceType" => "", "statusCounters" => {}, "resourceData" => [], "errors" => [], "options" => {} }.merge(map)
76
+ Migration.new(
77
+ id: map["$id"],
78
+ created_at: map["$createdAt"],
79
+ updated_at: map["$updatedAt"],
80
+ status: map["status"],
81
+ stage: map["stage"],
82
+ source: map["source"],
83
+ destination: map["destination"],
84
+ resources: map["resources"],
85
+ resource_id: map["resourceId"],
86
+ resource_internal_id: map["resourceInternalId"],
87
+ resource_type: map["resourceType"],
88
+ parent_resource_id: map["parentResourceId"],
89
+ parent_resource_internal_id: map["parentResourceInternalId"],
90
+ parent_resource_type: map["parentResourceType"],
91
+ destination_resource_id: map["destinationResourceId"],
92
+ destination_resource_internal_id: map["destinationResourceInternalId"],
93
+ destination_resource_type: map["destinationResourceType"],
94
+ status_counters: map["statusCounters"],
95
+ resource_data: map["resourceData"],
96
+ errors: map["errors"],
97
+ options: map["options"]
98
+ )
99
+ end
100
+
101
+ def to_map
102
+ {
103
+ "$id": @id,
104
+ "$createdAt": @created_at,
105
+ "$updatedAt": @updated_at,
106
+ "status": @status,
107
+ "stage": @stage,
108
+ "source": @source,
109
+ "destination": @destination,
110
+ "resources": @resources,
111
+ "resourceId": @resource_id,
112
+ "resourceInternalId": @resource_internal_id,
113
+ "resourceType": @resource_type,
114
+ "parentResourceId": @parent_resource_id,
115
+ "parentResourceInternalId": @parent_resource_internal_id,
116
+ "parentResourceType": @parent_resource_type,
117
+ "destinationResourceId": @destination_resource_id,
118
+ "destinationResourceInternalId": @destination_resource_internal_id,
119
+ "destinationResourceType": @destination_resource_type,
120
+ "statusCounters": @status_counters,
121
+ "resourceData": @resource_data,
122
+ "errors": @errors,
123
+ "options": @options
124
+ }
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class MigrationList
6
+ attr_reader :total
7
+ attr_reader :migrations
8
+
9
+ def initialize(
10
+ total:,
11
+ migrations:
12
+ )
13
+ @total = total
14
+ @migrations = migrations
15
+ end
16
+
17
+ def self.from(map:)
18
+ map = { "total" => 0, "migrations" => [] }.merge(map)
19
+ MigrationList.new(
20
+ total: map["total"],
21
+ migrations: map["migrations"].map { |it| Migration.from(map: it) }
22
+ )
23
+ end
24
+
25
+ def to_map
26
+ {
27
+ "total": @total,
28
+ "migrations": @migrations.map { |it| it.to_map }
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class PolicyDenyRealtimeGuests
6
+ attr_reader :id
7
+ attr_reader :enabled
8
+
9
+ def initialize(
10
+ id:,
11
+ enabled:
12
+ )
13
+ @id = id
14
+ @enabled = enabled
15
+ end
16
+
17
+ def self.from(map:)
18
+ map = { "$id" => "", "enabled" => false }.merge(map)
19
+ PolicyDenyRealtimeGuests.new(
20
+ id: map["$id"],
21
+ enabled: map["enabled"]
22
+ )
23
+ end
24
+
25
+ def to_map
26
+ {
27
+ "$id": @id,
28
+ "enabled": @enabled
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end