appwrite 11.0.0.pre.rc.4 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcd1ff90eb52b87f135ca3fca163a2eba3d92cae1d7e54d6b367df00787b3318
4
- data.tar.gz: 24df40246e934ce7a558d3d37b9d44b523d147c37d1dab17f28ebf2daa493863
3
+ metadata.gz: 0bca03eb7af675e72f241faee81443dd471831f3e7835c9f7bb32f83979a9266
4
+ data.tar.gz: 14612cd69df877ead2f82c0e0e9c9eaf423b1f059d6221570a9a285bd2f91189
5
5
  SHA512:
6
- metadata.gz: 5998ca3754b3a768c8f12235d8e814ed855f6602825b9eea58935d373a1c2fe21dc4ffaf59b91c1721bb43a2abdf896196a55d9a02ddcaf74271ba4030f6ef85
7
- data.tar.gz: 22c99db172afb9d4c3a2dd5010256a67b1c07af18e9a8a5d327a35eb1229ec434f2844022c61aac40730e46d43b97ead56d704cce347da0acaa99f5c0d47b4da
6
+ metadata.gz: a5afccd0969e11345fb06bf9f6857624f98a852d1359a685fe659245d490ff7a03351747b37173a9cb9030a326ee0b275c1ccee911c9cbc9509878c7c7479ac2
7
+ data.tar.gz: 8083c9e4416972961fc58af0b7a5328b72fb7e3e67f792bef5c7b8a4e04fc3600ae2e6c007e2bdf7093f4418ca34321f00b82428ed4a5514ff8096a06588a90f
@@ -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'=> '11.0.0-rc.4',
18
+ 'x-sdk-version'=> '11.0.1',
19
19
  'X-Appwrite-Response-Format' => '1.5.0'
20
20
  }
21
21
  @endpoint = 'https://cloud.appwrite.io/v1'
@@ -84,19 +84,6 @@ module Appwrite
84
84
  self
85
85
  end
86
86
 
87
- # Set ForwardedFor
88
- #
89
- # The IP address of the client that made the request
90
- #
91
- # @param [String] value The value to set for the ForwardedFor header
92
- #
93
- # @return [self]
94
- def set_forwarded_for(value)
95
- add_header('x-forwarded-for', value)
96
-
97
- self
98
- end
99
-
100
87
  # Set ForwardedUserAgent
101
88
  #
102
89
  # The user agent string of the client that made the request
@@ -293,12 +280,15 @@ module Appwrite
293
280
  rescue => error
294
281
  raise Appwrite::Exception.new(error.message)
295
282
  end
283
+
284
+ location = response['location']
285
+ if response_type == "location"
286
+ return location
287
+ end
296
288
 
297
289
  # Handle Redirects
298
- if response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently
299
- location = response['location']
290
+ if (response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently)
300
291
  uri = URI.parse(uri.scheme + "://" + uri.host + "" + location)
301
-
302
292
  return fetch(method, uri, headers, {}, response_type, limit - 1)
303
293
  end
304
294
 
@@ -1,9 +1,10 @@
1
1
  module Appwrite
2
2
  module Enums
3
3
  module AuthenticationFactor
4
- TOTP = 'totp'
5
- PHONE = 'phone'
6
4
  EMAIL = 'email'
5
+ PHONE = 'phone'
6
+ TOTP = 'totp'
7
+ RECOVERYCODE = 'recoverycode'
7
8
  end
8
9
  end
9
10
  end
@@ -34,7 +34,7 @@ module Appwrite
34
34
  SWITZERLAND = 'ch'
35
35
  CHILE = 'cl'
36
36
  CHINA = 'cn'
37
- CôTE_D'IVOIRE = 'ci'
37
+ COTE_DIVOIRE = 'ci'
38
38
  CAMEROON = 'cm'
39
39
  DEMOCRATIC_REPUBLIC_OF_THE_CONGO = 'cd'
40
40
  REPUBLIC_OF_THE_CONGO = 'cg'
@@ -96,7 +96,7 @@ module Appwrite
96
96
  SAINT_KITTS_AND_NEVIS = 'kn'
