appwrite 30.0.1 → 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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +58 -24
  3. data/lib/appwrite/enums/appwrite_migration_resource.rb +47 -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/o_auth_provider.rb +2 -0
  9. data/lib/appwrite/enums/on_duplicate.rb +9 -0
  10. data/lib/appwrite/enums/project_key_scopes.rb +6 -0
  11. data/lib/appwrite/enums/project_o_auth_provider_id.rb +2 -0
  12. data/lib/appwrite/enums/project_policy_id.rb +2 -0
  13. data/lib/appwrite/enums/runtime.rb +4 -0
  14. data/lib/appwrite/enums/supabase_migration_resource.rb +17 -0
  15. data/lib/appwrite/models/activity_event.rb +9 -4
  16. data/lib/appwrite/models/billing_plan.rb +15 -0
  17. data/lib/appwrite/models/device.rb +58 -0
  18. data/lib/appwrite/models/environment.rb +48 -0
  19. data/lib/appwrite/models/environment_list.rb +33 -0
  20. data/lib/appwrite/models/migration.rb +128 -0
  21. data/lib/appwrite/models/migration_list.rb +33 -0
  22. data/lib/appwrite/models/o_auth2_vipps.rb +43 -0
  23. data/lib/appwrite/models/organization.rb +16 -1
  24. data/lib/appwrite/models/policy_account_devices.rb +33 -0
  25. data/lib/appwrite/models/policy_deny_realtime_guests.rb +33 -0
  26. data/lib/appwrite/models/project.rb +10 -0
  27. data/lib/appwrite/models/proxy_rule.rb +11 -1
  28. data/lib/appwrite/models/session.rb +6 -1
  29. data/lib/appwrite/models/waf_rule_bypass.rb +8 -3
  30. data/lib/appwrite/models/waf_rule_challenge.rb +5 -0
  31. data/lib/appwrite/models/waf_rule_deny.rb +8 -3
  32. data/lib/appwrite/models/waf_rule_rate_limit.rb +5 -0
  33. data/lib/appwrite/models/waf_rule_redirect.rb +5 -0
  34. data/lib/appwrite/services/account.rb +175 -20
  35. data/lib/appwrite/services/activities.rb +1 -1
  36. data/lib/appwrite/services/advisor.rb +5 -5
  37. data/lib/appwrite/services/apps.rb +25 -25
  38. data/lib/appwrite/services/avatars.rb +3 -3
  39. data/lib/appwrite/services/backups.rb +6 -6
  40. data/lib/appwrite/services/databases.rb +157 -157
  41. data/lib/appwrite/services/documents_db.rb +63 -63
  42. data/lib/appwrite/services/domains.rb +77 -77
  43. data/lib/appwrite/services/functions.rb +33 -33
  44. data/lib/appwrite/services/messaging.rb +30 -30
  45. data/lib/appwrite/services/migrations.rb +653 -0
  46. data/lib/appwrite/services/mongo.rb +37 -37
  47. data/lib/appwrite/services/mysql.rb +40 -40
  48. data/lib/appwrite/services/oauth2.rb +14 -14
  49. data/lib/appwrite/services/organization.rb +17 -17
  50. data/lib/appwrite/services/postgresql.rb +44 -44
  51. data/lib/appwrite/services/presences.rb +4 -4
  52. data/lib/appwrite/services/project.rb +321 -47
  53. data/lib/appwrite/services/proxy.rb +157 -4
  54. data/lib/appwrite/services/sites.rb +32 -32
  55. data/lib/appwrite/services/storage.rb +19 -19
  56. data/lib/appwrite/services/tables_db.rb +169 -169
  57. data/lib/appwrite/services/teams.rb +23 -23
  58. data/lib/appwrite/services/tokens.rb +7 -7
  59. data/lib/appwrite/services/users.rb +50 -50
  60. data/lib/appwrite/services/vectors_db.rb +55 -55
  61. data/lib/appwrite/services/waf.rb +97 -45
  62. data/lib/appwrite/services/webhooks.rb +4 -4
  63. data/lib/appwrite.rb +17 -0
  64. metadata +17 -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: 601bdd8efcaeb72e627279eaba209d2a02d82f97e8b3bf23df456b3c3f18b1ed
