appwrite 7.0.0 → 8.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f348d926b806a8e4c869a935255d10dddb582059678f30bde0d70546ff6a25a5
4
- data.tar.gz: 69f280998be28ef53c23a1b36e44d15c877c7eae2c751f9482a4d0a05b63d70e
3
+ metadata.gz: 9887f972b6c4397ea1d2ec97bed57443f2d52df1beb4a2b6096d6d50a2942fdc
4
+ data.tar.gz: 5ff79e810868231c637b4d23145787db5300fe2230b205dfbcb2eb4c58e3f644
5
5
  SHA512:
6
- metadata.gz: 659e48d2a39aae8cf35b0805ced376de2b08faa97584b72bb5dfc396b14e8d7e44753a7daf467d134197f9d9581e9a2a40411f6ab79b0a18826f35f2f6e3ae5b
7
- data.tar.gz: 944ad30238981881d3fd9b4cac567152777cf9ddaf50b6aa7e8953ed43e987d5d48c2d5a290be188388e912fda18d60e6c80b05d8ccfaa9650d03ee1f52dd4b0
6
+ metadata.gz: 5e6fe6ffc1354374f05f88e7f5a7885d6f61535a545b87d5d664d6af9fa2c3d4399869d7308463a69b04fa94803342ff2c47f9141440ad26264c2e4659a789a8
7
+ data.tar.gz: 4f097152d343fe3bceaa7c7423d475359e46f26e546885233bc18636dcfa5db656e01deaa4b66df8c5df41b46e6c02648819898685d8bccaaac67e7ded4bcb53
@@ -15,7 +15,7 @@ module Appwrite
15
15
  'x-sdk-name'=> 'Ruby',
16
16
  'x-sdk-platform'=> 'server',
17
17
  'x-sdk-language'=> 'ruby',
18
- 'x-sdk-version'=> '7.0.0',
18
+ 'x-sdk-version'=> '8.0.0',
19
19
  'X-Appwrite-Response-Format' => '1.0.0'
20
20
  }
21
21
  @endpoint = 'https://HOSTNAME/v1'
@@ -3,15 +3,18 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoArgon2
6
+ attr_reader :type
6
7
  attr_reader :memory_cost
7
8
  attr_reader :time_cost
8
9
  attr_reader :threads
9
10
 
10
11
  def initialize(
12
+ type:,
11
13
  memory_cost:,
12
14
  time_cost:,
13
15
  threads:
14
16
  )
17
+ @type = type
15
18
  @memory_cost = memory_cost
16
19
  @time_cost = time_cost
17
20
  @threads = threads
@@ -19,6 +22,7 @@ module Appwrite
19
22
 
20
23
  def self.from(map:)