97
97
  SOUTH_KOREA = 'kr'
98
98
  KUWAIT = 'kw'
99
- LAO_PEOPLE'S_DEMOCRATIC_REPUBLIC = 'la'
99
+ LAO_PEOPLES_DEMOCRATIC_REPUBLIC = 'la'
100
100
  LEBANON = 'lb'
101
101
  LIBERIA = 'lr'
102
102
  LIBYA = 'ly'
@@ -4,7 +4,6 @@ module Appwrite
4
4
  KEY = 'key'
5
5
  FULLTEXT = 'fulltext'
6
6
  UNIQUE = 'unique'
7
- SPATIAL = 'spatial'
8
7
  end
9
8
  end
10
9
  end
@@ -7,6 +7,7 @@ module Appwrite
7
7
  V1_MAILS = 'v1-mails'
8
8
  V1_FUNCTIONS = 'v1-functions'
9
9
  V1_USAGE = 'v1-usage'
10
+ V1_USAGE_DUMP = 'v1-usage-dump'
10
11
  WEBHOOKSV1 = 'webhooksv1'
11
12
  V1_CERTIFICATES = 'v1-certificates'
12
13
  V1_BUILDS = 'v1-builds'
@@ -5,8 +5,8 @@ module Appwrite
5
5
  SHA224 = 'sha224'
6
6
  SHA256 = 'sha256'
7
7
  SHA384 = 'sha384'
8
- SHA512/224 = 'sha512/224'
9
- SHA512/256 = 'sha512/256'
8
+ SHA512_224 = 'sha512/224'
9
+ SHA512_256 = 'sha512/256'
10
10
  SHA512 = 'sha512'
11
11
  SHA3_224 = 'sha3-224'
12
12
  SHA3_256 = 'sha3-256'
@@ -1,42 +1,50 @@
1
1
  module Appwrite
2
2
  module Enums
3
3
  module Runtime
4
- NODE_145 = 'node-14.5'
5
- NODE_160 = 'node-16.0'
6
- NODE_180 = 'node-18.0'
7
- NODE_190 = 'node-19.0'
8
- NODE_200 = 'node-20.0'
9
- PHP_80 = 'php-8.0'
10
- PHP_81 = 'php-8.1'
11
- PHP_82 = 'php-8.2'
12
- RUBY_30 = 'ruby-3.0'
13
- RUBY_31 = 'ruby-3.1'
14
- RUBY_32 = 'ruby-3.2'
15
- PYTHON_38 = 'python-3.8'
16
- PYTHON_39 = 'python-3.9'
17
- PYTHON_310 = 'python-3.10'
18
- PYTHON_311 = 'python-3.11'
19
- PYTHON_312 = 'python-3.12'
20
- DART_215 = 'dart-2.15'
21
- DART_216 = 'dart-2.16'
22
- DART_217 = 'dart-2.17'
23
- DART_218 = 'dart-2.18'
24
- DART_30 = 'dart-3.0'
25
- DART_31 = 'dart-3.1'
26
- DOTNET_31 = 'dotnet-3.1'
27
- DOTNET_60 = 'dotnet-6.0'
28
- DOTNET_70 = 'dotnet-7.0'
29
- JAVA_80 = 'java-8.0'
30
- JAVA_110 = 'java-11.0'
31
- JAVA_170 = 'java-17.0'
32
- JAVA_180 = 'java-18.0'
33
- SWIFT_55 = 'swift-5.5'
34
- SWIFT_58 = 'swift-5.8'
35
- KOTLIN_16 = 'kotlin-1.6'
36
- KOTLIN_18 = 'kotlin-1.8'
4
+ NODE_14_5 = 'node-14.5'
5
+ NODE_16_0 = 'node-16.0'
6
+ NODE_18_0 = 'node-18.0'
7
+ NODE_19_0 = 'node-19.0'
8
+ NODE_20_0 = 'node-20.0'
9
+ NODE_21_0 = 'node-21.0'
10
+ PHP_8_0 = 'php-8.0'
11
+ PHP_8_1 = 'php-8.1'
12
+ PHP_8_2 = 'php-8.2'
13
+ PHP_8_3 = 'php-8.3'
14
+ RUBY_3_0 = 'ruby-3.0'
15
+ RUBY_3_1 = 'ruby-3.1'
16
+ RUBY_3_2 = 'ruby-3.2'
17
+ RUBY_3_3 = 'ruby-3.3'
18
+ PYTHON_3_8 = 'python-3.8'
19
+ PYTHON_3_9 = 'python-3.9'
20
+ PYTHON_3_10 = 'python-3.10'
21
+ PYTHON_3_11 = 'python-3.11'
22
+ PYTHON_3_12 = 'python-3.12'
23
+ DENO_1_40 = 'deno-1.40'
24
+ DART_2_15 = 'dart-2.15'
25
+ DART_2_16 = 'dart-2.16'
26
+ DART_2_17 = 'dart-2.17'
27
+ DART_2_18 = 'dart-2.18'
28
+ DART_3_0 = 'dart-3.0'
29
+ DART_3_1 = 'dart-3.1'
30
+ DART_3_3 = 'dart-3.3'
31
+ DOTNET_3_1 = 'dotnet-3.1'
32
+ DOTNET_6_0 = 'dotnet-6.0'
33
+ DOTNET_7_0 = 'dotnet-7.0'
34
+ JAVA_8_0 = 'java-8.0'
35
+ JAVA_11_0 = 'java-11.0'
36
+ JAVA_17_0 = 'java-17.0'
37
+ JAVA_18_0 = 'java-18.0'
38
+ JAVA_21_0 = 'java-21.0'
39
+ SWIFT_5_5 = 'swift-5.5'
40
+ SWIFT_5_8 = 'swift-5.8'
41
+ SWIFT_5_9 = 'swift-5.9'
42
+ KOTLIN_1_6 = 'kotlin-1.6'
43
+ KOTLIN_1_8 = 'kotlin-1.8'
44
+ KOTLIN_1_9 = 'kotlin-1.9'
37
45
  CPP_17 = 'cpp-17'
