appwrite 11.0.0 → 11.0.2
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 +4 -4
- data/lib/appwrite/client.rb +1 -1
- data/lib/appwrite/enums/credit_card.rb +1 -1
- data/lib/appwrite/enums/flag.rb +1 -0
- data/lib/appwrite/enums/runtime.rb +1 -0
- data/lib/appwrite/id.rb +20 -4
- data/lib/appwrite/models/mfa_factors.rb +8 -3
- data/lib/appwrite/models/session.rb +5 -0
- data/lib/appwrite/services/account.rb +4 -5
- data/lib/appwrite/services/avatars.rb +1 -1
- data/lib/appwrite/services/messaging.rb +16 -14
- data/lib/appwrite/services/users.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e424b9f2d47290e383c32b18e244a3a49847d6f65c4d208336271dd8c84cd66
|
4
|
+
data.tar.gz: 5472a16fc5f3c5b37ae116e73752aaf096804c9e06103003bf47f02d93e16b3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67c94728750e2116841b3f4292d00c40ab277e11a1083e58e5e813b5444953ce55ddfdd0873a782e03c9e3a2b1c16d8b2c74fbafe4b5c7b0f4990f923b376566
|
7
|
+
data.tar.gz: 0e6d5bcca03322aa2f6353695615a802e045018502fb65a6cbe0178d0a1f9ee038a9e1367c8017fa094dd841d9be80a86f30bfcfb7808ee8d840ec60000cc8bb
|
data/lib/appwrite/client.rb
CHANGED
data/lib/appwrite/enums/flag.rb
CHANGED
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
|
-
|
8
|
-
|
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
|
@@ -6,22 +6,26 @@ module Appwrite
|
|
6
6
|
attr_reader :totp
|
7
7
|
attr_reader :phone
|
8
8
|
attr_reader :email
|
9
|
+
attr_reader :recovery_code
|
9
10
|
|
10
11
|
def initialize(
|
11
12
|
totp:,
|
12
13
|
phone:,
|
13
|
-
email
|
14
|
+
email:,
|
15
|
+
recovery_code:
|
14
16
|
)
|
15
17
|
@totp = totp
|
16
18
|
@phone = phone
|
17
19
|
@email = email
|
20
|
+
@recovery_code = recovery_code
|
18
21
|
end
|
19
22
|
|
20
23
|
def self.from(map:)
|
21
24
|
MfaFactors.new(
|
22
25
|
totp: map["totp"],
|
23
26
|
phone: map["phone"],
|
24
|
-
email: map["email"]
|
27
|
+
email: map["email"],
|
28
|
+
recovery_code: map["recoveryCode"]
|
25
29
|
)
|
26
30
|
end
|
27
31
|
|
@@ -29,7 +33,8 @@ module Appwrite
|
|
29
33
|
{
|
30
34
|
"totp": @totp,
|
31
35
|
"phone": @phone,
|
32
|
-
"email": @email
|
36
|
+
"email": @email,
|
37
|
+
"recoveryCode": @recovery_code
|
33
38
|
}
|
34
39
|
end
|
35
40
|
end
|
@@ -5,6 +5,7 @@ module Appwrite
|
|
5
5
|
class Session
|
6
6
|
attr_reader :id
|
7
7
|
attr_reader :created_at
|
8
|
+
attr_reader :updated_at
|
8
9
|
attr_reader :user_id
|
9
10
|
attr_reader :expire
|
10
11
|
attr_reader :provider
|
@@ -35,6 +36,7 @@ module Appwrite
|
|
35
36
|
def initialize(
|
36
37
|
id:,
|
37
38
|
created_at:,
|
39
|
+
updated_at:,
|
38
40
|
user_id:,
|
39
41
|
expire:,
|
40
42
|
provider:,
|
@@ -64,6 +66,7 @@ module Appwrite
|
|
64
66
|
)
|
65
67
|
@id = id
|
66
68
|
@created_at = created_at
|
69
|
+
@updated_at = updated_at
|
67
70
|
@user_id = user_id
|
68
71
|
@expire = expire
|
69
72
|
@provider = provider
|
@@ -96,6 +99,7 @@ module Appwrite
|
|
96
99
|
Session.new(
|
97
100
|
id: map["$id"],
|
98
101
|
created_at: map["$createdAt"],
|
102
|
+
updated_at: map["$updatedAt"],
|
99
103
|
user_id: map["userId"],
|
100
104
|
expire: map["expire"],
|
101
105
|
provider: map["provider"],
|
@@ -129,6 +133,7 @@ module Appwrite
|
|
129
133
|
{
|
130
134
|
"$id": @id,
|
131
135
|
"$createdAt": @created_at,
|
136
|
+
"$updatedAt": @updated_at,
|
132
137
|
"userId": @user_id,
|
133
138
|
"expire": @expire,
|
134
139
|
"provider": @provider,
|
@@ -266,7 +266,7 @@ module Appwrite
|
|
266
266
|
|
267
267
|
# Add an authenticator app to be used as an MFA factor. Verify the
|
268
268
|
# authenticator using the [verify
|
269
|
-
# authenticator](/docs/references/cloud/client-web/account#
|
269
|
+
# authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
|
270
270
|
# method.
|
271
271
|
#
|
272
272
|
# @param [AuthenticatorType] type Type of authenticator. Must be `totp`
|
@@ -298,8 +298,8 @@ module Appwrite
|
|
298
298
|
|
299
299
|
|
300
300
|
# Verify an authenticator app after adding it using the [add
|
301
|
-
# authenticator](/docs/references/cloud/client-web/account#
|
302
|
-
# method.
|
301
|
+
# authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
302
|
+
# method. add
|
303
303
|
#
|
304
304
|
# @param [AuthenticatorType] type Type of authenticator.
|
305
305
|
# @param [String] otp Valid verification token.
|
@@ -340,7 +340,7 @@ module Appwrite
|
|
340
340
|
# @param [AuthenticatorType] type Type of authenticator.
|
341
341
|
# @param [String] otp Valid verification token.
|
342
342
|
#
|
343
|
-
# @return [
|
343
|
+
# @return []
|
344
344
|
def delete_mfa_authenticator(type:, otp:)
|
345
345
|
api_path = '/account/mfa/authenticators/{type}'
|
346
346
|
.gsub('{type}', type)
|
@@ -366,7 +366,6 @@ module Appwrite
|
|
366
366
|
path: api_path,
|
367
367
|
headers: api_headers,
|
368
368
|
params: api_params,
|
369
|
-
response_type: Models::User
|
370
369
|
)
|
371
370
|
end
|
372
371
|
|
@@ -61,7 +61,7 @@ module Appwrite
|
|
61
61
|
# of image returned is 100x100px.
|
62
62
|
#
|
63
63
|
#
|
64
|
-
# @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal,
|
64
|
+
# @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
|
65
65
|
# @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
66
66
|
# @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
67
67
|
# @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
@@ -45,7 +45,7 @@ module Appwrite
|
|
45
45
|
# @param [Array] targets List of Targets IDs.
|
46
46
|
# @param [Array] cc Array of target IDs to be added as CC.
|
47
47
|
# @param [Array] bcc Array of target IDs to be added as BCC.
|
48
|
-
# @param [Array] attachments Array of compound bucket IDs
|
48
|
+
# @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.
|
49
49
|
# @param [] draft Is message a draft
|
50
50
|
# @param [] html Is content of type HTML
|
51
51
|
# @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
|
@@ -109,9 +109,10 @@ module Appwrite
|
|
109
109
|
# @param [Array] cc Array of target IDs to be added as CC.
|
110
110
|
# @param [Array] bcc Array of target IDs to be added as BCC.
|
111
111
|
# @param [String] scheduled_at Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
|
112
|
+
# @param [Array] attachments Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.
|
112
113
|
#
|
113
114
|
# @return [Message]
|
114
|
-
def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil)
|
115
|
+
def update_email(message_id:, topics: nil, users: nil, targets: nil, subject: nil, content: nil, draft: nil, html: nil, cc: nil, bcc: nil, scheduled_at: nil, attachments: nil)
|
115
116
|
api_path = '/messaging/messages/email/{messageId}'
|
116
117
|
.gsub('{messageId}', message_id)
|
117
118
|
|
@@ -130,6 +131,7 @@ module Appwrite
|
|
130
131
|
cc: cc,
|
131
132
|
bcc: bcc,
|
132
133
|
scheduledAt: scheduled_at,
|
134
|
+
attachments: attachments,
|
133
135
|
}
|
134
136
|
|
135
137
|
api_headers = {
|
@@ -156,7 +158,7 @@ module Appwrite
|
|
156
158
|
# @param [Array] targets List of Targets IDs.
|
157
159
|
# @param [Hash] data Additional Data for push notification.
|
158
160
|
# @param [String] action Action for push notification.
|
159
|
-
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
|
161
|
+
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.
|
160
162
|
# @param [String] icon Icon for push notification. Available only for Android and Web Platform.
|
161
163
|
# @param [String] sound Sound for push notification. Available only for Android and IOS Platform.
|
162
164
|
# @param [String] color Color for push notification. Available only for Android Platform.
|
@@ -225,7 +227,7 @@ module Appwrite
|
|
225
227
|
# @param [String] body Body for push notification.
|
226
228
|
# @param [Hash] data Additional Data for push notification.
|
227
229
|
# @param [String] action Action for push notification.
|
228
|
-
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage.
|
230
|
+
# @param [String] image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.
|
229
231
|
# @param [String] icon Icon for push notification. Available only for Android and Web platforms.
|
230
232
|
# @param [String] sound Sound for push notification. Available only for Android and iOS platforms.
|
231
233
|
# @param [String] color Color for push notification. Available only for Android platforms.
|
@@ -789,13 +791,13 @@ module Appwrite
|
|
789
791
|
#
|
790
792
|
# @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
791
793
|
# @param [String] name Provider name.
|
792
|
-
# @param [String]
|
793
|
-
# @param [String] sender_id Msg91
|
794
|
-
# @param [String] auth_key Msg91
|
794
|
+
# @param [String] template_id Msg91 template ID
|
795
|
+
# @param [String] sender_id Msg91 sender ID.
|
796
|
+
# @param [String] auth_key Msg91 auth key.
|
795
797
|
# @param [] enabled Set as enabled.
|
796
798
|
#
|
797
799
|
# @return [Provider]
|
798
|
-
def create_msg91_provider(provider_id:, name:,
|
800
|
+
def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, auth_key: nil, enabled: nil)
|
799
801
|
api_path = '/messaging/providers/msg91'
|
800
802
|
|
801
803
|
if provider_id.nil?
|
@@ -809,7 +811,7 @@ module Appwrite
|
|
809
811
|
api_params = {
|
810
812
|
providerId: provider_id,
|
811
813
|
name: name,
|
812
|
-
|
814
|
+
templateId: template_id,
|
813
815
|
senderId: sender_id,
|
814
816
|
authKey: auth_key,
|
815
817
|
enabled: enabled,
|
@@ -834,12 +836,12 @@ module Appwrite
|
|
834
836
|
# @param [String] provider_id Provider ID.
|
835
837
|
# @param [String] name Provider name.
|
836
838
|
# @param [] enabled Set as enabled.
|
837
|
-
# @param [String]
|
838
|
-
# @param [String]
|
839
|
-
# @param [String]
|
839
|
+
# @param [String] template_id Msg91 template ID.
|
840
|
+
# @param [String] sender_id Msg91 sender ID.
|
841
|
+
# @param [String] auth_key Msg91 auth key.
|
840
842
|
#
|
841
843
|
# @return [Provider]
|
842
|
-
def update_msg91_provider(provider_id:, name: nil, enabled: nil,
|
844
|
+
def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: nil, sender_id: nil, auth_key: nil)
|
843
845
|
api_path = '/messaging/providers/msg91/{providerId}'
|
844
846
|
.gsub('{providerId}', provider_id)
|
845
847
|
|
@@ -850,9 +852,9 @@ module Appwrite
|
|
850
852
|
api_params = {
|
851
853
|
name: name,
|
852
854
|
enabled: enabled,
|
855
|
+
templateId: template_id,
|
853
856
|
senderId: sender_id,
|
854
857
|
authKey: auth_key,
|
855
|
-
from: from,
|
856
858
|
}
|
857
859
|
|
858
860
|
api_headers = {
|
@@ -1454,11 +1454,11 @@ module Appwrite
|
|
1454
1454
|
end
|
1455
1455
|
|
1456
1456
|
|
1457
|
-
# Returns a token with a secret key for creating a session.
|
1458
|
-
#
|
1459
|
-
#
|
1460
|
-
# /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession)
|
1457
|
+
# Returns a token with a secret key for creating a session. Use the user ID
|
1458
|
+
# and secret and submit a request to the [PUT
|
1459
|
+
# /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
1461
1460
|
# endpoint to complete the login process.
|
1461
|
+
#
|
1462
1462
|
#
|
1463
1463
|
# @param [String] user_id User ID.
|
1464
1464
|
# @param [Integer] length Token length in characters. The default length is 6 characters
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appwrite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.0.
|
4
|
+
version: 11.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Appwrite Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|