appwrite 1.0.8 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +16 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +1 -0
- data/LICENSE +1 -1
- data/README.md +10 -6
- data/appwrite.gemspec +3 -3
- data/docs/examples/avatars/get-browser.md +15 -0
- data/docs/examples/avatars/get-credit-card.md +15 -0
- data/docs/examples/avatars/get-favicon.md +15 -0
- data/docs/examples/avatars/get-flag.md +15 -0
- data/docs/examples/avatars/get-image.md +15 -0
- data/docs/examples/avatars/get-initials.md +15 -0
- data/docs/examples/avatars/get-q-r.md +15 -0
- data/docs/examples/database/create-collection.md +15 -0
- data/docs/examples/database/create-document.md +15 -0
- data/docs/examples/database/delete-collection.md +15 -0
- data/docs/examples/database/delete-document.md +15 -0
- data/docs/examples/database/get-collection.md +15 -0
- data/docs/examples/database/get-document.md +15 -0
- data/docs/examples/database/list-collections.md +15 -0
- data/docs/examples/database/list-documents.md +15 -0
- data/docs/examples/database/update-collection.md +15 -0
- data/docs/examples/database/update-document.md +15 -0
- data/docs/examples/functions/create-execution.md +15 -0
- data/docs/examples/functions/create-tag.md +15 -0
- data/docs/examples/functions/create.md +15 -0
- data/docs/examples/functions/delete-tag.md +15 -0
- data/docs/examples/functions/delete.md +15 -0
- data/docs/examples/functions/get-execution.md +15 -0
- data/docs/examples/functions/get-tag.md +15 -0
- data/docs/examples/functions/get.md +15 -0
- data/docs/examples/functions/list-executions.md +15 -0
- data/docs/examples/functions/list-tags.md +15 -0
- data/docs/examples/functions/list.md +15 -0
- data/docs/examples/functions/update-tag.md +15 -0
- data/docs/examples/functions/update.md +15 -0
- data/docs/examples/health/get-anti-virus.md +15 -0
- data/docs/examples/health/get-cache.md +15 -0
- data/docs/examples/health/get-d-b.md +15 -0
- data/docs/examples/health/get-queue-certificates.md +15 -0
- data/docs/examples/health/get-queue-functions.md +15 -0
- data/docs/examples/health/get-queue-logs.md +15 -0
- data/docs/examples/health/get-queue-tasks.md +15 -0
- data/docs/examples/health/get-queue-usage.md +15 -0
- data/docs/examples/health/get-queue-webhooks.md +15 -0
- data/docs/examples/health/get-storage-local.md +15 -0
- data/docs/examples/health/get-time.md +15 -0
- data/docs/examples/health/get.md +15 -0
- data/docs/examples/locale/get-continents.md +15 -0
- data/docs/examples/locale/get-countries-e-u.md +15 -0
- data/docs/examples/locale/get-countries-phones.md +15 -0
- data/docs/examples/locale/get-countries.md +15 -0
- data/docs/examples/locale/get-currencies.md +15 -0
- data/docs/examples/locale/get-languages.md +15 -0
- data/docs/examples/locale/get.md +15 -0
- data/docs/examples/storage/create-file.md +15 -0
- data/docs/examples/storage/delete-file.md +15 -0
- data/docs/examples/storage/get-file-download.md +15 -0
- data/docs/examples/storage/get-file-preview.md +15 -0
- data/docs/examples/storage/get-file-view.md +15 -0
- data/docs/examples/storage/get-file.md +15 -0
- data/docs/examples/storage/list-files.md +15 -0
- data/docs/examples/storage/update-file.md +15 -0
- data/docs/examples/teams/create-membership.md +15 -0
- data/docs/examples/teams/create.md +15 -0
- data/docs/examples/teams/delete-membership.md +15 -0
- data/docs/examples/teams/delete.md +15 -0
- data/docs/examples/teams/get-memberships.md +15 -0
- data/docs/examples/teams/get.md +15 -0
- data/docs/examples/teams/list.md +15 -0
- data/docs/examples/teams/update.md +15 -0
- data/docs/examples/users/create.md +15 -0
- data/docs/examples/users/delete-session.md +15 -0
- data/docs/examples/users/delete-sessions.md +15 -0
- data/docs/examples/users/delete-user.md +15 -0
- data/docs/examples/users/get-logs.md +15 -0
- data/docs/examples/users/get-prefs.md +15 -0
- data/docs/examples/users/get-sessions.md +15 -0
- data/docs/examples/users/get.md +15 -0
- data/docs/examples/users/list.md +15 -0
- data/docs/examples/users/update-prefs.md +15 -0
- data/docs/examples/users/update-status.md +15 -0
- data/lib/appwrite.rb +4 -3
- data/lib/appwrite/client.rb +46 -13
- data/lib/appwrite/file.rb +23 -0
- data/lib/appwrite/services/avatars.rb +17 -1
- data/lib/appwrite/services/database.rb +27 -29
- data/lib/appwrite/services/functions.rb +194 -0
- data/lib/appwrite/services/health.rb +141 -0
- data/lib/appwrite/services/locale.rb +12 -1
- data/lib/appwrite/services/storage.rb +9 -10
- data/lib/appwrite/services/teams.rb +21 -48
- data/lib/appwrite/services/users.rb +32 -20
- metadata +86 -11
- data/lib/appwrite/services/account.rb +0 -114
- data/lib/appwrite/services/auth.rb +0 -131
- data/lib/appwrite/services/projects.rb +0 -410
@@ -0,0 +1,141 @@
|
|
1
|
+
module Appwrite
|
2
|
+
class Health < Service
|
3
|
+
|
4
|
+
def get()
|
5
|
+
path = '/health'
|
6
|
+
|
7
|
+
params = {
|
8
|
+
}
|
9
|
+
|
10
|
+
return @client.call('get', path, {
|
11
|
+
'content-type' => 'application/json',
|
12
|
+
}, params);
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_anti_virus()
|
16
|
+
path = '/health/anti-virus'
|
17
|
+
|
18
|
+
params = {
|
19
|
+
}
|
20
|
+
|
21
|
+
return @client.call('get', path, {
|
22
|
+
'content-type' => 'application/json',
|
23
|
+
}, params);
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_cache()
|
27
|
+
path = '/health/cache'
|
28
|
+
|
29
|
+
params = {
|
30
|
+
}
|
31
|
+
|
32
|
+
return @client.call('get', path, {
|
33
|
+
'content-type' => 'application/json',
|
34
|
+
}, params);
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_d_b()
|
38
|
+
path = '/health/db'
|
39
|
+
|
40
|
+
params = {
|
41
|
+
}
|
42
|
+
|
43
|
+
return @client.call('get', path, {
|
44
|
+
'content-type' => 'application/json',
|
45
|
+
}, params);
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_queue_certificates()
|
49
|
+
path = '/health/queue/certificates'
|
50
|
+
|
51
|
+
params = {
|
52
|
+
}
|
53
|
+
|
54
|
+
return @client.call('get', path, {
|
55
|
+
'content-type' => 'application/json',
|
56
|
+
}, params);
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_queue_functions()
|
60
|
+
path = '/health/queue/functions'
|
61
|
+
|
62
|
+
params = {
|
63
|
+
}
|
64
|
+
|
65
|
+
return @client.call('get', path, {
|
66
|
+
'content-type' => 'application/json',
|
67
|
+
}, params);
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_queue_logs()
|
71
|
+
path = '/health/queue/logs'
|
72
|
+
|
73
|
+
params = {
|
74
|
+
}
|
75
|
+
|
76
|
+
return @client.call('get', path, {
|
77
|
+
'content-type' => 'application/json',
|
78
|
+
}, params);
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_queue_tasks()
|
82
|
+
path = '/health/queue/tasks'
|
83
|
+
|
84
|
+
params = {
|
85
|
+
}
|
86
|
+
|
87
|
+
return @client.call('get', path, {
|
88
|
+
'content-type' => 'application/json',
|
89
|
+
}, params);
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_queue_usage()
|
93
|
+
path = '/health/queue/usage'
|
94
|
+
|
95
|
+
params = {
|
96
|
+
}
|
97
|
+
|
98
|
+
return @client.call('get', path, {
|
99
|
+
'content-type' => 'application/json',
|
100
|
+
}, params);
|
101
|
+
end
|
102
|
+
|
103
|
+
def get_queue_webhooks()
|
104
|
+
path = '/health/queue/webhooks'
|
105
|
+
|
106
|
+
params = {
|
107
|
+
}
|
108
|
+
|
109
|
+
return @client.call('get', path, {
|
110
|
+
'content-type' => 'application/json',
|
111
|
+
}, params);
|
112
|
+
end
|
113
|
+
|
114
|
+
def get_storage_local()
|
115
|
+
path = '/health/storage/local'
|
116
|
+
|
117
|
+
params = {
|
118
|
+
}
|
119
|
+
|
120
|
+
return @client.call('get', path, {
|
121
|
+
'content-type' => 'application/json',
|
122
|
+
}, params);
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_time()
|
126
|
+
path = '/health/time'
|
127
|
+
|
128
|
+
params = {
|
129
|
+
}
|
130
|
+
|
131
|
+
return @client.call('get', path, {
|
132
|
+
'content-type' => 'application/json',
|
133
|
+
}, params);
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
protected
|
138
|
+
|
139
|
+
private
|
140
|
+
end
|
141
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Locale < Service
|
3
3
|
|
4
|
-
def
|
4
|
+
def get()
|
5
5
|
path = '/locale'
|
6
6
|
|
7
7
|
params = {
|
@@ -67,6 +67,17 @@ module Appwrite
|
|
67
67
|
}, params);
|
68
68
|
end
|
69
69
|
|
70
|
+
def get_languages()
|
71
|
+
path = '/locale/languages'
|
72
|
+
|
73
|
+
params = {
|
74
|
+
}
|
75
|
+
|
76
|
+
return @client.call('get', path, {
|
77
|
+
'content-type' => 'application/json',
|
78
|
+
}, params);
|
79
|
+
end
|
80
|
+
|
70
81
|
|
71
82
|
protected
|
72
83
|
|
@@ -16,11 +16,11 @@ module Appwrite
|
|
16
16
|
}, params);
|
17
17
|
end
|
18
18
|
|
19
|
-
def create_file(
|
19
|
+
def create_file(file:, read:, write:)
|
20
20
|
path = '/storage/files'
|
21
21
|
|
22
22
|
params = {
|
23
|
-
'
|
23
|
+
'file': file,
|
24
24
|
'read': read,
|
25
25
|
'write': write
|
26
26
|
}
|
@@ -32,7 +32,7 @@ module Appwrite
|
|
32
32
|
|
33
33
|
def get_file(file_id:)
|
34
34
|
path = '/storage/files/{fileId}'
|
35
|
-
.gsub('{
|
35
|
+
.gsub('{fileId}', file_id)
|
36
36
|
|
37
37
|
params = {
|
38
38
|
}
|
@@ -44,7 +44,7 @@ module Appwrite
|
|
44
44
|
|
45
45
|
def update_file(file_id:, read:, write:)
|
46
46
|
path = '/storage/files/{fileId}'
|
47
|
-
.gsub('{
|
47
|
+
.gsub('{fileId}', file_id)
|
48
48
|
|
49
49
|
params = {
|
50
50
|
'read': read,
|
@@ -58,7 +58,7 @@ module Appwrite
|
|
58
58
|
|
59
59
|
def delete_file(file_id:)
|
60
60
|
path = '/storage/files/{fileId}'
|
61
|
-
.gsub('{
|
61
|
+
.gsub('{fileId}', file_id)
|
62
62
|
|
63
63
|
params = {
|
64
64
|
}
|
@@ -70,7 +70,7 @@ module Appwrite
|
|
70
70
|
|
71
71
|
def get_file_download(file_id:)
|
72
72
|
path = '/storage/files/{fileId}/download'
|
73
|
-
.gsub('{
|
73
|
+
.gsub('{fileId}', file_id)
|
74
74
|
|
75
75
|
params = {
|
76
76
|
}
|
@@ -82,7 +82,7 @@ module Appwrite
|
|
82
82
|
|
83
83
|
def get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '')
|
84
84
|
path = '/storage/files/{fileId}/preview'
|
85
|
-
.gsub('{
|
85
|
+
.gsub('{fileId}', file_id)
|
86
86
|
|
87
87
|
params = {
|
88
88
|
'width': width,
|
@@ -97,12 +97,11 @@ module Appwrite
|
|
97
97
|
}, params);
|
98
98
|
end
|
99
99
|
|
100
|
-
def get_file_view(file_id
|
100
|
+
def get_file_view(file_id:)
|
101
101
|
path = '/storage/files/{fileId}/view'
|
102
|
-
.gsub('{
|
102
|
+
.gsub('{fileId}', file_id)
|
103
103
|
|
104
104
|
params = {
|
105
|
-
'as': as
|
106
105
|
}
|
107
106
|
|
108
107
|
return @client.call('get', path, {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Teams < Service
|
3
3
|
|
4
|
-
def
|
4
|
+
def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
|
5
5
|
path = '/teams'
|
6
6
|
|
7
7
|
params = {
|
@@ -16,7 +16,7 @@ module Appwrite
|
|
16
16
|
}, params);
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def create(name:, roles: ["owner"])
|
20
20
|
path = '/teams'
|
21
21
|
|
22
22
|
params = {
|
@@ -29,9 +29,9 @@ module Appwrite
|
|
29
29
|
}, params);
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def get(team_id:)
|
33
33
|
path = '/teams/{teamId}'
|
34
|
-
.gsub('{
|
34
|
+
.gsub('{teamId}', team_id)
|
35
35
|
|
36
36
|
params = {
|
37
37
|
}
|
@@ -41,9 +41,9 @@ module Appwrite
|
|
41
41
|
}, params);
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
44
|
+
def update(team_id:, name:)
|
45
45
|
path = '/teams/{teamId}'
|
46
|
-
.gsub('{
|
46
|
+
.gsub('{teamId}', team_id)
|
47
47
|
|
48
48
|
params = {
|
49
49
|
'name': name
|
@@ -54,9 +54,9 @@ module Appwrite
|
|
54
54
|
}, params);
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def delete(team_id:)
|
58
58
|
path = '/teams/{teamId}'
|
59
|
-
.gsub('{
|
59
|
+
.gsub('{teamId}', team_id)
|
60
60
|
|
61
61
|
params = {
|
62
62
|
}
|
@@ -66,11 +66,15 @@ module Appwrite
|
|
66
66
|
}, params);
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
path = '/teams/{teamId}/
|
71
|
-
.gsub('{
|
69
|
+
def get_memberships(team_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
|
70
|
+
path = '/teams/{teamId}/memberships'
|
71
|
+
.gsub('{teamId}', team_id)
|
72
72
|
|
73
73
|
params = {
|
74
|
+
'search': search,
|
75
|
+
'limit': limit,
|
76
|
+
'offset': offset,
|
77
|
+
'orderType': order_type
|
74
78
|
}
|
75
79
|
|
76
80
|
return @client.call('get', path, {
|
@@ -78,15 +82,15 @@ module Appwrite
|
|
78
82
|
}, params);
|
79
83
|
end
|
80
84
|
|
81
|
-
def
|
85
|
+
def create_membership(team_id:, email:, roles:, url:, name: '')
|
82
86
|
path = '/teams/{teamId}/memberships'
|
83
|
-
.gsub('{
|
87
|
+
.gsub('{teamId}', team_id)
|
84
88
|
|
85
89
|
params = {
|
86
90
|
'email': email,
|
87
91
|
'name': name,
|
88
92
|
'roles': roles,
|
89
|
-
'
|
93
|
+
'url': url
|
90
94
|
}
|
91
95
|
|
92
96
|
return @client.call('post', path, {
|
@@ -94,10 +98,10 @@ module Appwrite
|
|
94
98
|
}, params);
|
95
99
|
end
|
96
100
|
|
97
|
-
def
|
101
|
+
def delete_membership(team_id:, invite_id:)
|
98
102
|
path = '/teams/{teamId}/memberships/{inviteId}'
|
99
|
-
.gsub('{
|
100
|
-
.gsub('{
|
103
|
+
.gsub('{teamId}', team_id)
|
104
|
+
.gsub('{inviteId}', invite_id)
|
101
105
|
|
102
106
|
params = {
|
103
107
|
}
|
@@ -107,37 +111,6 @@ module Appwrite
|
|
107
111
|
}, params);
|
108
112
|
end
|
109
113
|
|
110
|
-
def create_team_membership_resend(team_id:, invite_id:, redirect:)
|
111
|
-
path = '/teams/{teamId}/memberships/{inviteId}/resend'
|
112
|
-
.gsub('{team_id}', team_id)
|
113
|
-
.gsub('{invite_id}', invite_id)
|
114
|
-
|
115
|
-
params = {
|
116
|
-
'redirect': redirect
|
117
|
-
}
|
118
|
-
|
119
|
-
return @client.call('post', path, {
|
120
|
-
'content-type' => 'application/json',
|
121
|
-
}, params);
|
122
|
-
end
|
123
|
-
|
124
|
-
def update_team_membership_status(team_id:, invite_id:, user_id:, secret:, success: '', failure: '')
|
125
|
-
path = '/teams/{teamId}/memberships/{inviteId}/status'
|
126
|
-
.gsub('{team_id}', team_id)
|
127
|
-
.gsub('{invite_id}', invite_id)
|
128
|
-
|
129
|
-
params = {
|
130
|
-
'userId': user_id,
|
131
|
-
'secret': secret,
|
132
|
-
'success': success,
|
133
|
-
'failure': failure
|
134
|
-
}
|
135
|
-
|
136
|
-
return @client.call('patch', path, {
|
137
|
-
'content-type' => 'application/json',
|
138
|
-
}, params);
|
139
|
-
end
|
140
|
-
|
141
114
|
|
142
115
|
protected
|
143
116
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Users < Service
|
3
3
|
|
4
|
-
def
|
4
|
+
def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
|
5
5
|
path = '/users'
|
6
6
|
|
7
7
|
params = {
|
@@ -16,7 +16,7 @@ module Appwrite
|
|
16
16
|
}, params);
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def create(email:, password:, name: '')
|
20
20
|
path = '/users'
|
21
21
|
|
22
22
|
params = {
|
@@ -30,9 +30,9 @@ module Appwrite
|
|
30
30
|
}, params);
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def get(user_id:)
|
34
34
|
path = '/users/{userId}'
|
35
|
-
.gsub('{
|
35
|
+
.gsub('{userId}', user_id)
|
36
36
|
|
37
37
|
params = {
|
38
38
|
}
|
@@ -42,9 +42,21 @@ module Appwrite
|
|
42
42
|
}, params);
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def delete_user(user_id:)
|
46
|
+
path = '/users/{userId}'
|
47
|
+
.gsub('{userId}', user_id)
|
48
|
+
|
49
|
+
params = {
|
50
|
+
}
|
51
|
+
|
52
|
+
return @client.call('delete', path, {
|
53
|
+
'content-type' => 'application/json',
|
54
|
+
}, params);
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_logs(user_id:)
|
46
58
|
path = '/users/{userId}/logs'
|
47
|
-
.gsub('{
|
59
|
+
.gsub('{userId}', user_id)
|
48
60
|
|
49
61
|
params = {
|
50
62
|
}
|
@@ -54,9 +66,9 @@ module Appwrite
|
|
54
66
|
}, params);
|
55
67
|
end
|
56
68
|
|
57
|
-
def
|
69
|
+
def get_prefs(user_id:)
|
58
70
|
path = '/users/{userId}/prefs'
|
59
|
-
.gsub('{
|
71
|
+
.gsub('{userId}', user_id)
|
60
72
|
|
61
73
|
params = {
|
62
74
|
}
|
@@ -66,9 +78,9 @@ module Appwrite
|
|
66
78
|
}, params);
|
67
79
|
end
|
68
80
|
|
69
|
-
def
|
81
|
+
def update_prefs(user_id:, prefs:)
|
70
82
|
path = '/users/{userId}/prefs'
|
71
|
-
.gsub('{
|
83
|
+
.gsub('{userId}', user_id)
|
72
84
|
|
73
85
|
params = {
|
74
86
|
'prefs': prefs
|
@@ -79,9 +91,9 @@ module Appwrite
|
|
79
91
|
}, params);
|
80
92
|
end
|
81
93
|
|
82
|
-
def
|
94
|
+
def get_sessions(user_id:)
|
83
95
|
path = '/users/{userId}/sessions'
|
84
|
-
.gsub('{
|
96
|
+
.gsub('{userId}', user_id)
|
85
97
|
|
86
98
|
params = {
|
87
99
|
}
|
@@ -91,9 +103,9 @@ module Appwrite
|
|
91
103
|
}, params);
|
92
104
|
end
|
93
105
|
|
94
|
-
def
|
106
|
+
def delete_sessions(user_id:)
|
95
107
|
path = '/users/{userId}/sessions'
|
96
|
-
.gsub('{
|
108
|
+
.gsub('{userId}', user_id)
|
97
109
|
|
98
110
|
params = {
|
99
111
|
}
|
@@ -103,12 +115,12 @@ module Appwrite
|
|
103
115
|
}, params);
|
104
116
|
end
|
105
117
|
|
106
|
-
def
|
107
|
-
path = '/users/{userId}/sessions
|
108
|
-
.gsub('{
|
118
|
+
def delete_session(user_id:, session_id:)
|
119
|
+
path = '/users/{userId}/sessions/{sessionId}'
|
120
|
+
.gsub('{userId}', user_id)
|
121
|
+
.gsub('{sessionId}', session_id)
|
109
122
|
|
110
123
|
params = {
|
111
|
-
'sessionId': session_id
|
112
124
|
}
|
113
125
|
|
114
126
|
return @client.call('delete', path, {
|
@@ -116,9 +128,9 @@ module Appwrite
|
|
116
128
|
}, params);
|
117
129
|
end
|
118
130
|
|
119
|
-
def
|
131
|
+
def update_status(user_id:, status:)
|
120
132
|
path = '/users/{userId}/status'
|
121
|
-
.gsub('{
|
133
|
+
.gsub('{userId}', user_id)
|
122
134
|
|
123
135
|
params = {
|
124
136
|
'status': status
|