appwrite 30.4.0 → 30.5.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: 74cae80fdbf5d2d8bce004eb891da0a982ee3c97b274059e4a29b16bd1181840
4
- data.tar.gz: 7a7c50ed5def8bff4d644e98ab130c4794770edc651d2cf77d632cb911c51031
3
+ metadata.gz: 9f7ad5b280deb7576c81b9ec445f307c82069b1baeae9d9e74b32a562a17258b
4
+ data.tar.gz: 8882cd5061bdd6124e8c9f2deb8fd4e34fdb7ef85d53bc275748b20f010f4118
5
5
  SHA512:
6
- metadata.gz: d93f03f527e1875a0ba0466d68b3c90169b1b96fadf6c7e1a2a17ccc75e8313a6456f99e4ce188397a74b5f6599b5cc2ba6313fa2816396b41deb384e871401e
7
- data.tar.gz: a35a86f654b47cb1c6101571536a148a6eba0360ebce3f1061f76cdd8632380bf52938d487f98f0a9f08fa6bb067b3a93132fc339f77f02ed91e6176225e8cc1
6
+ metadata.gz: b7d794f588efbb302b8da6b082ff4f7e5e79e7716d9fa688fe82a566c5fcf30fde64ce5288fdfc52931481cd17bd008691967804b4278e296e96da608abb4258
7
+ data.tar.gz: 59691258c8bb8dc8376dbaa738772ad48cd3c1107972d7351ce360e293e9b9d559fdac927a984f39176b919a662c8deb03279fdaaa17dba4ff1cb535c482416b
@@ -14,7 +14,7 @@ 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.4.0',
17
+ 'x-sdk-version' => '30.5.0',
18
18
  'X-Appwrite-Response-Format' => '2.7.2'
19
19
  }
20
20
  @endpoint = 'https://cloud.appwrite.io/v1'
