appwrite 20.1.0 → 21.0.1

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 +1 -2
  3. data/lib/appwrite/enums/backup_services.rb +9 -0
  4. data/lib/appwrite/enums/browser_permission.rb +26 -0
  5. data/lib/appwrite/enums/build_runtime.rb +22 -3
  6. data/lib/appwrite/enums/deployment_status.rb +1 -0
  7. data/lib/appwrite/enums/name.rb +1 -0
  8. data/lib/appwrite/enums/o_auth_provider.rb +0 -1
  9. data/lib/appwrite/enums/order_by.rb +8 -0
  10. data/lib/appwrite/enums/runtime.rb +22 -3
  11. data/lib/appwrite/enums/scopes.rb +72 -0
  12. data/lib/appwrite/models/activity_event.rb +182 -0
  13. data/lib/appwrite/models/activity_event_list.rb +32 -0
  14. data/lib/appwrite/models/attribute_longtext.rb +91 -0
  15. data/lib/appwrite/models/attribute_mediumtext.rb +91 -0
  16. data/lib/appwrite/models/attribute_text.rb +91 -0
  17. data/lib/appwrite/models/attribute_varchar.rb +96 -0
  18. data/lib/appwrite/models/backup_archive.rb +82 -0
  19. data/lib/appwrite/models/backup_archive_list.rb +32 -0
  20. data/lib/appwrite/models/backup_policy.rb +77 -0
  21. data/lib/appwrite/models/backup_policy_list.rb +32 -0
  22. data/lib/appwrite/models/backup_restoration.rb +77 -0
  23. data/lib/appwrite/models/backup_restoration_list.rb +32 -0
  24. data/lib/appwrite/models/bucket.rb +8 -3
  25. data/lib/appwrite/models/collection.rb +13 -3
  26. data/lib/appwrite/models/column_longtext.rb +91 -0
  27. data/lib/appwrite/models/column_mediumtext.rb +91 -0
  28. data/lib/appwrite/models/column_text.rb +91 -0
  29. data/lib/appwrite/models/column_varchar.rb +96 -0
  30. data/lib/appwrite/models/database.rb +13 -3
  31. data/lib/appwrite/models/deployment.rb +1 -0
  32. data/lib/appwrite/models/file.rb +13 -3
  33. data/lib/appwrite/models/health_status_list.rb +32 -0
  34. data/lib/appwrite/models/table.rb +13 -3
  35. data/lib/appwrite/query.rb +52 -0
  36. data/lib/appwrite/services/account.rb +3 -1
  37. data/lib/appwrite/services/activities.rb +64 -0
  38. data/lib/appwrite/services/avatars.rb +1 -1
  39. data/lib/appwrite/services/backups.rb +383 -0
  40. data/lib/appwrite/services/databases.rb +456 -15
  41. data/lib/appwrite/services/health.rb +151 -6
  42. data/lib/appwrite/services/storage.rb +8 -8
  43. data/lib/appwrite/services/tables_db.rb +461 -10
  44. data/lib/appwrite.rb +24 -2
  45. metadata +27 -5
  46. data/lib/appwrite/enums/output.rb +0 -13
