appwrite 30.0.1 → 30.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 +44 -24
- data/lib/appwrite/enums/appwrite_migration_resource.rb +46 -0
- data/lib/appwrite/enums/build_runtime.rb +4 -0
- data/lib/appwrite/enums/environment_resource.rb +40 -0
- data/lib/appwrite/enums/firebase_migration_resource.rb +16 -0
- data/lib/appwrite/enums/n_host_migration_resource.rb +17 -0
- data/lib/appwrite/enums/on_duplicate.rb +9 -0
- data/lib/appwrite/enums/project_policy_id.rb +1 -0
- data/lib/appwrite/enums/runtime.rb +4 -0
- data/lib/appwrite/enums/supabase_migration_resource.rb +17 -0
- data/lib/appwrite/models/billing_plan.rb +15 -0
- data/lib/appwrite/models/migration.rb +128 -0
- data/lib/appwrite/models/migration_list.rb +33 -0
- data/lib/appwrite/models/policy_deny_realtime_guests.rb +33 -0
- data/lib/appwrite/services/account.rb +19 -19
- data/lib/appwrite/services/activities.rb +1 -1
- data/lib/appwrite/services/advisor.rb +5 -5
- data/lib/appwrite/services/apps.rb +25 -25
- data/lib/appwrite/services/avatars.rb +3 -3
- data/lib/appwrite/services/backups.rb +6 -6
- data/lib/appwrite/services/databases.rb +157 -157
- data/lib/appwrite/services/documents_db.rb +63 -63
- data/lib/appwrite/services/domains.rb +77 -77
- data/lib/appwrite/services/functions.rb +33 -33
- data/lib/appwrite/services/messaging.rb +30 -30
- data/lib/appwrite/services/migrations.rb +653 -0
- data/lib/appwrite/services/mongo.rb +37 -37
- data/lib/appwrite/services/mysql.rb +40 -40
- data/lib/appwrite/services/oauth2.rb +14 -14
- data/lib/appwrite/services/organization.rb +17 -17
- data/lib/appwrite/services/postgresql.rb +44 -44
- data/lib/appwrite/services/presences.rb +4 -4
- data/lib/appwrite/services/project.rb +105 -28
- data/lib/appwrite/services/proxy.rb +3 -3
- data/lib/appwrite/services/sites.rb +32 -32
- data/lib/appwrite/services/storage.rb +17 -17
- data/lib/appwrite/services/tables_db.rb +169 -169
- data/lib/appwrite/services/teams.rb +23 -23
- data/lib/appwrite/services/tokens.rb +7 -7
- data/lib/appwrite/services/users.rb +50 -50
- data/lib/appwrite/services/vectors_db.rb +55 -55
- data/lib/appwrite/services/waf.rb +57 -35
- data/lib/appwrite/services/webhooks.rb +4 -4
- data/lib/appwrite.rb +12 -0
- metadata +12 -2
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
class Migrations < Service
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# List all migrations in the current project. This endpoint returns a list of
|
|
10
|
+
# all migrations including their status, progress, and any errors that
|
|
11
|
+
# occurred during the migration process.
|
|
12
|
+
#
|
|
13
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, stage, source, destination, resources, resourceId, resourceInternalId, resourceType, parentResourceId, parentResourceInternalId, parentResourceType, destinationResourceId, destinationResourceInternalId, destinationResourceType, statusCounters, resourceData, errors
|
|
14
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
|
15
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
16
|
+
#
|
|
17
|
+
# @return [MigrationList]
|
|
18
|
+
def list(
|
|
19
|
+
queries: nil,
|
|
20
|
+
search: nil,
|
|
21
|
+
total: nil
|
|
22
|
+
)
|
|
23
|
+
api_path = '/migrations'
|
|
24
|
+
|
|
25
|
+
api_params = {
|
|
26
|
+
queries: queries,
|
|
27
|
+
search: search,
|
|
28
|
+
total: total,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
api_headers = {
|
|
32
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
33
|
+
"accept": 'application/json',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@client.call(
|
|
37
|
+
method: 'GET',
|
|
38
|
+
path: api_path,
|
|
39
|
+
headers: api_headers,
|
|
40
|
+
params: api_params,
|
|
41
|
+
response_type: Models::MigrationList
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Migrate data from another Appwrite project to your current project. This
|
|
46
|
+
# endpoint allows you to migrate resources like databases, collections,
|
|
47
|
+
# documents, users, and files from an existing Appwrite project.
|
|
48
|
+
#
|
|
49
|
+
# @param [Array] resources List of resources to migrate
|
|
50
|
+
# @param [String] endpoint Source Appwrite endpoint
|
|
51
|
+
# @param [String] project_id Source Project ID
|
|
52
|
+
# @param [String] api_key Source API Key
|
|
53
|
+
# @param [OnDuplicate] on_duplicate Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row.
|
|
54
|
+
#
|
|
55
|
+
# @return [Migration]
|
|
56
|
+
def create_appwrite_migration(
|
|
57
|
+
resources:,
|
|
58
|
+
endpoint:,
|
|
59
|
+
project_id:,
|
|
60
|
+
api_key:,
|
|
61
|
+
on_duplicate: nil
|
|
62
|
+
)
|
|
63
|
+
if resources.nil?
|
|
64
|
+
raise Appwrite::Exception.new('Missing required parameter: "resources"')
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if endpoint.nil?
|
|
68
|
+
raise Appwrite::Exception.new('Missing required parameter: "endpoint"')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if project_id.nil?
|
|
72
|
+
raise Appwrite::Exception.new('Missing required parameter: "projectId"')
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if api_key.nil?
|
|
76
|
+
raise Appwrite::Exception.new('Missing required parameter: "apiKey"')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
api_path = '/migrations/appwrite'
|
|
80
|
+
|
|
81
|
+
api_params = {
|
|
82
|
+
resources: resources,
|
|
83
|
+
endpoint: endpoint,
|
|
84
|
+
projectId: project_id,
|
|
85
|
+
apiKey: api_key,
|
|
86
|
+
onDuplicate: on_duplicate,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
api_headers = {
|
|
90
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
91
|
+
"content-type": 'application/json',
|
|
92
|
+
"accept": 'application/json',
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@client.call(
|
|
96
|
+
method: 'POST',
|
|
97
|
+
path: api_path,
|
|
98
|
+
headers: api_headers,
|
|
99
|
+
params: api_params,
|
|
100
|
+
response_type: Models::Migration
|
|
101
|
+
)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Export documents to a CSV file from your Appwrite database. This endpoint
|
|
105
|
+
# allows you to export documents to a CSV file stored in a secure internal
|
|
106
|
+
# bucket. You'll receive an email with a download link when the export is
|
|
107
|
+
# complete.
|
|
108
|
+
#
|
|
109
|
+
# @param [String] database_id Database ID containing the source collection.
|
|
110
|
+
# @param [String] collection_id Collection ID to export documents from.
|
|
111
|
+
# @param [String] filename The name of the file to be created for the export, excluding the .csv extension.
|
|
112
|
+
# @param [Array] columns List of attributes to export. If empty, all attributes will be exported. You can use the `*` wildcard to export all attributes from the collection.
|
|
113
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK to filter documents to export. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
114
|
+
# @param [String] delimiter The character that separates each column value. Default is comma.
|
|
115
|
+
# @param [String] enclosure The character that encloses each column value. Default is double quotes.
|
|
116
|
+
# @param [String] escape The escape character for the enclosure character. Default is double quotes.
|
|
117
|
+
# @param [] header Whether to include the header row with column names. Default is true.
|
|
118
|
+
# @param [] notify Set to true to receive an email when the export is complete. Default is true.
|
|
119
|
+
#
|
|
120
|
+
# @return [Migration]
|
|
121
|
+
def create_csv_export(
|
|
122
|
+
database_id:,
|
|
123
|
+
collection_id:,
|
|
124
|
+
filename:,
|
|
125
|
+
columns: nil,
|
|
126
|
+
queries: nil,
|
|
127
|
+
delimiter: nil,
|
|
128
|
+
enclosure: nil,
|
|
129
|
+
escape: nil,
|
|
130
|
+
header: nil,
|
|
131
|
+
notify: nil
|
|
132
|
+
)
|
|
133
|
+
if database_id.nil?
|
|
134
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if collection_id.nil?
|
|
138
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if filename.nil?
|
|
142
|
+
raise Appwrite::Exception.new('Missing required parameter: "filename"')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
api_path = '/migrations/csv/exports'
|
|
146
|
+
|
|
147
|
+
api_params = {
|
|
148
|
+
databaseId: database_id,
|
|
149
|
+
collectionId: collection_id,
|
|
150
|
+
filename: filename,
|
|
151
|
+
columns: columns,
|
|
152
|
+
queries: queries,
|
|
153
|
+
delimiter: delimiter,
|
|
154
|
+
enclosure: enclosure,
|
|
155
|
+
escape: escape,
|
|
156
|
+
header: header,
|
|
157
|
+
notify: notify,
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
api_headers = {
|
|
161
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
162
|
+
"content-type": 'application/json',
|
|
163
|
+
"accept": 'application/json',
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@client.call(
|
|
167
|
+
method: 'POST',
|
|
168
|
+
path: api_path,
|
|
169
|
+
headers: api_headers,
|
|
170
|
+
params: api_params,
|
|
171
|
+
response_type: Models::Migration
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Import documents from a CSV file into your Appwrite database. This endpoint
|
|
176
|
+
# allows you to import documents from a CSV file uploaded to Appwrite Storage
|
|
177
|
+
# bucket.
|
|
178
|
+
#
|
|
179
|
+
# @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
|
|
180
|
+
# @param [String] file_id File ID.
|
|
181
|
+
# @param [String] database_id Database ID containing the target collection.
|
|
182
|
+
# @param [String] collection_id Collection ID to import documents into.
|
|
183
|
+
# @param [] internal_file Is the file stored in an internal bucket?
|
|
184
|
+
# @param [OnDuplicate] on_duplicate Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row.
|
|
185
|
+
#
|
|
186
|
+
# @return [Migration]
|
|
187
|
+
def create_csv_import(
|
|
188
|
+
bucket_id:,
|
|
189
|
+
file_id:,
|
|
190
|
+
database_id:,
|
|
191
|
+
collection_id:,
|
|
192
|
+
internal_file: nil,
|
|
193
|
+
on_duplicate: nil
|
|
194
|
+
)
|
|
195
|
+
if bucket_id.nil?
|
|
196
|
+
raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if file_id.nil?
|
|
200
|
+
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
if database_id.nil?
|
|
204
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if collection_id.nil?
|
|
208
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
api_path = '/migrations/csv/imports'
|
|
212
|
+
|
|
213
|
+
api_params = {
|
|
214
|
+
bucketId: bucket_id,
|
|
215
|
+
fileId: file_id,
|
|
216
|
+
databaseId: database_id,
|
|
217
|
+
collectionId: collection_id,
|
|
218
|
+
internalFile: internal_file,
|
|
219
|
+
onDuplicate: on_duplicate,
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
api_headers = {
|
|
223
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
224
|
+
"content-type": 'application/json',
|
|
225
|
+
"accept": 'application/json',
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@client.call(
|
|
229
|
+
method: 'POST',
|
|
230
|
+
path: api_path,
|
|
231
|
+
headers: api_headers,
|
|
232
|
+
params: api_params,
|
|
233
|
+
response_type: Models::Migration
|
|
234
|
+
)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Migrate data from a Firebase project to your Appwrite project. This
|
|
238
|
+
# endpoint allows you to migrate resources like authentication and other
|
|
239
|
+
# supported services from a Firebase project.
|
|
240
|
+
#
|
|
241
|
+
# @param [Array] resources List of resources to migrate
|
|
242
|
+
# @param [String] service_account JSON of the Firebase service account credentials
|
|
243
|
+
#
|
|
244
|
+
# @return [Migration]
|
|
245
|
+
def create_firebase_migration(
|
|
246
|
+
resources:,
|
|
247
|
+
service_account:
|
|
248
|
+
)
|
|
249
|
+
if resources.nil?
|
|
250
|
+
raise Appwrite::Exception.new('Missing required parameter: "resources"')
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if service_account.nil?
|
|
254
|
+
raise Appwrite::Exception.new('Missing required parameter: "serviceAccount"')
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
api_path = '/migrations/firebase'
|
|
258
|
+
|
|
259
|
+
api_params = {
|
|
260
|
+
resources: resources,
|
|
261
|
+
serviceAccount: service_account,
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
api_headers = {
|
|
265
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
266
|
+
"content-type": 'application/json',
|
|
267
|
+
"accept": 'application/json',
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@client.call(
|
|
271
|
+
method: 'POST',
|
|
272
|
+
path: api_path,
|
|
273
|
+
headers: api_headers,
|
|
274
|
+
params: api_params,
|
|
275
|
+
response_type: Models::Migration
|
|
276
|
+
)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Export documents to a JSON file from your Appwrite database. This endpoint
|
|
280
|
+
# allows you to export documents to a JSON file stored in a secure internal
|
|
281
|
+
# bucket. You'll receive an email with a download link when the export is
|
|
282
|
+
# complete.
|
|
283
|
+
#
|
|
284
|
+
#
|
|
285
|
+
# @param [String] database_id Database ID containing the source collection.
|
|
286
|
+
# @param [String] collection_id Collection ID to export documents from.
|
|
287
|
+
# @param [String] filename The name of the file to be created for the export, excluding the .json extension.
|
|
288
|
+
# @param [Array] columns List of attributes to export. If empty, all attributes will be exported. You can use the `*` wildcard to export all attributes from the collection.
|
|
289
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK to filter documents to export. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
290
|
+
# @param [] notify Set to true to receive an email when the export is complete. Default is true.
|
|
291
|
+
#
|
|
292
|
+
# @return [Migration]
|
|
293
|
+
def create_json_export(
|
|
294
|
+
database_id:,
|
|
295
|
+
collection_id:,
|
|
296
|
+
filename:,
|
|
297
|
+
columns: nil,
|
|
298
|
+
queries: nil,
|
|
299
|
+
notify: nil
|
|
300
|
+
)
|
|
301
|
+
if database_id.nil?
|
|
302
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
if collection_id.nil?
|
|
306
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
if filename.nil?
|
|
310
|
+
raise Appwrite::Exception.new('Missing required parameter: "filename"')
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
api_path = '/migrations/json/exports'
|
|
314
|
+
|
|
315
|
+
api_params = {
|
|
316
|
+
databaseId: database_id,
|
|
317
|
+
collectionId: collection_id,
|
|
318
|
+
filename: filename,
|
|
319
|
+
columns: columns,
|
|
320
|
+
queries: queries,
|
|
321
|
+
notify: notify,
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
api_headers = {
|
|
325
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
326
|
+
"content-type": 'application/json',
|
|
327
|
+
"accept": 'application/json',
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
@client.call(
|
|
331
|
+
method: 'POST',
|
|
332
|
+
path: api_path,
|
|
333
|
+
headers: api_headers,
|
|
334
|
+
params: api_params,
|
|
335
|
+
response_type: Models::Migration
|
|
336
|
+
)
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# Import documents from a JSON file into your Appwrite database. This
|
|
340
|
+
# endpoint allows you to import documents from a JSON file uploaded to
|
|
341
|
+
# Appwrite Storage bucket.
|
|
342
|
+
#
|
|
343
|
+
#
|
|
344
|
+
# @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
|
|
345
|
+
# @param [String] file_id File ID.
|
|
346
|
+
# @param [String] database_id Database ID containing the target collection.
|
|
347
|
+
# @param [String] collection_id Collection ID to import documents into.
|
|
348
|
+
# @param [] internal_file Is the file stored in an internal bucket?
|
|
349
|
+
# @param [OnDuplicate] on_duplicate Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row.
|
|
350
|
+
#
|
|
351
|
+
# @return [Migration]
|
|
352
|
+
def create_json_import(
|
|
353
|
+
bucket_id:,
|
|
354
|
+
file_id:,
|
|
355
|
+
database_id:,
|
|
356
|
+
collection_id:,
|
|
357
|
+
internal_file: nil,
|
|
358
|
+
on_duplicate: nil
|
|
359
|
+
)
|
|
360
|
+
if bucket_id.nil?
|
|
361
|
+
raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
if file_id.nil?
|
|
365
|
+
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
if database_id.nil?
|
|
369
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
if collection_id.nil?
|
|
373
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
api_path = '/migrations/json/imports'
|
|
377
|
+
|
|
378
|
+
api_params = {
|
|
379
|
+
bucketId: bucket_id,
|
|
380
|
+
fileId: file_id,
|
|
381
|
+
databaseId: database_id,
|
|
382
|
+
collectionId: collection_id,
|
|
383
|
+
internalFile: internal_file,
|
|
384
|
+
onDuplicate: on_duplicate,
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
api_headers = {
|
|
388
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
389
|
+
"content-type": 'application/json',
|
|
390
|
+
"accept": 'application/json',
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
@client.call(
|
|
394
|
+
method: 'POST',
|
|
395
|
+
path: api_path,
|
|
396
|
+
headers: api_headers,
|
|
397
|
+
params: api_params,
|
|
398
|
+
response_type: Models::Migration
|
|
399
|
+
)
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
# Migrate data from an NHost project to your Appwrite project. This endpoint
|
|
403
|
+
# allows you to migrate resources like authentication, databases, and other
|
|
404
|
+
# supported services from an NHost project.
|
|
405
|
+
#
|
|
406
|
+
# @param [Array] resources List of resources to migrate
|
|
407
|
+
# @param [String] subdomain Source's Subdomain
|
|
408
|
+
# @param [String] region Source's Region
|
|
409
|
+
# @param [String] admin_secret Source's Admin Secret
|
|
410
|
+
# @param [String] database Source's Database Name
|
|
411
|
+
# @param [String] username Source's Database Username
|
|
412
|
+
# @param [String] password Source's Database Password
|
|
413
|
+
# @param [Integer] port Source's Database Port
|
|
414
|
+
#
|
|
415
|
+
# @return [Migration]
|
|
416
|
+
def create_n_host_migration(
|
|
417
|
+
resources:,
|
|
418
|
+
subdomain:,
|
|
419
|
+
region:,
|
|
420
|
+
admin_secret:,
|
|
421
|
+
database:,
|
|
422
|
+
username:,
|
|
423
|
+
password:,
|
|
424
|
+
port: nil
|
|
425
|
+
)
|
|
426
|
+
if resources.nil?
|
|
427
|
+
raise Appwrite::Exception.new('Missing required parameter: "resources"')
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
if subdomain.nil?
|
|
431
|
+
raise Appwrite::Exception.new('Missing required parameter: "subdomain"')
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
if region.nil?
|
|
435
|
+
raise Appwrite::Exception.new('Missing required parameter: "region"')
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
if admin_secret.nil?
|
|
439
|
+
raise Appwrite::Exception.new('Missing required parameter: "adminSecret"')
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
if database.nil?
|
|
443
|
+
raise Appwrite::Exception.new('Missing required parameter: "database"')
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
if username.nil?
|
|
447
|
+
raise Appwrite::Exception.new('Missing required parameter: "username"')
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
if password.nil?
|
|
451
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
api_path = '/migrations/nhost'
|
|
455
|
+
|
|
456
|
+
api_params = {
|
|
457
|
+
resources: resources,
|
|
458
|
+
subdomain: subdomain,
|
|
459
|
+
region: region,
|
|
460
|
+
adminSecret: admin_secret,
|
|
461
|
+
database: database,
|
|
462
|
+
username: username,
|
|
463
|
+
password: password,
|
|
464
|
+
port: port,
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
api_headers = {
|
|
468
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
469
|
+
"content-type": 'application/json',
|
|
470
|
+
"accept": 'application/json',
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
@client.call(
|
|
474
|
+
method: 'POST',
|
|
475
|
+
path: api_path,
|
|
476
|
+
headers: api_headers,
|
|
477
|
+
params: api_params,
|
|
478
|
+
response_type: Models::Migration
|
|
479
|
+
)
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# Migrate data from a Supabase project to your Appwrite project. This
|
|
483
|
+
# endpoint allows you to migrate resources like authentication, databases,
|
|
484
|
+
# and other supported services from a Supabase project.
|
|
485
|
+
#
|
|
486
|
+
# @param [Array] resources List of resources to migrate
|
|
487
|
+
# @param [String] endpoint Source's Supabase Endpoint
|
|
488
|
+
# @param [String] api_key Source's API Key
|
|
489
|
+
# @param [String] database_host Source's Database Host
|
|
490
|
+
# @param [String] username Source's Database Username
|
|
491
|
+
# @param [String] password Source's Database Password
|
|
492
|
+
# @param [Integer] port Source's Database Port
|
|
493
|
+
#
|
|
494
|
+
# @return [Migration]
|
|
495
|
+
def create_supabase_migration(
|
|
496
|
+
resources:,
|
|
497
|
+
endpoint:,
|
|
498
|
+
api_key:,
|
|
499
|
+
database_host:,
|
|
500
|
+
username:,
|
|
501
|
+
password:,
|
|
502
|
+
port: nil
|
|
503
|
+
)
|
|
504
|
+
if resources.nil?
|
|
505
|
+
raise Appwrite::Exception.new('Missing required parameter: "resources"')
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
if endpoint.nil?
|
|
509
|
+
raise Appwrite::Exception.new('Missing required parameter: "endpoint"')
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
if api_key.nil?
|
|
513
|
+
raise Appwrite::Exception.new('Missing required parameter: "apiKey"')
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
if database_host.nil?
|
|
517
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseHost"')
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
if username.nil?
|
|
521
|
+
raise Appwrite::Exception.new('Missing required parameter: "username"')
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
if password.nil?
|
|
525
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
api_path = '/migrations/supabase'
|
|
529
|
+
|
|
530
|
+
api_params = {
|
|
531
|
+
resources: resources,
|
|
532
|
+
endpoint: endpoint,
|
|
533
|
+
apiKey: api_key,
|
|
534
|
+
databaseHost: database_host,
|
|
535
|
+
username: username,
|
|
536
|
+
password: password,
|
|
537
|
+
port: port,
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
api_headers = {
|
|
541
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
542
|
+
"content-type": 'application/json',
|
|
543
|
+
"accept": 'application/json',
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
@client.call(
|
|
547
|
+
method: 'POST',
|
|
548
|
+
path: api_path,
|
|
549
|
+
headers: api_headers,
|
|
550
|
+
params: api_params,
|
|
551
|
+
response_type: Models::Migration
|
|
552
|
+
)
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
# Get a migration by its unique ID. This endpoint returns detailed
|
|
556
|
+
# information about a specific migration including its current status,
|
|
557
|
+
# progress, and any errors that occurred during the migration process.
|
|
558
|
+
#
|
|
559
|
+
# @param [String] migration_id Migration unique ID.
|
|
560
|
+
#
|
|
561
|
+
# @return [Migration]
|
|
562
|
+
def get(
|
|
563
|
+
migration_id:
|
|
564
|
+
)
|
|
565
|
+
if migration_id.nil? || migration_id == ''
|
|
566
|
+
raise Appwrite::Exception.new('Missing required parameter: "migrationId"')
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
api_path = '/migrations/{migrationId}'
|
|
570
|
+
.gsub('{migrationId}', @client.encode_path(migration_id))
|
|
571
|
+
|
|
572
|
+
api_params = {}
|
|
573
|
+
|
|
574
|
+
api_headers = {
|
|
575
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
576
|
+
"accept": 'application/json',
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
@client.call(
|
|
580
|
+
method: 'GET',
|
|
581
|
+
path: api_path,
|
|
582
|
+
headers: api_headers,
|
|
583
|
+
params: api_params,
|
|
584
|
+
response_type: Models::Migration
|
|
585
|
+
)
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
# Retry a failed migration. This endpoint allows you to retry a migration
|
|
589
|
+
# that has previously failed.
|
|
590
|
+
#
|
|
591
|
+
# @param [String] migration_id Migration unique ID.
|
|
592
|
+
#
|
|
593
|
+
# @return [Migration]
|
|
594
|
+
def retry(
|
|
595
|
+
migration_id:
|
|
596
|
+
)
|
|
597
|
+
if migration_id.nil? || migration_id == ''
|
|
598
|
+
raise Appwrite::Exception.new('Missing required parameter: "migrationId"')
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
api_path = '/migrations/{migrationId}'
|
|
602
|
+
.gsub('{migrationId}', @client.encode_path(migration_id))
|
|
603
|
+
|
|
604
|
+
api_params = {}
|
|
605
|
+
|
|
606
|
+
api_headers = {
|
|
607
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
608
|
+
"content-type": 'application/json',
|
|
609
|
+
"accept": 'application/json',
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
@client.call(
|
|
613
|
+
method: 'PATCH',
|
|
614
|
+
path: api_path,
|
|
615
|
+
headers: api_headers,
|
|
616
|
+
params: api_params,
|
|
617
|
+
response_type: Models::Migration
|
|
618
|
+
)
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
# Delete a migration by its unique ID. This endpoint allows you to remove a
|
|
622
|
+
# migration from your project's migration history.
|
|
623
|
+
#
|
|
624
|
+
# @param [String] migration_id Migration ID.
|
|
625
|
+
#
|
|
626
|
+
# @return []
|
|
627
|
+
def delete(
|
|
628
|
+
migration_id:
|
|
629
|
+
)
|
|
630
|
+
if migration_id.nil? || migration_id == ''
|
|
631
|
+
raise Appwrite::Exception.new('Missing required parameter: "migrationId"')
|
|
632
|
+
end
|
|
633
|
+
|
|
634
|
+
api_path = '/migrations/{migrationId}'
|
|
635
|
+
.gsub('{migrationId}', @client.encode_path(migration_id))
|
|
636
|
+
|
|
637
|
+
api_params = {}
|
|
638
|
+
|
|
639
|
+
api_headers = {
|
|
640
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
641
|
+
"content-type": 'application/json',
|
|
642
|
+
"accept": 'application/json',
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
@client.call(
|
|
646
|
+
method: 'DELETE',
|
|
647
|
+
path: api_path,
|
|
648
|
+
headers: api_headers,
|
|
649
|
+
params: api_params,
|
|
650
|
+
)
|
|
651
|
+
end
|
|
652
|
+
end
|
|
653
|
+
end
|