4
+ data.tar.gz: b089b522b9fbc1e4e7cc2b1bcf5940e3329e072c7fda7cd65e3c1ce0cc02c710
5
5
  SHA512:
6
- metadata.gz: 8f6567262f1bb8996ba8e1bd157706f153bcc650d536930bd6480a6301b7b3af4bcb326db202a080b6d9025a8d58ada7cfdb390031f1d76d5b86f6ec26c25654
7
- data.tar.gz: 8bb14ef659726eae5d409cb16c8b57eff7928e2c1cf4221ee19b95c8e613d1d0584231fa576fa7ae6df67778d6266611afbdac386786effdc6fbad01776ef830
6
+ metadata.gz: 8ba045900879bfccd121a62f1fd976f0d9d676d7cd9a225f70b11007a66b77228bde3dea8cace3ff50f35a77ff7a28bb9f915ab1c96523d661bc6f2c1e95e71a
7
+ data.tar.gz: 94cdc3ed9ae3879a30b172b376d0698c23c9ee98e402859de2aeae8998be917b37c2430398b5d5258c1fea384737b1ceb60fca25b2bb7798da14d63b660d36a9
@@ -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.2.0',
18
+ 'X-Appwrite-Response-Format' => '2.7.1'
19
19
  }
20
20
  @endpoint = 'https://cloud.appwrite.io/v1'
21
21
  @config = {}
@@ -102,6 +102,20 @@ module Appwrite
102
102
  self
103
103
  end
104
104
 
105
+ # Set Environment
106
+ #
107
+ # The ID of the project environment to act in, alongside the project ID. Used with Appwrite Cloud projects that have environments.
108
+ #
109
+ # @param [String] value The value to set for the Environment header
110
+ #
111
+ # @return [self]
112
+ def set_environment(value)
113
+ add_header('x-appwrite-environment', value)
114
+ @config['environment'] = value
115
+
116
+ self
117
+ end
118
+
105
119
  # Set Session
106
120
  #
107
121
  # The user session to authenticate with
@@ -235,6 +249,21 @@ module Appwrite
235
249
  @headers.dup
236
250
  end
237
251
 
252
+ # Encode a value as one path segment.
253
+ #
254
+ # Every byte but letters, digits and -_.!~*'() is escaped, as
255
+ # encodeURIComponent does, so a value fills exactly the segment it replaces.
256
+ #
257
+ # @param [String] value The path parameter value
258
+ #
259
+ # @return [String]
260
+ def encode_path(value)
261
+ segment = value.to_s
262
+ raise Appwrite::Exception.new('Path parameter cannot be "." or ".."') if ['.', '..'].include?(segment)
263
+
264
+ segment.b.gsub(/[^A-Za-z0-9\-_.!~*'()]/n) { |byte| format('%%%02X', byte.ord) }
265
+ end
266
+
238
267
  # Send the HTTP request.
239
268
  #
240
269
  # @param [String] method The HTTP method for the request
@@ -314,7 +343,7 @@ module Appwrite
314
343
  begin
315
344
  current = call(
316
345
  method: "GET",
317
- path: "#{path}/#{params[id_param_name]}",
346
+ path: "#{path}/#{encode_path(upload_id)}",
318
347
  headers: headers,
319
348
  params: {}
320
349
  )
@@ -447,27 +476,26 @@ module Appwrite
447
476
  uri,
448
477
  headers,
449
478
  params,
450
- response_type = nil,
451
- limit = 5
479
+ response_type = nil
452
480
  )
453
- raise ArgumentError, 'Too Many HTTP Redirects' if limit == 0
454
-
455
481
  http = Net::HTTP.new(uri.host, uri.port)
456
- http.use_ssl = !@self_signed
482
+ http.use_ssl = uri.scheme == 'https'
483
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @self_signed
457
484
  payload = ''
458
485
 
459
486
  headers = @headers.merge(headers)
460
487
 
461
488
  params.compact!
462
489
 
463
- @boundary = "----A30#3ad1"
464
490
  if method != "GET"
465
491
  case headers[:'content-type']
466
492
  when 'application/json'
467
493
  payload = params.to_json
468
494
  when 'multipart/form-data'
469
- payload = encode_form_data(params) + "--#{@boundary}--\r\n"
470
- headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}"
495
+ # A fixed boundary lets file content end its part and add fields.
496
+ boundary = "----#{SecureRandom.hex(16)}"
497
+ payload = encode_form_data(params, boundary) + "--#{boundary}--\r\n"
498
+ headers[:'content-type'] = "multipart/form-data; boundary=#{boundary}"
471
499
  else
