appwrite 19.1.0 → 19.3.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: 64a22a71e17b953f80760db4e8b9413488b2bc36f2e24ea383964f45c305066d
4
- data.tar.gz: e01febf3f51453fa219a17cbc795235f7b7fb67ed2358be4f8091a6bfa4f345a
3
+ metadata.gz: 2aaddcbf4e8387d0d89648eaf0b3e5604ef6d8c11ccf4ef369288b4eac6e1bb1
4
+ data.tar.gz: be874d5ab33af88bae8256508989da77a4479a14523adcfc561d98dae58878ec
5
5
  SHA512:
6
- metadata.gz: 6fff66c4c1f8ce87720e13c93581704597cf65ce96e0c171c099541079d8051dcd6bc143f6bf136b931ed4343a65175dec7908b7ef86f6e6a96f55a808dec41b
7
- data.tar.gz: 65af206356d68b6a79255dee4c799ab3f37ce7093bbc31c48b5527a05134c42c63d353615ab594d8b63e0431497baddbc2bb2151ad00b11494cec53be74b6c85
6
+ metadata.gz: 4c214db3bab97e7f48ed0ab32f615c1b4bd6132e169837ac42043698d7fa696102db97e853566a3fe30cc35ba3e9f635a08176f3ef27f1b154ab4676951cbc1f
7
+ data.tar.gz: 81e453cc99b7e2fd070f22a4724079390128f9d147541470035e458ccbaea6e71a8acefe72aa193ff6cde41167e4bbee0175a22a3cf581182cc330c3ea625c61
@@ -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'=> '19.1.0',
18
+ 'x-sdk-version'=> '19.3.0',
19
19
  'X-Appwrite-Response-Format' => '1.8.0'
20
20
  }
21
21
  @endpoint = 'https://cloud.appwrite.io/v1'
@@ -5,6 +5,7 @@ module Appwrite
5
5
  PROCESSING = 'processing'
6
6
  COMPLETED = 'completed'
7
7
  FAILED = 'failed'
8
+ SCHEDULED = 'scheduled'
8
9
  end
9
10
  end
10
11
  end
@@ -9,6 +9,7 @@ module Appwrite
9
9
  VUE = 'vue'
10
10
  SVELTEKIT = 'sveltekit'
11
11
  ASTRO = 'astro'
12
+ TANSTACK_START = 'tanstack-start'
12
13
  REMIX = 'remix'
13
14
  LYNX = 'lynx'
14
15
  FLUTTER = 'flutter'
@@ -130,6 +130,7 @@ module Appwrite
130
130
  Appwrite::Enums::ExecutionStatus::PROCESSING,
131
131
  Appwrite::Enums::ExecutionStatus::COMPLETED,
132
132
  Appwrite::Enums::ExecutionStatus::FAILED,
133
+ Appwrite::Enums::ExecutionStatus::SCHEDULED,
133
134
  ]
134
135
 
135
136
  unless valid_status.include?(status)