21
24
  AlgoArgon2.new(
25
+ type: map["type"],
22
26
  memory_cost: map["memoryCost"],
23
27
  time_cost: map["timeCost"],
24
28
  threads: map["threads"]
@@ -27,6 +31,7 @@ module Appwrite
27
31
 
28
32
  def to_map
29
33
  {
34
+ "type": @type,
30
35
  "memoryCost": @memory_cost,
31
36
  "timeCost": @time_cost,
32
37
  "threads": @threads
@@ -3,18 +3,23 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoBcrypt
6
+ attr_reader :type
6
7
 
7
8
  def initialize(
9
+ type:
8
10
  )
11
+ @type = type
9
12
  end
10
13
 
11
14
  def self.from(map:)
12
15
  AlgoBcrypt.new(
16
+ type: map["type"]
13
17
  )
14
18
  end
15
19
 
16
20
  def to_map
17
21
  {
22
+ "type": @type
18
23
  }
19
24
  end
20
25
  end
@@ -3,18 +3,23 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoMd5
6
+ attr_reader :type
6
7
 
7
8
  def initialize(
9
+ type:
8
10
  )
11
+ @type = type
9
12
  end
10
13
 
11
14
  def self.from(map:)
12
15
  AlgoMd5.new(
16
+ type: map["type"]
13
17
  )
14
18
  end
15
19
 
16
20
  def to_map
17
21
  {
22
+ "type": @type
18
23
  }
19
24
  end
20
25
  end
@@ -3,18 +3,23 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoPhpass
6
+ attr_reader :type
6
7
 
7
8
  def initialize(
9
+ type:
8
10
  )
11
+ @type = type
9
12
  end
10
13
 
11
14
  def self.from(map:)
12
15
  AlgoPhpass.new(
16
+ type: map["type"]
13
17
  )
14
18
  end
15
19
 
16
20
  def to_map
17
21
  {
22
+ "type": @type
18
23
  }
19
24
  end
20
25
  end
@@ -3,17 +3,20 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoScrypt
6
+ attr_reader :type
6
7
  attr_reader :cost_cpu
7
8
  attr_reader :cost_memory
8
9
  attr_reader :cost_parallel
9
10
  attr_reader :length
10
11
 
11
12
  def initialize(
13
+ type:,
12
14
  cost_cpu:,
13
15
  cost_memory:,
14
16
  cost_parallel:,
15
17
  length:
16
18
  )
19
+ @type = type
17
20
  @cost_cpu = cost_cpu
18
21
  @cost_memory = cost_memory
19
22
  @cost_parallel = cost_parallel
@@ -22,6 +25,7 @@ module Appwrite
22
25
 
23
26
  def self.from(map:)
24
27
  AlgoScrypt.new(
28
+ type: map["type"],
25
29
  cost_cpu: map["costCpu"],
26
30
  cost_memory: map["costMemory"],
27
31
  cost_parallel: map["costParallel"],
@@ -31,6 +35,7 @@ module Appwrite
31
35
 
32
36
  def to_map
33
37
  {
38
+ "type": @type,
34
39
  "costCpu": @cost_cpu,
35
40
  "costMemory": @cost_memory,
36
41
  "costParallel": @cost_parallel,
@@ -3,15 +3,18 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoScryptModified
6
+ attr_reader :type
6
7
  attr_reader :salt
7
8
  attr_reader :salt_separator
8
9
  attr_reader :signer_key
9
10
 
10
11
  def initialize(
12
+ type:,
11
13
  salt:,
12
14
  salt_separator:,
13
15
  signer_key:
14
16
  )
17
+ @type = type
15
18
  @salt = salt
16
19
  @salt_separator = salt_separator
17
20
  @signer_key = signer_key
@@ -19,6 +22,7 @@ module Appwrite
19
22
 
20
23
  def self.from(map:)
21
24
  AlgoScryptModified.new(
25
+ type: map["type"],
22
26
  salt: map["salt"],
23
27
  salt_separator: map["saltSeparator"],
24
28
  signer_key: map["signerKey"]
@@ -27,6 +31,7 @@ module Appwrite
27
31
 
28
32
  def to_map
29
33
  {
34
+ "type": @type,
30
35
  "salt": @salt,
31
36
  "saltSeparator": @salt_separator,
32
37
  "signerKey": @signer_key
@@ -3,18 +3,23 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class AlgoSha
6
+ attr_reader :type
6
7
 
7
8
  def initialize(
9
+ type:
8
10
  )
11
+ @type = type
9
12
  end
10
13
 
11
14
  def self.from(map:)
12
15
  AlgoSha.new(
16
+ type: map["type"]
13
17
  )
14
18
  end
15
19
 
16
20
  def to_map
17
21
  {
22
+ "type": @type
18
23
  }
19
24
  end
20
25
  end
@@ -0,0 +1,77 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeRelationship
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :required
10
+ attr_reader :array
11
+ attr_reader :related_collection
12
+ attr_reader :relation_type
13
+ attr_reader :two_way
14
+ attr_reader :two_way_key
15
+ attr_reader :on_delete
16
+ attr_reader :side
17
+
18
+ def initialize(
19
+ key:,
20
+ type:,
21
+ status:,
22
+ required:,
23
+ array: ,
24
+ related_collection:,
25
+ relation_type:,
26
+ two_way:,
27
+ two_way_key:,
28
+ on_delete:,
29
+ side:
30
+ )
31
+ @key = key
32
+ @type = type
33
+ @status = status
34
+ @required = required
35
+ @array = array
36
+ @related_collection = related_collection
37
+ @relation_type = relation_type
38
+ @two_way = two_way
39
+ @two_way_key = two_way_key
40
+ @on_delete = on_delete
41
+ @side = side
42
+ end
43
+
44
+ def self.from(map:)
45
+ AttributeRelationship.new(
46
+ key: map["key"],
47
+ type: map["type"],
48
+ status: map["status"],
49
+ required: map["required"],
50
+ array: map["array"],
51
+ related_collection: map["relatedCollection"],
52
+ relation_type: map["relationType"],
53
+ two_way: map["twoWay"],
54
+ two_way_key: map["twoWayKey"],
55
+ on_delete: map["onDelete"],
56
+ side: map["side"]
57
+ )
58
+ end
59
+
60
+ def to_map
61
+ {
62
+ "key": @key,
63
+ "type": @type,
64
+ "status": @status,
65
+ "required": @required,
66
+ "array": @array,
67
+ "relatedCollection": @related_collection,
68
+ "relationType": @relation_type,
69
+ "twoWay": @two_way,
70
+ "twoWayKey": @two_way_key,
71
+ "onDelete": @on_delete,
72
+ "side": @side
73
+ }
74
+ end
75
+ end
76
+ end
77
+ end
@@ -15,6 +15,7 @@ module Appwrite
15
15
  attr_reader :status
16
16
  attr_reader :build_stdout
17
17
  attr_reader :build_stderr
18
+ attr_reader :build_time
18
19
 
19
20
  def initialize(
20
21
  id:,
@@ -28,7 +29,8 @@ module Appwrite
28
29
  activate:,
29
30
  status:,
30
31
  build_stdout:,
31
- build_stderr:
32
+ build_stderr:,
33
+ build_time:
32
34
  )
33
35
  @id = id
34
36
  @created_at = created_at
@@ -42,6 +44,7 @@ module Appwrite
42
44
  @status = status
43
45
  @build_stdout = build_stdout
44
46
  @build_stderr = build_stderr
47
+ @build_time = build_time
45
48
  end
46
49
 
47
50
  def self.from(map:)
@@ -57,7 +60,8 @@ module Appwrite
57
60
  activate: map["activate"],
58
61
  status: map["status"],
59
62
  build_stdout: map["buildStdout"],
60
- build_stderr: map["buildStderr"]
63
+ build_stderr: map["buildStderr"],
64
+ build_time: map["buildTime"]
61
65
  )
62
66
  end
63
67
 
@@ -74,7 +78,8 @@ module Appwrite
74
78
  "activate": @activate,
75
79
  "status": @status,
76
80
  "buildStdout": @build_stdout,
77
- "buildStderr": @build_stderr
81
+ "buildStderr": @build_stderr,
82
+ "buildTime": @build_time
78
83
  }
79
84
  end
80
85
  end
@@ -8,19 +8,22 @@ module Appwrite
8
8
  attr_reader :updated_at
9
9
  attr_reader :name
10
10
  attr_reader :total
11
+ attr_reader :prefs
11
12
 
12
13
  def initialize(
13
14
  id:,
14
15
  created_at:,
15
16
  updated_at:,
16
17
  name:,
17
- total:
18
+ total:,
19
+ prefs:
18
20
  )
19
21
  @id = id
20
22
  @created_at = created_at
21
23
  @updated_at = updated_at
22
24
  @name = name
23
25
  @total = total
26
+ @prefs = prefs
24
27
  end
25
28
 
26
29
  def self.from(map:)
@@ -29,7 +32,8 @@ module Appwrite
29
32
  created_at: map["$createdAt"],
30
33
  updated_at: map["$updatedAt"],
31
34
  name: map["name"],
32
- total: map["total"]
35
+ total: map["total"],
36
+ prefs: Preferences.from(map: map["prefs"])
33
37
  )
34
38
  end
35
39
 
@@ -39,7 +43,8 @@ module Appwrite
39
43
  "$createdAt": @created_at,
40
44
  "$updatedAt": @updated_at,
41
45
  "name": @name,
42
- "total": @total
46
+ "total": @total,
47
+ "prefs": @prefs.to_map
43
48
  }
44
49
  end
45
50
  end
@@ -24,9 +24,9 @@ module Appwrite
24
24
  created_at:,
25
25
  updated_at:,
26
26
  name:,
27
- password:,
28
- hash:,
29
- hash_options:,
27
+ password: ,
28
+ hash: ,
29
+ hash_options: ,
30
30
  registration:,
31
31
  status:,
32
32
  password_update:,
@@ -2,46 +2,70 @@ module Appwrite
2
2
  class Query
3
3
  class << Query
4
4
  def equal(attribute, value)
5
- return addQuery(attribute, "equal", value)
5
+ return add_query(attribute, "equal", value)
6
6
  end
7
7
 
8
- def notEqual(attribute, value)
9
- return addQuery(attribute, "notEqual", value)
8
+ def not_equal(attribute, value)
9
+ return add_query(attribute, "notEqual", value)
10
10
  end
11
11
 
12
- def lessThan(attribute, value)
13
- return addQuery(attribute, "lessThan", value)
12
+ def less_than(attribute, value)
13
+ return add_query(attribute, "lessThan", value)
14
14
  end
15
15
 
16
- def lessThanEqual(attribute, value)
17
- return addQuery(attribute, "lessThanEqual", value)
16
+ def less_than_equal(attribute, value)
17
+ return add_query(attribute, "lessThanEqual", value)
18
18
  end
19
19
 
20
- def greaterThan(attribute, value)
21
- return addQuery(attribute, "greaterThan", value)
20
+ def greater_than(attribute, value)
21
+ return add_query(attribute, "greaterThan", value)
22
22
  end
23
23
 
24
- def greaterThanEqual(attribute, value)
25
- return addQuery(attribute, "greaterThanEqual", value)
24
+ def greater_than_equal(attribute, value)
25
+ return add_query(attribute, "greaterThanEqual", value)
26
+ end
27
+
28
+ def is_null(attribute)
29
+ return "isNull(\"#{attribute}\")"
30
+ end
31
+
32
+ def is_not_null(attribute)
33
+ return "isNotNull(\"#{attribute}\")"
34
+ end
35
+
36
+ def between(attribute, start, ending)
37
+ return add_query(attribute, "between", [start, ending])
38
+ end
39
+
40
+ def starts_with(attribute, value)
41
+ return add_query(attribute, "startsWith", value)
42
+ end
43
+
44
+ def ends_with(attribute, value)
45
+ return add_query(attribute, "endsWith", value)
46
+ end
47
+
48
+ def select(attributes)
49
+ return "select([#{attributes.map {|attribute| "\"#{attribute}\""}.join(',')}])"
26
50
  end
