appwrite 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +134 -57
- data/lib/appwrite/exception.rb +5 -7
- data/lib/appwrite/file.rb +5 -13
- data/lib/appwrite/models/attribute_boolean.rb +52 -0
- data/lib/appwrite/models/attribute_email.rb +57 -0
- data/lib/appwrite/models/attribute_enum.rb +62 -0
- data/lib/appwrite/models/attribute_float.rb +62 -0
- data/lib/appwrite/models/attribute_integer.rb +62 -0
- data/lib/appwrite/models/attribute_ip.rb +57 -0
- data/lib/appwrite/models/attribute_list.rb +32 -0
- data/lib/appwrite/models/attribute_string.rb +57 -0
- data/lib/appwrite/models/attribute_url.rb +57 -0
- data/lib/appwrite/models/collection.rb +62 -0
- data/lib/appwrite/models/collection_list.rb +32 -0
- data/lib/appwrite/models/continent.rb +32 -0
- data/lib/appwrite/models/continent_list.rb +32 -0
- data/lib/appwrite/models/country.rb +32 -0
- data/lib/appwrite/models/country_list.rb +32 -0
- data/lib/appwrite/models/currency.rb +57 -0
- data/lib/appwrite/models/currency_list.rb +32 -0
- data/lib/appwrite/models/document.rb +50 -0
- data/lib/appwrite/models/document_list.rb +36 -0
- data/lib/appwrite/models/execution.rb +72 -0
- data/lib/appwrite/models/execution_list.rb +32 -0
- data/lib/appwrite/models/file.rb +62 -0
- data/lib/appwrite/models/file_list.rb +32 -0
- data/lib/appwrite/models/function.rb +92 -0
- data/lib/appwrite/models/function_list.rb +32 -0
- data/lib/appwrite/models/health_antivirus.rb +32 -0
- data/lib/appwrite/models/health_queue.rb +27 -0
- data/lib/appwrite/models/health_status.rb +32 -0
- data/lib/appwrite/models/health_time.rb +37 -0
- data/lib/appwrite/models/index.rb +47 -0
- data/lib/appwrite/models/index_list.rb +32 -0
- data/lib/appwrite/models/language.rb +37 -0
- data/lib/appwrite/models/language_list.rb +32 -0
- data/lib/appwrite/models/locale.rb +57 -0
- data/lib/appwrite/models/log.rb +127 -0
- data/lib/appwrite/models/log_list.rb +32 -0
- data/lib/appwrite/models/membership.rb +67 -0
- data/lib/appwrite/models/membership_list.rb +32 -0
- data/lib/appwrite/models/phone.rb +37 -0
- data/lib/appwrite/models/phone_list.rb +32 -0
- data/lib/appwrite/models/preferences.rb +30 -0
- data/lib/appwrite/models/runtime.rb +57 -0
- data/lib/appwrite/models/runtime_list.rb +32 -0
- data/lib/appwrite/models/session.rb +132 -0
- data/lib/appwrite/models/session_list.rb +32 -0
- data/lib/appwrite/models/tag.rb +47 -0
- data/lib/appwrite/models/tag_list.rb +32 -0
- data/lib/appwrite/models/team.rb +42 -0
- data/lib/appwrite/models/team_list.rb +32 -0
- data/lib/appwrite/models/token.rb +42 -0
- data/lib/appwrite/models/user.rb +62 -0
- data/lib/appwrite/models/user_list.rb +32 -0
- data/lib/appwrite/query.rb +42 -0
- data/lib/appwrite/service.rb +0 -5
- data/lib/appwrite/services/account.rb +380 -133
- data/lib/appwrite/services/avatars.rb +189 -125
- data/lib/appwrite/services/database.rb +876 -130
- data/lib/appwrite/services/functions.rb +366 -184
- data/lib/appwrite/services/health.rb +202 -58
- data/lib/appwrite/services/locale.rb +134 -32
- data/lib/appwrite/services/storage.rb +211 -118
- data/lib/appwrite/services/teams.rb +299 -118
- data/lib/appwrite/services/users.rb +372 -85
- data/lib/appwrite.rb +55 -0
- metadata +72 -103
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -4
- data/LICENSE +0 -12
- data/README.md +0 -97
- data/appwrite.gemspec +0 -11
- data/docs/examples/account/create-recovery.md +0 -15
- data/docs/examples/account/create-verification.md +0 -15
- data/docs/examples/account/delete-session.md +0 -15
- data/docs/examples/account/delete-sessions.md +0 -15
- data/docs/examples/account/delete.md +0 -15
- data/docs/examples/account/get-logs.md +0 -15
- data/docs/examples/account/get-prefs.md +0 -15
- data/docs/examples/account/get-sessions.md +0 -15
- data/docs/examples/account/get.md +0 -15
- data/docs/examples/account/update-email.md +0 -15
- data/docs/examples/account/update-name.md +0 -15
- data/docs/examples/account/update-password.md +0 -15
- data/docs/examples/account/update-prefs.md +0 -15
- data/docs/examples/account/update-recovery.md +0 -15
- data/docs/examples/account/update-verification.md +0 -15
- data/docs/examples/avatars/get-browser.md +0 -15
- data/docs/examples/avatars/get-credit-card.md +0 -15
- data/docs/examples/avatars/get-favicon.md +0 -15
- data/docs/examples/avatars/get-flag.md +0 -15
- data/docs/examples/avatars/get-image.md +0 -15
- data/docs/examples/avatars/get-initials.md +0 -15
- data/docs/examples/avatars/get-q-r.md +0 -15
- data/docs/examples/database/create-collection.md +0 -15
- data/docs/examples/database/create-document.md +0 -15
- data/docs/examples/database/delete-collection.md +0 -15
- data/docs/examples/database/delete-document.md +0 -15
- data/docs/examples/database/get-collection.md +0 -15
- data/docs/examples/database/get-document.md +0 -15
- data/docs/examples/database/list-collections.md +0 -15
- data/docs/examples/database/list-documents.md +0 -15
- data/docs/examples/database/update-collection.md +0 -15
- data/docs/examples/database/update-document.md +0 -15
- data/docs/examples/functions/create-execution.md +0 -15
- data/docs/examples/functions/create-tag.md +0 -15
- data/docs/examples/functions/create.md +0 -15
- data/docs/examples/functions/delete-tag.md +0 -15
- data/docs/examples/functions/delete.md +0 -15
- data/docs/examples/functions/get-execution.md +0 -15
- data/docs/examples/functions/get-tag.md +0 -15
- data/docs/examples/functions/get.md +0 -15
- data/docs/examples/functions/list-executions.md +0 -15
- data/docs/examples/functions/list-tags.md +0 -15
- data/docs/examples/functions/list.md +0 -15
- data/docs/examples/functions/update-tag.md +0 -15
- data/docs/examples/functions/update.md +0 -15
- data/docs/examples/health/get-anti-virus.md +0 -15
- data/docs/examples/health/get-cache.md +0 -15
- data/docs/examples/health/get-d-b.md +0 -15
- data/docs/examples/health/get-queue-certificates.md +0 -15
- data/docs/examples/health/get-queue-functions.md +0 -15
- data/docs/examples/health/get-queue-logs.md +0 -15
- data/docs/examples/health/get-queue-tasks.md +0 -15
- data/docs/examples/health/get-queue-usage.md +0 -15
- data/docs/examples/health/get-queue-webhooks.md +0 -15
- data/docs/examples/health/get-storage-local.md +0 -15
- data/docs/examples/health/get-time.md +0 -15
- data/docs/examples/health/get.md +0 -15
- data/docs/examples/locale/get-continents.md +0 -15
- data/docs/examples/locale/get-countries-e-u.md +0 -15
- data/docs/examples/locale/get-countries-phones.md +0 -15
- data/docs/examples/locale/get-countries.md +0 -15
- data/docs/examples/locale/get-currencies.md +0 -15
- data/docs/examples/locale/get-languages.md +0 -15
- data/docs/examples/locale/get.md +0 -15
- data/docs/examples/storage/create-file.md +0 -15
- data/docs/examples/storage/delete-file.md +0 -15
- data/docs/examples/storage/get-file-download.md +0 -15
- data/docs/examples/storage/get-file-preview.md +0 -15
- data/docs/examples/storage/get-file-view.md +0 -15
- data/docs/examples/storage/get-file.md +0 -15
- data/docs/examples/storage/list-files.md +0 -15
- data/docs/examples/storage/update-file.md +0 -15
- data/docs/examples/teams/create-membership.md +0 -15
- data/docs/examples/teams/create.md +0 -15
- data/docs/examples/teams/delete-membership.md +0 -15
- data/docs/examples/teams/delete.md +0 -15
- data/docs/examples/teams/get-memberships.md +0 -15
- data/docs/examples/teams/get.md +0 -15
- data/docs/examples/teams/list.md +0 -15
- data/docs/examples/teams/update-membership-roles.md +0 -15
- data/docs/examples/teams/update-membership-status.md +0 -15
- data/docs/examples/teams/update.md +0 -15
- data/docs/examples/users/create.md +0 -15
- data/docs/examples/users/delete-session.md +0 -15
- data/docs/examples/users/delete-sessions.md +0 -15
- data/docs/examples/users/delete.md +0 -15
- data/docs/examples/users/get-logs.md +0 -15
- data/docs/examples/users/get-prefs.md +0 -15
- data/docs/examples/users/get-sessions.md +0 -15
- data/docs/examples/users/get.md +0 -15
- data/docs/examples/users/list.md +0 -15
- data/docs/examples/users/update-prefs.md +0 -15
- data/docs/examples/users/update-status.md +0 -15
@@ -0,0 +1,42 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class Team
|
6
|
+
attr_reader :id
|
7
|
+
attr_reader :name
|
8
|
+
attr_reader :date_created
|
9
|
+
attr_reader :sum
|
10
|
+
|
11
|
+
def initialize(
|
12
|
+
id:,
|
13
|
+
name:,
|
14
|
+
date_created:,
|
15
|
+
sum:
|
16
|
+
)
|
17
|
+
@id = id
|
18
|
+
@name = name
|
19
|
+
@date_created = date_created
|
20
|
+
@sum = sum
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.from(map:)
|
24
|
+
Team.new(
|
25
|
+
id: map["$id"],
|
26
|
+
name: map["name"],
|
27
|
+
date_created: map["dateCreated"],
|
28
|
+
sum: map["sum"]
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_map
|
33
|
+
{
|
34
|
+
"$id": @id,
|
35
|
+
"name": @name,
|
36
|
+
"dateCreated": @date_created,
|
37
|
+
"sum": @sum
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class TeamList
|
6
|
+
attr_reader :sum
|
7
|
+
attr_reader :teams
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
sum:,
|
11
|
+
teams:
|
12
|
+
)
|
13
|
+
@sum = sum
|
14
|
+
@teams = teams
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from(map:)
|
18
|
+
TeamList.new(
|
19
|
+
sum: map["sum"],
|
20
|
+
teams: map["teams"].map { |it| Team.from(map: it) }
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_map
|
25
|
+
{
|
26
|
+
"sum": @sum,
|
27
|
+
"teams": @teams.map { |it| it.to_map }
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class Token
|
6
|
+
attr_reader :id
|
7
|
+
attr_reader :user_id
|
8
|
+
attr_reader :secret
|
9
|
+
attr_reader :expire
|
10
|
+
|
11
|
+
def initialize(
|
12
|
+
id:,
|
13
|
+
user_id:,
|
14
|
+
secret:,
|
15
|
+
expire:
|
16
|
+
)
|
17
|
+
@id = id
|
18
|
+
@user_id = user_id
|
19
|
+
@secret = secret
|
20
|
+
@expire = expire
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.from(map:)
|
24
|
+
Token.new(
|
25
|
+
id: map["$id"],
|
26
|
+
user_id: map["userId"],
|
27
|
+
secret: map["secret"],
|
28
|
+
expire: map["expire"]
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_map
|
33
|
+
{
|
34
|
+
"$id": @id,
|
35
|
+
"userId": @user_id,
|
36
|
+
"secret": @secret,
|
37
|
+
"expire": @expire
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class User
|
6
|
+
attr_reader :id
|
7
|
+
attr_reader :name
|
8
|
+
attr_reader :registration
|
9
|
+
attr_reader :status
|
10
|
+
attr_reader :password_update
|
11
|
+
attr_reader :email
|
12
|
+
attr_reader :email_verification
|
13
|
+
attr_reader :prefs
|
14
|
+
|
15
|
+
def initialize(
|
16
|
+
id:,
|
17
|
+
name:,
|
18
|
+
registration:,
|
19
|
+
status:,
|
20
|
+
password_update:,
|
21
|
+
email:,
|
22
|
+
email_verification:,
|
23
|
+
prefs:
|
24
|
+
)
|
25
|
+
@id = id
|
26
|
+
@name = name
|
27
|
+
@registration = registration
|
28
|
+
@status = status
|
29
|
+
@password_update = password_update
|
30
|
+
@email = email
|
31
|
+
@email_verification = email_verification
|
32
|
+
@prefs = prefs
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from(map:)
|
36
|
+
User.new(
|
37
|
+
id: map["$id"],
|
38
|
+
name: map["name"],
|
39
|
+
registration: map["registration"],
|
40
|
+
status: map["status"],
|
41
|
+
password_update: map["passwordUpdate"],
|
42
|
+
email: map["email"],
|
43
|
+
email_verification: map["emailVerification"],
|
44
|
+
prefs: Preferences.from(map: map["prefs"])
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_map
|
49
|
+
{
|
50
|
+
"$id": @id,
|
51
|
+
"name": @name,
|
52
|
+
"registration": @registration,
|
53
|
+
"status": @status,
|
54
|
+
"passwordUpdate": @password_update,
|
55
|
+
"email": @email,
|
56
|
+
"emailVerification": @email_verification,
|
57
|
+
"prefs": @prefs.to_map
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class UserList
|
6
|
+
attr_reader :sum
|
7
|
+
attr_reader :users
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
sum:,
|
11
|
+
users:
|
12
|
+
)
|
13
|
+
@sum = sum
|
14
|
+
@users = users
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from(map:)
|
18
|
+
UserList.new(
|
19
|
+
sum: map["sum"],
|
20
|
+
users: map["users"].map { |it| User.from(map: it) }
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_map
|
25
|
+
{
|
26
|
+
"sum": @sum,
|
27
|
+
"users": @users.map { |it| it.to_map }
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Appwrite
|
2
|
+
class Query
|
3
|
+
class << Query
|
4
|
+
def equal(attribute, value)
|
5
|
+
return addQuery(attribute, "equal", value)
|
6
|
+
end
|
7
|
+
|
8
|
+
def notEqual(attribute, value)
|
9
|
+
return Query.addQuery(attribute, "notEqual", value)
|
10
|
+
end
|
11
|
+
def lesser(attribute, value)
|
12
|
+
return Query.addQuery(attribute, "lesser", value)
|
13
|
+
end
|
14
|
+
def lesserEqual(attribute, value)
|
15
|
+
return Query.addQuery(attribute, "lesserEqual", value)
|
16
|
+
end
|
17
|
+
def greater(attribute, value)
|
18
|
+
return Query.addQuery(attribute, "greater", value)
|
19
|
+
end
|
20
|
+
def greaterEqual(attribute, value)
|
21
|
+
return Query.addQuery(attribute, "equal", value)
|
22
|
+
end
|
23
|
+
def search(attribute, value)
|
24
|
+
return Query.addQuery(attribute, "search", value)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def addQuery(attribute, oper, value)
|
30
|
+
if value.is_a?(Array)
|
31
|
+
"#{attribute}.#{oper}.(#{value.map {|item| parseValues(item)}.join(',')})"
|
32
|
+
else
|
33
|
+
return "#{attribute}.#{oper}.(#{parseValues(value)})"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def parseValues(value)
|
38
|
+
return value.is_a?(String) ? "\"#{value}\"" : value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|