appwrite 1.0.8 → 1.0.9
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 +5 -5
- data/README.md +2 -2
- data/appwrite.gemspec +1 -1
- data/lib/appwrite.rb +0 -3
- data/lib/appwrite/client.rb +20 -6
- data/lib/appwrite/services/database.rb +11 -11
- data/lib/appwrite/services/locale.rb +1 -1
- data/lib/appwrite/services/storage.rb +2 -2
- data/lib/appwrite/services/teams.rb +10 -41
- data/lib/appwrite/services/users.rb +10 -10
- metadata +3 -7
- data/lib/appwrite/services/account.rb +0 -114
- data/lib/appwrite/services/auth.rb +0 -131
- data/lib/appwrite/services/projects.rb +0 -410
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 435a9e4f801ceb45d990c57a8f5aaffdb8c4068978527c8b1d9ce619ea6a7e1c
|
4
|
+
data.tar.gz: 2171bf4a196ba398f3444dbe5d53e4082fc970a97eea5d7b13560c7250411220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a40d4c714c50b9ab205e90c2bfe3adcd6814c9c53193c8266c295b4559bd04e253b5cd70a4adfe801ba1141a4669e66eef6b21101fcbd4ad85294aba4a98f3
|
7
|
+
data.tar.gz: dd3d40be334f7650b8664959f246063d55b2e0b8563bf0d592c64f229582fc05dc868f20194e9ed2f379f9a47d95d944bd2e2412936fc9b6bb4b1fa1ba98facc
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Appwrite SDK for Ruby
|
2
2
|
|
3
3
|

|
4
|
-