27
51
 
28
52
  def search(attribute, value)
29
- return addQuery(attribute, "search", value)
53
+ return add_query(attribute, "search", value)
30
54
  end
31
55
 
32
- def orderAsc(attribute)
56
+ def order_asc(attribute)
33
57
  return "orderAsc(\"#{attribute}\")"
34
58
  end
35
59
 
36
- def orderDesc(attribute)
60
+ def order_desc(attribute)
37
61
  return "orderDesc(\"#{attribute}\")"
38
62
  end
39
63
 
40
- def cursorBefore(id)
64
+ def cursor_before(id)
41
65
  return "cursorBefore(\"#{id}\")"
42
66
  end
43
67
 
44
- def cursorAfter(id)
68
+ def cursor_after(id)
45
69
  return "cursorAfter(\"#{id}\")"
46
70
  end
47
71
 
@@ -55,7 +79,7 @@ module Appwrite
55
79
 
56
80
  private
57
81
 
58
- def addQuery(attribute, method, value)
82
+ def add_query(attribute, method, value)
59
83
  if value.is_a?(Array)
60
84
  "#{method}(\"#{attribute}\", [#{value.map {|item| parseValues(item)}.join(',')}])"
61
85
  else
data/lib/appwrite/role.rb CHANGED
@@ -35,9 +35,5 @@ module Appwrite
35
35
  def self.member(id)