38
46
  CPP_20 = 'cpp-20'
39
- BUN_10 = 'bun-1.0'
47
+ BUN_1_0 = 'bun-1.0'
40
48
  end
41
49
  end
42
50
  end
@@ -1,6 +1,6 @@
1
1
  module Appwrite
2
2
  module Enums
3
- module Encryption
3
+ module SmtpEncryption
4
4
  NONE = 'none'
5
5
  SSL = 'ssl'
6
6
  TLS = 'tls'
data/lib/appwrite/id.rb CHANGED
@@ -1,11 +1,27 @@
1
+ require 'securerandom'
2
+
1
3
  module Appwrite
2
4
  class ID
3
5
  def self.custom(id)
4
6
  id
5
7
  end
6
-
7
- def self.unique
8
- 'unique()'
8
+
9
+ # Generate a unique ID with padding to have a longer ID
10
+ def self.unique(padding=7)
11
+ base_id = self.hex_timestamp
12
+ random_padding = SecureRandom.hex(padding)
13
+ random_padding = random_padding[0...padding]
14
+ base_id + random_padding
15
+ end
16
+
17
+ #Generate an hex ID based on timestamp
18
+ #Recreated from https://www.php.net/manual/en/function.uniqid.php
19
+ private_class_method def self.hex_timestamp
20
+ now = Time.now
21
+ sec = now.to_i
22
+ usec = now.usec
23
+ hex_timestamp = "%08x%05x" % [sec, usec]
24
+ hex_timestamp
9
25
  end
10
26
  end
