appwrite 26.0.0 → 26.1.0
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/database_status.rb +11 -0
- data/lib/appwrite/enums/database_type.rb +3 -0
- data/lib/appwrite/enums/organization_key_scopes.rb +2 -0
- data/lib/appwrite/enums/project_key_scopes.rb +3 -0
- data/lib/appwrite/models/activity_event.rb +58 -3
- data/lib/appwrite/models/app.rb +152 -0
- data/lib/appwrite/models/app_installation.rb +72 -0
- data/lib/appwrite/models/app_installation_list.rb +32 -0
- data/lib/appwrite/models/app_key.rb +67 -0
- data/lib/appwrite/models/app_key_list.rb +32 -0
- data/lib/appwrite/models/app_scope.rb +47 -0
- data/lib/appwrite/models/app_scope_list.rb +32 -0
- data/lib/appwrite/models/app_secret.rb +67 -0
- data/lib/appwrite/models/app_secret_list.rb +32 -0
- data/lib/appwrite/models/app_secret_plaintext.rb +67 -0
- data/lib/appwrite/models/apps_list.rb +32 -0
- data/lib/appwrite/models/billing_plan.rb +5 -0
- data/lib/appwrite/models/database.rb +35 -6
- data/lib/appwrite/models/database_status.rb +62 -0
- data/lib/appwrite/models/database_status_connections.rb +32 -0
- data/lib/appwrite/models/database_status_replica.rb +42 -0
- data/lib/appwrite/models/database_status_volume.rb +42 -0
- data/lib/appwrite/models/dedicated_database.rb +267 -0
- data/lib/appwrite/models/dedicated_database_member.rb +42 -0
- data/lib/appwrite/models/dedicated_database_replicas.rb +37 -0
- data/lib/appwrite/models/dedicated_database_specification.rb +67 -0
- data/lib/appwrite/models/dedicated_database_specification_list.rb +37 -0
- data/lib/appwrite/models/dedicated_database_specification_pricing.rb +47 -0
- data/lib/appwrite/models/oauth2_approve.rb +27 -0
- data/lib/appwrite/models/oauth2_authorize.rb +32 -0
- data/lib/appwrite/models/oauth2_consent.rb +72 -0
- data/lib/appwrite/models/oauth2_consent_list.rb +32 -0
- data/lib/appwrite/models/oauth2_consent_token.rb +77 -0
- data/lib/appwrite/models/oauth2_consent_token_list.rb +32 -0
- data/lib/appwrite/models/oauth2_device_authorization.rb +52 -0
- data/lib/appwrite/models/oauth2_grant.rb +82 -0
- data/lib/appwrite/models/oauth2_organization.rb +27 -0
- data/lib/appwrite/models/oauth2_organization_list.rb +32 -0
- data/lib/appwrite/models/oauth2_par.rb +32 -0
- data/lib/appwrite/models/oauth2_project.rb +37 -0
- data/lib/appwrite/models/oauth2_project_list.rb +32 -0
- data/lib/appwrite/models/oauth2_reject.rb +27 -0
- data/lib/appwrite/models/oauth2_token.rb +57 -0
- data/lib/appwrite/models/project.rb +10 -0
- data/lib/appwrite/models/project_auth_method.rb +3 -3
- data/lib/appwrite/services/account.rb +209 -0
- data/lib/appwrite/services/apps.rb +813 -0
- data/lib/appwrite/services/backups.rb +25 -12
- data/lib/appwrite/services/oauth2.rb +525 -0
- data/lib/appwrite/services/organization.rb +168 -0
- data/lib/appwrite/services/project.rb +3 -1
- data/lib/appwrite/services/sites.rb +3 -1
- data/lib/appwrite/services/tables_db.rb +134 -2
- data/lib/appwrite/services/teams.rb +198 -0
- data/lib/appwrite.rb +38 -0
- metadata +40 -2
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
#frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
class Apps < Service
|
|
5
|
+
|
|
6
|
+
def initialize(client)
|
|
7
|
+
@client = client
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# List applications.
|
|
11
|
+
#
|
|
12
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
13
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
14
|
+
#
|
|
15
|
+
# @return [AppsList]
|
|
16
|
+
def list(queries: nil, total: nil)
|
|
17
|
+
api_path = '/apps'
|
|
18
|
+
|
|
19
|
+
api_params = {
|
|
20
|
+
queries: queries,
|
|
21
|
+
total: total,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
api_headers = {
|
|
25
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
26
|
+
"accept": 'application/json',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@client.call(
|
|
30
|
+
method: 'GET',
|
|
31
|
+
path: api_path,
|
|
32
|
+
headers: api_headers,
|
|
33
|
+
params: api_params,
|
|
34
|
+
response_type: Models::AppsList
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Create a new application.
|
|
40
|
+
#
|
|
41
|
+
# @param [String] app_id Application 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.
|
|
42
|
+
# @param [String] name Application name.
|
|
43
|
+
# @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment.
|
|
44
|
+
# @param [String] description Application description shown to users during OAuth2 consent.
|
|
45
|
+
# @param [String] client_uri Application homepage URL shown to users during OAuth2 consent.
|
|
46
|
+
# @param [String] logo_uri Application logo URL shown to users during OAuth2 consent.
|
|
47
|
+
# @param [String] privacy_policy_url Application privacy policy URL shown to users during OAuth2 consent.
|
|
48
|
+
# @param [String] terms_url Application terms of service URL shown to users during OAuth2 consent.
|
|
49
|
+
# @param [Array] contacts Application support or security contact emails. Maximum of 100 contacts are allowed.
|
|
50
|
+
# @param [String] tagline Application tagline shown to users during OAuth2 consent.
|
|
51
|
+
# @param [Array] tags Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long.
|
|
52
|
+
# @param [Array] images Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed.
|
|
53
|
+
# @param [String] support_url Application support URL shown to users during OAuth2 consent.
|
|
54
|
+
# @param [String] data_deletion_url Application data deletion URL shown to users during OAuth2 consent.
|
|
55
|
+
# @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list.
|
|
56
|
+
# @param [] enabled Is application enabled?
|
|
57
|
+
# @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`.
|
|
58
|
+
# @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false.
|
|
59
|
+
# @param [String] team_id Team unique ID.
|
|
60
|
+
#
|
|
61
|
+
# @return [App]
|
|
62
|
+
def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, post_logout_redirect_uris: nil, enabled: nil, type: nil, device_flow: nil, team_id: nil)
|
|
63
|
+
api_path = '/apps'
|
|
64
|
+
|
|
65
|
+
if app_id.nil?
|
|
66
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
if name.nil?
|
|
70
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if redirect_uris.nil?
|
|
74
|
+
raise Appwrite::Exception.new('Missing required parameter: "redirectUris"')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
api_params = {
|
|
78
|
+
appId: app_id,
|
|
79
|
+
name: name,
|
|
80
|
+
description: description,
|
|
81
|
+
clientUri: client_uri,
|
|
82
|
+
logoUri: logo_uri,
|
|
83
|
+
privacyPolicyUrl: privacy_policy_url,
|
|
84
|
+
termsUrl: terms_url,
|
|
85
|
+
contacts: contacts,
|
|
86
|
+
tagline: tagline,
|
|
87
|
+
tags: tags,
|
|
88
|
+
images: images,
|
|
89
|
+
supportUrl: support_url,
|
|
90
|
+
dataDeletionUrl: data_deletion_url,
|
|
91
|
+
redirectUris: redirect_uris,
|
|
92
|
+
postLogoutRedirectUris: post_logout_redirect_uris,
|
|
93
|
+
enabled: enabled,
|
|
94
|
+
type: type,
|
|
95
|
+
deviceFlow: device_flow,
|
|
96
|
+
teamId: team_id,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
api_headers = {
|
|
100
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
101
|
+
"content-type": 'application/json',
|
|
102
|
+
"accept": 'application/json',
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@client.call(
|
|
106
|
+
method: 'POST',
|
|
107
|
+
path: api_path,
|
|
108
|
+
headers: api_headers,
|
|
109
|
+
params: api_params,
|
|
110
|
+
response_type: Models::App
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# List scopes an application can request when installed on a team.
|
|
116
|
+
#
|
|
117
|
+
#
|
|
118
|
+
# @return [AppScopeList]
|
|
119
|
+
def list_installation_scopes()
|
|
120
|
+
api_path = '/apps/scopes/installations'
|
|
121
|
+
|
|
122
|
+
api_params = {
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
api_headers = {
|
|
126
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
127
|
+
"accept": 'application/json',
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@client.call(
|
|
131
|
+
method: 'GET',
|
|
132
|
+
path: api_path,
|
|
133
|
+
headers: api_headers,
|
|
134
|
+
params: api_params,
|
|
135
|
+
response_type: Models::AppScopeList
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# List scopes an application can request during the OAuth2 flow.
|
|
141
|
+
#
|
|
142
|
+
#
|
|
143
|
+
# @return [AppScopeList]
|
|
144
|
+
def list_o_auth2_scopes()
|
|
145
|
+
api_path = '/apps/scopes/oauth2'
|
|
146
|
+
|
|
147
|
+
api_params = {
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
api_headers = {
|
|
151
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
152
|
+
"accept": 'application/json',
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@client.call(
|
|
156
|
+
method: 'GET',
|
|
157
|
+
path: api_path,
|
|
158
|
+
headers: api_headers,
|
|
159
|
+
params: api_params,
|
|
160
|
+
response_type: Models::AppScopeList
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Get an application by its unique ID.
|
|
166
|
+
#
|
|
167
|
+
# @param [String] app_id Application unique ID or HTTPS client ID metadata document URL.
|
|
168
|
+
#
|
|
169
|
+
# @return [App]
|
|
170
|
+
def get(app_id:)
|
|
171
|
+
api_path = '/apps/{appId}'
|
|
172
|
+
.gsub('{appId}', app_id)
|
|
173
|
+
|
|
174
|
+
if app_id.nil?
|
|
175
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
api_params = {
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
api_headers = {
|
|
182
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
183
|
+
"accept": 'application/json',
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@client.call(
|
|
187
|
+
method: 'GET',
|
|
188
|
+
path: api_path,
|
|
189
|
+
headers: api_headers,
|
|
190
|
+
params: api_params,
|
|
191
|
+
response_type: Models::App
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Update an application by its unique ID.
|
|
197
|
+
#
|
|
198
|
+
# @param [String] app_id Application unique ID.
|
|
199
|
+
# @param [String] name Application name.
|
|
200
|
+
# @param [String] description Application description shown to users during OAuth2 consent.
|
|
201
|
+
# @param [String] client_uri Application homepage URL shown to users during OAuth2 consent.
|
|
202
|
+
# @param [String] logo_uri Application logo URL shown to users during OAuth2 consent.
|
|
203
|
+
# @param [String] privacy_policy_url Application privacy policy URL shown to users during OAuth2 consent.
|
|
204
|
+
# @param [String] terms_url Application terms of service URL shown to users during OAuth2 consent.
|
|
205
|
+
# @param [Array] contacts Application support or security contact emails. Maximum of 100 contacts are allowed.
|
|
206
|
+
# @param [String] tagline Application tagline shown to users during OAuth2 consent.
|
|
207
|
+
# @param [Array] tags Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long.
|
|
208
|
+
# @param [Array] images Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed.
|
|
209
|
+
# @param [String] support_url Application support URL shown to users during OAuth2 consent.
|
|
210
|
+
# @param [String] data_deletion_url Application data deletion URL shown to users during OAuth2 consent.
|
|
211
|
+
# @param [] enabled Is application enabled?
|
|
212
|
+
# @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment.
|
|
213
|
+
# @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list.
|
|
214
|
+
# @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`.
|
|
215
|
+
# @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false.
|
|
216
|
+
# @param [Array] installation_scopes Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed.
|
|
217
|
+
# @param [String] installation_redirect_url URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect.
|
|
218
|
+
#
|
|
219
|
+
# @return [App]
|
|
220
|
+
def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, enabled: nil, redirect_uris: nil, post_logout_redirect_uris: nil, type: nil, device_flow: nil, installation_scopes: nil, installation_redirect_url: nil)
|
|
221
|
+
api_path = '/apps/{appId}'
|
|
222
|
+
.gsub('{appId}', app_id)
|
|
223
|
+
|
|
224
|
+
if app_id.nil?
|
|
225
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
if name.nil?
|
|
229
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
api_params = {
|
|
233
|
+
name: name,
|
|
234
|
+
description: description,
|
|
235
|
+
clientUri: client_uri,
|
|
236
|
+
logoUri: logo_uri,
|
|
237
|
+
privacyPolicyUrl: privacy_policy_url,
|
|
238
|
+
termsUrl: terms_url,
|
|
239
|
+
contacts: contacts,
|
|
240
|
+
tagline: tagline,
|
|
241
|
+
tags: tags,
|
|
242
|
+
images: images,
|
|
243
|
+
supportUrl: support_url,
|
|
244
|
+
dataDeletionUrl: data_deletion_url,
|
|
245
|
+
enabled: enabled,
|
|
246
|
+
redirectUris: redirect_uris,
|
|
247
|
+
postLogoutRedirectUris: post_logout_redirect_uris,
|
|
248
|
+
type: type,
|
|
249
|
+
deviceFlow: device_flow,
|
|
250
|
+
installationScopes: installation_scopes,
|
|
251
|
+
installationRedirectUrl: installation_redirect_url,
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
api_headers = {
|
|
255
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
256
|
+
"content-type": 'application/json',
|
|
257
|
+
"accept": 'application/json',
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@client.call(
|
|
261
|
+
method: 'PUT',
|
|
262
|
+
path: api_path,
|
|
263
|
+
headers: api_headers,
|
|
264
|
+
params: api_params,
|
|
265
|
+
response_type: Models::App
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# Delete an application by its unique ID.
|
|
271
|
+
#
|
|
272
|
+
# @param [String] app_id Application unique ID.
|
|
273
|
+
#
|
|
274
|
+
# @return []
|
|
275
|
+
def delete(app_id:)
|
|
276
|
+
api_path = '/apps/{appId}'
|
|
277
|
+
.gsub('{appId}', app_id)
|
|
278
|
+
|
|
279
|
+
if app_id.nil?
|
|
280
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
api_params = {
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
api_headers = {
|
|
287
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
288
|
+
"content-type": 'application/json',
|
|
289
|
+
"accept": 'application/json',
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@client.call(
|
|
293
|
+
method: 'DELETE',
|
|
294
|
+
path: api_path,
|
|
295
|
+
headers: api_headers,
|
|
296
|
+
params: api_params,
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# List installations of an application. Requires an app key sent in the
|
|
302
|
+
# `X-Appwrite-Key` header alongside the `X-Appwrite-App` header.
|
|
303
|
+
#
|
|
304
|
+
# @param [String] app_id Application unique ID.
|
|
305
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
306
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
307
|
+
#
|
|
308
|
+
# @return [AppInstallationList]
|
|
309
|
+
def list_installations(app_id:, queries: nil, total: nil)
|
|
310
|
+
api_path = '/apps/{appId}/installations'
|
|
311
|
+
.gsub('{appId}', app_id)
|
|
312
|
+
|
|
313
|
+
if app_id.nil?
|
|
314
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
api_params = {
|
|
318
|
+
queries: queries,
|
|
319
|
+
total: total,
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
api_headers = {
|
|
323
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
324
|
+
"accept": 'application/json',
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
@client.call(
|
|
328
|
+
method: 'GET',
|
|
329
|
+
path: api_path,
|
|
330
|
+
headers: api_headers,
|
|
331
|
+
params: api_params,
|
|
332
|
+
response_type: Models::AppInstallationList
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Get an installation of an application by its unique ID. Requires an app key
|
|
338
|
+
# sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header.
|
|
339
|
+
#
|
|
340
|
+
# @param [String] app_id Application unique ID.
|
|
341
|
+
# @param [String] installation_id Installation unique ID.
|
|
342
|
+
#
|
|
343
|
+
# @return [AppInstallation]
|
|
344
|
+
def get_installation(app_id:, installation_id:)
|
|
345
|
+
api_path = '/apps/{appId}/installations/{installationId}'
|
|
346
|
+
.gsub('{appId}', app_id)
|
|
347
|
+
.gsub('{installationId}', installation_id)
|
|
348
|
+
|
|
349
|
+
if app_id.nil?
|
|
350
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
if installation_id.nil?
|
|
354
|
+
raise Appwrite::Exception.new('Missing required parameter: "installationId"')
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
api_params = {
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
api_headers = {
|
|
361
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
362
|
+
"accept": 'application/json',
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@client.call(
|
|
366
|
+
method: 'GET',
|
|
367
|
+
path: api_path,
|
|
368
|
+
headers: api_headers,
|
|
369
|
+
params: api_params,
|
|
370
|
+
response_type: Models::AppInstallation
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# Create a token for an installation of an application. Requires an app key
|
|
376
|
+
# sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header.
|
|
377
|
+
# The returned token carries the scopes and authorization details granted to
|
|
378
|
+
# the installation, and can be used as an `Authorization: Bearer` header
|
|
379
|
+
# everywhere OAuth2 access tokens are accepted. Multiple tokens can be active
|
|
380
|
+
# for the same installation at once; each token stays valid until it expires
|
|
381
|
+
# or the installation is updated or deleted.
|
|
382
|
+
#
|
|
383
|
+
# @param [String] app_id Application unique ID.
|
|
384
|
+
# @param [String] installation_id Installation unique ID.
|
|
385
|
+
#
|
|
386
|
+
# @return [Oauth2Token]
|
|
387
|
+
def create_installation_token(app_id:, installation_id:)
|
|
388
|
+
api_path = '/apps/{appId}/installations/{installationId}/tokens'
|
|
389
|
+
.gsub('{appId}', app_id)
|
|
390
|
+
.gsub('{installationId}', installation_id)
|
|
391
|
+
|
|
392
|
+
if app_id.nil?
|
|
393
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
if installation_id.nil?
|
|
397
|
+
raise Appwrite::Exception.new('Missing required parameter: "installationId"')
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
api_params = {
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
api_headers = {
|
|
404
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
405
|
+
"content-type": 'application/json',
|
|
406
|
+
"accept": 'application/json',
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
@client.call(
|
|
410
|
+
method: 'POST',
|
|
411
|
+
path: api_path,
|
|
412
|
+
headers: api_headers,
|
|
413
|
+
params: api_params,
|
|
414
|
+
response_type: Models::Oauth2Token
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
# List app keys for an application.
|
|
420
|
+
#
|
|
421
|
+
# @param [String] app_id Application unique ID.
|
|
422
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
423
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
424
|
+
#
|
|
425
|
+
# @return [AppKeyList]
|
|
426
|
+
def list_keys(app_id:, queries: nil, total: nil)
|
|
427
|
+
api_path = '/apps/{appId}/keys'
|
|
428
|
+
.gsub('{appId}', app_id)
|
|
429
|
+
|
|
430
|
+
if app_id.nil?
|
|
431
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
api_params = {
|
|
435
|
+
queries: queries,
|
|
436
|
+
total: total,
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
api_headers = {
|
|
440
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
441
|
+
"accept": 'application/json',
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@client.call(
|
|
445
|
+
method: 'GET',
|
|
446
|
+
path: api_path,
|
|
447
|
+
headers: api_headers,
|
|
448
|
+
params: api_params,
|
|
449
|
+
response_type: Models::AppKeyList
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
# Create a new app key for an application. App keys carry no scopes; send one
|
|
455
|
+
# in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to
|
|
456
|
+
# list the application's installations and create installation access tokens.
|
|
457
|
+
#
|
|
458
|
+
# @param [String] app_id Application unique ID.
|
|
459
|
+
#
|
|
460
|
+
# @return [AppKey]
|
|
461
|
+
def create_key(app_id:)
|
|
462
|
+
api_path = '/apps/{appId}/keys'
|
|
463
|
+
.gsub('{appId}', app_id)
|
|
464
|
+
|
|
465
|
+
if app_id.nil?
|
|
466
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
api_params = {
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
api_headers = {
|
|
473
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
474
|
+
"content-type": 'application/json',
|
|
475
|
+
"accept": 'application/json',
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
@client.call(
|
|
479
|
+
method: 'POST',
|
|
480
|
+
path: api_path,
|
|
481
|
+
headers: api_headers,
|
|
482
|
+
params: api_params,
|
|
483
|
+
response_type: Models::AppKey
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
# Get an app key by its unique ID.
|
|
489
|
+
#
|
|
490
|
+
# @param [String] app_id Application unique ID.
|
|
491
|
+
# @param [String] key_id App key unique ID.
|
|
492
|
+
#
|
|
493
|
+
# @return [AppKey]
|
|
494
|
+
def get_key(app_id:, key_id:)
|
|
495
|
+
api_path = '/apps/{appId}/keys/{keyId}'
|
|
496
|
+
.gsub('{appId}', app_id)
|
|
497
|
+
.gsub('{keyId}', key_id)
|
|
498
|
+
|
|
499
|
+
if app_id.nil?
|
|
500
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
if key_id.nil?
|
|
504
|
+
raise Appwrite::Exception.new('Missing required parameter: "keyId"')
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
api_params = {
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
api_headers = {
|
|
511
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
512
|
+
"accept": 'application/json',
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
@client.call(
|
|
516
|
+
method: 'GET',
|
|
517
|
+
path: api_path,
|
|
518
|
+
headers: api_headers,
|
|
519
|
+
params: api_params,
|
|
520
|
+
response_type: Models::AppKey
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
# Delete an app key by its unique ID.
|
|
526
|
+
#
|
|
527
|
+
# @param [String] app_id Application unique ID.
|
|
528
|
+
# @param [String] key_id App key unique ID.
|
|
529
|
+
#
|
|
530
|
+
# @return []
|
|
531
|
+
def delete_key(app_id:, key_id:)
|
|
532
|
+
api_path = '/apps/{appId}/keys/{keyId}'
|
|
533
|
+
.gsub('{appId}', app_id)
|
|
534
|
+
.gsub('{keyId}', key_id)
|
|
535
|
+
|
|
536
|
+
if app_id.nil?
|
|
537
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
if key_id.nil?
|
|
541
|
+
raise Appwrite::Exception.new('Missing required parameter: "keyId"')
|
|
542
|
+
end
|
|
543
|
+
|
|
544
|
+
api_params = {
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
api_headers = {
|
|
548
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
549
|
+
"content-type": 'application/json',
|
|
550
|
+
"accept": 'application/json',
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
@client.call(
|
|
554
|
+
method: 'DELETE',
|
|
555
|
+
path: api_path,
|
|
556
|
+
headers: api_headers,
|
|
557
|
+
params: api_params,
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
# Update the labels of an application. Labels are read-only for clients; only
|
|
563
|
+
# a server SDK using a project API key can set them. Replaces the previous
|
|
564
|
+
# labels.
|
|
565
|
+
#
|
|
566
|
+
# @param [String] app_id Application unique ID.
|
|
567
|
+
# @param [Array] labels Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
|
|
568
|
+
#
|
|
569
|
+
# @return [App]
|
|
570
|
+
def update_labels(app_id:, labels:)
|
|
571
|
+
api_path = '/apps/{appId}/labels'
|
|
572
|
+
.gsub('{appId}', app_id)
|
|
573
|
+
|
|
574
|
+
if app_id.nil?
|
|
575
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
if labels.nil?
|
|
579
|
+
raise Appwrite::Exception.new('Missing required parameter: "labels"')
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
api_params = {
|
|
583
|
+
labels: labels,
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
api_headers = {
|
|
587
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
588
|
+
"content-type": 'application/json',
|
|
589
|
+
"accept": 'application/json',
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
@client.call(
|
|
593
|
+
method: 'PUT',
|
|
594
|
+
path: api_path,
|
|
595
|
+
headers: api_headers,
|
|
596
|
+
params: api_params,
|
|
597
|
+
response_type: Models::App
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
# List client secrets for an application.
|
|
603
|
+
#
|
|
604
|
+
# @param [String] app_id Application unique ID.
|
|
605
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
606
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
607
|
+
#
|
|
608
|
+
# @return [AppSecretList]
|
|
609
|
+
def list_secrets(app_id:, queries: nil, total: nil)
|
|
610
|
+
api_path = '/apps/{appId}/secrets'
|
|
611
|
+
.gsub('{appId}', app_id)
|
|
612
|
+
|
|
613
|
+
if app_id.nil?
|
|
614
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
api_params = {
|
|
618
|
+
queries: queries,
|
|
619
|
+
total: total,
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
api_headers = {
|
|
623
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
624
|
+
"accept": 'application/json',
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
@client.call(
|
|
628
|
+
method: 'GET',
|
|
629
|
+
path: api_path,
|
|
630
|
+
headers: api_headers,
|
|
631
|
+
params: api_params,
|
|
632
|
+
response_type: Models::AppSecretList
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
# Create a new client secret for an application.
|
|
638
|
+
#
|
|
639
|
+
# @param [String] app_id Application unique ID.
|
|
640
|
+
#
|
|
641
|
+
# @return [AppSecretPlaintext]
|
|
642
|
+
def create_secret(app_id:)
|
|
643
|
+
api_path = '/apps/{appId}/secrets'
|
|
644
|
+
.gsub('{appId}', app_id)
|
|
645
|
+
|
|
646
|
+
if app_id.nil?
|
|
647
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
648
|
+
end
|
|
649
|
+
|
|
650
|
+
api_params = {
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
api_headers = {
|
|
654
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
655
|
+
"content-type": 'application/json',
|
|
656
|
+
"accept": 'application/json',
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
@client.call(
|
|
660
|
+
method: 'POST',
|
|
661
|
+
path: api_path,
|
|
662
|
+
headers: api_headers,
|
|
663
|
+
params: api_params,
|
|
664
|
+
response_type: Models::AppSecretPlaintext
|
|
665
|
+
)
|
|
666
|
+
|
|
667
|
+
end
|
|
668
|
+
|
|
669
|
+
# Get an application client secret by its unique ID.
|
|
670
|
+
#
|
|
671
|
+
# @param [String] app_id Application unique ID.
|
|
672
|
+
# @param [String] secret_id Secret unique ID.
|
|
673
|
+
#
|
|
674
|
+
# @return [AppSecret]
|
|
675
|
+
def get_secret(app_id:, secret_id:)
|
|
676
|
+
api_path = '/apps/{appId}/secrets/{secretId}'
|
|
677
|
+
.gsub('{appId}', app_id)
|
|
678
|
+
.gsub('{secretId}', secret_id)
|
|
679
|
+
|
|
680
|
+
if app_id.nil?
|
|
681
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
682
|
+
end
|
|
683
|
+
|
|
684
|
+
if secret_id.nil?
|
|
685
|
+
raise Appwrite::Exception.new('Missing required parameter: "secretId"')
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
api_params = {
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
api_headers = {
|
|
692
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
693
|
+
"accept": 'application/json',
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
@client.call(
|
|
697
|
+
method: 'GET',
|
|
698
|
+
path: api_path,
|
|
699
|
+
headers: api_headers,
|
|
700
|
+
params: api_params,
|
|
701
|
+
response_type: Models::AppSecret
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
end
|
|
705
|
+
|
|
706
|
+
# Delete an application client secret by its unique ID.
|
|
707
|
+
#
|
|
708
|
+
# @param [String] app_id Application unique ID.
|
|
709
|
+
# @param [String] secret_id Secret unique ID.
|
|
710
|
+
#
|
|
711
|
+
# @return []
|
|
712
|
+
def delete_secret(app_id:, secret_id:)
|
|
713
|
+
api_path = '/apps/{appId}/secrets/{secretId}'
|
|
714
|
+
.gsub('{appId}', app_id)
|
|
715
|
+
.gsub('{secretId}', secret_id)
|
|
716
|
+
|
|
717
|
+
if app_id.nil?
|
|
718
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
719
|
+
end
|
|
720
|
+
|
|
721
|
+
if secret_id.nil?
|
|
722
|
+
raise Appwrite::Exception.new('Missing required parameter: "secretId"')
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
api_params = {
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
api_headers = {
|
|
729
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
730
|
+
"content-type": 'application/json',
|
|
731
|
+
"accept": 'application/json',
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
@client.call(
|
|
735
|
+
method: 'DELETE',
|
|
736
|
+
path: api_path,
|
|
737
|
+
headers: api_headers,
|
|
738
|
+
params: api_params,
|
|
739
|
+
)
|
|
740
|
+
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
# Transfer an application to another team by its unique ID.
|
|
744
|
+
#
|
|
745
|
+
# @param [String] app_id Application unique ID.
|
|
746
|
+
# @param [String] team_id Team ID of the team to transfer application to.
|
|
747
|
+
#
|
|
748
|
+
# @return [App]
|
|
749
|
+
def update_team(app_id:, team_id:)
|
|
750
|
+
api_path = '/apps/{appId}/team'
|
|
751
|
+
.gsub('{appId}', app_id)
|
|
752
|
+
|
|
753
|
+
if app_id.nil?
|
|
754
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
if team_id.nil?
|
|
758
|
+
raise Appwrite::Exception.new('Missing required parameter: "teamId"')
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
api_params = {
|
|
762
|
+
teamId: team_id,
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
api_headers = {
|
|
766
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
767
|
+
"content-type": 'application/json',
|
|
768
|
+
"accept": 'application/json',
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
@client.call(
|
|
772
|
+
method: 'PATCH',
|
|
773
|
+
path: api_path,
|
|
774
|
+
headers: api_headers,
|
|
775
|
+
params: api_params,
|
|
776
|
+
response_type: Models::App
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
# Revoke all tokens for an application by its unique ID.
|
|
782
|
+
#
|
|
783
|
+
# @param [String] app_id Application unique ID.
|
|
784
|
+
#
|
|
785
|
+
# @return []
|
|
786
|
+
def delete_tokens(app_id:)
|
|
787
|
+
api_path = '/apps/{appId}/tokens'
|
|
788
|
+
.gsub('{appId}', app_id)
|
|
789
|
+
|
|
790
|
+
if app_id.nil?
|
|
791
|
+
raise Appwrite::Exception.new('Missing required parameter: "appId"')
|
|
792
|
+
end
|
|
793
|
+
|
|
794
|
+
api_params = {
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
api_headers = {
|
|
798
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
799
|
+
"content-type": 'application/json',
|
|
800
|
+
"accept": 'application/json',
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
@client.call(
|
|
804
|
+
method: 'DELETE',
|
|
805
|
+
path: api_path,
|
|
806
|
+
headers: api_headers,
|
|
807
|
+
params: api_params,
|
|
808
|
+
)
|
|
809
|
+
|
|
810
|
+
end
|
|
811
|
+
|
|
812
|
+
end
|
|
813
|
+
end
|