@@ -0,0 +1,91 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeMediumtext
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :error
10
+ attr_reader :required
11
+ attr_reader :array
12
+ attr_reader :created_at
13
+ attr_reader :updated_at
14
+ attr_reader :default
15
+ attr_reader :encrypt
16
+
17
+ def initialize(
18
+ key:,
19
+ type:,
20
+ status:,
21
+ error:,
22
+ required:,
23
+ array: ,
24
+ created_at:,
25
+ updated_at:,
26
+ default: ,
27
+ encrypt:
28
+ )
29
+ @key = key
30
+ @type = type
31
+ @status = validate_status(status)
32
+ @error = error
33
+ @required = required
34
+ @array = array
35
+ @created_at = created_at
36
+ @updated_at = updated_at
37
+ @default = default
38
+ @encrypt = encrypt
39
+ end
40
+
41
+ def self.from(map:)
42
+ AttributeMediumtext.new(
43
+ key: map["key"],
44
+ type: map["type"],
45
+ status: map["status"],
46
+ error: map["error"],
47
+ required: map["required"],
48
+ array: map["array"],
49
+ created_at: map["$createdAt"],
50
+ updated_at: map["$updatedAt"],
51
+ default: map["default"],
52
+ encrypt: map["encrypt"]
53
+ )
54
+ end
55
+
56
+ def to_map
57
+ {
58
+ "key": @key,
59
+ "type": @type,
60
+ "status": @status,
61
+ "error": @error,
62
+ "required": @required,
63
+ "array": @array,
64
+ "$createdAt": @created_at,
65
+ "$updatedAt": @updated_at,
66
+ "default": @default,
67
+ "encrypt": @encrypt
68
+ }
69
+ end
70
+
71
+ private
72
+
73
+ def validate_status(status)
74
+ valid_status = [
75
+ Appwrite::Enums::AttributeStatus::AVAILABLE,
76
+ Appwrite::Enums::AttributeStatus::PROCESSING,
77
+ Appwrite::Enums::AttributeStatus::DELETING,
78
+ Appwrite::Enums::AttributeStatus::STUCK,
79
+ Appwrite::Enums::AttributeStatus::FAILED,
80
+ ]
81
+
82
+ unless valid_status.include?(status)
83
+ raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
84
+ end
85
+
86
+ status
87
+ end
88
+
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,91 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeText
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :error
10
+ attr_reader :required
11
+ attr_reader :array
12
+ attr_reader :created_at
13
+ attr_reader :updated_at
14
+ attr_reader :default
15
+ attr_reader :encrypt
16
+
17
+ def initialize(
18
+ key:,
19
+ type:,
20
+ status:,
21
+ error:,
22
+ required:,
23
+ array: ,
24
+ created_at:,
25
+ updated_at:,
26
+ default: ,
27
+ encrypt:
28
+ )
29
+ @key = key
30
+ @type = type
31
+ @status = validate_status(status)
32
+ @error = error
33
+ @required = required
34
+ @array = array
35
+ @created_at = created_at
36
+ @updated_at = updated_at
37
+ @default = default
38
+ @encrypt = encrypt
39
+ end
40
+
41
+ def self.from(map:)
42
+ AttributeText.new(
43
+ key: map["key"],
44
+ type: map["type"],
45
+ status: map["status"],
46
+ error: map["error"],
47
+ required: map["required"],
48
+ array: map["array"],
49
+ created_at: map["$createdAt"],
50
+ updated_at: map["$updatedAt"],
51
+ default: map["default"],
52
+ encrypt: map["encrypt"]
53
+ )
54
+ end
55
+
56
+ def to_map
57
+ {
58
+ "key": @key,
59
+ "type": @type,
60
+ "status": @status,
61
+ "error": @error,
62
+ "required": @required,
63
+ "array": @array,
64
+ "$createdAt": @created_at,
65
+ "$updatedAt": @updated_at,
66
+ "default": @default,
67
+ "encrypt": @encrypt
68
+ }
69
+ end
70
+
71
+ private
72
+
73
+ def validate_status(status)
74
+ valid_status = [
75
+ Appwrite::Enums::AttributeStatus::AVAILABLE,
76
+ Appwrite::Enums::AttributeStatus::PROCESSING,
77
+ Appwrite::Enums::AttributeStatus::DELETING,
78
+ Appwrite::Enums::AttributeStatus::STUCK,
79
+ Appwrite::Enums::AttributeStatus::FAILED,
80
+ ]
81
+
82
+ unless valid_status.include?(status)
83
+ raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
84
+ end
85
+
86
+ status
87
+ end
88
+
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,96 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeVarchar
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :error
10
+ attr_reader :required
11
+ attr_reader :array
12
+ attr_reader :created_at
13
+ attr_reader :updated_at
14
+ attr_reader :size
15
+ attr_reader :default
16
+ attr_reader :encrypt
17
+
18
+ def initialize(
19
+ key:,
20
+ type:,
21
+ status:,
22
+ error:,
23
+ required:,
24
+ array: ,
25
+ created_at:,
26
+ updated_at:,
27
+ size:,
28
+ default: ,
29
+ encrypt:
30
+ )
31
+ @key = key
32
+ @type = type
33
+ @status = validate_status(status)
34
+ @error = error
35
+ @required = required
36
+ @array = array
37
+ @created_at = created_at
38
+ @updated_at = updated_at
39
+ @size = size
40
+ @default = default
41
+ @encrypt = encrypt
42
+ end
43
+
44
+ def self.from(map:)
45
+ AttributeVarchar.new(
46
+ key: map["key"],
47
+ type: map["type"],
48
+ status: map["status"],
49
+ error: map["error"],
50
+ required: map["required"],
51
+ array: map["array"],
52
+ created_at: map["$createdAt"],
53
+ updated_at: map["$updatedAt"],
54
+ size: map["size"],
55
+ default: map["default"],
56
+ encrypt: map["encrypt"]
57
+ )
58
+ end
59
+
60
+ def to_map
61
+ {
62
+ "key": @key,
63
+ "type": @type,
64
+ "status": @status,
65
+ "error": @error,
66
+ "required": @required,
67
+ "array": @array,
68
+ "$createdAt": @created_at,
69
+ "$updatedAt": @updated_at,
70
+ "size": @size,
71
+ "default": @default,
72
+ "encrypt": @encrypt
73
+ }
74
+ end
75
+
76
+ private
77
+
78
+ def validate_status(status)
79
+ valid_status = [
80
+ Appwrite::Enums::AttributeStatus::AVAILABLE,
81
+ Appwrite::Enums::AttributeStatus::PROCESSING,
82
+ Appwrite::Enums::AttributeStatus::DELETING,
83
+ Appwrite::Enums::AttributeStatus::STUCK,
84
+ Appwrite::Enums::AttributeStatus::FAILED,
85
+ ]
86
+
87
+ unless valid_status.include?(status)
88
+ raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
89
+ end
90
+
91
+ status
92
+ end
93
+
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,82 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class BackupArchive
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :policy_id
10
+ attr_reader :size
11
+ attr_reader :status
12
+ attr_reader :started_at
13
+ attr_reader :migration_id
14
+ attr_reader :services
15
+ attr_reader :resources
16
+ attr_reader :resource_id
17
+ attr_reader :resource_type
18
+
19
+ def initialize(
20
+ id:,
21
+ created_at:,
22
+ updated_at:,
23
+ policy_id:,
24
+ size:,
25
+ status:,
26
+ started_at:,
27
+ migration_id:,
28
+ services:,
29
+ resources:,
30
+ resource_id: ,
31
+ resource_type:
32
+ )
33
+ @id = id
34
+ @created_at = created_at
35
+ @updated_at = updated_at
36
+ @policy_id = policy_id
37
+ @size = size
38
+ @status = status
39
+ @started_at = started_at
40
+ @migration_id = migration_id
41
+ @services = services
42
+ @resources = resources
43
+ @resource_id = resource_id
44
+ @resource_type = resource_type
45
+ end
46
+
47
+ def self.from(map:)
48
+ BackupArchive.new(
49
+ id: map["$id"],
50
+ created_at: map["$createdAt"],
51
+ updated_at: map["$updatedAt"],
52
+ policy_id: map["policyId"],
53
+ size: map["size"],
54
+ status: map["status"],
55
+ started_at: map["startedAt"],
56
+ migration_id: map["migrationId"],
57
+ services: map["services"],
58
+ resources: map["resources"],
59
+ resource_id: map["resourceId"],
60
+ resource_type: map["resourceType"]
61
+ )
62
+ end
63
+
64
+ def to_map
65
+ {
66
+ "$id": @id,
67
+ "$createdAt": @created_at,
68
+ "$updatedAt": @updated_at,
69
+ "policyId": @policy_id,
70
+ "size": @size,
71
+ "status": @status,
72
+ "startedAt": @started_at,
73
+ "migrationId": @migration_id,
74
+ "services": @services,
75
+ "resources": @resources,
76
+ "resourceId": @resource_id,
77
+ "resourceType": @resource_type
78
+ }
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class BackupArchiveList
6
+ attr_reader :total
7
+ attr_reader :archives
8
+
9
+ def initialize(
10
+ total:,
11
+ archives:
12
+ )
13
+ @total = total
14
+ @archives = archives
15
+ end
16
+
17
+ def self.from(map:)
18
+ BackupArchiveList.new(
19
+ total: map["total"],
20
+ archives: map["archives"].map { |it| BackupArchive.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "archives": @archives.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,77 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class BackupPolicy
6
+ attr_reader :id
7
+ attr_reader :name
8
+ attr_reader :created_at
9
+ attr_reader :updated_at
10
+ attr_reader :services
11
+ attr_reader :resources
12
+ attr_reader :resource_id
13
+ attr_reader :resource_type
14
+ attr_reader :retention
15
+ attr_reader :schedule
16
+ attr_reader :enabled
17
+
18
+ def initialize(
19
+ id:,
20
+ name:,
21
+ created_at:,
22
+ updated_at:,
23
+ services:,
24
+ resources:,
25
+ resource_id: ,
26
+ resource_type: ,
27
+ retention:,
28
+ schedule:,
29
+ enabled:
30
+ )
31
+ @id = id
32
+ @name = name
33
+ @created_at = created_at
34
+ @updated_at = updated_at
35
+ @services = services
36
+ @resources = resources
37
+ @resource_id = resource_id
38
+ @resource_type = resource_type
39
+ @retention = retention
40
+ @schedule = schedule
41
+ @enabled = enabled
42
+ end
43
+
44
+ def self.from(map:)
45
+ BackupPolicy.new(
46
+ id: map["$id"],
47
+ name: map["name"],
48
+ created_at: map["$createdAt"],
49
+ updated_at: map["$updatedAt"],
50
+ services: map["services"],
51
+ resources: map["resources"],
52
+ resource_id: map["resourceId"],
53
+ resource_type: map["resourceType"],
54
+ retention: map["retention"],
55
+ schedule: map["schedule"],
56
+ enabled: map["enabled"]
57
+ )
58
+ end
59
+
60
+ def to_map
61
+ {
62
+ "$id": @id,
63
+ "name": @name,
64
+ "$createdAt": @created_at,
65
+ "$updatedAt": @updated_at,
66
+ "services": @services,
67
+ "resources": @resources,
68
+ "resourceId": @resource_id,
69
+ "resourceType": @resource_type,
70
+ "retention": @retention,
71
+ "schedule": @schedule,
72
+ "enabled": @enabled
73
+ }
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class BackupPolicyList
6
+ attr_reader :total
7
+ attr_reader :policies
8
+
9
+ def initialize(
10
+ total:,
11
+ policies:
12
+ )
13
+ @total = total
14
+ @policies = policies
15
+ end
16
+
17
+ def self.from(map:)
18
+ BackupPolicyList.new(
19
+ total: map["total"],
20
+ policies: map["policies"].map { |it| BackupPolicy.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "policies": @policies.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,77 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class BackupRestoration
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :archive_id
10
+ attr_reader :policy_id
11
+ attr_reader :status
12
+ attr_reader :started_at
13
+ attr_reader :migration_id
14
+ attr_reader :services
15
+ attr_reader :resources
16
+ attr_reader :options
17
+
18
+ def initialize(
19
+ id:,
20
+ created_at:,
21
+ updated_at:,
22
+ archive_id:,
23
+ policy_id:,
24
+ status:,
25
+ started_at:,
26
+ migration_id:,
27
+ services:,
28
+ resources:,
29
+ options:
30
+ )
31
+ @id = id
32
+ @created_at = created_at
33
+ @updated_at = updated_at
34
+ @archive_id = archive_id
35
+ @policy_id = policy_id
36
+ @status = status
37
+ @started_at = started_at
38
+ @migration_id = migration_id
39
+ @services = services
40
+ @resources = resources
41
+ @options = options
42
+ end
43
+
44
+ def self.from(map:)
45
+ BackupRestoration.new(
46
+ id: map["$id"],
47
+ created_at: map["$createdAt"],
48
+ updated_at: map["$updatedAt"],
49
+ archive_id: map["archiveId"],
50
+ policy_id: map["policyId"],
51
+ status: map["status"],
52
+ started_at: map["startedAt"],
53
+ migration_id: map["migrationId"],
54
+ services: map["services"],
55
+ resources: map["resources"],
56
+ options: map["options"]
57
+ )
58
+ end
59
+
60
+ def to_map
61
+ {
62
+ "$id": @id,
63
+ "$createdAt": @created_at,
64
+ "$updatedAt": @updated_at,
65
+ "archiveId": @archive_id,
66
+ "policyId": @policy_id,
67
+ "status": @status,
68
+ "startedAt": @started_at,
69
+ "migrationId": @migration_id,
70
+ "services": @services,
71
+ "resources": @resources,
72
+ "options": @options
73
+ }
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class BackupRestorationList
6
+ attr_reader :total
7
+ attr_reader :restorations
8
+
9
+ def initialize(
10
+ total:,
11
+ restorations:
12
+ )
13
+ @total = total
14
+ @restorations = restorations
15
+ end
16
+
17
+ def self.from(map:)
18
+ BackupRestorationList.new(
19
+ total: map["total"],
20
+ restorations: map["restorations"].map { |it| BackupRestoration.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "restorations": @restorations.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -16,6 +16,7 @@ module Appwrite
16
16
  attr_reader :encryption
17
17
  attr_reader :antivirus
18
18
  attr_reader :transformations
19
+ attr_reader :total_size
19
20
 
20
21
  def initialize(
21
22
  id:,
@@ -30,7 +31,8 @@ module Appwrite
30
31
  compression:,
31
32
  encryption:,
32
33
  antivirus:,
33
- transformations:
34
+ transformations:,
35
+ total_size:
34
36
  )
35
37
  @id = id
36
38
  @created_at = created_at
@@ -45,6 +47,7 @@ module Appwrite
45
47
  @encryption = encryption
46
48
  @antivirus = antivirus
47
49
  @transformations = transformations
50
+ @total_size = total_size
48
51
  end
49
52
 
50
53
  def self.from(map:)
@@ -61,7 +64,8 @@ module Appwrite
61
64
  compression: map["compression"],
62
65
  encryption: map["encryption"],
63
66
  antivirus: map["antivirus"],
64
- transformations: map["transformations"]
67
+ transformations: map["transformations"],
68
+ total_size: map["totalSize"]
65
69
  )
66
70
  end
67
71
 
@@ -79,7 +83,8 @@ module Appwrite
79
83
  "compression": @compression,
80
84
  "encryption": @encryption,
81
85
  "antivirus": @antivirus,
82
- "transformations": @transformations
86
+ "transformations": @transformations,
87
+ "totalSize": @total_size
83
88
  }
84
89
  end
85
90
  end