36
36
  "member:#{id}"
37
37
  end
38
-
39
- def self.status(status)
40
- "status:#{status}"
41
- end
42
38
  end
43
39
  end
@@ -10,7 +10,7 @@ module Appwrite
10
10
  # Get currently logged in user data as JSON object.
11
11
  #
12
12
  #
13
- # @return [Account]
13
+ # @return [User]
14
14
  def get()
15
15
  path = '/account'
16
16
 
@@ -26,7 +26,7 @@ module Appwrite
26
26
  path: path,
27
27
  headers: headers,
28
28
  params: params,
29
- response_type: Models::Account
29
+ response_type: Models::User
30
30
  )
31
31
  end
32
32
 
@@ -43,7 +43,7 @@ module Appwrite
43
43
  # @param [String] email User email.
44
44
  # @param [String] password User password. Must be at least 8 chars.
45
45
  #
46
- # @return [Account]
46
+ # @return [User]
47
47
  def update_email(email:, password:)
48
48
  path = '/account/email'
49
49
 
@@ -69,7 +69,7 @@ module Appwrite
69
69
  path: path,
70
70
  headers: headers,
71
71
  params: params,
72
- response_type: Models::Account
72
+ response_type: Models::User
73
73
  )
74
74
  end
75
75
 
@@ -77,7 +77,7 @@ module Appwrite
77
77
  # Get currently logged in user list of latest security activity logs. Each
