@appwrite.io/console 0.0.1 → 0.0.2-preview-0.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.
@@ -0,0 +1,494 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Databases extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * List Databases
8
+ *
9
+ * Get a list of all databases from the current Appwrite project. You can use
10
+ * the search parameter to filter your results.
11
+ *
12
+ * @param {string[]} queries
13
+ * @param {string} search
14
+ * @throws {AppwriteException}
15
+ * @returns {Promise}
16
+ */
17
+ list(queries?: string[], search?: string): Promise<Models.DatabaseList>;
18
+ /**
19
+ * Create Database
20
+ *
21
+ * Create a new Database.
22
+ *
23
+ *
24
+ * @param {string} databaseId
25
+ * @param {string} name
26
+ * @throws {AppwriteException}
27
+ * @returns {Promise}
28
+ */
29
+ create(databaseId: string, name: string): Promise<Models.Database>;
30
+ /**
31
+ * Get usage stats for the database
32
+ *
33
+ *
34
+ * @param {string} range
35
+ * @throws {AppwriteException}
36
+ * @returns {Promise}
37
+ */
38
+ getUsage(range?: string): Promise<Models.UsageDatabases>;
39
+ /**
40
+ * Get Database
41
+ *
42
+ * Get a database by its unique ID. This endpoint response returns a JSON
43
+ * object with the database metadata.
44
+ *
45
+ * @param {string} databaseId
46
+ * @throws {AppwriteException}
47
+ * @returns {Promise}
48
+ */
49
+ get(databaseId: string): Promise<Models.Database>;
50
+ /**
51
+ * Update Database
52
+ *
53
+ * Update a database by its unique ID.
54
+ *
55
+ * @param {string} databaseId
56
+ * @param {string} name
57
+ * @throws {AppwriteException}
58
+ * @returns {Promise}
59
+ */
60
+ update(databaseId: string, name: string): Promise<Models.Database>;
61
+ /**
62
+ * Delete Database
63
+ *
64
+ * Delete a database by its unique ID. Only API keys with with databases.write
65
+ * scope can delete a database.
66
+ *
67
+ * @param {string} databaseId
68
+ * @throws {AppwriteException}
69
+ * @returns {Promise}
70
+ */
71
+ delete(databaseId: string): Promise<{}>;
72
+ /**
73
+ * List Collections
74
+ *
75
+ * Get a list of all collections that belong to the provided databaseId. You
76
+ * can use the search parameter to filter your results.
77
+ *
78
+ * @param {string} databaseId
79
+ * @param {string[]} queries
80
+ * @param {string} search
81
+ * @throws {AppwriteException}
82
+ * @returns {Promise}
83
+ */
84
+ listCollections(databaseId: string, queries?: string[], search?: string): Promise<Models.CollectionList>;
85
+ /**
86
+ * Create Collection
87
+ *
88
+ * Create a new Collection. Before using this route, you should create a new
89
+ * database resource using either a [server
90
+ * integration](/docs/server/databases#databasesCreateCollection) API or
91
+ * directly from your database console.
92
+ *
93
+ * @param {string} databaseId
94
+ * @param {string} collectionId
95
+ * @param {string} name
96
+ * @param {string[]} permissions
97
+ * @param {boolean} documentSecurity
98
+ * @throws {AppwriteException}
99
+ * @returns {Promise}
100
+ */
101
+ createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean): Promise<Models.Collection>;
102
+ /**
103
+ * Get Collection
104
+ *
105
+ * Get a collection by its unique ID. This endpoint response returns a JSON
106
+ * object with the collection metadata.
107
+ *
108
+ * @param {string} databaseId
109
+ * @param {string} collectionId
110
+ * @throws {AppwriteException}
111
+ * @returns {Promise}
112
+ */
113
+ getCollection(databaseId: string, collectionId: string): Promise<Models.Collection>;
114
+ /**
115
+ * Update Collection
116
+ *
117
+ * Update a collection by its unique ID.
118
+ *
119
+ * @param {string} databaseId
120
+ * @param {string} collectionId
121
+ * @param {string} name
122
+ * @param {string[]} permissions
123
+ * @param {boolean} documentSecurity
124
+ * @param {boolean} enabled
125
+ * @throws {AppwriteException}
126
+ * @returns {Promise}
127
+ */
128
+ updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection>;
129
+ /**
130
+ * Delete Collection
131
+ *
132
+ * Delete a collection by its unique ID. Only users with write permissions
133
+ * have access to delete this resource.
134
+ *
135
+ * @param {string} databaseId
136
+ * @param {string} collectionId
137
+ * @throws {AppwriteException}
138
+ * @returns {Promise}
139
+ */
140
+ deleteCollection(databaseId: string, collectionId: string): Promise<{}>;
141
+ /**
142
+ * List Attributes
143
+ *
144
+ *
145
+ * @param {string} databaseId
146
+ * @param {string} collectionId
147
+ * @throws {AppwriteException}
148
+ * @returns {Promise}
149
+ */
150
+ listAttributes(databaseId: string, collectionId: string): Promise<Models.AttributeList>;
151
+ /**
152
+ * Create Boolean Attribute
153
+ *
154
+ * Create a boolean attribute.
155
+ *
156
+ *
157
+ * @param {string} databaseId
158
+ * @param {string} collectionId
159
+ * @param {string} key
160
+ * @param {boolean} required
161
+ * @param {boolean} xdefault
162
+ * @param {boolean} array
163
+ * @throws {AppwriteException}
164
+ * @returns {Promise}
165
+ */
166
+ createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>;
167
+ /**
168
+ * Create DateTime Attribute
169
+ *
170
+ *
171
+ * @param {string} databaseId
172
+ * @param {string} collectionId
173
+ * @param {string} key
174
+ * @param {boolean} required
175
+ * @param {string} xdefault
176
+ * @param {boolean} array
177
+ * @throws {AppwriteException}
178
+ * @returns {Promise}
179
+ */
180
+ createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>;
181
+ /**
182
+ * Create Email Attribute
183
+ *
184
+ * Create an email attribute.
185
+ *
186
+ *
187
+ * @param {string} databaseId
188
+ * @param {string} collectionId
189
+ * @param {string} key
190
+ * @param {boolean} required
191
+ * @param {string} xdefault
192
+ * @param {boolean} array
193
+ * @throws {AppwriteException}
194
+ * @returns {Promise}
195
+ */
196
+ createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>;
197
+ /**
198
+ * Create Enum Attribute
199
+ *
200
+ *
201
+ * @param {string} databaseId
202
+ * @param {string} collectionId
203
+ * @param {string} key
204
+ * @param {string[]} elements
205
+ * @param {boolean} required
206
+ * @param {string} xdefault
207
+ * @param {boolean} array
208
+ * @throws {AppwriteException}
209
+ * @returns {Promise}
210
+ */
211
+ createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>;
212
+ /**
213
+ * Create Float Attribute
214
+ *
215
+ * Create a float attribute. Optionally, minimum and maximum values can be
216
+ * provided.
217
+ *
218
+ *
219
+ * @param {string} databaseId
220
+ * @param {string} collectionId
221
+ * @param {string} key
222
+ * @param {boolean} required
223
+ * @param {number} min
224
+ * @param {number} max
225
+ * @param {number} xdefault
226
+ * @param {boolean} array
227
+ * @throws {AppwriteException}
228
+ * @returns {Promise}
229
+ */
230
+ createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>;
231
+ /**
232
+ * Create Integer Attribute
233
+ *
234
+ * Create an integer attribute. Optionally, minimum and maximum values can be
235
+ * provided.
236
+ *
237
+ *
238
+ * @param {string} databaseId
239
+ * @param {string} collectionId
240
+ * @param {string} key
241
+ * @param {boolean} required
242
+ * @param {number} min
243
+ * @param {number} max
244
+ * @param {number} xdefault
245
+ * @param {boolean} array
246
+ * @throws {AppwriteException}
247
+ * @returns {Promise}
248
+ */
249
+ createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger>;
250
+ /**
251
+ * Create IP Address Attribute
252
+ *
253
+ * Create IP address attribute.
254
+ *
255
+ *
256
+ * @param {string} databaseId
257
+ * @param {string} collectionId
258
+ * @param {string} key
259
+ * @param {boolean} required
260
+ * @param {string} xdefault
261
+ * @param {boolean} array
262
+ * @throws {AppwriteException}
263
+ * @returns {Promise}
264
+ */
265
+ createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>;
266
+ /**
267
+ * Create String Attribute
268
+ *
269
+ * Create a string attribute.
270
+ *
271
+ *
272
+ * @param {string} databaseId
273
+ * @param {string} collectionId
274
+ * @param {string} key
275
+ * @param {number} size
276
+ * @param {boolean} required
277
+ * @param {string} xdefault
278
+ * @param {boolean} array
279
+ * @throws {AppwriteException}
280
+ * @returns {Promise}
281
+ */
282
+ createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString>;
283
+ /**
284
+ * Create URL Attribute
285
+ *
286
+ * Create a URL attribute.
287
+ *
288
+ *
289
+ * @param {string} databaseId
290
+ * @param {string} collectionId
291
+ * @param {string} key
292
+ * @param {boolean} required
293
+ * @param {string} xdefault
294
+ * @param {boolean} array
295
+ * @throws {AppwriteException}
296
+ * @returns {Promise}
297
+ */
298
+ createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>;
299
+ /**
300
+ * Get Attribute
301
+ *
302
+ *
303
+ * @param {string} databaseId
304
+ * @param {string} collectionId
305
+ * @param {string} key
306
+ * @throws {AppwriteException}
307
+ * @returns {Promise}
308
+ */
309
+ getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>;
310
+ /**
311
+ * Delete Attribute
312
+ *
313
+ *
314
+ * @param {string} databaseId
315
+ * @param {string} collectionId
316
+ * @param {string} key
317
+ * @throws {AppwriteException}
318
+ * @returns {Promise}
319
+ */
320
+ deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>;
321
+ /**
322
+ * List Documents
323
+ *
324
+ * Get a list of all the user's documents in a given collection. You can use
325
+ * the query params to filter your results.
326
+ *
327
+ * @param {string} databaseId
328
+ * @param {string} collectionId
329
+ * @param {string[]} queries
330
+ * @throws {AppwriteException}
331
+ * @returns {Promise}
332
+ */
333
+ listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>>;
334
+ /**
335
+ * Create Document
336
+ *
337
+ * Create a new Document. Before using this route, you should create a new
338
+ * collection resource using either a [server
339
+ * integration](/docs/server/databases#databasesCreateCollection) API or
340
+ * directly from your database console.
341
+ *
342
+ * @param {string} databaseId
343
+ * @param {string} collectionId
344
+ * @param {string} documentId
345
+ * @param {Omit<Document, keyof Models.Document>} data
346
+ * @param {string[]} permissions
347
+ * @throws {AppwriteException}
348
+ * @returns {Promise}
349
+ */
350
+ createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>;
351
+ /**
352
+ * Get Document
353
+ *
354
+ * Get a document by its unique ID. This endpoint response returns a JSON
355
+ * object with the document data.
356
+ *
357
+ * @param {string} databaseId
358
+ * @param {string} collectionId
359
+ * @param {string} documentId
360
+ * @throws {AppwriteException}
361
+ * @returns {Promise}
362
+ */
363
+ getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string): Promise<Document>;
364
+ /**
365
+ * Update Document
366
+ *
367
+ * Update a document by its unique ID. Using the patch method you can pass
368
+ * only specific fields that will get updated.
369
+ *
370
+ * @param {string} databaseId
371
+ * @param {string} collectionId
372
+ * @param {string} documentId
373
+ * @param {Partial<Omit<Document, keyof Models.Document>>} data
374
+ * @param {string[]} permissions
375
+ * @throws {AppwriteException}
376
+ * @returns {Promise}
377
+ */
378
+ updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document>;
379
+ /**
380
+ * Delete Document
381
+ *
382
+ * Delete a document by its unique ID.
383
+ *
384
+ * @param {string} databaseId
385
+ * @param {string} collectionId
386
+ * @param {string} documentId
387
+ * @throws {AppwriteException}
388
+ * @returns {Promise}
389
+ */
390
+ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}>;
391
+ /**
392
+ * List Document Logs
393
+ *
394
+ * Get the document activity logs list by its unique ID.
395
+ *
396
+ * @param {string} databaseId
397
+ * @param {string} collectionId
398
+ * @param {string} documentId
399
+ * @param {string[]} queries
400
+ * @throws {AppwriteException}
401
+ * @returns {Promise}
402
+ */
403
+ listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Models.LogList>;
404
+ /**
405
+ * List Indexes
406
+ *
407
+ *
408
+ * @param {string} databaseId
409
+ * @param {string} collectionId
410
+ * @throws {AppwriteException}
411
+ * @returns {Promise}
412
+ */
413
+ listIndexes(databaseId: string, collectionId: string): Promise<Models.IndexList>;
414
+ /**
415
+ * Create Index
416
+ *
417
+ *
418
+ * @param {string} databaseId
419
+ * @param {string} collectionId
420
+ * @param {string} key
421
+ * @param {string} type
422
+ * @param {string[]} attributes
423
+ * @param {string[]} orders
424
+ * @throws {AppwriteException}
425
+ * @returns {Promise}
426
+ */
427
+ createIndex(databaseId: string, collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise<Models.Index>;
428
+ /**
429
+ * Get Index
430
+ *
431
+ *
432
+ * @param {string} databaseId
433
+ * @param {string} collectionId
434
+ * @param {string} key
435
+ * @throws {AppwriteException}
436
+ * @returns {Promise}
437
+ */
438
+ getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>;
439
+ /**
440
+ * Delete Index
441
+ *
442
+ *
443
+ * @param {string} databaseId
444
+ * @param {string} collectionId
445
+ * @param {string} key
446
+ * @throws {AppwriteException}
447
+ * @returns {Promise}
448
+ */
449
+ deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}>;
450
+ /**
451
+ * List Collection Logs
452
+ *
453
+ * Get the collection activity logs list by its unique ID.
454
+ *
455
+ * @param {string} databaseId
456
+ * @param {string} collectionId
457
+ * @param {string[]} queries
458
+ * @throws {AppwriteException}
459
+ * @returns {Promise}
460
+ */
461
+ listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.LogList>;
462
+ /**
463
+ * Get usage stats for a collection
464
+ *
465
+ *
466
+ * @param {string} databaseId
467
+ * @param {string} collectionId
468
+ * @param {string} range
469
+ * @throws {AppwriteException}
470
+ * @returns {Promise}
471
+ */
472
+ getCollectionUsage(databaseId: string, collectionId: string, range?: string): Promise<Models.UsageCollection>;
473
+ /**
474
+ * List Database Logs
475
+ *
476
+ * Get the database activity logs list by its unique ID.
477
+ *
478
+ * @param {string} databaseId
479
+ * @param {string[]} queries
480
+ * @throws {AppwriteException}
481
+ * @returns {Promise}
482
+ */
483
+ listLogs(databaseId: string, queries?: string[]): Promise<Models.LogList>;
484
+ /**
485
+ * Get usage stats for the database
486
+ *
487
+ *
488
+ * @param {string} databaseId
489
+ * @param {string} range
490
+ * @throws {AppwriteException}
491
+ * @returns {Promise}
492
+ */
493
+ getDatabaseUsage(databaseId: string, range?: string): Promise<Models.UsageDatabase>;
494
+ }