appwrite 1.0.10 → 2.1.1
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/.travis.yml +16 -0
- data/Gemfile +1 -0
- data/LICENSE +1 -1
- data/README.md +72 -5
- data/appwrite.gemspec +3 -5
- data/docs/examples/account/create-recovery.md +15 -0
- data/docs/examples/account/create-verification.md +15 -0
- data/docs/examples/account/delete-session.md +15 -0
- data/docs/examples/account/delete-sessions.md +15 -0
- data/docs/examples/account/delete.md +15 -0
- data/docs/examples/account/get-logs.md +15 -0
- data/docs/examples/account/get-prefs.md +15 -0
- data/docs/examples/account/get-sessions.md +15 -0
- data/docs/examples/account/get.md +15 -0
- data/docs/examples/account/update-email.md +15 -0
- data/docs/examples/account/update-name.md +15 -0
- data/docs/examples/account/update-password.md +15 -0
- data/docs/examples/account/update-prefs.md +15 -0
- data/docs/examples/account/update-recovery.md +15 -0
- data/docs/examples/account/update-verification.md +15 -0
- 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-membership-roles.md +15 -0
- data/docs/examples/teams/update-membership-status.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.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 +5 -0
- data/lib/appwrite/client.rb +46 -5
- data/lib/appwrite/exception.rb +14 -0
- data/lib/appwrite/file.rb +23 -0
- data/lib/appwrite/services/account.rb +190 -0
- data/lib/appwrite/services/avatars.rb +17 -1
- data/lib/appwrite/services/database.rb +17 -31
- data/lib/appwrite/services/functions.rb +195 -0
- data/lib/appwrite/services/locale.rb +11 -0
- data/lib/appwrite/services/storage.rb +14 -10
- data/lib/appwrite/services/teams.rb +43 -10
- data/lib/appwrite/services/users.rb +21 -9
- metadata +104 -10
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'mime/types'
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
class File
|
|
5
|
+
def initialize(path)
|
|
6
|
+
@name = ::File.basename(path)
|
|
7
|
+
@content = ::File.read(path)
|
|
8
|
+
@mimeType = MIME::Types.type_for(path)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def name
|
|
12
|
+
@name
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def content
|
|
16
|
+
@content
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def mimeType
|
|
20
|
+
@mimeType
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,190 @@
|
|
|
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 get_logs()
|
|
40
|
+
path = '/account/logs'
|
|
41
|
+
|
|
42
|
+
params = {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return @client.call('get', path, {
|
|
46
|
+
'content-type' => 'application/json',
|
|
47
|
+
}, params);
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def update_name(name:)
|
|
51
|
+
path = '/account/name'
|
|
52
|
+
|
|
53
|
+
params = {
|
|
54
|
+
'name': name
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return @client.call('patch', path, {
|
|
58
|
+
'content-type' => 'application/json',
|
|
59
|
+
}, params);
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def update_password(password:, old_password: '')
|
|
63
|
+
path = '/account/password'
|
|
64
|
+
|
|
65
|
+
params = {
|
|
66
|
+
'password': password,
|
|
67
|
+
'oldPassword': old_password
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return @client.call('patch', path, {
|
|
71
|
+
'content-type' => 'application/json',
|
|
72
|
+
}, params);
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def get_prefs()
|
|
76
|
+
path = '/account/prefs'
|
|
77
|
+
|
|
78
|
+
params = {
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return @client.call('get', path, {
|
|
82
|
+
'content-type' => 'application/json',
|
|
83
|
+
}, params);
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def update_prefs(prefs:)
|
|
87
|
+
path = '/account/prefs'
|
|
88
|
+
|
|
89
|
+
params = {
|
|
90
|
+
'prefs': prefs
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return @client.call('patch', path, {
|
|
94
|
+
'content-type' => 'application/json',
|
|
95
|
+
}, params);
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def create_recovery(email:, url:)
|
|
99
|
+
path = '/account/recovery'
|
|
100
|
+
|
|
101
|
+
params = {
|
|
102
|
+
'email': email,
|
|
103
|
+
'url': url
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return @client.call('post', path, {
|
|
107
|
+
'content-type' => 'application/json',
|
|
108
|
+
}, params);
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def update_recovery(user_id:, secret:, password:, password_again:)
|
|
112
|
+
path = '/account/recovery'
|
|
113
|
+
|
|
114
|
+
params = {
|
|
115
|
+
'userId': user_id,
|
|
116
|
+
'secret': secret,
|
|
117
|
+
'password': password,
|
|
118
|
+
'passwordAgain': password_again
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return @client.call('put', path, {
|
|
122
|
+
'content-type' => 'application/json',
|
|
123
|
+
}, params);
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def get_sessions()
|
|
127
|
+
path = '/account/sessions'
|
|
128
|
+
|
|
129
|
+
params = {
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return @client.call('get', path, {
|
|
133
|
+
'content-type' => 'application/json',
|
|
134
|
+
}, params);
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def delete_sessions()
|
|
138
|
+
path = '/account/sessions'
|
|
139
|
+
|
|
140
|
+
params = {
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return @client.call('delete', path, {
|
|
144
|
+
'content-type' => 'application/json',
|
|
145
|
+
}, params);
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def delete_session(session_id:)
|
|
149
|
+
path = '/account/sessions/{sessionId}'
|
|
150
|
+
.gsub('{sessionId}', session_id)
|
|
151
|
+
|
|
152
|
+
params = {
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return @client.call('delete', path, {
|
|
156
|
+
'content-type' => 'application/json',
|
|
157
|
+
}, params);
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def create_verification(url:)
|
|
161
|
+
path = '/account/verification'
|
|
162
|
+
|
|
163
|
+
params = {
|
|
164
|
+
'url': url
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return @client.call('post', path, {
|
|
168
|
+
'content-type' => 'application/json',
|
|
169
|
+
}, params);
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def update_verification(user_id:, secret:)
|
|
173
|
+
path = '/account/verification'
|
|
174
|
+
|
|
175
|
+
params = {
|
|
176
|
+
'userId': user_id,
|
|
177
|
+
'secret': secret
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return @client.call('put', path, {
|
|
181
|
+
'content-type' => 'application/json',
|
|
182
|
+
}, params);
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
protected
|
|
187
|
+
|
|
188
|
+
private
|
|
189
|
+
end
|
|
190
|
+
end
|
|
@@ -72,7 +72,23 @@ module Appwrite
|
|
|
72
72
|
}, params);
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
def
|
|
75
|
+
def get_initials(name: '', width: 500, height: 500, color: '', background: '')
|
|
76
|
+
path = '/avatars/initials'
|
|
77
|
+
|
|
78
|
+
params = {
|
|
79
|
+
'name': name,
|
|
80
|
+
'width': width,
|
|
81
|
+
'height': height,
|
|
82
|
+
'color': color,
|
|
83
|
+
'background': background
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return @client.call('get', path, {
|
|
87
|
+
'content-type' => 'application/json',
|
|
88
|
+
}, params);
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def get_q_r(text:, size: 400, margin: 1, download: false)
|
|
76
92
|
path = '/avatars/qr'
|
|
77
93
|
|
|
78
94
|
params = {
|
|
@@ -33,7 +33,7 @@ module Appwrite
|
|
|
33
33
|
|
|
34
34
|
def get_collection(collection_id:)
|
|
35
35
|
path = '/database/collections/{collectionId}'
|
|
36
|
-
.gsub('{
|
|
36
|
+
.gsub('{collectionId}', collection_id)
|
|
37
37
|
|
|
38
38
|
params = {
|
|
39
39
|
}
|
|
@@ -43,9 +43,9 @@ module Appwrite
|
|
|
43
43
|
}, params);
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
def update_collection(collection_id:, name:, read
|
|
46
|
+
def update_collection(collection_id:, name:, read: [], write: [], rules: [])
|
|
47
47
|
path = '/database/collections/{collectionId}'
|
|
48
|
-
.gsub('{
|
|
48
|
+
.gsub('{collectionId}', collection_id)
|
|
49
49
|
|
|
50
50
|
params = {
|
|
51
51
|
'name': name,
|
|
@@ -61,7 +61,7 @@ module Appwrite
|
|
|
61
61
|
|
|
62
62
|
def delete_collection(collection_id:)
|
|
63
63
|
path = '/database/collections/{collectionId}'
|
|
64
|
-
.gsub('{
|
|
64
|
+
.gsub('{collectionId}', collection_id)
|
|
65
65
|
|
|
66
66
|
params = {
|
|
67
67
|
}
|
|
@@ -71,20 +71,18 @@ module Appwrite
|
|
|
71
71
|
}, params);
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
def list_documents(collection_id:, filters: [],
|
|
74
|
+
def list_documents(collection_id:, filters: [], limit: 25, offset: 0, order_field: '', order_type: 'ASC', order_cast: 'string', search: '')
|
|
75
75
|
path = '/database/collections/{collectionId}/documents'
|
|
76
|
-
.gsub('{
|
|
76
|
+
.gsub('{collectionId}', collection_id)
|
|
77
77
|
|
|
78
78
|
params = {
|
|
79
79
|
'filters': filters,
|
|
80
|
-
'offset': offset,
|
|
81
80
|
'limit': limit,
|
|
81
|
+
'offset': offset,
|
|
82
82
|
'orderField': order_field,
|
|
83
83
|
'orderType': order_type,
|
|
84
84
|
'orderCast': order_cast,
|
|
85
|
-
'search': search
|
|
86
|
-
'first': first,
|
|
87
|
-
'last': last
|
|
85
|
+
'search': search
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
return @client.call('get', path, {
|
|
@@ -92,9 +90,9 @@ module Appwrite
|
|
|
92
90
|
}, params);
|
|
93
91
|
end
|
|
94
92
|
|
|
95
|
-
def create_document(collection_id:, data:, read
|
|
93
|
+
def create_document(collection_id:, data:, read: [], write: [], parent_document: '', parent_property: '', parent_property_type: 'assign')
|
|
96
94
|
path = '/database/collections/{collectionId}/documents'
|
|
97
|
-
.gsub('{
|
|
95
|
+
.gsub('{collectionId}', collection_id)
|
|
98
96
|
|
|
99
97
|
params = {
|
|
100
98
|
'data': data,
|
|
@@ -112,8 +110,8 @@ module Appwrite
|
|
|
112
110
|
|
|
113
111
|
def get_document(collection_id:, document_id:)
|
|
114
112
|
path = '/database/collections/{collectionId}/documents/{documentId}'
|
|
115
|
-
.gsub('{
|
|
116
|
-
.gsub('{
|
|
113
|
+
.gsub('{collectionId}', collection_id)
|
|
114
|
+
.gsub('{documentId}', document_id)
|
|
117
115
|
|
|
118
116
|
params = {
|
|
119
117
|
}
|
|
@@ -123,10 +121,10 @@ module Appwrite
|
|
|
123
121
|
}, params);
|
|
124
122
|
end
|
|
125
123
|
|
|
126
|
-
def update_document(collection_id:, document_id:, data:, read
|
|
124
|
+
def update_document(collection_id:, document_id:, data:, read: [], write: [])
|
|
127
125
|
path = '/database/collections/{collectionId}/documents/{documentId}'
|
|
128
|
-
.gsub('{
|
|
129
|
-
.gsub('{
|
|
126
|
+
.gsub('{collectionId}', collection_id)
|
|
127
|
+
.gsub('{documentId}', document_id)
|
|
130
128
|
|
|
131
129
|
params = {
|
|
132
130
|
'data': data,
|
|
@@ -141,8 +139,8 @@ module Appwrite
|
|
|
141
139
|
|
|
142
140
|
def delete_document(collection_id:, document_id:)
|
|
143
141
|
path = '/database/collections/{collectionId}/documents/{documentId}'
|
|
144
|
-
.gsub('{
|
|
145
|
-
.gsub('{
|
|
142
|
+
.gsub('{collectionId}', collection_id)
|
|
143
|
+
.gsub('{documentId}', document_id)
|
|
146
144
|
|
|
147
145
|
params = {
|
|
148
146
|
}
|
|
@@ -152,18 +150,6 @@ module Appwrite
|
|
|
152
150
|
}, params);
|
|
153
151
|
end
|
|
154
152
|
|
|
155
|
-
def get_collection_logs(collection_id:)
|
|
156
|
-
path = '/database/collections/{collectionId}/logs'
|
|
157
|
-
.gsub('{collection_id}', collection_id)
|
|
158
|
-
|
|
159
|
-
params = {
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return @client.call('get', path, {
|
|
163
|
-
'content-type' => 'application/json',
|
|
164
|
-
}, params);
|
|
165
|
-
end
|
|
166
|
-
|
|
167
153
|
|
|
168
154
|
protected
|
|
169
155
|
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
module Appwrite
|
|
2
|
+
class Functions < Service
|
|
3
|
+
|
|
4
|
+
def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
|
|
5
|
+
path = '/functions'
|
|
6
|
+
|
|
7
|
+
params = {
|
|
8
|
+
'search': search,
|
|
9
|
+
'limit': limit,
|
|
10
|
+
'offset': offset,
|
|
11
|
+
'orderType': order_type
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return @client.call('get', path, {
|
|
15
|
+
'content-type' => 'application/json',
|
|
16
|
+
}, params);
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create(name:, execute:, env:, vars: {}, events: [], schedule: '', timeout: 15)
|
|
20
|
+
path = '/functions'
|
|
21
|
+
|
|
22
|
+
params = {
|
|
23
|
+
'name': name,
|
|
24
|
+
'execute': execute,
|
|
25
|
+
'env': env,
|
|
26
|
+
'vars': vars,
|
|
27
|
+
'events': events,
|
|
28
|
+
'schedule': schedule,
|
|
29
|
+
'timeout': timeout
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return @client.call('post', path, {
|
|
33
|
+
'content-type' => 'application/json',
|
|
34
|
+
}, params);
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def get(function_id:)
|
|
38
|
+
path = '/functions/{functionId}'
|
|
39
|
+
.gsub('{functionId}', function_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(function_id:, name:, execute:, vars: {}, events: [], schedule: '', timeout: 15)
|
|
50
|
+
path = '/functions/{functionId}'
|
|
51
|
+
.gsub('{functionId}', function_id)
|
|
52
|
+
|
|
53
|
+
params = {
|
|
54
|
+
'name': name,
|
|
55
|
+
'execute': execute,
|
|
56
|
+
'vars': vars,
|
|
57
|
+
'events': events,
|
|
58
|
+
'schedule': schedule,
|
|
59
|
+
'timeout': timeout
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return @client.call('put', path, {
|
|
63
|
+
'content-type' => 'application/json',
|
|
64
|
+
}, params);
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def delete(function_id:)
|
|
68
|
+
path = '/functions/{functionId}'
|
|
69
|
+
.gsub('{functionId}', function_id)
|
|
70
|
+
|
|
71
|
+
params = {
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return @client.call('delete', path, {
|
|
75
|
+
'content-type' => 'application/json',
|
|
76
|
+
}, params);
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def list_executions(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
|
|
80
|
+
path = '/functions/{functionId}/executions'
|
|
81
|
+
.gsub('{functionId}', function_id)
|
|
82
|
+
|
|
83
|
+
params = {
|
|
84
|
+
'search': search,
|
|
85
|
+
'limit': limit,
|
|
86
|
+
'offset': offset,
|
|
87
|
+
'orderType': order_type
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return @client.call('get', path, {
|
|
91
|
+
'content-type' => 'application/json',
|
|
92
|
+
}, params);
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def create_execution(function_id:, data: '')
|
|
96
|
+
path = '/functions/{functionId}/executions'
|
|
97
|
+
.gsub('{functionId}', function_id)
|
|
98
|
+
|
|
99
|
+
params = {
|
|
100
|
+
'data': data
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return @client.call('post', path, {
|
|
104
|
+
'content-type' => 'application/json',
|
|
105
|
+
}, params);
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def get_execution(function_id:, execution_id:)
|
|
109
|
+
path = '/functions/{functionId}/executions/{executionId}'
|
|
110
|
+
.gsub('{functionId}', function_id)
|
|
111
|
+
.gsub('{executionId}', execution_id)
|
|
112
|
+
|
|
113
|
+
params = {
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return @client.call('get', path, {
|
|
117
|
+
'content-type' => 'application/json',
|
|
118
|
+
}, params);
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def update_tag(function_id:, tag:)
|
|
122
|
+
path = '/functions/{functionId}/tag'
|
|
123
|
+
.gsub('{functionId}', function_id)
|
|
124
|
+
|
|
125
|
+
params = {
|
|
126
|
+
'tag': tag
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return @client.call('patch', path, {
|
|
130
|
+
'content-type' => 'application/json',
|
|
131
|
+
}, params);
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def list_tags(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
|
|
135
|
+
path = '/functions/{functionId}/tags'
|
|
136
|
+
.gsub('{functionId}', function_id)
|
|
137
|
+
|
|
138
|
+
params = {
|
|
139
|
+
'search': search,
|
|
140
|
+
'limit': limit,
|
|
141
|
+
'offset': offset,
|
|
142
|
+
'orderType': order_type
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return @client.call('get', path, {
|
|
146
|
+
'content-type' => 'application/json',
|
|
147
|
+
}, params);
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def create_tag(function_id:, command:, code:)
|
|
151
|
+
path = '/functions/{functionId}/tags'
|
|
152
|
+
.gsub('{functionId}', function_id)
|
|
153
|
+
|
|
154
|
+
params = {
|
|
155
|
+
'command': command,
|
|
156
|
+
'code': code
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return @client.call('post', path, {
|
|
160
|
+
'content-type' => 'multipart/form-data',
|
|
161
|
+
}, params);
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def get_tag(function_id:, tag_id:)
|
|
165
|
+
path = '/functions/{functionId}/tags/{tagId}'
|
|
166
|
+
.gsub('{functionId}', function_id)
|
|
167
|
+
.gsub('{tagId}', tag_id)
|
|
168
|
+
|
|
169
|
+
params = {
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return @client.call('get', path, {
|
|
173
|
+
'content-type' => 'application/json',
|
|
174
|
+
}, params);
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def delete_tag(function_id:, tag_id:)
|
|
178
|
+
path = '/functions/{functionId}/tags/{tagId}'
|
|
179
|
+
.gsub('{functionId}', function_id)
|
|
180
|
+
.gsub('{tagId}', tag_id)
|
|
181
|
+
|
|
182
|
+
params = {
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return @client.call('delete', path, {
|
|
186
|
+
'content-type' => 'application/json',
|
|
187
|
+
}, params);
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
protected
|
|
192
|
+
|
|
193
|
+
private
|
|
194
|
+
end
|
|
195
|
+
end
|