11
- end
27
+ end
@@ -0,0 +1,27 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class MfaRecoveryCodes
6
+ attr_reader :recovery_codes
7
+
8
+ def initialize(
9
+ recovery_codes:
10
+ )
11
+ @recovery_codes = recovery_codes
12
+ end
13
+
14
+ def self.from(map:)
15
+ MfaRecoveryCodes.new(
16
+ recovery_codes: map["recoveryCodes"]
17
+ )
18
+ end
19
+
20
+ def to_map
21
+ {
22
+ "recoveryCodes": @recovery_codes
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -3,23 +3,19 @@
3
3
  module Appwrite
4
4
  module Models
5
5
  class MfaType
6
- attr_reader :backups
7
6
  attr_reader :secret
8
7
  attr_reader :uri
9
8
 
10
9
  def initialize(
11
- backups:,
12
10
  secret:,
13
11
  uri:
14
12
  )
15
- @backups = backups
16
13
  @secret = secret
17
14
  @uri = uri
18
15
  end
19
16
 
20
17
  def self.from(map:)
21
18
  MfaType.new(
22
- backups: map["backups"],
23
19
  secret: map["secret"],
24
20
  uri: map["uri"]
25
21
  )
@@ -27,7 +23,6 @@ module Appwrite
27
23
 
28
24
  def to_map
29
25
  {
30
- "backups": @backups,
31
26
  "secret": @secret,
32
27
  "uri": @uri
33
28
  }
@@ -30,6 +30,7 @@ module Appwrite
30
30
  attr_reader :current
31
31
  attr_reader :factors
32
32
  attr_reader :secret
33
+ attr_reader :mfa_updated_at
33
34
 
34
35
  def initialize(
35
36
  id:,
@@ -58,7 +59,8 @@ module Appwrite
58
59
  country_name:,
59
60
  current:,
60
61
  factors:,
61
- secret:
62
+ secret:,
63
+ mfa_updated_at:
62
64
  )
63
65
  @id = id
64
66
  @created_at = created_at
@@ -87,6 +89,7 @@ module Appwrite
87
89
  @current = current
88
90
  @factors = factors
89
91
  @secret = secret
92
+ @mfa_updated_at = mfa_updated_at
90
93
  end
91
94
 
92
95
  def self.from(map:)
@@ -117,7 +120,8 @@ module Appwrite
117
120
  country_name: map["countryName"],
118
121
  current: map["current"],
119
122
  factors: map["factors"],
120
- secret: map["secret"]
123
+ secret: map["secret"],
124
+ mfa_updated_at: map["mfaUpdatedAt"]
121
125
  )
122
126
  end
123
127
 
@@ -149,7 +153,8 @@ module Appwrite
149
153
  "countryName": @country_name,
150
154
  "current": @current,
151
155
  "factors": @factors,
152
- "secret": @secret
156
+ "secret": @secret,
157
+ "mfaUpdatedAt": @mfa_updated_at
153
158
  }
154
159
  end
155
160
  end
@@ -19,7 +19,6 @@ module Appwrite
19
19
  attr_reader :email_verification
20
20
  attr_reader :phone_verification
21
21
  attr_reader :mfa
22
- attr_reader :totp
23
22
  attr_reader :prefs
24
23
  attr_reader :targets
25
24
  attr_reader :accessed_at
@@ -41,7 +40,6 @@ module Appwrite
41
40
  email_verification:,
42
41
  phone_verification:,
43
42
  mfa:,
44
- totp:,
45
43
  prefs:,
46
44
  targets:,
47
45
  accessed_at:
@@ -62,7 +60,6 @@ module Appwrite
62
60
  @email_verification = email_verification
63
61
  @phone_verification = phone_verification
64
62
  @mfa = mfa
65
- @totp = totp
66
63
  @prefs = prefs
67
64
  @targets = targets
68
65
  @accessed_at = accessed_at
@@ -86,7 +83,6 @@ module Appwrite
86
83
  email_verification: map["emailVerification"],
87
84
  phone_verification: map["phoneVerification"],
88
85
  mfa: map["mfa"],
89
- totp: map["totp"],
90
86
  prefs: Preferences.from(map: map["prefs"]),
91
87
  targets: map["targets"].map { |it| Target.from(map: it) },
92
88
  accessed_at: map["accessedAt"]
@@ -111,7 +107,6 @@ module Appwrite
111
107
  "emailVerification": @email_verification,
112
108
  "phoneVerification": @phone_verification,
113
109
  "mfa": @mfa,
114
- "totp": @totp,
115
110
  "prefs": @prefs.to_map,
116
111
  "targets": @targets.map { |it| it.to_map },
117
112
  "accessedAt": @accessed_at