472
500
  payload = encode(params)
473
501
  end
@@ -491,10 +519,10 @@ module Appwrite
491
519
  return location
492
520
  end
493
521
 
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)
522
+ # A redirect is reported, not followed: it would carry the API key to
523
+ # wherever it points, possibly another host.
524
+ if response.is_a?(Net::HTTPRedirection)
525
+ raise Appwrite::Exception.new("Redirect to #{location} not followed", response.code, nil, response.body)
498
526
  end
499
527
 
500
528
  if response.content_type == 'application/json'
@@ -541,27 +569,27 @@ module Appwrite
541
569
  String.new(response.body.to_s, encoding: encoding).encode(Encoding::UTF_8)
542
570
  end
543
571
 
544
- def encode_form_data(value, key = nil)
572
+ def encode_form_data(value, boundary, key = nil)
545
573
  case value
546
574
  when Hash
547
- return encode_form_data(value.to_json, key) unless key.nil?
575
+ return encode_form_data(value.to_json, boundary, key) unless key.nil?
548
576
 
549
- value.map { |k, v| encode_form_data(v, k) }.join
577
+ value.map { |k, v| encode_form_data(v, boundary, k) }.join
550
578
  when Array
551
- value.map { |v| encode_form_data(v, "#{key}[]") }.join
579
+ value.map { |v| encode_form_data(v, boundary, "#{key}[]") }.join
552
580
  when nil
553
581
  ''
554
582
  else
555
583
  post_body = []
556
584
  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}"
585
+ post_body << "--#{boundary}"
586
+ post_body << "Content-Disposition: form-data; name=\"#{escape_form_data_name(key)}\"; filename=\"#{escape_form_data_name(value.filename)}\""
587
+ post_body << "Content-Type: #{value.mime_type.to_s.delete("\r\n")}"
560
588
  post_body << ""
561
589
  post_body << value.data
562
590
  else
563
- post_body << "--#{@boundary}"
564
- post_body << "Content-Disposition: form-data; name=\"#{key}\""
591
+ post_body << "--#{boundary}"
592
+ post_body << "Content-Disposition: form-data; name=\"#{escape_form_data_name(key)}\""
565
593
  post_body << ""
566
594
  post_body << value.to_s
567
595
  end
@@ -569,6 +597,12 @@ module Appwrite
569
597
  end
570
598
  end
571
599
 
600
+ # Field and file names are quoted in the part headers; escape what would
601
+ # end the quoted string or the header line, as browsers do.
602
+ def escape_form_data_name(name)
603
+ name.to_s.gsub("\r", '%0D').gsub("\n", '%0A').gsub('"', '%22')
604
+ end
605
+
572
606
  def encode(value, key = nil)
573
607
  case value
574
608
  when Hash then value.map { |k, v| encode(v, append_key(key, k)) }.join('&')
@@ -0,0 +1,47 @@
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_PREFERENCES = 'project-preferences'
41
+ PROJECT_SERVICES = 'project-services'
42
+ PROJECT_EMAIL_TEMPLATE = 'project-email-template'
43
+ PROJECT_ENVIRONMENT = 'project-environment'
44
+ RULE = 'rule'
45
+ end
46
+ end
47
+ 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
@@ -43,6 +43,8 @@ module Appwrite
43
43
  TRADESHIFT = 'tradeshift'