78
78
  # log returns user IP address, location and date and time of log.
79
79
  #
80
- # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset
80
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
81
81
  #
82
82
  # @return [LogList]
83
83
  def list_logs(queries: nil)
@@ -105,7 +105,7 @@ module Appwrite
105
105
  #
106
106
  # @param [String] name User name. Max length: 128 chars.
107
107
  #
108
- # @return [Account]
108
+ # @return [User]
109
109
  def update_name(name:)
110
110
  path = '/account/name'
111
111
 
@@ -126,7 +126,7 @@ module Appwrite
126
126
  path: path,
127
127
  headers: headers,
128
128
  params: params,
129
- response_type: Models::Account
129
+ response_type: Models::User
130
130
  )
131
131
  end
132
132
 
@@ -138,7 +138,7 @@ module Appwrite
138
138
  # @param [String] password New user password. Must be at least 8 chars.
139
139
  # @param [String] old_password Current user password. Must be at least 8 chars.
140
140
  #
141
- # @return [Account]
141
+ # @return [User]
142
142
  def update_password(password:, old_password: nil)
143
143
  path = '/account/password'
144
144
 
@@ -160,7 +160,7 @@ module Appwrite
160
160
  path: path,
161
161
  headers: headers,
162
162
  params: params,
163
- response_type: Models::Account
163
+ response_type: Models::User
164
164
  )
165
165
  end
166
166
 
@@ -174,7 +174,7 @@ module Appwrite
174
174
  # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
175
175
  # @param [String] password User password. Must be at least 8 chars.
176
176
  #
177
- # @return [Account]
177
+ # @return [User]
178
178
  def update_phone(phone:, password:)
179
179
  path = '/account/phone'
180
180
 
@@ -200,7 +200,7 @@ module Appwrite
200
200
  path: path,
201
201
  headers: headers,
202
202
  params: params,
203
- response_type: Models::Account
203
+ response_type: Models::User
204
204
  )
205
205
  end
206
206
 
@@ -235,7 +235,7 @@ module Appwrite
235
235
  #
236
236
  # @param [Hash] prefs Prefs key-value JSON object.
237
237
  #
238
- # @return [Account]
238
+ # @return [User]
239
239
  def update_prefs(prefs:)
240
240
  path = '/account/prefs'
241
241
 
@@ -256,7 +256,7 @@ module Appwrite
256
256
  path: path,
257
257
  headers: headers,
258
258
  params: params,
259
- response_type: Models::Account
259
+ response_type: Models::User
260
260
  )
261
261
  end
262
262
 
@@ -509,7 +509,7 @@ module Appwrite
509
509
  # completely delete a user, use the Users API instead.
510
510
  #
511
511
  #
512
- # @return [Account]
512
+ # @return [User]
513
513
  def update_status()
514
514
  path = '/account/status'
515
515
 
@@ -525,7 +525,7 @@ module Appwrite
525
525
  path: path,
526
526
  headers: headers,
527
527
  params: params,
528
- response_type: Models::Account
528
+ response_type: Models::User
529
529
  )
530
530
  end
531
531