|
5
5
|
|
6
|
-
**
|
6
|
+
**This SDK is compatible with Appwrite server version . For older versions, please check previous releases.**
|
7
7
|
|
8
8
|
Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
9
9
|
|
data/appwrite.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'appwrite'
|
4
|
-
s.version = '1.0.
|
4
|
+
s.version = '1.0.9'
|
5
5
|
s.summary = "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)"
|
6
6
|
s.author = 'Appwrite Team'
|
7
7
|
s.homepage = 'https://appwrite.io/support'
|
data/lib/appwrite.rb
CHANGED
@@ -3,12 +3,9 @@ require 'uri'
|
|
3
3
|
require 'json'
|
4
4
|
require_relative 'appwrite/client'
|
5
5
|
require_relative 'appwrite/service'
|
6
|
-
require_relative 'appwrite/services/account'
|
7
|
-
require_relative 'appwrite/services/auth'
|
8
6
|
require_relative 'appwrite/services/avatars'
|
9
7
|
require_relative 'appwrite/services/database'
|
10
8
|
require_relative 'appwrite/services/locale'
|
11
|
-
require_relative 'appwrite/services/projects'
|
12
9
|
require_relative 'appwrite/services/storage'
|
13
10
|
require_relative 'appwrite/services/teams'
|
14
11
|
require_relative 'appwrite/services/users'
|
data/lib/appwrite/client.rb
CHANGED
@@ -20,7 +20,7 @@ module Appwrite
|
|
20
20
|
@headers = {
|
21
21
|
'content-type' => '',
|
22
22
|
'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
|
23
|
-
'x-sdk-version' => 'appwrite:ruby:1.0.
|
23
|
+
'x-sdk-version' => 'appwrite:ruby:1.0.9'
|
24
24
|
}
|
25
25
|
@endpoint = 'https://appwrite.io/v1';
|
26
26
|
end
|
@@ -62,7 +62,17 @@ module Appwrite
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def call(method, path = '', headers = {}, params = {})
|
65
|
-
uri = URI.parse(@endpoint + path + ((method == METHOD_GET) ? '?' + encode(params) : ''))
|
65
|
+
uri = URI.parse(@endpoint + path + ((method == METHOD_GET && params.length) ? '?' + encode(params) : ''))
|
66
|
+
return fetch(method, uri, headers, params)
|
67
|
+
end
|
68
|
+
|
69
|
+
protected
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def fetch(method, uri, headers, params, limit = 5)
|
74
|
+
raise ArgumentError, 'Too Many HTTP Redirects' if limit == 0
|
75
|
+
|
66
76
|
http = Net::HTTP.new(uri.host, uri.port)
|
67
77
|
http.use_ssl = (uri.scheme == 'https')
|
68
78
|
payload = ''
|
@@ -83,14 +93,18 @@ module Appwrite
|
|
83
93
|
rescue => error
|
84
94
|
raise 'Request Failed: ' + error.message
|
85
95
|
end
|
96
|
+
|
97
|
+
# Handle Redirects
|
98
|
+
if (response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently)
|
99
|
+
location = response['location']
|
100
|
+
uri = URI.parse(uri.scheme + "://" + uri.host + "" + location)
|
101
|
+
|
102
|
+
return fetch(method, uri, headers, {}, limit - 1)
|
103
|
+
end
|
86
104
|
|
87
105
|
return JSON.parse(response.body);
|
88
106
|
end
|
89
107
|
|
90
|
-
protected
|
91
|
-
|
92
|
-
private
|
93
|
-
|
94
108
|
def encode(value, key = nil)
|
95
109
|
case value
|
96
110
|
when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&')
|
@@ -2,7 +2,7 @@ module Appwrite
|
|
2
2
|
class Database < Service
|
3
3
|
|
4
4
|
def list_collections(search: '', limit: 25, offset: 0, order_type: 'ASC')
|
5
|
-
path = '/database'
|
5
|
+
path = '/database/collections'
|
6
6
|
|
7
7
|
params = {
|
8
8
|
'search': search,
|
@@ -17,7 +17,7 @@ module Appwrite
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def create_collection(name:, read:, write:, rules:)
|
20
|
-
path = '/database'
|
20
|
+
path = '/database/collections'
|
21
21
|
|
22
22
|
params = {
|
23
23
|
'name': name,
|
@@ -32,7 +32,7 @@ module Appwrite
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def get_collection(collection_id:)
|
35
|
-
path = '/database/{collectionId}'
|
35
|
+
path = '/database/collections/{collectionId}'
|
36
36
|
.gsub('{collection_id}', collection_id)
|
37
37
|
|
38
38
|
params = {
|
@@ -44,7 +44,7 @@ module Appwrite
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def update_collection(collection_id:, name:, read:, write:, rules: [])
|
47
|
-
path = '/database/{collectionId}'
|
47
|
+
path = '/database/collections/{collectionId}'
|
48
48
|
.gsub('{collection_id}', collection_id)
|
49
49
|
|
50
50
|
params = {
|
@@ -60,7 +60,7 @@ module Appwrite
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def delete_collection(collection_id:)
|
63
|
-
path = '/database/{collectionId}'
|
63
|
+
path = '/database/collections/{collectionId}'
|
64
64
|
.gsub('{collection_id}', collection_id)
|
65
65
|
|
66
66
|
params = {
|
@@ -71,8 +71,8 @@ module Appwrite
|
|
71
71
|
}, params);
|
72
72
|
end
|
73
73
|
|
74
|
-
def list_documents(collection_id:, filters: [], offset: 0, limit: 50, order_field: '$
|
75
|
-
path = '/database/{collectionId}/documents'
|
74
|
+
def list_documents(collection_id:, filters: [], offset: 0, limit: 50, order_field: '$id', order_type: 'ASC', order_cast: 'string', search: '', first: 0, last: 0)
|
75
|
+
path = '/database/collections/{collectionId}/documents'
|
76
76
|
.gsub('{collection_id}', collection_id)
|
77
77
|
|
78
78
|
params = {
|
@@ -93,7 +93,7 @@ module Appwrite
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def create_document(collection_id:, data:, read:, write:, parent_document: '', parent_property: '', parent_property_type: 'assign')
|
96
|
-
path = '/database/{collectionId}/documents'
|
96
|
+
path = '/database/collections/{collectionId}/documents'
|
97
97
|
.gsub('{collection_id}', collection_id)
|
98
98
|
|
99
99
|
params = {
|
@@ -111,7 +111,7 @@ module Appwrite
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def get_document(collection_id:, document_id:)
|
114
|
-
path = '/database/{collectionId}/documents/{documentId}'
|
114
|
+
path = '/database/collections/{collectionId}/documents/{documentId}'
|
115
115
|
.gsub('{collection_id}', collection_id)
|
116
116
|
.gsub('{document_id}', document_id)
|
117
117
|
|
@@ -124,7 +124,7 @@ module Appwrite
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def update_document(collection_id:, document_id:, data:, read:, write:)
|
127
|
-
path = '/database/{collectionId}/documents/{documentId}'
|
127
|
+
path = '/database/collections/{collectionId}/documents/{documentId}'
|
128
128
|
.gsub('{collection_id}', collection_id)
|
129
129
|
.gsub('{document_id}', document_id)
|
130
130
|
|
@@ -140,7 +140,7 @@ module Appwrite
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def delete_document(collection_id:, document_id:)
|
143
|
-
path = '/database/{collectionId}/documents/{documentId}'
|
143
|
+
path = '/database/collections/{collectionId}/documents/{documentId}'
|
144
144
|
.gsub('{collection_id}', collection_id)
|
145
145
|
.gsub('{document_id}', document_id)
|
146
146
|
|
@@ -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,7 +29,7 @@ module Appwrite
|
|
29
29
|
}, params);
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def get(team_id:)
|
33
33
|
path = '/teams/{teamId}'
|
34
34
|
.gsub('{team_id}', team_id)
|
35
35
|
|
@@ -41,7 +41,7 @@ module Appwrite
|
|
41
41
|
}, params);
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
44
|
+
def update(team_id:, name:)
|
45
45
|
path = '/teams/{teamId}'
|
46
46
|
.gsub('{team_id}', team_id)
|
47
47
|
|
@@ -54,7 +54,7 @@ module Appwrite
|
|
54
54
|
}, params);
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def delete(team_id:)
|
58
58
|
path = '/teams/{teamId}'
|
59
59
|
.gsub('{team_id}', team_id)
|
60
60
|
|
@@ -66,8 +66,8 @@ module Appwrite
|
|
66
66
|
}, params);
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
path = '/teams/{teamId}/
|
69
|
+
def get_memberships(team_id:)
|
70
|
+
path = '/teams/{teamId}/memberships'
|
71
71
|
.gsub('{team_id}', team_id)
|
72
72
|
|
73
73
|
params = {
|
@@ -78,7 +78,7 @@ module Appwrite
|
|
78
78
|
}, params);
|
79
79
|
end
|
80
80
|
|
81
|
-
def
|
81
|
+
def create_membership(team_id:, email:, roles:, url:, name: '')
|
82
82
|
path = '/teams/{teamId}/memberships'
|
83
83
|
.gsub('{team_id}', team_id)
|
84
84
|
|
@@ -86,7 +86,7 @@ module Appwrite
|
|
86
86
|
'email': email,
|
87
87
|
'name': name,
|
88
88
|
'roles': roles,
|
89
|
-
'
|
89
|
+
'url': url
|
90
90
|
}
|
91
91
|
|
92
92
|
return @client.call('post', path, {
|
@@ -94,7 +94,7 @@ module Appwrite
|
|
94
94
|
}, params);
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
97
|
+
def delete_membership(team_id:, invite_id:)
|
98
98
|
path = '/teams/{teamId}/memberships/{inviteId}'
|
99
99
|
.gsub('{team_id}', team_id)
|
100
100
|
.gsub('{invite_id}', invite_id)
|
@@ -107,37 +107,6 @@ module Appwrite
|
|
107
107
|
}, params);
|
108
108
|
end
|
109
109
|
|
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
110
|
|
142
111
|
protected
|
143
112
|
|
@@ -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,7 +30,7 @@ module Appwrite
|
|
30
30
|
}, params);
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def get(user_id:)
|
34
34
|
path = '/users/{userId}'
|
35
35
|
.gsub('{user_id}', user_id)
|
36
36
|
|
@@ -42,7 +42,7 @@ module Appwrite
|
|
42
42
|
}, params);
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def get_logs(user_id:)
|
46
46
|
path = '/users/{userId}/logs'
|
47
47
|
.gsub('{user_id}', user_id)
|
48
48
|
|
@@ -54,7 +54,7 @@ module Appwrite
|
|
54
54
|
}, params);
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def get_prefs(user_id:)
|
58
58
|
path = '/users/{userId}/prefs'
|
59
59
|
.gsub('{user_id}', user_id)
|
60
60
|
|
@@ -66,7 +66,7 @@ module Appwrite
|
|
66
66
|
}, params);
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def update_prefs(user_id:, prefs:)
|
70
70
|
path = '/users/{userId}/prefs'
|
71
71
|
.gsub('{user_id}', user_id)
|
72
72
|
|
@@ -79,7 +79,7 @@ module Appwrite
|
|
79
79
|
}, params);
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def get_sessions(user_id:)
|
83
83
|
path = '/users/{userId}/sessions'
|
84
84
|
.gsub('{user_id}', user_id)
|
85
85
|
|
@@ -91,7 +91,7 @@ module Appwrite
|
|
91
91
|
}, params);
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
94
|
+
def delete_sessions(user_id:)
|
95
95
|
path = '/users/{userId}/sessions'
|
96
96
|
.gsub('{user_id}', user_id)
|
97
97
|
|
@@ -103,7 +103,7 @@ module Appwrite
|
|
103
103
|
}, params);
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
106
|
+
def delete_session(user_id:, session_id:)
|
107
107
|
path = '/users/{userId}/sessions/:session'
|
108
108
|
.gsub('{user_id}', user_id)
|
109
109
|
|
@@ -116,7 +116,7 @@ module Appwrite
|
|
116
116
|
}, params);
|
117
117
|
end
|
118
118
|
|
119
|
-
def
|
119
|
+
def update_status(user_id:, status:)
|
120
120
|
path = '/users/{userId}/status'
|
121
121
|
.gsub('{user_id}', user_id)
|
122
122
|
|
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: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Appwrite Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: team@appwrite.io
|
@@ -23,12 +23,9 @@ files:
|
|
23
23
|
- lib/appwrite.rb
|
24
24
|
- lib/appwrite/client.rb
|
25
25
|
- lib/appwrite/service.rb
|
26
|
-
- lib/appwrite/services/account.rb
|
27
|
-
- lib/appwrite/services/auth.rb
|
28
26
|
- lib/appwrite/services/avatars.rb
|
29
27
|
- lib/appwrite/services/database.rb
|
30
28
|
- lib/appwrite/services/locale.rb
|
31
|
-
- lib/appwrite/services/projects.rb
|
32
29
|
- lib/appwrite/services/storage.rb
|
33
30
|
- lib/appwrite/services/teams.rb
|
34
31
|
- lib/appwrite/services/users.rb
|
@@ -50,8 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
47
|
- !ruby/object:Gem::Version
|
51
48
|
version: '0'
|
52
49
|
requirements: []
|
53
|
-
|
54
|
-
rubygems_version: 2.5.2.3
|
50
|
+
rubygems_version: 3.0.3
|
55
51
|
signing_key:
|
56
52
|
specification_version: 4
|
57
53
|
summary: Appwrite backend as a service cuts up to 70% of the time and costs required
|
@@ -1,114 +0,0 @@
|
|
1
|
-
module Appwrite
|
2
|
-
class Account < Service
|
3
|
-
|
4
|
-
def get()
|
5
|
-
path = '/account'
|
6
|
-
|
7
|
-
params = {
|
8
|
-
}
|
9
|
-
|
10
|
-
return @client.call('get', path, {
|
11
|
-
'content-type' => 'application/json',
|
12
|
-
}, params);
|
13
|
-
end
|
14
|
-
|
15
|
-
def delete()
|
16
|
-
path = '/account'
|
17
|
-
|
18
|
-
params = {
|
19
|
-
}
|
20
|
-
|
21
|
-
return @client.call('delete', path, {
|
22
|
-
'content-type' => 'application/json',
|
23
|
-
}, params);
|
24
|
-
end
|
25
|
-
|
26
|
-
def update_email(email:, password:)
|
27
|
-
path = '/account/email'
|
28
|
-
|
29
|
-
params = {
|
30
|
-
'email': email,
|
31
|
-
'password': password
|
32
|
-
}
|
33
|
-
|
34
|
-
return @client.call('patch', path, {
|
35
|
-
'content-type' => 'application/json',
|
36
|
-
}, params);
|
37
|
-
end
|
38
|
-
|
39
|
-
def update_name(name:)
|
40
|
-
path = '/account/name'
|
41
|
-
|
42
|
-
params = {
|
43
|
-
'name': name
|
44
|
-
}
|
45
|
-
|
46
|
-
return @client.call('patch', path, {
|
47
|
-
'content-type' => 'application/json',
|
48
|
-
}, params);
|
49
|
-
end
|
50
|
-
|
51
|
-
def update_password(password:, old_password:)
|
52
|
-
path = '/account/password'
|
53
|
-
|
54
|
-
params = {
|
55
|
-
'password': password,
|
56
|
-
'old-password': old_password
|
57
|
-
}
|
58
|
-
|
59
|
-
return @client.call('patch', path, {
|
60
|
-
'content-type' => 'application/json',
|
61
|
-
}, params);
|
62
|
-
end
|
63
|
-
|
64
|
-
def get_prefs()
|
65
|
-
path = '/account/prefs'
|
66
|
-
|
67
|
-
params = {
|
68
|
-
}
|
69
|
-
|
70
|
-
return @client.call('get', path, {
|
71
|
-
'content-type' => 'application/json',
|
72
|
-
}, params);
|
73
|
-
end
|
74
|
-
|
75
|
-
def update_prefs(prefs:)
|
76
|
-
path = '/account/prefs'
|
77
|
-
|
78
|
-
params = {
|
79
|
-
'prefs': prefs
|
80
|
-
}
|
81
|
-
|
82
|
-
return @client.call('patch', path, {
|
83
|
-
'content-type' => 'application/json',
|
84
|
-
}, params);
|
85
|
-
end
|
86
|
-
|
87
|
-
def get_security()
|
88
|
-
path = '/account/security'
|
89
|
-
|
90
|
-
params = {
|
91
|
-
}
|
92
|
-
|
93
|
-
return @client.call('get', path, {
|
94
|
-
'content-type' => 'application/json',
|
95
|
-
}, params);
|
96
|
-
end
|
97
|
-
|
98
|
-
def get_sessions()
|
99
|
-
path = '/account/sessions'
|
100
|
-
|
101
|
-
params = {
|
102
|
-
}
|
103
|
-
|
104
|
-
return @client.call('get', path, {
|
105
|
-
'content-type' => 'application/json',
|
106
|
-
}, params);
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
protected
|
111
|
-
|
112
|
-
private
|
113
|
-
end
|
114
|
-
end
|
@@ -1,131 +0,0 @@
|
|
1
|
-
module Appwrite
|
2
|
-
class Auth < Service
|
3
|
-
|
4
|
-
def login(email:, password:, success: '', failure: '')
|
5
|
-
path = '/auth/login'
|
6
|
-
|
7
|
-
params = {
|
8
|
-
'email': email,
|
9
|
-
'password': password,
|
10
|
-
'success': success,
|
11
|
-
'failure': failure
|
12
|
-
}
|
13
|
-
|
14
|
-
return @client.call('post', path, {
|
15
|
-
'content-type' => 'application/json',
|
16
|
-
}, params);
|
17
|
-
end
|
18
|
-
|
19
|
-
def oauth(provider:, success:, failure:)
|
20
|
-
path = '/auth/login/oauth/{provider}'
|
21
|
-
.gsub('{provider}', provider)
|
22
|
-
|
23
|
-
params = {
|
24
|
-
'success': success,
|
25
|
-
'failure': failure
|
26
|
-
}
|
27
|
-
|
28
|
-
return @client.call('get', path, {
|
29
|
-
'content-type' => 'application/json',
|
30
|
-
}, params);
|
31
|
-
end
|
32
|
-
|
33
|
-
def logout()
|
34
|
-
path = '/auth/logout'
|
35
|
-
|
36
|
-
params = {
|
37
|
-
}
|
38
|
-
|
39
|
-
return @client.call('delete', path, {
|
40
|
-
'content-type' => 'application/json',
|
41
|
-
}, params);
|
42
|
-
end
|
43
|
-
|
44
|
-
def logout_by_session(id:)
|
45
|
-
path = '/auth/logout/{id}'
|
46
|
-
.gsub('{id}', id)
|
47
|
-
|
48
|
-
params = {
|
49
|
-
}
|
50
|
-
|
51
|
-
return @client.call('delete', path, {
|
52
|
-
'content-type' => 'application/json',
|
53
|
-
}, params);
|
54
|
-
end
|
55
|
-
|
56
|
-
def recovery(email:, reset:)
|
57
|
-
path = '/auth/recovery'
|
58
|
-
|
59
|
-
params = {
|
60
|
-
'email': email,
|
61
|
-
'reset': reset
|
62
|
-
}
|
63
|
-
|
64
|
-
return @client.call('post', path, {
|
65
|
-
'content-type' => 'application/json',
|
66
|
-
}, params);
|
67
|
-
end
|
68
|
-
|
69
|
-
def recovery_reset(user_id:, token:, password_a:, password_b:)
|
70
|
-
path = '/auth/recovery/reset'
|
71
|
-
|
72
|
-
params = {
|
73
|
-
'userId': user_id,
|
74
|
-
'token': token,
|
75
|
-
'password-a': password_a,
|
76
|
-
'password-b': password_b
|
77
|
-
}
|
78
|
-
|
79
|
-
return @client.call('put', path, {
|
80
|
-
'content-type' => 'application/json',
|
81
|
-
}, params);
|
82
|
-
end
|
83
|
-
|
84
|
-
def register(email:, password:, confirm:, success: '', failure: '', name: '')
|
85
|
-
path = '/auth/register'
|
86
|
-
|
87
|
-
params = {
|
88
|
-
'email': email,
|
89
|
-
'password': password,
|
90
|
-
'confirm': confirm,
|
91
|
-
'success': success,
|
92
|
-
'failure': failure,
|
93
|
-
'name': name
|
94
|
-
}
|
95
|
-
|
96
|
-
return @client.call('post', path, {
|
97
|
-
'content-type' => 'application/json',
|
98
|
-
}, params);
|
99
|
-
end
|
100
|
-
|
101
|
-
def confirm(user_id:, token:)
|
102
|
-
path = '/auth/register/confirm'
|
103
|
-
|
104
|
-
params = {
|
105
|
-
'userId': user_id,
|
106
|
-
'token': token
|
107
|
-
}
|
108
|
-
|
109
|
-
return @client.call('post', path, {
|
110
|
-
'content-type' => 'application/json',
|
111
|
-
}, params);
|
112
|
-
end
|
113
|
-
|
114
|
-
def confirm_resend(confirm:)
|
115
|
-
path = '/auth/register/confirm/resend'
|
116
|
-
|
117
|
-
params = {
|
118
|
-
'confirm': confirm
|
119
|
-
}
|
120
|
-
|
121
|
-
return @client.call('post', path, {
|
122
|
-
'content-type' => 'application/json',
|
123
|
-
}, params);
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
protected
|
128
|
-
|
129
|
-
private
|
130
|
-
end
|
131
|
-
end
|
@@ -1,410 +0,0 @@
|
|
1
|
-
module Appwrite
|
2
|
-
class Projects < Service
|
3
|
-
|
4
|
-
def list_projects()
|
5
|
-
path = '/projects'
|
6
|
-
|
7
|
-
params = {
|
8
|
-
}
|
9
|
-
|
10
|
-
return @client.call('get', path, {
|
11
|
-
'content-type' => 'application/json',
|
12
|
-
}, params);
|
13
|
-
end
|
14
|
-
|
15
|
-
def create_project(name:, team_id:, description: '', logo: '', url: '', legal_name: '', legal_country: '', legal_state: '', legal_city: '', legal_address: '', legal_tax_id: '')
|
16
|
-
path = '/projects'
|
17
|
-
|
18
|
-
params = {
|
19
|
-
'name': name,
|
20
|
-
'teamId': team_id,
|
21
|
-
'description': description,
|
22
|
-
'logo': logo,
|
23
|
-
'url': url,
|
24
|
-
'legalName': legal_name,
|
25
|
-
'legalCountry': legal_country,
|
26
|
-
'legalState': legal_state,
|
27
|
-
'legalCity': legal_city,
|
28
|
-
'legalAddress': legal_address,
|
29
|
-
'legalTaxId': legal_tax_id
|
30
|
-
}
|
31
|
-
|
32
|
-
return @client.call('post', path, {
|
33
|
-
'content-type' => 'application/json',
|
34
|
-
}, params);
|
35
|
-
end
|
36
|
-
|
37
|
-
def get_project(project_id:)
|
38
|
-
path = '/projects/{projectId}'
|
39
|
-
.gsub('{project_id}', project_id)
|
40
|
-
|
41
|
-
params = {
|
42
|
-
}
|
43
|
-
|
44
|
-
return @client.call('get', path, {
|
45
|
-
'content-type' => 'application/json',
|
46
|
-
}, params);
|
47
|
-
end
|
48
|
-
|
49
|
-
def update_project(project_id:, name:, description: '', logo: '', url: '', legal_name: '', legal_country: '', legal_state: '', legal_city: '', legal_address: '', legal_tax_id: '')
|
50
|
-
path = '/projects/{projectId}'
|
51
|
-
.gsub('{project_id}', project_id)
|
52
|
-
|
53
|
-
params = {
|
54
|
-
'name': name,
|
55
|
-
'description': description,
|
56
|
-
'logo': logo,
|
57
|
-
'url': url,
|
58
|
-
'legalName': legal_name,
|
59
|
-
'legalCountry': legal_country,
|
60
|
-
'legalState': legal_state,
|
61
|
-
'legalCity': legal_city,
|
62
|
-
'legalAddress': legal_address,
|
63
|
-
'legalTaxId': legal_tax_id
|
64
|
-
}
|
65
|
-
|
66
|
-
return @client.call('patch', path, {
|
67
|
-
'content-type' => 'application/json',
|
68
|
-
}, params);
|
69
|
-
end
|
70
|
-
|
71
|
-
def delete_project(project_id:)
|
72
|
-
path = '/projects/{projectId}'
|
73
|
-
.gsub('{project_id}', project_id)
|
74
|
-
|
75
|
-
params = {
|
76
|
-
}
|
77
|
-
|
78
|
-
return @client.call('delete', path, {
|
79
|
-
'content-type' => 'application/json',
|
80
|
-
}, params);
|
81
|
-
end
|
82
|
-
|
83
|
-
def list_keys(project_id:)
|
84
|
-
path = '/projects/{projectId}/keys'
|
85
|
-
.gsub('{project_id}', project_id)
|
86
|
-
|
87
|
-
params = {
|
88
|
-
}
|
89
|
-
|
90
|
-
return @client.call('get', path, {
|
91
|
-
'content-type' => 'application/json',
|
92
|
-
}, params);
|
93
|
-
end
|
94
|
-
|
95
|
-
def create_key(project_id:, name:, scopes:)
|
96
|
-
path = '/projects/{projectId}/keys'
|
97
|
-
.gsub('{project_id}', project_id)
|
98
|
-
|
99
|
-
params = {
|
100
|
-
'name': name,
|
101
|
-
'scopes': scopes
|
102
|
-
}
|
103
|
-
|
104
|
-
return @client.call('post', path, {
|
105
|
-
'content-type' => 'application/json',
|
106
|
-
}, params);
|
107
|
-
end
|
108
|
-
|
109
|
-
def get_key(project_id:, key_id:)
|
110
|
-
path = '/projects/{projectId}/keys/{keyId}'
|
111
|
-
.gsub('{project_id}', project_id)
|
112
|
-
.gsub('{key_id}', key_id)
|
113
|
-
|
114
|
-
params = {
|
115
|
-
}
|
116
|
-
|
117
|
-
return @client.call('get', path, {
|
118
|
-
'content-type' => 'application/json',
|
119
|
-
}, params);
|
120
|
-
end
|
121
|
-
|
122
|
-
def update_key(project_id:, key_id:, name:, scopes:)
|
123
|
-
path = '/projects/{projectId}/keys/{keyId}'
|
124
|
-
.gsub('{project_id}', project_id)
|
125
|
-
.gsub('{key_id}', key_id)
|
126
|
-
|
127
|
-
params = {
|
128
|
-
'name': name,
|
129
|
-
'scopes': scopes
|
130
|
-
}
|
131
|
-
|
132
|
-
return @client.call('put', path, {
|
133
|
-
'content-type' => 'application/json',
|
134
|
-
}, params);
|
135
|
-
end
|
136
|
-
|
137
|
-
def delete_key(project_id:, key_id:)
|
138
|
-
path = '/projects/{projectId}/keys/{keyId}'
|
139
|
-
.gsub('{project_id}', project_id)
|
140
|
-
.gsub('{key_id}', key_id)
|
141
|
-
|
142
|
-
params = {
|
143
|
-
}
|
144
|
-
|
145
|
-
return @client.call('delete', path, {
|
146
|
-
'content-type' => 'application/json',
|
147
|
-
}, params);
|
148
|
-
end
|
149
|
-
|
150
|
-
def update_project_o_auth(project_id:, provider:, app_id: '', secret: '')
|
151
|
-
path = '/projects/{projectId}/oauth'
|
152
|
-
.gsub('{project_id}', project_id)
|
153
|
-
|
154
|
-
params = {
|
155
|
-
'provider': provider,
|
156
|
-
'appId': app_id,
|
157
|
-
'secret': secret
|
158
|
-
}
|
159
|
-
|
160
|
-
return @client.call('patch', path, {
|
161
|
-
'content-type' => 'application/json',
|
162
|
-
}, params);
|
163
|
-
end
|
164
|
-
|
165
|
-
def list_platforms(project_id:)
|
166
|
-
path = '/projects/{projectId}/platforms'
|
167
|
-
.gsub('{project_id}', project_id)
|
168
|
-
|
169
|
-
params = {
|
170
|
-
}
|
171
|
-
|
172
|
-
return @client.call('get', path, {
|
173
|
-
'content-type' => 'application/json',
|
174
|
-
}, params);
|
175
|
-
end
|
176
|
-
|
177
|
-
def create_platform(project_id:, type:, name:, key: '', store: '', url: '')
|
178
|
-
path = '/projects/{projectId}/platforms'
|
179
|
-
.gsub('{project_id}', project_id)
|
180
|
-
|
181
|
-
params = {
|
182
|
-
'type': type,
|
183
|
-
'name': name,
|
184
|
-
'key': key,
|
185
|
-
'store': store,
|
186
|
-
'url': url
|
187
|
-
}
|
188
|
-
|
189
|
-
return @client.call('post', path, {
|
190
|
-
'content-type' => 'application/json',
|
191
|
-
}, params);
|
192
|
-
end
|
193
|
-
|
194
|
-
def get_platform(project_id:, platform_id:)
|
195
|
-
path = '/projects/{projectId}/platforms/{platformId}'
|
196
|
-
.gsub('{project_id}', project_id)
|
197
|
-
.gsub('{platform_id}', platform_id)
|
198
|
-
|
199
|
-
params = {
|
200
|
-
}
|
201
|
-
|
202
|
-
return @client.call('get', path, {
|
203
|
-
'content-type' => 'application/json',
|
204
|
-
}, params);
|
205
|
-
end
|
206
|
-
|
207
|
-
def update_platform(project_id:, platform_id:, name:, key: '', store: '', url: '')
|
208
|
-
path = '/projects/{projectId}/platforms/{platformId}'
|
209
|
-
.gsub('{project_id}', project_id)
|
210
|
-
.gsub('{platform_id}', platform_id)
|
211
|
-
|
212
|
-
params = {
|
213
|
-
'name': name,
|
214
|
-
'key': key,
|
215
|
-
'store': store,
|
216
|
-
'url': url
|
217
|
-
}
|
218
|
-
|
219
|
-
return @client.call('put', path, {
|
220
|
-
'content-type' => 'application/json',
|
221
|
-
}, params);
|
222
|
-
end
|
223
|
-
|
224
|
-
def delete_platform(project_id:, platform_id:)
|
225
|
-
path = '/projects/{projectId}/platforms/{platformId}'
|
226
|
-
.gsub('{project_id}', project_id)
|
227
|
-
.gsub('{platform_id}', platform_id)
|
228
|
-
|
229
|
-
params = {
|
230
|
-
}
|
231
|
-
|
232
|
-
return @client.call('delete', path, {
|
233
|
-
'content-type' => 'application/json',
|
234
|
-
}, params);
|
235
|
-
end
|
236
|
-
|
237
|
-
def list_tasks(project_id:)
|
238
|
-
path = '/projects/{projectId}/tasks'
|
239
|
-
.gsub('{project_id}', project_id)
|
240
|
-
|
241
|
-
params = {
|
242
|
-
}
|
243
|
-
|
244
|
-
return @client.call('get', path, {
|
245
|
-
'content-type' => 'application/json',
|
246
|
-
}, params);
|
247
|
-
end
|
248
|
-
|
249
|
-
def create_task(project_id:, name:, status:, schedule:, security:, http_method:, http_url:, http_headers: [], http_user: '', http_pass: '')
|
250
|
-
path = '/projects/{projectId}/tasks'
|
251
|
-
.gsub('{project_id}', project_id)
|
252
|
-
|
253
|
-
params = {
|
254
|
-
'name': name,
|
255
|
-
'status': status,
|
256
|
-
'schedule': schedule,
|
257
|
-
'security': security,
|
258
|
-
'httpMethod': http_method,
|
259
|
-
'httpUrl': http_url,
|
260
|
-
'httpHeaders': http_headers,
|
261
|
-
'httpUser': http_user,
|
262
|
-
'httpPass': http_pass
|
263
|
-
}
|
264
|
-
|
265
|
-
return @client.call('post', path, {
|
266
|
-
'content-type' => 'application/json',
|
267
|
-
}, params);
|
268
|
-
end
|
269
|
-
|
270
|
-
def get_task(project_id:, task_id:)
|
271
|
-
path = '/projects/{projectId}/tasks/{taskId}'
|
272
|
-
.gsub('{project_id}', project_id)
|
273
|
-
.gsub('{task_id}', task_id)
|
274
|
-
|
275
|
-
params = {
|
276
|
-
}
|
277
|
-
|
278
|
-
return @client.call('get', path, {
|
279
|
-
'content-type' => 'application/json',
|
280
|
-
}, params);
|
281
|
-
end
|
282
|
-
|
283
|
-
def update_task(project_id:, task_id:, name:, status:, schedule:, security:, http_method:, http_url:, http_headers: [], http_user: '', http_pass: '')
|
284
|
-
path = '/projects/{projectId}/tasks/{taskId}'
|
285
|
-
.gsub('{project_id}', project_id)
|
286
|
-
.gsub('{task_id}', task_id)
|
287
|
-
|
288
|
-
params = {
|
289
|
-
'name': name,
|
290
|
-
'status': status,
|
291
|
-
'schedule': schedule,
|
292
|
-
'security': security,
|
293
|
-
'httpMethod': http_method,
|
294
|
-
'httpUrl': http_url,
|
295
|
-
'httpHeaders': http_headers,
|
296
|
-
'httpUser': http_user,
|
297
|
-
'httpPass': http_pass
|
298
|
-
}
|
299
|
-
|
300
|
-
return @client.call('put', path, {
|
301
|
-
'content-type' => 'application/json',
|
302
|
-
}, params);
|
303
|
-
end
|
304
|
-
|
305
|
-
def delete_task(project_id:, task_id:)
|
306
|
-
path = '/projects/{projectId}/tasks/{taskId}'
|
307
|
-
.gsub('{project_id}', project_id)
|
308
|
-
.gsub('{task_id}', task_id)
|
309
|
-
|
310
|
-
params = {
|
311
|
-
}
|
312
|
-
|
313
|
-
return @client.call('delete', path, {
|
314
|
-
'content-type' => 'application/json',
|
315
|
-
}, params);
|
316
|
-
end
|
317
|
-
|
318
|
-
def get_project_usage(project_id:)
|
319
|
-
path = '/projects/{projectId}/usage'
|
320
|
-
.gsub('{project_id}', project_id)
|
321
|
-
|
322
|
-
params = {
|
323
|
-
}
|
324
|
-
|
325
|
-
return @client.call('get', path, {
|
326
|
-
'content-type' => 'application/json',
|
327
|
-
}, params);
|
328
|
-
end
|
329
|
-
|
330
|
-
def list_webhooks(project_id:)
|
331
|
-
path = '/projects/{projectId}/webhooks'
|
332
|
-
.gsub('{project_id}', project_id)
|
333
|
-
|
334
|
-
params = {
|
335
|
-
}
|
336
|
-
|
337
|
-
return @client.call('get', path, {
|
338
|
-
'content-type' => 'application/json',
|
339
|
-
}, params);
|
340
|
-
end
|
341
|
-
|
342
|
-
def create_webhook(project_id:, name:, events:, url:, security:, http_user: '', http_pass: '')
|
343
|
-
path = '/projects/{projectId}/webhooks'
|
344
|
-
.gsub('{project_id}', project_id)
|
345
|
-
|
346
|
-
params = {
|
347
|
-
'name': name,
|
348
|
-
'events': events,
|
349
|
-
'url': url,
|
350
|
-
'security': security,
|
351
|
-
'httpUser': http_user,
|
352
|
-
'httpPass': http_pass
|
353
|
-
}
|
354
|
-
|
355
|
-
return @client.call('post', path, {
|
356
|
-
'content-type' => 'application/json',
|
357
|
-
}, params);
|
358
|
-
end
|
359
|
-
|
360
|
-
def get_webhook(project_id:, webhook_id:)
|
361
|
-
path = '/projects/{projectId}/webhooks/{webhookId}'
|
362
|
-
.gsub('{project_id}', project_id)
|
363
|
-
.gsub('{webhook_id}', webhook_id)
|
364
|
-
|
365
|
-
params = {
|
366
|
-
}
|
367
|
-
|
368
|
-
return @client.call('get', path, {
|
369
|
-
'content-type' => 'application/json',
|
370
|
-
}, params);
|
371
|
-
end
|
372
|
-
|
373
|
-
def update_webhook(project_id:, webhook_id:, name:, events:, url:, security:, http_user: '', http_pass: '')
|
374
|
-
path = '/projects/{projectId}/webhooks/{webhookId}'
|
375
|
-
.gsub('{project_id}', project_id)
|
376
|
-
.gsub('{webhook_id}', webhook_id)
|
377
|
-
|
378
|
-
params = {
|
379
|
-
'name': name,
|
380
|
-
'events': events,
|
381
|
-
'url': url,
|
382
|
-
'security': security,
|
383
|
-
'httpUser': http_user,
|
384
|
-
'httpPass': http_pass
|
385
|
-
}
|
386
|
-
|
387
|
-
return @client.call('put', path, {
|
388
|
-
'content-type' => 'application/json',
|
389
|
-
}, params);
|
390
|
-
end
|
391
|
-
|
392
|
-
def delete_webhook(project_id:, webhook_id:)
|
393
|
-
path = '/projects/{projectId}/webhooks/{webhookId}'
|
394
|
-
.gsub('{project_id}', project_id)
|
395
|
-
.gsub('{webhook_id}', webhook_id)
|
396
|
-
|
397
|
-
params = {
|
398
|
-
}
|
399
|
-
|
400
|
-
return @client.call('delete', path, {
|
401
|
-
'content-type' => 'application/json',
|
402
|
-
}, params);
|
403
|
-
end
|
404
|
-
|
405
|
-
|
406
|
-
protected
|
407
|
-
|
408
|
-
private
|
409
|
-
end
|
410
|
-
end
|