44
44
  TRADESHIFTBOX = 'tradeshiftBox'
45
45
  TWITCH = 'twitch'
46
+ VIPPS = 'vipps'
47
+ VIPPSSANDBOX = 'vippsSandbox'
46
48
  WEBFLOW = 'webflow'
47
49
  WORDPRESS = 'wordpress'
48
50
  X = 'x'
@@ -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
@@ -89,6 +89,10 @@ module Appwrite
89
89
  RULES_WRITE = 'rules.write'
90
90
  WEBHOOKS_READ = 'webhooks.read'
91
91
  WEBHOOKS_WRITE = 'webhooks.write'
92
+ MONITORS_READ = 'monitors.read'
93
+ MONITORS_WRITE = 'monitors.write'
94
+ ALERTS_READ = 'alerts.read'
95
+ ALERTS_WRITE = 'alerts.write'
92
96
  LOCALE_READ = 'locale.read'
93
97
  AVATARS_READ = 'avatars.read'
94
98
  AVATARS_WRITE = 'avatars.write'
@@ -104,6 +108,8 @@ module Appwrite
104
108
  INSIGHTS_WRITE = 'insights.write'
105
109
  REPORTS_READ = 'reports.read'
106
110
  REPORTS_WRITE = 'reports.write'
111
+ REVIEWS_READ = 'reviews.read'
112
+ REVIEWS_WRITE = 'reviews.write'
107
113
  PRESENCES_READ = 'presences.read'
108
114
  PRESENCES_WRITE = 'presences.write'
109
115
  DEDICATEDDATABASES_EXECUTE = 'dedicatedDatabases.execute'
@@ -43,6 +43,8 @@ module Appwrite
43
43
  TRADESHIFT = 'tradeshift'
44
44
  TRADESHIFTBOX = 'tradeshiftBox'
45
45
  TWITCH = 'twitch'
46
+ VIPPS = 'vipps'
47
+ VIPPSSANDBOX = 'vippsSandbox'
46
48
  WEBFLOW = 'webflow'
47
49
  WORDPRESS = 'wordpress'
48
50
  X = 'x'
@@ -18,7 +18,9 @@ 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'
23
+ ACCOUNT_DEVICES = 'account-devices'
22
24
  end
23
25
  end
24
26
  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
@@ -32,6 +32,7 @@ module Appwrite
32
32
  attr_reader :hostname
33
33
  attr_reader :sdk
34
34
  attr_reader :sdk_version
35
+ attr_reader :reason
35
36
 
36
37
  def initialize(
37
38
  id:,
@@ -62,7 +63,8 @@ module Appwrite
62
63
  team_id:,
63
64
  hostname:,
64
65
  sdk:,
65
- sdk_version:
66
+ sdk_version:,
67
+ reason:
66
68
  )
67
69
  @id = id
68
70
  @actor_type = actor_type
@@ -93,10 +95,11 @@ module Appwrite
93
95
  @hostname = hostname
94
96
  @sdk = sdk
95
97
  @sdk_version = sdk_version
98
+ @reason = reason
96
99
  end
97
100
 
98
101
  def self.from(map:)