@@ -0,0 +1,52 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Transaction
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :status
10
+ attr_reader :operations
11
+ attr_reader :expires_at
12
+
13
+ def initialize(
14
+ id:,
15
+ created_at:,
16
+ updated_at:,
17
+ status:,
18
+ operations:,
19
+ expires_at:
20
+ )
21
+ @id = id
22
+ @created_at = created_at
23
+ @updated_at = updated_at
24
+ @status = status
25
+ @operations = operations
26
+ @expires_at = expires_at
27
+ end
28
+
29
+ def self.from(map:)
30
+ Transaction.new(
31
+ id: map["$id"],
32
+ created_at: map["$createdAt"],
33
+ updated_at: map["$updatedAt"],
34
+ status: map["status"],
35
+ operations: map["operations"],
36
+ expires_at: map["expiresAt"]
37
+ )
38
+ end
39
+
40
+ def to_map
41
+ {
42
+ "$id": @id,
43
+ "$createdAt": @created_at,
44
+ "$updatedAt": @updated_at,
45
+ "status": @status,
46
+ "operations": @operations,
47
+ "expiresAt": @expires_at
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class TransactionList
6
+ attr_reader :total
7
+ attr_reader :transactions
8
+
9
+ def initialize(
10
+ total:,
11
+ transactions:
12
+ )
13
+ @total = total
14
+ @transactions = transactions
15
+ end
16
+
17
+ def self.from(map:)
18
+ TransactionList.new(
19
+ total: map["total"],
20
+ transactions: map["transactions"].map { |it| Transaction.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "transactions": @transactions.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,145 @@
1
+ require 'json'
2
+
3
+ module Appwrite
4
+ module Condition
5
+ EQUAL = "equal"
6
+ NOT_EQUAL = "notEqual"
7
+ GREATER_THAN = "greaterThan"
8
+ GREATER_THAN_EQUAL = "greaterThanEqual"
9
+ LESS_THAN = "lessThan"
10
+ LESS_THAN_EQUAL = "lessThanEqual"
11
+ CONTAINS = "contains"
12
+ IS_NULL = "isNull"
13
+ IS_NOT_NULL = "isNotNull"
14
+ end
15
+
16
+ class Operator
17
+ def initialize(method, values = nil)
18
+ @method = method
19
+
20
+ if values != nil
21
+ if values.is_a?(Array)
22
+ @values = values
23
+ else
24
+ @values = [values]
25
+ end
26
+ end
27
+ end
28
+
29
+ def to_json(*args)
30
+ result = { method: @method }
31
+ result[:values] = @values unless @values.nil?
32
+ result.to_json(*args)
33
+ end
34
+
35
+ def to_s
36
+ return self.to_json
37
+ end
38
+
39
+ class << Operator
40
+ def increment(value = 1, max = nil)
41
+ raise ArgumentError, "Value cannot be NaN or Infinity" if value.respond_to?(:nan?) && (value.nan? || value.infinite?)
42
+ raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?)
43
+ values = [value]
44
+ values << max if max != nil
45
+ return Operator.new("increment", values).to_s
46
+ end
47
+
48
+ def decrement(value = 1, min = nil)
49
+ raise ArgumentError, "Value cannot be NaN or Infinity" if value.respond_to?(:nan?) && (value.nan? || value.infinite?)
50
+ raise ArgumentError, "Min cannot be NaN or Infinity" if min != nil && min.respond_to?(:nan?) && (min.nan? || min.infinite?)
51
+ values = [value]
52
+ values << min if min != nil
53
+ return Operator.new("decrement", values).to_s
54
+ end
55
+
56
+ def multiply(factor, max = nil)
57
+ raise ArgumentError, "Factor cannot be NaN or Infinity" if factor.respond_to?(:nan?) && (factor.nan? || factor.infinite?)
58
+ raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?)
59
+ values = [factor]
60
+ values << max if max != nil
61
+ return Operator.new("multiply", values).to_s
62
+ end
63
+
64
+ def divide(divisor, min = nil)
65
+ raise ArgumentError, "Divisor cannot be NaN or Infinity" if divisor.respond_to?(:nan?) && (divisor.nan? || divisor.infinite?)
66
+ raise ArgumentError, "Min cannot be NaN or Infinity" if min != nil && min.respond_to?(:nan?) && (min.nan? || min.infinite?)
67
+ raise ArgumentError, "Divisor cannot be zero" if divisor == 0 || divisor == 0.0
68
+ values = [divisor]
69
+ values << min if min != nil
70
+ return Operator.new("divide", values).to_s
71
+ end
72
+
73
+ def modulo(divisor)
74
+ raise ArgumentError, "Divisor cannot be NaN or Infinity" if divisor.respond_to?(:nan?) && (divisor.nan? || divisor.infinite?)
75
+ raise ArgumentError, "Divisor cannot be zero" if divisor == 0 || divisor == 0.0
76
+ return Operator.new("modulo", [divisor]).to_s
77
+ end
78
+
79
+ def power(exponent, max = nil)
80
+ raise ArgumentError, "Exponent cannot be NaN or Infinity" if exponent.respond_to?(:nan?) && (exponent.nan? || exponent.infinite?)
81
+ raise ArgumentError, "Max cannot be NaN or Infinity" if max != nil && max.respond_to?(:nan?) && (max.nan? || max.infinite?)
82
+ values = [exponent]
83
+ values << max if max != nil
84
+ return Operator.new("power", values).to_s
85
+ end
86
+
87
+ def array_append(values)
88
+ return Operator.new("arrayAppend", values).to_s
89
+ end
90
+
91
+ def array_prepend(values)
92
+ return Operator.new("arrayPrepend", values).to_s
93
+ end
94
+
95
+ def array_insert(index, value)
96
+ return Operator.new("arrayInsert", [index, value]).to_s
97
+ end
98
+
99
+ def array_remove(value)
100
+ return Operator.new("arrayRemove", [value]).to_s
101
+ end
102
+
103
+ def array_unique()
104
+ return Operator.new("arrayUnique", []).to_s
105
+ end
106
+
107
+ def array_intersect(values)
108
+ return Operator.new("arrayIntersect", values).to_s
109
+ end
110
+
111
+ def array_diff(values)
112
+ return Operator.new("arrayDiff", values).to_s
113
+ end
114
+
115
+ def array_filter(condition, value = nil)
116
+ values = [condition, value]
117
+ return Operator.new("arrayFilter", values).to_s
118
+ end
119
+
120
+ def string_concat(value)
121
+ return Operator.new("stringConcat", [value]).to_s
122
+ end
123
+
124
+ def string_replace(search, replace)
125
+ return Operator.new("stringReplace", [search, replace]).to_s
126
+ end
127
+
128
+ def toggle()
129
+ return Operator.new("toggle", []).to_s
130
+ end
131
+
132
+ def date_add_days(days)
133
+ return Operator.new("dateAddDays", [days]).to_s
134
+ end
135
+
136
+ def date_sub_days(days)
137
+ return Operator.new("dateSubDays", [days]).to_s
138
+ end
139
+
140
+ def date_set_now()
141
+ return Operator.new("dateSetNow", []).to_s
142
+ end
143
+ end
144
+ end
145
+ end
@@ -133,27 +133,27 @@ module Appwrite
133
133
  end
134
134
 
135
135
  def created_before(value)
136
- return Query.new("createdBefore", nil, value).to_s
136
+ return less_than("$createdAt", value)
137
137
  end
138
138
 
139
139
  def created_after(value)
140
- return Query.new("createdAfter", nil, value).to_s
140
+ return greater_than("$createdAt", value)
141
141
  end
142
142
 
143
143
  def created_between(start, ending)
144
- return Query.new("createdBetween", nil, [start, ending]).to_s
144
+ return between("$createdAt", start, ending)
145
145
  end
146
146
 
147
147
  def updated_before(value)
148
- return Query.new("updatedBefore", nil, value).to_s
148
+ return less_than("$updatedAt", value)
149
149
  end
150
150
 
151
151
  def updated_after(value)
152
- return Query.new("updatedAfter", nil, value).to_s
152
+ return greater_than("$updatedAt", value)
153
153
  end
154
154
 
155
155
  def updated_between(start, ending)
156
- return Query.new("updatedBetween", nil, [start, ending]).to_s
156
+ return between("$updatedAt", start, ending)
157
157
  end
158
158
 
159
159
  def or(queries)
@@ -123,13 +123,15 @@ module Appwrite
123
123
  # Get the list of identities for the currently logged in user.
124
124
  #
125
125
  # @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). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
126
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
126
127
  #
127
128
  # @return [IdentityList]
128
- def list_identities(queries: nil)
129
+ def list_identities(queries: nil, total: nil)
129
130
  api_path = '/account/identities'
130
131
 
131
132
  api_params = {
132
133
  queries: queries,
134
+ total: total,
133
135
  }
134
136
 
135
137
  api_headers = {
@@ -203,13 +205,15 @@ module Appwrite
203
205
  # user. Each log returns user IP address, location and date and time of log.
204
206
  #
205
207
  # @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
208
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
206
209
  #
207
210
  # @return [LogList]
208
- def list_logs(queries: nil)
211
+ def list_logs(queries: nil, total: nil)
209
212
  api_path = '/account/logs'
210
213
 
211
214
  api_params = {
212
215
  queries: queries,
216
+ total: total,
213
217
  }
214
218
 
215
219
  api_headers = {