@@ -0,0 +1,10 @@
1
+ module Appwrite
2
+ module Enums
3
+ module AlertComparator
4
+ GREATERTHAN = 'greaterThan'
5
+ GREATERTHANEQUAL = 'greaterThanEqual'
6
+ LESSTHAN = 'lessThan'
7
+ LESSTHANEQUAL = 'lessThanEqual'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ module Appwrite
2
+ module Enums
3
+ module AlertMetric
4
+ NETWORK_REQUESTS = 'network.requests'
5
+ NETWORK_INBOUND = 'network.inbound'
6
+ NETWORK_OUTBOUND = 'network.outbound'
7
+ EXECUTIONS = 'executions'
8
+ EXECUTIONS_MBSECONDS = 'executions.mbSeconds'
9
+ REALTIME_CONNECTIONS = 'realtime.connections'
10
+ WEBHOOKS_EVENTS_SENT = 'webhooks.events.sent'
11
+ WEBHOOKS_EVENTS_FAILED = 'webhooks.events.failed'
12
+ USERS_MAU = 'users.mau'
13
+ AUTH_METHOD_PHONE = 'auth.method.phone'
14
+ USERS = 'users'
15
+ DATABASES_OPERATIONS_READS = 'databases.operations.reads'
16
+ DATABASES_OPERATIONS_WRITES = 'databases.operations.writes'
17
+ DATABASES_STORAGE = 'databases.storage'
18
+ STORAGE = 'storage'
19
+ FILES_STORAGE = 'files.storage'
20
+ MESSAGES_SENT = 'messages.sent'
21
+ MESSAGES_SMS_SENT = 'messages.sms.sent'
22
+ MESSAGES_FAILED = 'messages.failed'
23
+ AVATARS_SCREENSHOTSGENERATED = 'avatars.screenshotsGenerated'
24
+ DEDICATEDDATABASES_CPU = 'dedicatedDatabases.cpu'
25
+ DEDICATEDDATABASES_MEMORY = 'dedicatedDatabases.memory'
26
+ DEDICATEDDATABASES_STORAGE = 'dedicatedDatabases.storage'
27
+ DEDICATEDDATABASES_CONNECTIONS = 'dedicatedDatabases.connections'
28
+ DEDICATEDDATABASES_QPS = 'dedicatedDatabases.qps'
29
+ DEDICATEDDATABASES_IOPSREAD = 'dedicatedDatabases.iopsRead'
30
+ DEDICATEDDATABASES_IOPSWRITE = 'dedicatedDatabases.iopsWrite'
31
+ ANALYTICS_EVENTS = 'analytics.events'
32
+ ANALYTICS_PAGEVIEWS = 'analytics.pageviews'
33
+ BILLING_BUDGETUSED = 'billing.budgetUsed'
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,8 @@
1
+ module Appwrite
2
+ module Enums
3
+ module AlertStatus
4
+ FIRING = 'firing'
5
+ RESOLVED = 'resolved'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorMethod
4
+ GET = 'GET'
5
+ HEAD = 'HEAD'
6
+ POST = 'POST'
7
+ PUT = 'PUT'
8
+ PATCH = 'PATCH'
9
+ DELETE = 'DELETE'
10
+ OPTIONS = 'OPTIONS'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorRecord
4
+ A = 'A'
5
+ AAAA = 'AAAA'
6
+ CNAME = 'CNAME'
7
+ MX = 'MX'
8
+ TXT = 'TXT'
9
+ NS = 'NS'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorResourceType
4
+ PROJECT = 'project'
5
+ DATABASE = 'database'
6
+ BUCKET = 'bucket'
7
+ FUNCTION = 'function'
8
+ SITE = 'site'
9
+ DEDICATEDDATABASE = 'dedicatedDatabase'
10
+ ORGANIZATION = 'organization'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorResult
4
+ OK = 'ok'
5
+ DNS_FAILED = 'dns_failed'
6
+ CONNECT_REFUSED = 'connect_refused'
7
+ CONNECT_TIMEOUT = 'connect_timeout'
8
+ CONNECT_FAILED = 'connect_failed'
9
+ TLS_FAILED = 'tls_failed'
10
+ TLS_EXPIRING = 'tls_expiring'
11
+ STATUS_MISMATCH = 'status_mismatch'
12
+ ANSWER_MISMATCH = 'answer_mismatch'
13
+ SMTP_REJECTED = 'smtp_rejected'
14
+ TARGET_DENIED = 'target_denied'
15
+ TIMEOUT = 'timeout'
16
+ RULE_MATCHED = 'rule_matched'
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorSeverity
4
+ INFO = 'info'
5
+ WARNING = 'warning'
6
+ ERROR = 'error'
7
+ CRITICAL = 'critical'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorStatus
4
+ OK = 'ok'
5
+ FIRING = 'firing'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorTlsMode
4
+ NONE = 'none'
5
+ STARTTLS = 'starttls'
6
+ IMPLICIT = 'implicit'
7
+ AUTO = 'auto'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ module Appwrite
2
+ module Enums
3
+ module MonitorType
4
+ USAGE = 'usage'
5
+ HTTP = 'http'
6
+ DNS = 'dns'
7
+ TCP = 'tcp'
8
+ SMTP = 'smtp'
9
+ BUDGET = 'budget'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,308 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Alert
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :monitor_id
10
+ attr_reader :project_id
11
+ attr_reader :name
12
+ attr_reader :status
13
+ attr_reader :resolved_at
14
+ attr_reader :acknowledged_at
15
+ attr_reader :acknowledged_by
16
+ attr_reader :acknowledged_by_name
17
+ attr_reader :escalation_id
18
+ attr_reader :escalation_step
19
+ attr_reader :escalation_round
20
+ attr_reader :escalates_at
21
+ attr_reader :rules
22
+ attr_reader :severity
23
+ attr_reader :metric
24
+ attr_reader :comparator
25
+ attr_reader :threshold
26
+ attr_reader :value
27
+ attr_reader :peak
28
+ attr_reader :type
29
+ attr_reader :resource_type
30
+ attr_reader :resource_id
31
+ attr_reader :notifications
32
+ attr_reader :latency
33
+ attr_reader :result
34
+
35
+ def initialize(
36
+ id:,
37
+ created_at:,
38
+ updated_at:,
39
+ monitor_id:,
40
+ project_id:,
41
+ name:,
42
+ status:,
43
+ resolved_at: nil,
44
+ acknowledged_at: nil,
45
+ acknowledged_by:,
46
+ acknowledged_by_name:,
47
+ escalation_id:,
48
+ escalation_step:,
49
+ escalation_round:,
50
+ escalates_at: nil,
51
+ rules:,
52
+ severity:,
53
+ metric: nil,
54
+ comparator: nil,
55
+ threshold:,
56
+ value:,
57
+ peak:,
58
+ type:,
59
+ resource_type:,
60
+ resource_id:,
61
+ notifications:,
62
+ latency: nil,
63
+ result: nil
64
+ )
65
+ @id = id
66
+ @created_at = created_at
67
+ @updated_at = updated_at
68
+ @monitor_id = monitor_id
69
+ @project_id = project_id
70
+ @name = name
71
+ @status = validate_status(status)
72
+ @resolved_at = resolved_at
73
+ @acknowledged_at = acknowledged_at
74
+ @acknowledged_by = acknowledged_by
75
+ @acknowledged_by_name = acknowledged_by_name
76
+ @escalation_id = escalation_id
77
+ @escalation_step = escalation_step
78
+ @escalation_round = escalation_round
79
+ @escalates_at = escalates_at
80
+ @rules = rules
81
+ @severity = validate_severity(severity)
82
+ @metric = metric.nil? ? metric : validate_metric(metric)
83
+ @comparator = comparator.nil? ? comparator : validate_comparator(comparator)
84
+ @threshold = threshold
85
+ @value = value
86
+ @peak = peak
87
+ @type = validate_type(type)
88
+ @resource_type = validate_resource_type(resource_type)
89
+ @resource_id = resource_id
90
+ @notifications = notifications
91
+ @latency = latency
92
+ @result = result.nil? ? result : validate_result(result)
93
+ end
94
+
95
+ def self.from(map:)
96
+ map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "monitorId" => "", "projectId" => "", "name" => "", "status" => "firing", "acknowledgedBy" => "", "acknowledgedByName" => "", "escalationId" => "", "escalationStep" => 0, "escalationRound" => 0, "rules" => [], "severity" => "warning", "threshold" => 0, "value" => 0, "peak" => 0, "type" => "usage", "resourceType" => "project", "resourceId" => "", "notifications" => 0 }.merge(map)
97
+ Alert.new(
98
+ id: map["$id"],
99
+ created_at: map["$createdAt"],
100
+ updated_at: map["$updatedAt"],
101
+ monitor_id: map["monitorId"],
102
+ project_id: map["projectId"],
103
+ name: map["name"],
104
+ status: map["status"],
105
+ resolved_at: map["resolvedAt"],
106
+ acknowledged_at: map["acknowledgedAt"],
107
+ acknowledged_by: map["acknowledgedBy"],
108
+ acknowledged_by_name: map["acknowledgedByName"],
109
+ escalation_id: map["escalationId"],
110
+ escalation_step: map["escalationStep"],
111
+ escalation_round: map["escalationRound"],
112
+ escalates_at: map["escalatesAt"],
113
+ rules: map["rules"],
114
+ severity: map["severity"],
115
+ metric: map["metric"],
116
+ comparator: map["comparator"],
117
+ threshold: map["threshold"],
118
+ value: map["value"],
119
+ peak: map["peak"],
120
+ type: map["type"],
121
+ resource_type: map["resourceType"],
122
+ resource_id: map["resourceId"],
123
+ notifications: map["notifications"],
124
+ latency: map["latency"],
125
+ result: map["result"]
126
+ )
127
+ end
128
+
129
+ def to_map
130
+ {
131
+ "$id": @id,
132
+ "$createdAt": @created_at,
133
+ "$updatedAt": @updated_at,
134
+ "monitorId": @monitor_id,
135
+ "projectId": @project_id,
136
+ "name": @name,
137
+ "status": @status,
138
+ "resolvedAt": @resolved_at,
139
+ "acknowledgedAt": @acknowledged_at,
140
+ "acknowledgedBy": @acknowledged_by,
141
+ "acknowledgedByName": @acknowledged_by_name,
142
+ "escalationId": @escalation_id,
143
+ "escalationStep": @escalation_step,
144
+ "escalationRound": @escalation_round,
145
+ "escalatesAt": @escalates_at,
146
+ "rules": @rules,
147
+ "severity": @severity,
148
+ "metric": @metric,
149
+ "comparator": @comparator,
150
+ "threshold": @threshold,
151
+ "value": @value,
152
+ "peak": @peak,
153
+ "type": @type,
154
+ "resourceType": @resource_type,
155
+ "resourceId": @resource_id,
156
+ "notifications": @notifications,
157
+ "latency": @latency,
158
+ "result": @result
159
+ }
160
+ end
161
+
162
+ private
163
+
164
+ def validate_status(status)
165
+ valid_status = [
166
+ Appwrite::Enums::AlertStatus::FIRING,
167
+ Appwrite::Enums::AlertStatus::RESOLVED,
168
+ ]
169
+
170
+ unless valid_status.include?(status)
171
+ raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
172
+ end
173
+
174
+ status
175
+ end
176
+
177
+ def validate_severity(severity)
178
+ valid_severity = [
179
+ Appwrite::Enums::MonitorSeverity::INFO,
180
+ Appwrite::Enums::MonitorSeverity::WARNING,
181
+ Appwrite::Enums::MonitorSeverity::ERROR,
182
+ Appwrite::Enums::MonitorSeverity::CRITICAL,
183
+ ]
184
+
185
+ unless valid_severity.include?(severity)
186
+ raise ArgumentError, "Invalid " + severity + ". Must be one of: " + valid_severity.join(', ')
187
+ end
188
+
189
+ severity
190
+ end
191
+
192
+ def validate_metric(metric)
193
+ valid_metric = [
194
+ Appwrite::Enums::AlertMetric::NETWORK_REQUESTS,
195
+ Appwrite::Enums::AlertMetric::NETWORK_INBOUND,
196
+ Appwrite::Enums::AlertMetric::NETWORK_OUTBOUND,
197
+ Appwrite::Enums::AlertMetric::EXECUTIONS,
198
+ Appwrite::Enums::AlertMetric::EXECUTIONS_MBSECONDS,
199
+ Appwrite::Enums::AlertMetric::REALTIME_CONNECTIONS,
200
+ Appwrite::Enums::AlertMetric::WEBHOOKS_EVENTS_SENT,
201
+ Appwrite::Enums::AlertMetric::WEBHOOKS_EVENTS_FAILED,
202
+ Appwrite::Enums::AlertMetric::USERS_MAU,
203
+ Appwrite::Enums::AlertMetric::AUTH_METHOD_PHONE,
204
+ Appwrite::Enums::AlertMetric::USERS,
205
+ Appwrite::Enums::AlertMetric::DATABASES_OPERATIONS_READS,
206
+ Appwrite::Enums::AlertMetric::DATABASES_OPERATIONS_WRITES,
207
+ Appwrite::Enums::AlertMetric::DATABASES_STORAGE,
208
+ Appwrite::Enums::AlertMetric::STORAGE,
209
+ Appwrite::Enums::AlertMetric::FILES_STORAGE,
210
+ Appwrite::Enums::AlertMetric::MESSAGES_SENT,
211
+ Appwrite::Enums::AlertMetric::MESSAGES_SMS_SENT,
212
+ Appwrite::Enums::AlertMetric::MESSAGES_FAILED,
213
+ Appwrite::Enums::AlertMetric::AVATARS_SCREENSHOTSGENERATED,
214
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_CPU,
215
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_MEMORY,
216
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_STORAGE,
217
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_CONNECTIONS,
218
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_QPS,
219
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_IOPSREAD,
220
+ Appwrite::Enums::AlertMetric::DEDICATEDDATABASES_IOPSWRITE,
221
+ Appwrite::Enums::AlertMetric::ANALYTICS_EVENTS,
222
+ Appwrite::Enums::AlertMetric::ANALYTICS_PAGEVIEWS,
223
+ Appwrite::Enums::AlertMetric::BILLING_BUDGETUSED,
224
+ ]
225
+
226
+ unless valid_metric.include?(metric)
227
+ raise ArgumentError, "Invalid " + metric + ". Must be one of: " + valid_metric.join(', ')
228
+ end
229
+
230
+ metric
231
+ end
232
+
233
+ def validate_comparator(comparator)
234
+ valid_comparator = [
235
+ Appwrite::Enums::AlertComparator::GREATERTHAN,
236
+ Appwrite::Enums::AlertComparator::GREATERTHANEQUAL,
237
+ Appwrite::Enums::AlertComparator::LESSTHAN,
238
+ Appwrite::Enums::AlertComparator::LESSTHANEQUAL,
239
+ ]
240
+
241
+ unless valid_comparator.include?(comparator)
242
+ raise ArgumentError, "Invalid " + comparator + ". Must be one of: " + valid_comparator.join(', ')
243
+ end
244
+
245
+ comparator
246
+ end
247
+
248
+ def validate_type(type)
249
+ valid_type = [
250
+ Appwrite::Enums::MonitorType::USAGE,
251
+ Appwrite::Enums::MonitorType::HTTP,
252
+ Appwrite::Enums::MonitorType::DNS,
253
+ Appwrite::Enums::MonitorType::TCP,
254
+ Appwrite::Enums::MonitorType::SMTP,
255
+ Appwrite::Enums::MonitorType::BUDGET,
256
+ ]
257
+
258
+ unless valid_type.include?(type)
259
+ raise ArgumentError, "Invalid " + type + ". Must be one of: " + valid_type.join(', ')
260
+ end
261
+
262
+ type
263
+ end
264
+
265
+ def validate_resource_type(resource_type)
266
+ valid_resource_type = [
267
+ Appwrite::Enums::MonitorResourceType::PROJECT,
268
+ Appwrite::Enums::MonitorResourceType::DATABASE,
269
+ Appwrite::Enums::MonitorResourceType::BUCKET,
270
+ Appwrite::Enums::MonitorResourceType::FUNCTION,
271
+ Appwrite::Enums::MonitorResourceType::SITE,
272
+ Appwrite::Enums::MonitorResourceType::DEDICATEDDATABASE,
273
+ Appwrite::Enums::MonitorResourceType::ORGANIZATION,
274
+ ]
275
+
276
+ unless valid_resource_type.include?(resource_type)
277
+ raise ArgumentError, "Invalid " + resource_type + ". Must be one of: " + valid_resource_type.join(', ')
278
+ end
279
+
280
+ resource_type
281
+ end
282
+
283
+ def validate_result(result)
284
+ valid_result = [
285
+ Appwrite::Enums::MonitorResult::OK,
286
+ Appwrite::Enums::MonitorResult::DNS_FAILED,
287
+ Appwrite::Enums::MonitorResult::CONNECT_REFUSED,
288
+ Appwrite::Enums::MonitorResult::CONNECT_TIMEOUT,
289
+ Appwrite::Enums::MonitorResult::CONNECT_FAILED,
290
+ Appwrite::Enums::MonitorResult::TLS_FAILED,
291
+ Appwrite::Enums::MonitorResult::TLS_EXPIRING,
292
+ Appwrite::Enums::MonitorResult::STATUS_MISMATCH,
293
+ Appwrite::Enums::MonitorResult::ANSWER_MISMATCH,
294
+ Appwrite::Enums::MonitorResult::SMTP_REJECTED,
295
+ Appwrite::Enums::MonitorResult::TARGET_DENIED,
296
+ Appwrite::Enums::MonitorResult::TIMEOUT,
297
+ Appwrite::Enums::MonitorResult::RULE_MATCHED,
298
+ ]
299
+
300
+ unless valid_result.include?(result)
301
+ raise ArgumentError, "Invalid " + result + ". Must be one of: " + valid_result.join(', ')
302
+ end
303
+
304
+ result
305
+ end
306
+ end
307
+ end
308
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AlertList
6
+ attr_reader :total
7
+ attr_reader :alerts
8
+
9
+ def initialize(
10
+ total:,
11
+ alerts:
12
+ )
13
+ @total = total
14
+ @alerts = alerts
15
+ end
16
+
17
+ def self.from(map:)
18
+ map = { "total" => 0, "alerts" => [] }.merge(map)
19
+ AlertList.new(
20
+ total: map["total"],
21
+ alerts: map["alerts"].map { |it| Alert.from(map: it) }
22
+ )
23
+ end
24
+
25
+ def to_map
26
+ {
27
+ "total": @total,
28
+ "alerts": @alerts.map { |it| it.to_map }
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Escalation
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :name
10
+ attr_reader :steps
11
+ attr_reader :repeat
12
+
13
+ def initialize(
14
+ id:,
15
+ created_at:,
16
+ updated_at:,
17
+ name:,
18
+ steps:,
19
+ repeat:
20
+ )
21
+ @id = id
22
+ @created_at = created_at
23
+ @updated_at = updated_at
24
+ @name = name
25
+ @steps = steps
26
+ @repeat = repeat
27
+ end
28
+
29
+ def self.from(map:)
30
+ map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "steps" => [], "repeat" => 0 }.merge(map)
31
+ Escalation.new(
32
+ id: map["$id"],
33
+ created_at: map["$createdAt"],
34
+ updated_at: map["$updatedAt"],
35
+ name: map["name"],
36
+ steps: map["steps"].map { |it| EscalationStep.from(map: it) },
37
+ repeat: map["repeat"]
38
+ )
39
+ end
40
+
41
+ def to_map
42
+ {
43
+ "$id": @id,
44
+ "$createdAt": @created_at,
45
+ "$updatedAt": @updated_at,
46
+ "name": @name,
47
+ "steps": @steps.map { |it| it.to_map },
48
+ "repeat": @repeat
49
+ }
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class EscalationList
6
+ attr_reader :total
7
+ attr_reader :escalations
8
+
9
+ def initialize(
10
+ total:,
11
+ escalations:
12
+ )
13
+ @total = total
14
+ @escalations = escalations
15
+ end
16
+
17
+ def self.from(map:)
18
+ map = { "total" => 0, "escalations" => [] }.merge(map)
19
+ EscalationList.new(
20
+ total: map["total"],
21
+ escalations: map["escalations"].map { |it| Escalation.from(map: it) }
22
+ )
23
+ end
24
+
25
+ def to_map
26
+ {
27
+ "total": @total,
28
+ "escalations": @escalations.map { |it| it.to_map }
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class EscalationStep
6
+ attr_reader :delay
7
+ attr_reader :roles
8
+ attr_reader :user_ids
9
+
10
+ def initialize(
11
+ delay:,
12
+ roles:,
13
+ user_ids:
14
+ )
15
+ @delay = delay
16
+ @roles = roles
17
+ @user_ids = user_ids
18
+ end
19
+
20
+ def self.from(map:)
21
+ map = { "delay" => 0, "roles" => [], "userIds" => [] }.merge(map)
22
+ EscalationStep.new(
23
+ delay: map["delay"],
24
+ roles: map["roles"],
25
+ user_ids: map["userIds"]
26
+ )
27
+ end
28
+
29
+ def to_map
30
+ {
31
+ "delay": @delay,
32
+ "roles": @roles,
33
+ "userIds": @user_ids
34
+ }
35
+ end
36
+ end
37
+ end
38
+ end