99
- map = { "$id" => "", "actorType" => "", "actorId" => "", "actorEmail" => "", "actorName" => "", "resourceParent" => "", "resourceType" => "", "resourceId" => "", "resource" => "", "event" => "", "userAgent" => "", "ip" => "", "mode" => "", "country" => "", "continentCode" => "", "city" => "", "subdivisions" => "", "isp" => "", "autonomousSystemNumber" => "", "autonomousSystemOrganization" => "", "connectionType" => "", "connectionUsageType" => "", "connectionOrganization" => "", "time" => "", "projectId" => "", "teamId" => "", "hostname" => "", "sdk" => "", "sdkVersion" => "" }.merge(map)
102
+ map = { "$id" => "", "actorType" => "", "actorId" => "", "actorEmail" => "", "actorName" => "", "resourceParent" => "", "resourceType" => "", "resourceId" => "", "resource" => "", "event" => "", "userAgent" => "", "ip" => "", "mode" => "", "country" => "", "continentCode" => "", "city" => "", "subdivisions" => "", "isp" => "", "autonomousSystemNumber" => "", "autonomousSystemOrganization" => "", "connectionType" => "", "connectionUsageType" => "", "connectionOrganization" => "", "time" => "", "projectId" => "", "teamId" => "", "hostname" => "", "sdk" => "", "sdkVersion" => "", "reason" => "" }.merge(map)
100
103
  ActivityEvent.new(
101
104
  id: map["$id"],
102
105
  actor_type: map["actorType"],
@@ -126,7 +129,8 @@ module Appwrite
126
129
  team_id: map["teamId"],
127
130
  hostname: map["hostname"],
128
131
  sdk: map["sdk"],
129
- sdk_version: map["sdkVersion"]
132
+ sdk_version: map["sdkVersion"],
133
+ reason: map["reason"]
130
134
  )
131
135
  end
132
136
 
@@ -160,7 +164,8 @@ module Appwrite
160
164
  "teamId": @team_id,
161
165
  "hostname": @hostname,
162
166
  "sdk": @sdk,
163
- "sdkVersion": @sdk_version
167
+ "sdkVersion": @sdk_version,
168
+ "reason": @reason
164
169
  }
165
170
  end
166
171
  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,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Device
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :expire
10
+ attr_reader :active_session_id
11
+ attr_reader :sessions
12
+ attr_reader :secret
13
+
14
+ def initialize(
15
+ id:,
16
+ created_at:,
17
+ updated_at:,
18
+ expire:,
19
+ active_session_id:,
20
+ sessions:,
21
+ secret:
22
+ )
23
+ @id = id
24
+ @created_at = created_at
25
+ @updated_at = updated_at
26
+ @expire = expire
27
+ @active_session_id = active_session_id
28
+ @sessions = sessions
29
+ @secret = secret
30
+ end
31
+
32
+ def self.from(map:)
33
+ map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "expire" => "", "activeSessionId" => "", "sessions" => [], "secret" => "" }.merge(map)
34
+ Device.new(
35
+ id: map["$id"],
36
+ created_at: map["$createdAt"],
37
+ updated_at: map["$updatedAt"],
38
+ expire: map["expire"],
39
+ active_session_id: map["activeSessionId"],
40
+ sessions: map["sessions"].map { |it| Session.from(map: it) },
41
+ secret: map["secret"]
42
+ )
43
+ end
44
+
45
+ def to_map
46
+ {
47
+ "$id": @id,
48
+ "$createdAt": @created_at,
49
+ "$updatedAt": @updated_at,
50
+ "expire": @expire,
51
+ "activeSessionId": @active_session_id,
52
+ "sessions": @sessions.map { |it| it.to_map },
53
+ "secret": @secret
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Environment
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :project_id
10
+ attr_reader :name
11
+
12
+ def initialize(
13
+ id:,
14
+ created_at:,
15
+ updated_at:,
16
+ project_id:,
17
+ name:
18
+ )
19
+ @id = id
20
+ @created_at = created_at
21
+ @updated_at = updated_at
22
+ @project_id = project_id
23
+ @name = name
24
+ end
25
+
26
+ def self.from(map:)
27
+ map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "projectId" => "", "name" => "" }.merge(map)
28
+ Environment.new(
29
+ id: map["$id"],
30
+ created_at: map["$createdAt"],
31
+ updated_at: map["$updatedAt"],
32
+ project_id: map["projectId"],
33
+ name: map["name"]
34
+ )
35
+ end
36
+
37
+ def to_map
38
+ {
39
+ "$id": @id,
40
+ "$createdAt": @created_at,
41
+ "$updatedAt": @updated_at,
42
+ "projectId": @project_id,
43
+ "name": @name
44
+ }
45
+ end
46
+ end
47
+ end
48
+ end