@appwrite.io/console 5.0.0 → 7.0.0-rc.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.
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/dist/cjs/sdk.js +13663 -10879
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +13661 -10880
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +13268 -10484
- package/docs/examples/databases/create-index.md +2 -2
- package/docs/examples/documentsdb/create-collection.md +22 -0
- package/docs/examples/documentsdb/create-document.md +25 -0
- package/docs/examples/documentsdb/create-documents.md +17 -0
- package/docs/examples/documentsdb/create-index.md +21 -0
- package/docs/examples/documentsdb/create-transaction.md +15 -0
- package/docs/examples/documentsdb/create.md +17 -0
- package/docs/examples/documentsdb/decrement-document-attribute.md +21 -0
- package/docs/examples/documentsdb/delete-collection.md +16 -0
- package/docs/examples/documentsdb/delete-document.md +18 -0
- package/docs/examples/documentsdb/delete-documents.md +18 -0
- package/docs/examples/documentsdb/delete-index.md +17 -0
- package/docs/examples/documentsdb/delete-transaction.md +15 -0
- package/docs/examples/documentsdb/delete.md +15 -0
- package/docs/examples/documentsdb/get-collection-usage.md +17 -0
- package/docs/examples/documentsdb/get-collection.md +16 -0
- package/docs/examples/documentsdb/get-document.md +19 -0
- package/docs/examples/documentsdb/get-index.md +17 -0
- package/docs/examples/documentsdb/get-transaction.md +15 -0
- package/docs/examples/documentsdb/get-usage.md +16 -0
- package/docs/examples/documentsdb/get.md +15 -0
- package/docs/examples/documentsdb/increment-document-attribute.md +21 -0
- package/docs/examples/documentsdb/list-collection-logs.md +17 -0
- package/docs/examples/documentsdb/list-collections.md +18 -0
- package/docs/examples/documentsdb/list-document-logs.md +18 -0
- package/docs/examples/documentsdb/list-documents.md +20 -0
- package/docs/examples/documentsdb/list-indexes.md +18 -0
- package/docs/examples/documentsdb/list-transactions.md +15 -0
- package/docs/examples/documentsdb/list-usage.md +15 -0
- package/docs/examples/documentsdb/list.md +17 -0
- package/docs/examples/documentsdb/update-collection.md +20 -0
- package/docs/examples/documentsdb/update-document.md +20 -0
- package/docs/examples/documentsdb/update-documents.md +19 -0
- package/docs/examples/documentsdb/update-transaction.md +17 -0
- package/docs/examples/documentsdb/update.md +17 -0
- package/docs/examples/documentsdb/upsert-document.md +20 -0
- package/docs/examples/documentsdb/upsert-documents.md +18 -0
- package/docs/examples/domains/update-purchase.md +16 -0
- package/docs/examples/domains/update-transfer-in.md +16 -0
- package/docs/examples/tablesdb/create-index.md +2 -2
- package/docs/examples/vectorsdb/create-collection.md +21 -0
- package/docs/examples/vectorsdb/create-document.md +29 -0
- package/docs/examples/vectorsdb/create-documents.md +17 -0
- package/docs/examples/vectorsdb/create-index.md +21 -0
- package/docs/examples/vectorsdb/create-operations.md +26 -0
- package/docs/examples/vectorsdb/create-text-embeddings.md +16 -0
- package/docs/examples/vectorsdb/create-transaction.md +15 -0
- package/docs/examples/vectorsdb/create.md +17 -0
- package/docs/examples/vectorsdb/delete-collection.md +16 -0
- package/docs/examples/vectorsdb/delete-document.md +18 -0
- package/docs/examples/vectorsdb/delete-documents.md +18 -0
- package/docs/examples/vectorsdb/delete-index.md +17 -0
- package/docs/examples/vectorsdb/delete-transaction.md +15 -0
- package/docs/examples/vectorsdb/delete.md +15 -0
- package/docs/examples/vectorsdb/get-collection-usage.md +17 -0
- package/docs/examples/vectorsdb/get-collection.md +16 -0
- package/docs/examples/vectorsdb/get-document.md +19 -0
- package/docs/examples/vectorsdb/get-index.md +17 -0
- package/docs/examples/vectorsdb/get-transaction.md +15 -0
- package/docs/examples/vectorsdb/get-usage.md +16 -0
- package/docs/examples/vectorsdb/get.md +15 -0
- package/docs/examples/vectorsdb/list-collection-logs.md +17 -0
- package/docs/examples/vectorsdb/list-collections.md +18 -0
- package/docs/examples/vectorsdb/list-documents.md +20 -0
- package/docs/examples/vectorsdb/list-indexes.md +18 -0
- package/docs/examples/vectorsdb/list-transactions.md +15 -0
- package/docs/examples/vectorsdb/list-usage.md +15 -0
- package/docs/examples/vectorsdb/list.md +17 -0
- package/docs/examples/vectorsdb/update-collection.md +21 -0
- package/docs/examples/vectorsdb/update-document.md +20 -0
- package/docs/examples/vectorsdb/update-documents.md +19 -0
- package/docs/examples/vectorsdb/update-transaction.md +17 -0
- package/docs/examples/vectorsdb/update.md +17 -0
- package/docs/examples/vectorsdb/upsert-document.md +20 -0
- package/docs/examples/vectorsdb/upsert-documents.md +18 -0
- package/docs/examples/webhooks/create.md +22 -0
- package/docs/examples/webhooks/delete.md +15 -0
- package/docs/examples/webhooks/get.md +15 -0
- package/docs/examples/webhooks/list.md +16 -0
- package/docs/examples/webhooks/update-signature.md +15 -0
- package/docs/examples/webhooks/update.md +22 -0
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/appwrite-migration-resource.ts +2 -0
- package/src/enums/backup-services.ts +3 -0
- package/src/enums/build-runtime.ts +89 -0
- package/src/enums/database-type.ts +2 -0
- package/src/enums/databases-index-type.ts +6 -0
- package/src/enums/documents-db-index-type.ts +6 -0
- package/src/enums/domain-purchase-status.ts +6 -0
- package/src/enums/domain-transfer-status-enum.ts +10 -0
- package/src/enums/model.ts +3 -0
- package/src/enums/runtime.ts +89 -0
- package/src/enums/runtimes.ts +89 -0
- package/src/enums/scopes.ts +2 -0
- package/src/enums/{index-type.ts → tables-db-index-type.ts} +1 -1
- package/src/enums/vectors-db-index-type.ts +8 -0
- package/src/index.ts +11 -4
- package/src/models.ts +519 -19
- package/src/services/databases.ts +10 -10
- package/src/services/documents-db.ts +2608 -0
- package/src/services/domains.ts +30 -30
- package/src/services/projects.ts +0 -473
- package/src/services/tables-db.ts +10 -10
- package/src/services/vectors-db.ts +2406 -0
- package/src/services/webhooks.ts +451 -0
- package/types/enums/appwrite-migration-resource.d.ts +2 -0
- package/types/enums/backup-services.d.ts +3 -0
- package/types/enums/build-runtime.d.ts +90 -1
- package/types/enums/database-type.d.ts +3 -1
- package/types/enums/databases-index-type.d.ts +6 -0
- package/types/enums/documents-db-index-type.d.ts +6 -0
- package/types/enums/domain-purchase-status.d.ts +6 -0
- package/types/enums/domain-transfer-status-enum.d.ts +10 -0
- package/types/enums/model.d.ts +3 -0
- package/types/enums/runtime.d.ts +90 -1
- package/types/enums/runtimes.d.ts +90 -1
- package/types/enums/scopes.d.ts +2 -0
- package/types/enums/{index-type.d.ts → tables-db-index-type.d.ts} +1 -1
- package/types/enums/vectors-db-index-type.d.ts +8 -0
- package/types/index.d.ts +11 -4
- package/types/models.d.ts +509 -19
- package/types/services/databases.d.ts +5 -5
- package/types/services/documents-db.d.ts +977 -0
- package/types/services/domains.d.ts +22 -22
- package/types/services/projects.d.ts +0 -171
- package/types/services/tables-db.d.ts +5 -5
- package/types/services/vectors-db.d.ts +854 -0
- package/types/services/webhooks.d.ts +165 -0
- package/.github/workflows/autoclose.yml +0 -11
|
@@ -0,0 +1,2406 @@
|
|
|
1
|
+
import { Service } from '../service';
|
|
2
|
+
import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
|
|
3
|
+
import type { Models } from '../models';
|
|
4
|
+
|
|
5
|
+
import { Model } from '../enums/model';
|
|
6
|
+
import { UsageRange } from '../enums/usage-range';
|
|
7
|
+
import { VectorsDBIndexType } from '../enums/vectors-db-index-type';
|
|
8
|
+
import { OrderBy } from '../enums/order-by';
|
|
9
|
+
|
|
10
|
+
export class VectorsDB {
|
|
11
|
+
client: Client;
|
|
12
|
+
|
|
13
|
+
constructor(client: Client) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} params.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. You may filter on the following columns: name
|
|
20
|
+
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
|
|
21
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
22
|
+
* @throws {AppwriteException}
|
|
23
|
+
* @returns {Promise<Models.DatabaseList>}
|
|
24
|
+
*/
|
|
25
|
+
list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {string[]} 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. You may filter on the following columns: name
|
|
29
|
+
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
|
|
30
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
31
|
+
* @throws {AppwriteException}
|
|
32
|
+
* @returns {Promise<Models.DatabaseList>}
|
|
33
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
34
|
+
*/
|
|
35
|
+
list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>;
|
|
36
|
+
list(
|
|
37
|
+
paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[],
|
|
38
|
+
...rest: [(string)?, (boolean)?]
|
|
39
|
+
): Promise<Models.DatabaseList> {
|
|
40
|
+
let params: { queries?: string[], search?: string, total?: boolean };
|
|
41
|
+
|
|
42
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
43
|
+
params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean };
|
|
44
|
+
} else {
|
|
45
|
+
params = {
|
|
46
|
+
queries: paramsOrFirst as string[],
|
|
47
|
+
search: rest[0] as string,
|
|
48
|
+
total: rest[1] as boolean
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const queries = params.queries;
|
|
53
|
+
const search = params.search;
|
|
54
|
+
const total = params.total;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const apiPath = '/vectorsdb';
|
|
58
|
+
const payload: Payload = {};
|
|
59
|
+
if (typeof queries !== 'undefined') {
|
|
60
|
+
payload['queries'] = queries;
|
|
61
|
+
}
|
|
62
|
+
if (typeof search !== 'undefined') {
|
|
63
|
+
payload['search'] = search;
|
|
64
|
+
}
|
|
65
|
+
if (typeof total !== 'undefined') {
|
|
66
|
+
payload['total'] = total;
|
|
67
|
+
}
|
|
68
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
69
|
+
|
|
70
|
+
const apiHeaders: { [header: string]: string } = {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return this.client.call(
|
|
74
|
+
'get',
|
|
75
|
+
uri,
|
|
76
|
+
apiHeaders,
|
|
77
|
+
payload
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param {string} params.databaseId - Unique 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.
|
|
84
|
+
* @param {string} params.name - Database name. Max length: 128 chars.
|
|
85
|
+
* @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
86
|
+
* @throws {AppwriteException}
|
|
87
|
+
* @returns {Promise<Models.Database>}
|
|
88
|
+
*/
|
|
89
|
+
create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @param {string} databaseId - Unique 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.
|
|
93
|
+
* @param {string} name - Database name. Max length: 128 chars.
|
|
94
|
+
* @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
95
|
+
* @throws {AppwriteException}
|
|
96
|
+
* @returns {Promise<Models.Database>}
|
|
97
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
98
|
+
*/
|
|
99
|
+
create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>;
|
|
100
|
+
create(
|
|
101
|
+
paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string,
|
|
102
|
+
...rest: [(string)?, (boolean)?]
|
|
103
|
+
): Promise<Models.Database> {
|
|
104
|
+
let params: { databaseId: string, name: string, enabled?: boolean };
|
|
105
|
+
|
|
106
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
107
|
+
params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean };
|
|
108
|
+
} else {
|
|
109
|
+
params = {
|
|
110
|
+
databaseId: paramsOrFirst as string,
|
|
111
|
+
name: rest[0] as string,
|
|
112
|
+
enabled: rest[1] as boolean
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const databaseId = params.databaseId;
|
|
117
|
+
const name = params.name;
|
|
118
|
+
const enabled = params.enabled;
|
|
119
|
+
|
|
120
|
+
if (typeof databaseId === 'undefined') {
|
|
121
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
122
|
+
}
|
|
123
|
+
if (typeof name === 'undefined') {
|
|
124
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const apiPath = '/vectorsdb';
|
|
128
|
+
const payload: Payload = {};
|
|
129
|
+
if (typeof databaseId !== 'undefined') {
|
|
130
|
+
payload['databaseId'] = databaseId;
|
|
131
|
+
}
|
|
132
|
+
if (typeof name !== 'undefined') {
|
|
133
|
+
payload['name'] = name;
|
|
134
|
+
}
|
|
135
|
+
if (typeof enabled !== 'undefined') {
|
|
136
|
+
payload['enabled'] = enabled;
|
|
137
|
+
}
|
|
138
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
139
|
+
|
|
140
|
+
const apiHeaders: { [header: string]: string } = {
|
|
141
|
+
'content-type': 'application/json',
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return this.client.call(
|
|
145
|
+
'post',
|
|
146
|
+
uri,
|
|
147
|
+
apiHeaders,
|
|
148
|
+
payload
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @param {string[]} params.texts - Array of text to generate embeddings.
|
|
155
|
+
* @param {Model} params.model - The embedding model to use for generating vector embeddings.
|
|
156
|
+
* @throws {AppwriteException}
|
|
157
|
+
* @returns {Promise<Models.EmbeddingList>}
|
|
158
|
+
*/
|
|
159
|
+
createTextEmbeddings(params: { texts: string[], model?: Model }): Promise<Models.EmbeddingList>;
|
|
160
|
+
/**
|
|
161
|
+
*
|
|
162
|
+
* @param {string[]} texts - Array of text to generate embeddings.
|
|
163
|
+
* @param {Model} model - The embedding model to use for generating vector embeddings.
|
|
164
|
+
* @throws {AppwriteException}
|
|
165
|
+
* @returns {Promise<Models.EmbeddingList>}
|
|
166
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
167
|
+
*/
|
|
168
|
+
createTextEmbeddings(texts: string[], model?: Model): Promise<Models.EmbeddingList>;
|
|
169
|
+
createTextEmbeddings(
|
|
170
|
+
paramsOrFirst: { texts: string[], model?: Model } | string[],
|
|
171
|
+
...rest: [(Model)?]
|
|
172
|
+
): Promise<Models.EmbeddingList> {
|
|
173
|
+
let params: { texts: string[], model?: Model };
|
|
174
|
+
|
|
175
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
176
|
+
params = (paramsOrFirst || {}) as { texts: string[], model?: Model };
|
|
177
|
+
} else {
|
|
178
|
+
params = {
|
|
179
|
+
texts: paramsOrFirst as string[],
|
|
180
|
+
model: rest[0] as Model
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const texts = params.texts;
|
|
185
|
+
const model = params.model;
|
|
186
|
+
|
|
187
|
+
if (typeof texts === 'undefined') {
|
|
188
|
+
throw new AppwriteException('Missing required parameter: "texts"');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const apiPath = '/vectorsdb/embeddings/text';
|
|
192
|
+
const payload: Payload = {};
|
|
193
|
+
if (typeof texts !== 'undefined') {
|
|
194
|
+
payload['texts'] = texts;
|
|
195
|
+
}
|
|
196
|
+
if (typeof model !== 'undefined') {
|
|
197
|
+
payload['model'] = model;
|
|
198
|
+
}
|
|
199
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
200
|
+
|
|
201
|
+
const apiHeaders: { [header: string]: string } = {
|
|
202
|
+
'content-type': 'application/json',
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return this.client.call(
|
|
206
|
+
'post',
|
|
207
|
+
uri,
|
|
208
|
+
apiHeaders,
|
|
209
|
+
payload
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
*
|
|
215
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
|
|
216
|
+
* @throws {AppwriteException}
|
|
217
|
+
* @returns {Promise<Models.TransactionList>}
|
|
218
|
+
*/
|
|
219
|
+
listTransactions(params?: { queries?: string[] }): Promise<Models.TransactionList>;
|
|
220
|
+
/**
|
|
221
|
+
*
|
|
222
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
|
|
223
|
+
* @throws {AppwriteException}
|
|
224
|
+
* @returns {Promise<Models.TransactionList>}
|
|
225
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
226
|
+
*/
|
|
227
|
+
listTransactions(queries?: string[]): Promise<Models.TransactionList>;
|
|
228
|
+
listTransactions(
|
|
229
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
230
|
+
): Promise<Models.TransactionList> {
|
|
231
|
+
let params: { queries?: string[] };
|
|
232
|
+
|
|
233
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
234
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
235
|
+
} else {
|
|
236
|
+
params = {
|
|
237
|
+
queries: paramsOrFirst as string[]
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const queries = params.queries;
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
const apiPath = '/vectorsdb/transactions';
|
|
245
|
+
const payload: Payload = {};
|
|
246
|
+
if (typeof queries !== 'undefined') {
|
|
247
|
+
payload['queries'] = queries;
|
|
248
|
+
}
|
|
249
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
250
|
+
|
|
251
|
+
const apiHeaders: { [header: string]: string } = {
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return this.client.call(
|
|
255
|
+
'get',
|
|
256
|
+
uri,
|
|
257
|
+
apiHeaders,
|
|
258
|
+
payload
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
*
|
|
264
|
+
* @param {number} params.ttl - Seconds before the transaction expires.
|
|
265
|
+
* @throws {AppwriteException}
|
|
266
|
+
* @returns {Promise<Models.Transaction>}
|
|
267
|
+
*/
|
|
268
|
+
createTransaction(params?: { ttl?: number }): Promise<Models.Transaction>;
|
|
269
|
+
/**
|
|
270
|
+
*
|
|
271
|
+
* @param {number} ttl - Seconds before the transaction expires.
|
|
272
|
+
* @throws {AppwriteException}
|
|
273
|
+
* @returns {Promise<Models.Transaction>}
|
|
274
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
275
|
+
*/
|
|
276
|
+
createTransaction(ttl?: number): Promise<Models.Transaction>;
|
|
277
|
+
createTransaction(
|
|
278
|
+
paramsOrFirst?: { ttl?: number } | number
|
|
279
|
+
): Promise<Models.Transaction> {
|
|
280
|
+
let params: { ttl?: number };
|
|
281
|
+
|
|
282
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
283
|
+
params = (paramsOrFirst || {}) as { ttl?: number };
|
|
284
|
+
} else {
|
|
285
|
+
params = {
|
|
286
|
+
ttl: paramsOrFirst as number
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const ttl = params.ttl;
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
const apiPath = '/vectorsdb/transactions';
|
|
294
|
+
const payload: Payload = {};
|
|
295
|
+
if (typeof ttl !== 'undefined') {
|
|
296
|
+
payload['ttl'] = ttl;
|
|
297
|
+
}
|
|
298
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
299
|
+
|
|
300
|
+
const apiHeaders: { [header: string]: string } = {
|
|
301
|
+
'content-type': 'application/json',
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return this.client.call(
|
|
305
|
+
'post',
|
|
306
|
+
uri,
|
|
307
|
+
apiHeaders,
|
|
308
|
+
payload
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
*
|
|
314
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
315
|
+
* @throws {AppwriteException}
|
|
316
|
+
* @returns {Promise<Models.Transaction>}
|
|
317
|
+
*/
|
|
318
|
+
getTransaction(params: { transactionId: string }): Promise<Models.Transaction>;
|
|
319
|
+
/**
|
|
320
|
+
*
|
|
321
|
+
* @param {string} transactionId - Transaction ID.
|
|
322
|
+
* @throws {AppwriteException}
|
|
323
|
+
* @returns {Promise<Models.Transaction>}
|
|
324
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
325
|
+
*/
|
|
326
|
+
getTransaction(transactionId: string): Promise<Models.Transaction>;
|
|
327
|
+
getTransaction(
|
|
328
|
+
paramsOrFirst: { transactionId: string } | string
|
|
329
|
+
): Promise<Models.Transaction> {
|
|
330
|
+
let params: { transactionId: string };
|
|
331
|
+
|
|
332
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
333
|
+
params = (paramsOrFirst || {}) as { transactionId: string };
|
|
334
|
+
} else {
|
|
335
|
+
params = {
|
|
336
|
+
transactionId: paramsOrFirst as string
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const transactionId = params.transactionId;
|
|
341
|
+
|
|
342
|
+
if (typeof transactionId === 'undefined') {
|
|
343
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const apiPath = '/vectorsdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
347
|
+
const payload: Payload = {};
|
|
348
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
349
|
+
|
|
350
|
+
const apiHeaders: { [header: string]: string } = {
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return this.client.call(
|
|
354
|
+
'get',
|
|
355
|
+
uri,
|
|
356
|
+
apiHeaders,
|
|
357
|
+
payload
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
*
|
|
363
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
364
|
+
* @param {boolean} params.commit - Commit transaction?
|
|
365
|
+
* @param {boolean} params.rollback - Rollback transaction?
|
|
366
|
+
* @throws {AppwriteException}
|
|
367
|
+
* @returns {Promise<Models.Transaction>}
|
|
368
|
+
*/
|
|
369
|
+
updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise<Models.Transaction>;
|
|
370
|
+
/**
|
|
371
|
+
*
|
|
372
|
+
* @param {string} transactionId - Transaction ID.
|
|
373
|
+
* @param {boolean} commit - Commit transaction?
|
|
374
|
+
* @param {boolean} rollback - Rollback transaction?
|
|
375
|
+
* @throws {AppwriteException}
|
|
376
|
+
* @returns {Promise<Models.Transaction>}
|
|
377
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
378
|
+
*/
|
|
379
|
+
updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>;
|
|
380
|
+
updateTransaction(
|
|
381
|
+
paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string,
|
|
382
|
+
...rest: [(boolean)?, (boolean)?]
|
|
383
|
+
): Promise<Models.Transaction> {
|
|
384
|
+
let params: { transactionId: string, commit?: boolean, rollback?: boolean };
|
|
385
|
+
|
|
386
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
387
|
+
params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean };
|
|
388
|
+
} else {
|
|
389
|
+
params = {
|
|
390
|
+
transactionId: paramsOrFirst as string,
|
|
391
|
+
commit: rest[0] as boolean,
|
|
392
|
+
rollback: rest[1] as boolean
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const transactionId = params.transactionId;
|
|
397
|
+
const commit = params.commit;
|
|
398
|
+
const rollback = params.rollback;
|
|
399
|
+
|
|
400
|
+
if (typeof transactionId === 'undefined') {
|
|
401
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const apiPath = '/vectorsdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
405
|
+
const payload: Payload = {};
|
|
406
|
+
if (typeof commit !== 'undefined') {
|
|
407
|
+
payload['commit'] = commit;
|
|
408
|
+
}
|
|
409
|
+
if (typeof rollback !== 'undefined') {
|
|
410
|
+
payload['rollback'] = rollback;
|
|
411
|
+
}
|
|
412
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
413
|
+
|
|
414
|
+
const apiHeaders: { [header: string]: string } = {
|
|
415
|
+
'content-type': 'application/json',
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return this.client.call(
|
|
419
|
+
'patch',
|
|
420
|
+
uri,
|
|
421
|
+
apiHeaders,
|
|
422
|
+
payload
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
*
|
|
428
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
429
|
+
* @throws {AppwriteException}
|
|
430
|
+
* @returns {Promise<{}>}
|
|
431
|
+
*/
|
|
432
|
+
deleteTransaction(params: { transactionId: string }): Promise<{}>;
|
|
433
|
+
/**
|
|
434
|
+
*
|
|
435
|
+
* @param {string} transactionId - Transaction ID.
|
|
436
|
+
* @throws {AppwriteException}
|
|
437
|
+
* @returns {Promise<{}>}
|
|
438
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
439
|
+
*/
|
|
440
|
+
deleteTransaction(transactionId: string): Promise<{}>;
|
|
441
|
+
deleteTransaction(
|
|
442
|
+
paramsOrFirst: { transactionId: string } | string
|
|
443
|
+
): Promise<{}> {
|
|
444
|
+
let params: { transactionId: string };
|
|
445
|
+
|
|
446
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
447
|
+
params = (paramsOrFirst || {}) as { transactionId: string };
|
|
448
|
+
} else {
|
|
449
|
+
params = {
|
|
450
|
+
transactionId: paramsOrFirst as string
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const transactionId = params.transactionId;
|
|
455
|
+
|
|
456
|
+
if (typeof transactionId === 'undefined') {
|
|
457
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const apiPath = '/vectorsdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
461
|
+
const payload: Payload = {};
|
|
462
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
463
|
+
|
|
464
|
+
const apiHeaders: { [header: string]: string } = {
|
|
465
|
+
'content-type': 'application/json',
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return this.client.call(
|
|
469
|
+
'delete',
|
|
470
|
+
uri,
|
|
471
|
+
apiHeaders,
|
|
472
|
+
payload
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
*
|
|
478
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
479
|
+
* @param {object[]} params.operations - Array of staged operations.
|
|
480
|
+
* @throws {AppwriteException}
|
|
481
|
+
* @returns {Promise<Models.Transaction>}
|
|
482
|
+
*/
|
|
483
|
+
createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>;
|
|
484
|
+
/**
|
|
485
|
+
*
|
|
486
|
+
* @param {string} transactionId - Transaction ID.
|
|
487
|
+
* @param {object[]} operations - Array of staged operations.
|
|
488
|
+
* @throws {AppwriteException}
|
|
489
|
+
* @returns {Promise<Models.Transaction>}
|
|
490
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
491
|
+
*/
|
|
492
|
+
createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>;
|
|
493
|
+
createOperations(
|
|
494
|
+
paramsOrFirst: { transactionId: string, operations?: object[] } | string,
|
|
495
|
+
...rest: [(object[])?]
|
|
496
|
+
): Promise<Models.Transaction> {
|
|
497
|
+
let params: { transactionId: string, operations?: object[] };
|
|
498
|
+
|
|
499
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
500
|
+
params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] };
|
|
501
|
+
} else {
|
|
502
|
+
params = {
|
|
503
|
+
transactionId: paramsOrFirst as string,
|
|
504
|
+
operations: rest[0] as object[]
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
const transactionId = params.transactionId;
|
|
509
|
+
const operations = params.operations;
|
|
510
|
+
|
|
511
|
+
if (typeof transactionId === 'undefined') {
|
|
512
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const apiPath = '/vectorsdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
|
|
516
|
+
const payload: Payload = {};
|
|
517
|
+
if (typeof operations !== 'undefined') {
|
|
518
|
+
payload['operations'] = operations;
|
|
519
|
+
}
|
|
520
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
521
|
+
|
|
522
|
+
const apiHeaders: { [header: string]: string } = {
|
|
523
|
+
'content-type': 'application/json',
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
return this.client.call(
|
|
527
|
+
'post',
|
|
528
|
+
uri,
|
|
529
|
+
apiHeaders,
|
|
530
|
+
payload
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
*
|
|
536
|
+
* @param {UsageRange} params.range - Date range.
|
|
537
|
+
* @throws {AppwriteException}
|
|
538
|
+
* @returns {Promise<Models.UsageVectorsDBs>}
|
|
539
|
+
*/
|
|
540
|
+
listUsage(params?: { range?: UsageRange }): Promise<Models.UsageVectorsDBs>;
|
|
541
|
+
/**
|
|
542
|
+
*
|
|
543
|
+
* @param {UsageRange} range - Date range.
|
|
544
|
+
* @throws {AppwriteException}
|
|
545
|
+
* @returns {Promise<Models.UsageVectorsDBs>}
|
|
546
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
547
|
+
*/
|
|
548
|
+
listUsage(range?: UsageRange): Promise<Models.UsageVectorsDBs>;
|
|
549
|
+
listUsage(
|
|
550
|
+
paramsOrFirst?: { range?: UsageRange } | UsageRange
|
|
551
|
+
): Promise<Models.UsageVectorsDBs> {
|
|
552
|
+
let params: { range?: UsageRange };
|
|
553
|
+
|
|
554
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
|
|
555
|
+
params = (paramsOrFirst || {}) as { range?: UsageRange };
|
|
556
|
+
} else {
|
|
557
|
+
params = {
|
|
558
|
+
range: paramsOrFirst as UsageRange
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
const range = params.range;
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
const apiPath = '/vectorsdb/usage';
|
|
566
|
+
const payload: Payload = {};
|
|
567
|
+
if (typeof range !== 'undefined') {
|
|
568
|
+
payload['range'] = range;
|
|
569
|
+
}
|
|
570
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
571
|
+
|
|
572
|
+
const apiHeaders: { [header: string]: string } = {
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
return this.client.call(
|
|
576
|
+
'get',
|
|
577
|
+
uri,
|
|
578
|
+
apiHeaders,
|
|
579
|
+
payload
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
*
|
|
585
|
+
* @param {string} params.databaseId - Database ID.
|
|
586
|
+
* @throws {AppwriteException}
|
|
587
|
+
* @returns {Promise<Models.Database>}
|
|
588
|
+
*/
|
|
589
|
+
get(params: { databaseId: string }): Promise<Models.Database>;
|
|
590
|
+
/**
|
|
591
|
+
*
|
|
592
|
+
* @param {string} databaseId - Database ID.
|
|
593
|
+
* @throws {AppwriteException}
|
|
594
|
+
* @returns {Promise<Models.Database>}
|
|
595
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
596
|
+
*/
|
|
597
|
+
get(databaseId: string): Promise<Models.Database>;
|
|
598
|
+
get(
|
|
599
|
+
paramsOrFirst: { databaseId: string } | string
|
|
600
|
+
): Promise<Models.Database> {
|
|
601
|
+
let params: { databaseId: string };
|
|
602
|
+
|
|
603
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
604
|
+
params = (paramsOrFirst || {}) as { databaseId: string };
|
|
605
|
+
} else {
|
|
606
|
+
params = {
|
|
607
|
+
databaseId: paramsOrFirst as string
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const databaseId = params.databaseId;
|
|
612
|
+
|
|
613
|
+
if (typeof databaseId === 'undefined') {
|
|
614
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const apiPath = '/vectorsdb/{databaseId}'.replace('{databaseId}', databaseId);
|
|
618
|
+
const payload: Payload = {};
|
|
619
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
620
|
+
|
|
621
|
+
const apiHeaders: { [header: string]: string } = {
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return this.client.call(
|
|
625
|
+
'get',
|
|
626
|
+
uri,
|
|
627
|
+
apiHeaders,
|
|
628
|
+
payload
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
*
|
|
634
|
+
* @param {string} params.databaseId - Database ID.
|
|
635
|
+
* @param {string} params.name - Database name. Max length: 128 chars.
|
|
636
|
+
* @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
637
|
+
* @throws {AppwriteException}
|
|
638
|
+
* @returns {Promise<Models.Database>}
|
|
639
|
+
*/
|
|
640
|
+
update(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>;
|
|
641
|
+
/**
|
|
642
|
+
*
|
|
643
|
+
* @param {string} databaseId - Database ID.
|
|
644
|
+
* @param {string} name - Database name. Max length: 128 chars.
|
|
645
|
+
* @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
646
|
+
* @throws {AppwriteException}
|
|
647
|
+
* @returns {Promise<Models.Database>}
|
|
648
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
649
|
+
*/
|
|
650
|
+
update(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>;
|
|
651
|
+
update(
|
|
652
|
+
paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string,
|
|
653
|
+
...rest: [(string)?, (boolean)?]
|
|
654
|
+
): Promise<Models.Database> {
|
|
655
|
+
let params: { databaseId: string, name: string, enabled?: boolean };
|
|
656
|
+
|
|
657
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
658
|
+
params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean };
|
|
659
|
+
} else {
|
|
660
|
+
params = {
|
|
661
|
+
databaseId: paramsOrFirst as string,
|
|
662
|
+
name: rest[0] as string,
|
|
663
|
+
enabled: rest[1] as boolean
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const databaseId = params.databaseId;
|
|
668
|
+
const name = params.name;
|
|
669
|
+
const enabled = params.enabled;
|
|
670
|
+
|
|
671
|
+
if (typeof databaseId === 'undefined') {
|
|
672
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
673
|
+
}
|
|
674
|
+
if (typeof name === 'undefined') {
|
|
675
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const apiPath = '/vectorsdb/{databaseId}'.replace('{databaseId}', databaseId);
|
|
679
|
+
const payload: Payload = {};
|
|
680
|
+
if (typeof name !== 'undefined') {
|
|
681
|
+
payload['name'] = name;
|
|
682
|
+
}
|
|
683
|
+
if (typeof enabled !== 'undefined') {
|
|
684
|
+
payload['enabled'] = enabled;
|
|
685
|
+
}
|
|
686
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
687
|
+
|
|
688
|
+
const apiHeaders: { [header: string]: string } = {
|
|
689
|
+
'content-type': 'application/json',
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
return this.client.call(
|
|
693
|
+
'put',
|
|
694
|
+
uri,
|
|
695
|
+
apiHeaders,
|
|
696
|
+
payload
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
*
|
|
702
|
+
* @param {string} params.databaseId - Database ID.
|
|
703
|
+
* @throws {AppwriteException}
|
|
704
|
+
* @returns {Promise<{}>}
|
|
705
|
+
*/
|
|
706
|
+
delete(params: { databaseId: string }): Promise<{}>;
|
|
707
|
+
/**
|
|
708
|
+
*
|
|
709
|
+
* @param {string} databaseId - Database ID.
|
|
710
|
+
* @throws {AppwriteException}
|
|
711
|
+
* @returns {Promise<{}>}
|
|
712
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
713
|
+
*/
|
|
714
|
+
delete(databaseId: string): Promise<{}>;
|
|
715
|
+
delete(
|
|
716
|
+
paramsOrFirst: { databaseId: string } | string
|
|
717
|
+
): Promise<{}> {
|
|
718
|
+
let params: { databaseId: string };
|
|
719
|
+
|
|
720
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
721
|
+
params = (paramsOrFirst || {}) as { databaseId: string };
|
|
722
|
+
} else {
|
|
723
|
+
params = {
|
|
724
|
+
databaseId: paramsOrFirst as string
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
const databaseId = params.databaseId;
|
|
729
|
+
|
|
730
|
+
if (typeof databaseId === 'undefined') {
|
|
731
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
const apiPath = '/vectorsdb/{databaseId}'.replace('{databaseId}', databaseId);
|
|
735
|
+
const payload: Payload = {};
|
|
736
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
737
|
+
|
|
738
|
+
const apiHeaders: { [header: string]: string } = {
|
|
739
|
+
'content-type': 'application/json',
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
return this.client.call(
|
|
743
|
+
'delete',
|
|
744
|
+
uri,
|
|
745
|
+
apiHeaders,
|
|
746
|
+
payload
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
*
|
|
752
|
+
* @param {string} params.databaseId - Database ID.
|
|
753
|
+
* @param {string[]} params.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. You may filter on the following attributes: name, enabled, documentSecurity
|
|
754
|
+
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
|
|
755
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
756
|
+
* @throws {AppwriteException}
|
|
757
|
+
* @returns {Promise<Models.VectorsdbCollectionList>}
|
|
758
|
+
*/
|
|
759
|
+
listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.VectorsdbCollectionList>;
|
|
760
|
+
/**
|
|
761
|
+
*
|
|
762
|
+
* @param {string} databaseId - Database ID.
|
|
763
|
+
* @param {string[]} 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. You may filter on the following attributes: name, enabled, documentSecurity
|
|
764
|
+
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
|
|
765
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
766
|
+
* @throws {AppwriteException}
|
|
767
|
+
* @returns {Promise<Models.VectorsdbCollectionList>}
|
|
768
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
769
|
+
*/
|
|
770
|
+
listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.VectorsdbCollectionList>;
|
|
771
|
+
listCollections(
|
|
772
|
+
paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string,
|
|
773
|
+
...rest: [(string[])?, (string)?, (boolean)?]
|
|
774
|
+
): Promise<Models.VectorsdbCollectionList> {
|
|
775
|
+
let params: { databaseId: string, queries?: string[], search?: string, total?: boolean };
|
|
776
|
+
|
|
777
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
778
|
+
params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean };
|
|
779
|
+
} else {
|
|
780
|
+
params = {
|
|
781
|
+
databaseId: paramsOrFirst as string,
|
|
782
|
+
queries: rest[0] as string[],
|
|
783
|
+
search: rest[1] as string,
|
|
784
|
+
total: rest[2] as boolean
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
const databaseId = params.databaseId;
|
|
789
|
+
const queries = params.queries;
|
|
790
|
+
const search = params.search;
|
|
791
|
+
const total = params.total;
|
|
792
|
+
|
|
793
|
+
if (typeof databaseId === 'undefined') {
|
|
794
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const apiPath = '/vectorsdb/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
|
798
|
+
const payload: Payload = {};
|
|
799
|
+
if (typeof queries !== 'undefined') {
|
|
800
|
+
payload['queries'] = queries;
|
|
801
|
+
}
|
|
802
|
+
if (typeof search !== 'undefined') {
|
|
803
|
+
payload['search'] = search;
|
|
804
|
+
}
|
|
805
|
+
if (typeof total !== 'undefined') {
|
|
806
|
+
payload['total'] = total;
|
|
807
|
+
}
|
|
808
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
809
|
+
|
|
810
|
+
const apiHeaders: { [header: string]: string } = {
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
return this.client.call(
|
|
814
|
+
'get',
|
|
815
|
+
uri,
|
|
816
|
+
apiHeaders,
|
|
817
|
+
payload
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
*
|
|
823
|
+
* @param {string} params.databaseId - Database ID.
|
|
824
|
+
* @param {string} params.collectionId - Unique 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.
|
|
825
|
+
* @param {string} params.name - Collection name. Max length: 128 chars.
|
|
826
|
+
* @param {number} params.dimension - Embedding dimension.
|
|
827
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
828
|
+
* @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
829
|
+
* @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
830
|
+
* @throws {AppwriteException}
|
|
831
|
+
* @returns {Promise<Models.VectorsdbCollection>}
|
|
832
|
+
*/
|
|
833
|
+
createCollection(params: { databaseId: string, collectionId: string, name: string, dimension: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }): Promise<Models.VectorsdbCollection>;
|
|
834
|
+
/**
|
|
835
|
+
*
|
|
836
|
+
* @param {string} databaseId - Database ID.
|
|
837
|
+
* @param {string} collectionId - Unique 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.
|
|
838
|
+
* @param {string} name - Collection name. Max length: 128 chars.
|
|
839
|
+
* @param {number} dimension - Embedding dimension.
|
|
840
|
+
* @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
841
|
+
* @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
842
|
+
* @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
843
|
+
* @throws {AppwriteException}
|
|
844
|
+
* @returns {Promise<Models.VectorsdbCollection>}
|
|
845
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
846
|
+
*/
|
|
847
|
+
createCollection(databaseId: string, collectionId: string, name: string, dimension: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.VectorsdbCollection>;
|
|
848
|
+
createCollection(
|
|
849
|
+
paramsOrFirst: { databaseId: string, collectionId: string, name: string, dimension: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean } | string,
|
|
850
|
+
...rest: [(string)?, (string)?, (number)?, (string[])?, (boolean)?, (boolean)?]
|
|
851
|
+
): Promise<Models.VectorsdbCollection> {
|
|
852
|
+
let params: { databaseId: string, collectionId: string, name: string, dimension: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean };
|
|
853
|
+
|
|
854
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
855
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, dimension: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean };
|
|
856
|
+
} else {
|
|
857
|
+
params = {
|
|
858
|
+
databaseId: paramsOrFirst as string,
|
|
859
|
+
collectionId: rest[0] as string,
|
|
860
|
+
name: rest[1] as string,
|
|
861
|
+
dimension: rest[2] as number,
|
|
862
|
+
permissions: rest[3] as string[],
|
|
863
|
+
documentSecurity: rest[4] as boolean,
|
|
864
|
+
enabled: rest[5] as boolean
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
const databaseId = params.databaseId;
|
|
869
|
+
const collectionId = params.collectionId;
|
|
870
|
+
const name = params.name;
|
|
871
|
+
const dimension = params.dimension;
|
|
872
|
+
const permissions = params.permissions;
|
|
873
|
+
const documentSecurity = params.documentSecurity;
|
|
874
|
+
const enabled = params.enabled;
|
|
875
|
+
|
|
876
|
+
if (typeof databaseId === 'undefined') {
|
|
877
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
878
|
+
}
|
|
879
|
+
if (typeof collectionId === 'undefined') {
|
|
880
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
881
|
+
}
|
|
882
|
+
if (typeof name === 'undefined') {
|
|
883
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
884
|
+
}
|
|
885
|
+
if (typeof dimension === 'undefined') {
|
|
886
|
+
throw new AppwriteException('Missing required parameter: "dimension"');
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const apiPath = '/vectorsdb/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
|
890
|
+
const payload: Payload = {};
|
|
891
|
+
if (typeof collectionId !== 'undefined') {
|
|
892
|
+
payload['collectionId'] = collectionId;
|
|
893
|
+
}
|
|
894
|
+
if (typeof name !== 'undefined') {
|
|
895
|
+
payload['name'] = name;
|
|
896
|
+
}
|
|
897
|
+
if (typeof dimension !== 'undefined') {
|
|
898
|
+
payload['dimension'] = dimension;
|
|
899
|
+
}
|
|
900
|
+
if (typeof permissions !== 'undefined') {
|
|
901
|
+
payload['permissions'] = permissions;
|
|
902
|
+
}
|
|
903
|
+
if (typeof documentSecurity !== 'undefined') {
|
|
904
|
+
payload['documentSecurity'] = documentSecurity;
|
|
905
|
+
}
|
|
906
|
+
if (typeof enabled !== 'undefined') {
|
|
907
|
+
payload['enabled'] = enabled;
|
|
908
|
+
}
|
|
909
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
910
|
+
|
|
911
|
+
const apiHeaders: { [header: string]: string } = {
|
|
912
|
+
'content-type': 'application/json',
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return this.client.call(
|
|
916
|
+
'post',
|
|
917
|
+
uri,
|
|
918
|
+
apiHeaders,
|
|
919
|
+
payload
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
*
|
|
925
|
+
* @param {string} params.databaseId - Database ID.
|
|
926
|
+
* @param {string} params.collectionId - Collection ID.
|
|
927
|
+
* @throws {AppwriteException}
|
|
928
|
+
* @returns {Promise<Models.VectorsdbCollection>}
|
|
929
|
+
*/
|
|
930
|
+
getCollection(params: { databaseId: string, collectionId: string }): Promise<Models.VectorsdbCollection>;
|
|
931
|
+
/**
|
|
932
|
+
*
|
|
933
|
+
* @param {string} databaseId - Database ID.
|
|
934
|
+
* @param {string} collectionId - Collection ID.
|
|
935
|
+
* @throws {AppwriteException}
|
|
936
|
+
* @returns {Promise<Models.VectorsdbCollection>}
|
|
937
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
938
|
+
*/
|
|
939
|
+
getCollection(databaseId: string, collectionId: string): Promise<Models.VectorsdbCollection>;
|
|
940
|
+
getCollection(
|
|
941
|
+
paramsOrFirst: { databaseId: string, collectionId: string } | string,
|
|
942
|
+
...rest: [(string)?]
|
|
943
|
+
): Promise<Models.VectorsdbCollection> {
|
|
944
|
+
let params: { databaseId: string, collectionId: string };
|
|
945
|
+
|
|
946
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
947
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string };
|
|
948
|
+
} else {
|
|
949
|
+
params = {
|
|
950
|
+
databaseId: paramsOrFirst as string,
|
|
951
|
+
collectionId: rest[0] as string
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
const databaseId = params.databaseId;
|
|
956
|
+
const collectionId = params.collectionId;
|
|
957
|
+
|
|
958
|
+
if (typeof databaseId === 'undefined') {
|
|
959
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
960
|
+
}
|
|
961
|
+
if (typeof collectionId === 'undefined') {
|
|
962
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
966
|
+
const payload: Payload = {};
|
|
967
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
968
|
+
|
|
969
|
+
const apiHeaders: { [header: string]: string } = {
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
return this.client.call(
|
|
973
|
+
'get',
|
|
974
|
+
uri,
|
|
975
|
+
apiHeaders,
|
|
976
|
+
payload
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
*
|
|
982
|
+
* @param {string} params.databaseId - Database ID.
|
|
983
|
+
* @param {string} params.collectionId - Collection ID.
|
|
984
|
+
* @param {string} params.name - Collection name. Max length: 128 chars.
|
|
985
|
+
* @param {number} params.dimension - Embedding dimensions.
|
|
986
|
+
* @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
987
|
+
* @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
988
|
+
* @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
989
|
+
* @throws {AppwriteException}
|
|
990
|
+
* @returns {Promise<Models.VectorsdbCollection>}
|
|
991
|
+
*/
|
|
992
|
+
updateCollection(params: { databaseId: string, collectionId: string, name: string, dimension?: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean }): Promise<Models.VectorsdbCollection>;
|
|
993
|
+
/**
|
|
994
|
+
*
|
|
995
|
+
* @param {string} databaseId - Database ID.
|
|
996
|
+
* @param {string} collectionId - Collection ID.
|
|
997
|
+
* @param {string} name - Collection name. Max length: 128 chars.
|
|
998
|
+
* @param {number} dimension - Embedding dimensions.
|
|
999
|
+
* @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1000
|
+
* @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1001
|
+
* @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
1002
|
+
* @throws {AppwriteException}
|
|
1003
|
+
* @returns {Promise<Models.VectorsdbCollection>}
|
|
1004
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1005
|
+
*/
|
|
1006
|
+
updateCollection(databaseId: string, collectionId: string, name: string, dimension?: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.VectorsdbCollection>;
|
|
1007
|
+
updateCollection(
|
|
1008
|
+
paramsOrFirst: { databaseId: string, collectionId: string, name: string, dimension?: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean } | string,
|
|
1009
|
+
...rest: [(string)?, (string)?, (number)?, (string[])?, (boolean)?, (boolean)?]
|
|
1010
|
+
): Promise<Models.VectorsdbCollection> {
|
|
1011
|
+
let params: { databaseId: string, collectionId: string, name: string, dimension?: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean };
|
|
1012
|
+
|
|
1013
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1014
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, dimension?: number, permissions?: string[], documentSecurity?: boolean, enabled?: boolean };
|
|
1015
|
+
} else {
|
|
1016
|
+
params = {
|
|
1017
|
+
databaseId: paramsOrFirst as string,
|
|
1018
|
+
collectionId: rest[0] as string,
|
|
1019
|
+
name: rest[1] as string,
|
|
1020
|
+
dimension: rest[2] as number,
|
|
1021
|
+
permissions: rest[3] as string[],
|
|
1022
|
+
documentSecurity: rest[4] as boolean,
|
|
1023
|
+
enabled: rest[5] as boolean
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
const databaseId = params.databaseId;
|
|
1028
|
+
const collectionId = params.collectionId;
|
|
1029
|
+
const name = params.name;
|
|
1030
|
+
const dimension = params.dimension;
|
|
1031
|
+
const permissions = params.permissions;
|
|
1032
|
+
const documentSecurity = params.documentSecurity;
|
|
1033
|
+
const enabled = params.enabled;
|
|
1034
|
+
|
|
1035
|
+
if (typeof databaseId === 'undefined') {
|
|
1036
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1037
|
+
}
|
|
1038
|
+
if (typeof collectionId === 'undefined') {
|
|
1039
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1040
|
+
}
|
|
1041
|
+
if (typeof name === 'undefined') {
|
|
1042
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1046
|
+
const payload: Payload = {};
|
|
1047
|
+
if (typeof name !== 'undefined') {
|
|
1048
|
+
payload['name'] = name;
|
|
1049
|
+
}
|
|
1050
|
+
if (typeof dimension !== 'undefined') {
|
|
1051
|
+
payload['dimension'] = dimension;
|
|
1052
|
+
}
|
|
1053
|
+
if (typeof permissions !== 'undefined') {
|
|
1054
|
+
payload['permissions'] = permissions;
|
|
1055
|
+
}
|
|
1056
|
+
if (typeof documentSecurity !== 'undefined') {
|
|
1057
|
+
payload['documentSecurity'] = documentSecurity;
|
|
1058
|
+
}
|
|
1059
|
+
if (typeof enabled !== 'undefined') {
|
|
1060
|
+
payload['enabled'] = enabled;
|
|
1061
|
+
}
|
|
1062
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1063
|
+
|
|
1064
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1065
|
+
'content-type': 'application/json',
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
return this.client.call(
|
|
1069
|
+
'put',
|
|
1070
|
+
uri,
|
|
1071
|
+
apiHeaders,
|
|
1072
|
+
payload
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
*
|
|
1078
|
+
* @param {string} params.databaseId - Database ID.
|
|
1079
|
+
* @param {string} params.collectionId - Collection ID.
|
|
1080
|
+
* @throws {AppwriteException}
|
|
1081
|
+
* @returns {Promise<{}>}
|
|
1082
|
+
*/
|
|
1083
|
+
deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>;
|
|
1084
|
+
/**
|
|
1085
|
+
*
|
|
1086
|
+
* @param {string} databaseId - Database ID.
|
|
1087
|
+
* @param {string} collectionId - Collection ID.
|
|
1088
|
+
* @throws {AppwriteException}
|
|
1089
|
+
* @returns {Promise<{}>}
|
|
1090
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1091
|
+
*/
|
|
1092
|
+
deleteCollection(databaseId: string, collectionId: string): Promise<{}>;
|
|
1093
|
+
deleteCollection(
|
|
1094
|
+
paramsOrFirst: { databaseId: string, collectionId: string } | string,
|
|
1095
|
+
...rest: [(string)?]
|
|
1096
|
+
): Promise<{}> {
|
|
1097
|
+
let params: { databaseId: string, collectionId: string };
|
|
1098
|
+
|
|
1099
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1100
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string };
|
|
1101
|
+
} else {
|
|
1102
|
+
params = {
|
|
1103
|
+
databaseId: paramsOrFirst as string,
|
|
1104
|
+
collectionId: rest[0] as string
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
const databaseId = params.databaseId;
|
|
1109
|
+
const collectionId = params.collectionId;
|
|
1110
|
+
|
|
1111
|
+
if (typeof databaseId === 'undefined') {
|
|
1112
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1113
|
+
}
|
|
1114
|
+
if (typeof collectionId === 'undefined') {
|
|
1115
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1119
|
+
const payload: Payload = {};
|
|
1120
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1121
|
+
|
|
1122
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1123
|
+
'content-type': 'application/json',
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
return this.client.call(
|
|
1127
|
+
'delete',
|
|
1128
|
+
uri,
|
|
1129
|
+
apiHeaders,
|
|
1130
|
+
payload
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
*
|
|
1136
|
+
* @param {string} params.databaseId - Database ID.
|
|
1137
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1138
|
+
* @param {string[]} params.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.
|
|
1139
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
1140
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
1141
|
+
* @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
|
|
1142
|
+
* @throws {AppwriteException}
|
|
1143
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1144
|
+
*/
|
|
1145
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>;
|
|
1146
|
+
/**
|
|
1147
|
+
*
|
|
1148
|
+
* @param {string} databaseId - Database ID.
|
|
1149
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1150
|
+
* @param {string[]} 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.
|
|
1151
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
1152
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
1153
|
+
* @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
|
|
1154
|
+
* @throws {AppwriteException}
|
|
1155
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1156
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1157
|
+
*/
|
|
1158
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>;
|
|
1159
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(
|
|
1160
|
+
paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string,
|
|
1161
|
+
...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?]
|
|
1162
|
+
): Promise<Models.DocumentList<Document>> {
|
|
1163
|
+
let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number };
|
|
1164
|
+
|
|
1165
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1166
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number };
|
|
1167
|
+
} else {
|
|
1168
|
+
params = {
|
|
1169
|
+
databaseId: paramsOrFirst as string,
|
|
1170
|
+
collectionId: rest[0] as string,
|
|
1171
|
+
queries: rest[1] as string[],
|
|
1172
|
+
transactionId: rest[2] as string,
|
|
1173
|
+
total: rest[3] as boolean,
|
|
1174
|
+
ttl: rest[4] as number
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
const databaseId = params.databaseId;
|
|
1179
|
+
const collectionId = params.collectionId;
|
|
1180
|
+
const queries = params.queries;
|
|
1181
|
+
const transactionId = params.transactionId;
|
|
1182
|
+
const total = params.total;
|
|
1183
|
+
const ttl = params.ttl;
|
|
1184
|
+
|
|
1185
|
+
if (typeof databaseId === 'undefined') {
|
|
1186
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1187
|
+
}
|
|
1188
|
+
if (typeof collectionId === 'undefined') {
|
|
1189
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1193
|
+
const payload: Payload = {};
|
|
1194
|
+
if (typeof queries !== 'undefined') {
|
|
1195
|
+
payload['queries'] = queries;
|
|
1196
|
+
}
|
|
1197
|
+
if (typeof transactionId !== 'undefined') {
|
|
1198
|
+
payload['transactionId'] = transactionId;
|
|
1199
|
+
}
|
|
1200
|
+
if (typeof total !== 'undefined') {
|
|
1201
|
+
payload['total'] = total;
|
|
1202
|
+
}
|
|
1203
|
+
if (typeof ttl !== 'undefined') {
|
|
1204
|
+
payload['ttl'] = ttl;
|
|
1205
|
+
}
|
|
1206
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1207
|
+
|
|
1208
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
return this.client.call(
|
|
1212
|
+
'get',
|
|
1213
|
+
uri,
|
|
1214
|
+
apiHeaders,
|
|
1215
|
+
payload
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
*
|
|
1221
|
+
* @param {string} params.databaseId - Database ID.
|
|
1222
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
1223
|
+
* @param {string} params.documentId - Document 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.
|
|
1224
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON object.
|
|
1225
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1226
|
+
* @throws {AppwriteException}
|
|
1227
|
+
* @returns {Promise<Document>}
|
|
1228
|
+
*/
|
|
1229
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] }): Promise<Document>;
|
|
1230
|
+
/**
|
|
1231
|
+
*
|
|
1232
|
+
* @param {string} databaseId - Database ID.
|
|
1233
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
1234
|
+
* @param {string} documentId - Document 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.
|
|
1235
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON object.
|
|
1236
|
+
* @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1237
|
+
* @throws {AppwriteException}
|
|
1238
|
+
* @returns {Promise<Document>}
|
|
1239
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1240
|
+
*/
|
|
1241
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>;
|
|
1242
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
1243
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] } | string,
|
|
1244
|
+
...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?]
|
|
1245
|
+
): Promise<Document> {
|
|
1246
|
+
let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] };
|
|
1247
|
+
|
|
1248
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1249
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[] };
|
|
1250
|
+
} else {
|
|
1251
|
+
params = {
|
|
1252
|
+
databaseId: paramsOrFirst as string,
|
|
1253
|
+
collectionId: rest[0] as string,
|
|
1254
|
+
documentId: rest[1] as string,
|
|
1255
|
+
data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>,
|
|
1256
|
+
permissions: rest[3] as string[]
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
const databaseId = params.databaseId;
|
|
1261
|
+
const collectionId = params.collectionId;
|
|
1262
|
+
const documentId = params.documentId;
|
|
1263
|
+
const data = params.data;
|
|
1264
|
+
const permissions = params.permissions;
|
|
1265
|
+
|
|
1266
|
+
if (typeof databaseId === 'undefined') {
|
|
1267
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1268
|
+
}
|
|
1269
|
+
if (typeof collectionId === 'undefined') {
|
|
1270
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1271
|
+
}
|
|
1272
|
+
if (typeof documentId === 'undefined') {
|
|
1273
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1274
|
+
}
|
|
1275
|
+
if (typeof data === 'undefined') {
|
|
1276
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1280
|
+
const payload: Payload = {};
|
|
1281
|
+
if (typeof documentId !== 'undefined') {
|
|
1282
|
+
payload['documentId'] = documentId;
|
|
1283
|
+
}
|
|
1284
|
+
if (typeof data !== 'undefined') {
|
|
1285
|
+
payload['data'] = data;
|
|
1286
|
+
}
|
|
1287
|
+
if (typeof permissions !== 'undefined') {
|
|
1288
|
+
payload['permissions'] = permissions;
|
|
1289
|
+
}
|
|
1290
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1291
|
+
|
|
1292
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1293
|
+
'content-type': 'application/json',
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
return this.client.call(
|
|
1297
|
+
'post',
|
|
1298
|
+
uri,
|
|
1299
|
+
apiHeaders,
|
|
1300
|
+
payload
|
|
1301
|
+
);
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
*
|
|
1306
|
+
* @param {string} params.databaseId - Database ID.
|
|
1307
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
1308
|
+
* @param {object[]} params.documents - Array of documents data as JSON objects.
|
|
1309
|
+
* @throws {AppwriteException}
|
|
1310
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1311
|
+
*/
|
|
1312
|
+
createDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[] }): Promise<Models.DocumentList<Document>>;
|
|
1313
|
+
/**
|
|
1314
|
+
*
|
|
1315
|
+
* @param {string} databaseId - Database ID.
|
|
1316
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
1317
|
+
* @param {object[]} documents - Array of documents data as JSON objects.
|
|
1318
|
+
* @throws {AppwriteException}
|
|
1319
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1320
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1321
|
+
*/
|
|
1322
|
+
createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>>;
|
|
1323
|
+
createDocuments<Document extends Models.Document = Models.DefaultDocument>(
|
|
1324
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documents: object[] } | string,
|
|
1325
|
+
...rest: [(string)?, (object[])?]
|
|
1326
|
+
): Promise<Models.DocumentList<Document>> {
|
|
1327
|
+
let params: { databaseId: string, collectionId: string, documents: object[] };
|
|
1328
|
+
|
|
1329
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1330
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[] };
|
|
1331
|
+
} else {
|
|
1332
|
+
params = {
|
|
1333
|
+
databaseId: paramsOrFirst as string,
|
|
1334
|
+
collectionId: rest[0] as string,
|
|
1335
|
+
documents: rest[1] as object[]
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
const databaseId = params.databaseId;
|
|
1340
|
+
const collectionId = params.collectionId;
|
|
1341
|
+
const documents = params.documents;
|
|
1342
|
+
|
|
1343
|
+
if (typeof databaseId === 'undefined') {
|
|
1344
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1345
|
+
}
|
|
1346
|
+
if (typeof collectionId === 'undefined') {
|
|
1347
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1348
|
+
}
|
|
1349
|
+
if (typeof documents === 'undefined') {
|
|
1350
|
+
throw new AppwriteException('Missing required parameter: "documents"');
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1354
|
+
const payload: Payload = {};
|
|
1355
|
+
if (typeof documents !== 'undefined') {
|
|
1356
|
+
payload['documents'] = documents;
|
|
1357
|
+
}
|
|
1358
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1359
|
+
|
|
1360
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1361
|
+
'content-type': 'application/json',
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
return this.client.call(
|
|
1365
|
+
'post',
|
|
1366
|
+
uri,
|
|
1367
|
+
apiHeaders,
|
|
1368
|
+
payload
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
/**
|
|
1373
|
+
*
|
|
1374
|
+
* @param {string} params.databaseId - Database ID.
|
|
1375
|
+
* @param {string} params.collectionId - Collection ID.
|
|
1376
|
+
* @param {object[]} params.documents - Array of document data as JSON objects. May contain partial documents.
|
|
1377
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
1378
|
+
* @throws {AppwriteException}
|
|
1379
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1380
|
+
*/
|
|
1381
|
+
upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>;
|
|
1382
|
+
/**
|
|
1383
|
+
*
|
|
1384
|
+
* @param {string} databaseId - Database ID.
|
|
1385
|
+
* @param {string} collectionId - Collection ID.
|
|
1386
|
+
* @param {object[]} documents - Array of document data as JSON objects. May contain partial documents.
|
|
1387
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
1388
|
+
* @throws {AppwriteException}
|
|
1389
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1390
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1391
|
+
*/
|
|
1392
|
+
upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>;
|
|
1393
|
+
upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(
|
|
1394
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string,
|
|
1395
|
+
...rest: [(string)?, (object[])?, (string)?]
|
|
1396
|
+
): Promise<Models.DocumentList<Document>> {
|
|
1397
|
+
let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string };
|
|
1398
|
+
|
|
1399
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1400
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string };
|
|
1401
|
+
} else {
|
|
1402
|
+
params = {
|
|
1403
|
+
databaseId: paramsOrFirst as string,
|
|
1404
|
+
collectionId: rest[0] as string,
|
|
1405
|
+
documents: rest[1] as object[],
|
|
1406
|
+
transactionId: rest[2] as string
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
const databaseId = params.databaseId;
|
|
1411
|
+
const collectionId = params.collectionId;
|
|
1412
|
+
const documents = params.documents;
|
|
1413
|
+
const transactionId = params.transactionId;
|
|
1414
|
+
|
|
1415
|
+
if (typeof databaseId === 'undefined') {
|
|
1416
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1417
|
+
}
|
|
1418
|
+
if (typeof collectionId === 'undefined') {
|
|
1419
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1420
|
+
}
|
|
1421
|
+
if (typeof documents === 'undefined') {
|
|
1422
|
+
throw new AppwriteException('Missing required parameter: "documents"');
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1426
|
+
const payload: Payload = {};
|
|
1427
|
+
if (typeof documents !== 'undefined') {
|
|
1428
|
+
payload['documents'] = documents;
|
|
1429
|
+
}
|
|
1430
|
+
if (typeof transactionId !== 'undefined') {
|
|
1431
|
+
payload['transactionId'] = transactionId;
|
|
1432
|
+
}
|
|
1433
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1434
|
+
|
|
1435
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1436
|
+
'content-type': 'application/json',
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
return this.client.call(
|
|
1440
|
+
'put',
|
|
1441
|
+
uri,
|
|
1442
|
+
apiHeaders,
|
|
1443
|
+
payload
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
/**
|
|
1448
|
+
*
|
|
1449
|
+
* @param {string} params.databaseId - Database ID.
|
|
1450
|
+
* @param {string} params.collectionId - Collection ID.
|
|
1451
|
+
* @param {object} params.data - Document data as JSON object. Include only attribute and value pairs to be updated.
|
|
1452
|
+
* @param {string[]} params.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.
|
|
1453
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
1454
|
+
* @throws {AppwriteException}
|
|
1455
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1456
|
+
*/
|
|
1457
|
+
updateDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>;
|
|
1458
|
+
/**
|
|
1459
|
+
*
|
|
1460
|
+
* @param {string} databaseId - Database ID.
|
|
1461
|
+
* @param {string} collectionId - Collection ID.
|
|
1462
|
+
* @param {object} data - Document data as JSON object. Include only attribute and value pairs to be updated.
|
|
1463
|
+
* @param {string[]} 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.
|
|
1464
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
1465
|
+
* @throws {AppwriteException}
|
|
1466
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1467
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1468
|
+
*/
|
|
1469
|
+
updateDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>;
|
|
1470
|
+
updateDocuments<Document extends Models.Document = Models.DefaultDocument>(
|
|
1471
|
+
paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string,
|
|
1472
|
+
...rest: [(string)?, (object)?, (string[])?, (string)?]
|
|
1473
|
+
): Promise<Models.DocumentList<Document>> {
|
|
1474
|
+
let params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string };
|
|
1475
|
+
|
|
1476
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1477
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string };
|
|
1478
|
+
} else {
|
|
1479
|
+
params = {
|
|
1480
|
+
databaseId: paramsOrFirst as string,
|
|
1481
|
+
collectionId: rest[0] as string,
|
|
1482
|
+
data: rest[1] as object,
|
|
1483
|
+
queries: rest[2] as string[],
|
|
1484
|
+
transactionId: rest[3] as string
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
const databaseId = params.databaseId;
|
|
1489
|
+
const collectionId = params.collectionId;
|
|
1490
|
+
const data = params.data;
|
|
1491
|
+
const queries = params.queries;
|
|
1492
|
+
const transactionId = params.transactionId;
|
|
1493
|
+
|
|
1494
|
+
if (typeof databaseId === 'undefined') {
|
|
1495
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1496
|
+
}
|
|
1497
|
+
if (typeof collectionId === 'undefined') {
|
|
1498
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1502
|
+
const payload: Payload = {};
|
|
1503
|
+
if (typeof data !== 'undefined') {
|
|
1504
|
+
payload['data'] = data;
|
|
1505
|
+
}
|
|
1506
|
+
if (typeof queries !== 'undefined') {
|
|
1507
|
+
payload['queries'] = queries;
|
|
1508
|
+
}
|
|
1509
|
+
if (typeof transactionId !== 'undefined') {
|
|
1510
|
+
payload['transactionId'] = transactionId;
|
|
1511
|
+
}
|
|
1512
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1513
|
+
|
|
1514
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1515
|
+
'content-type': 'application/json',
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
return this.client.call(
|
|
1519
|
+
'patch',
|
|
1520
|
+
uri,
|
|
1521
|
+
apiHeaders,
|
|
1522
|
+
payload
|
|
1523
|
+
);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
*
|
|
1528
|
+
* @param {string} params.databaseId - Database ID.
|
|
1529
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1530
|
+
* @param {string[]} params.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.
|
|
1531
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
1532
|
+
* @throws {AppwriteException}
|
|
1533
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1534
|
+
*/
|
|
1535
|
+
deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>;
|
|
1536
|
+
/**
|
|
1537
|
+
*
|
|
1538
|
+
* @param {string} databaseId - Database ID.
|
|
1539
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1540
|
+
* @param {string[]} 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.
|
|
1541
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
1542
|
+
* @throws {AppwriteException}
|
|
1543
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
1544
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1545
|
+
*/
|
|
1546
|
+
deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>;
|
|
1547
|
+
deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(
|
|
1548
|
+
paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string,
|
|
1549
|
+
...rest: [(string)?, (string[])?, (string)?]
|
|
1550
|
+
): Promise<Models.DocumentList<Document>> {
|
|
1551
|
+
let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string };
|
|
1552
|
+
|
|
1553
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1554
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string };
|
|
1555
|
+
} else {
|
|
1556
|
+
params = {
|
|
1557
|
+
databaseId: paramsOrFirst as string,
|
|
1558
|
+
collectionId: rest[0] as string,
|
|
1559
|
+
queries: rest[1] as string[],
|
|
1560
|
+
transactionId: rest[2] as string
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
const databaseId = params.databaseId;
|
|
1565
|
+
const collectionId = params.collectionId;
|
|
1566
|
+
const queries = params.queries;
|
|
1567
|
+
const transactionId = params.transactionId;
|
|
1568
|
+
|
|
1569
|
+
if (typeof databaseId === 'undefined') {
|
|
1570
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1571
|
+
}
|
|
1572
|
+
if (typeof collectionId === 'undefined') {
|
|
1573
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1577
|
+
const payload: Payload = {};
|
|
1578
|
+
if (typeof queries !== 'undefined') {
|
|
1579
|
+
payload['queries'] = queries;
|
|
1580
|
+
}
|
|
1581
|
+
if (typeof transactionId !== 'undefined') {
|
|
1582
|
+
payload['transactionId'] = transactionId;
|
|
1583
|
+
}
|
|
1584
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1585
|
+
|
|
1586
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1587
|
+
'content-type': 'application/json',
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
return this.client.call(
|
|
1591
|
+
'delete',
|
|
1592
|
+
uri,
|
|
1593
|
+
apiHeaders,
|
|
1594
|
+
payload
|
|
1595
|
+
);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
/**
|
|
1599
|
+
*
|
|
1600
|
+
* @param {string} params.databaseId - Database ID.
|
|
1601
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1602
|
+
* @param {string} params.documentId - Document ID.
|
|
1603
|
+
* @param {string[]} params.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.
|
|
1604
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
1605
|
+
* @throws {AppwriteException}
|
|
1606
|
+
* @returns {Promise<Document>}
|
|
1607
|
+
*/
|
|
1608
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }): Promise<Document>;
|
|
1609
|
+
/**
|
|
1610
|
+
*
|
|
1611
|
+
* @param {string} databaseId - Database ID.
|
|
1612
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1613
|
+
* @param {string} documentId - Document ID.
|
|
1614
|
+
* @param {string[]} 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.
|
|
1615
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
1616
|
+
* @throws {AppwriteException}
|
|
1617
|
+
* @returns {Promise<Document>}
|
|
1618
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1619
|
+
*/
|
|
1620
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string): Promise<Document>;
|
|
1621
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
1622
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string } | string,
|
|
1623
|
+
...rest: [(string)?, (string)?, (string[])?, (string)?]
|
|
1624
|
+
): Promise<Document> {
|
|
1625
|
+
let params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string };
|
|
1626
|
+
|
|
1627
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1628
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string };
|
|
1629
|
+
} else {
|
|
1630
|
+
params = {
|
|
1631
|
+
databaseId: paramsOrFirst as string,
|
|
1632
|
+
collectionId: rest[0] as string,
|
|
1633
|
+
documentId: rest[1] as string,
|
|
1634
|
+
queries: rest[2] as string[],
|
|
1635
|
+
transactionId: rest[3] as string
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
const databaseId = params.databaseId;
|
|
1640
|
+
const collectionId = params.collectionId;
|
|
1641
|
+
const documentId = params.documentId;
|
|
1642
|
+
const queries = params.queries;
|
|
1643
|
+
const transactionId = params.transactionId;
|
|
1644
|
+
|
|
1645
|
+
if (typeof databaseId === 'undefined') {
|
|
1646
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1647
|
+
}
|
|
1648
|
+
if (typeof collectionId === 'undefined') {
|
|
1649
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1650
|
+
}
|
|
1651
|
+
if (typeof documentId === 'undefined') {
|
|
1652
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1656
|
+
const payload: Payload = {};
|
|
1657
|
+
if (typeof queries !== 'undefined') {
|
|
1658
|
+
payload['queries'] = queries;
|
|
1659
|
+
}
|
|
1660
|
+
if (typeof transactionId !== 'undefined') {
|
|
1661
|
+
payload['transactionId'] = transactionId;
|
|
1662
|
+
}
|
|
1663
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1664
|
+
|
|
1665
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
return this.client.call(
|
|
1669
|
+
'get',
|
|
1670
|
+
uri,
|
|
1671
|
+
apiHeaders,
|
|
1672
|
+
payload
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
*
|
|
1678
|
+
* @param {string} params.databaseId - Database ID.
|
|
1679
|
+
* @param {string} params.collectionId - Collection ID.
|
|
1680
|
+
* @param {string} params.documentId - Document ID.
|
|
1681
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include all required fields of the document to be created or updated.
|
|
1682
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1683
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
1684
|
+
* @throws {AppwriteException}
|
|
1685
|
+
* @returns {Promise<Document>}
|
|
1686
|
+
*/
|
|
1687
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>;
|
|
1688
|
+
/**
|
|
1689
|
+
*
|
|
1690
|
+
* @param {string} databaseId - Database ID.
|
|
1691
|
+
* @param {string} collectionId - Collection ID.
|
|
1692
|
+
* @param {string} documentId - Document ID.
|
|
1693
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include all required fields of the document to be created or updated.
|
|
1694
|
+
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1695
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
1696
|
+
* @throws {AppwriteException}
|
|
1697
|
+
* @returns {Promise<Document>}
|
|
1698
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1699
|
+
*/
|
|
1700
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
|
|
1701
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
1702
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string,
|
|
1703
|
+
...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?]
|
|
1704
|
+
): Promise<Document> {
|
|
1705
|
+
let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
|
|
1706
|
+
|
|
1707
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1708
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
|
|
1709
|
+
} else {
|
|
1710
|
+
params = {
|
|
1711
|
+
databaseId: paramsOrFirst as string,
|
|
1712
|
+
collectionId: rest[0] as string,
|
|
1713
|
+
documentId: rest[1] as string,
|
|
1714
|
+
data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>,
|
|
1715
|
+
permissions: rest[3] as string[],
|
|
1716
|
+
transactionId: rest[4] as string
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
const databaseId = params.databaseId;
|
|
1721
|
+
const collectionId = params.collectionId;
|
|
1722
|
+
const documentId = params.documentId;
|
|
1723
|
+
const data = params.data;
|
|
1724
|
+
const permissions = params.permissions;
|
|
1725
|
+
const transactionId = params.transactionId;
|
|
1726
|
+
|
|
1727
|
+
if (typeof databaseId === 'undefined') {
|
|
1728
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1729
|
+
}
|
|
1730
|
+
if (typeof collectionId === 'undefined') {
|
|
1731
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1732
|
+
}
|
|
1733
|
+
if (typeof documentId === 'undefined') {
|
|
1734
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1738
|
+
const payload: Payload = {};
|
|
1739
|
+
if (typeof data !== 'undefined') {
|
|
1740
|
+
payload['data'] = data;
|
|
1741
|
+
}
|
|
1742
|
+
if (typeof permissions !== 'undefined') {
|
|
1743
|
+
payload['permissions'] = permissions;
|
|
1744
|
+
}
|
|
1745
|
+
if (typeof transactionId !== 'undefined') {
|
|
1746
|
+
payload['transactionId'] = transactionId;
|
|
1747
|
+
}
|
|
1748
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1749
|
+
|
|
1750
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1751
|
+
'content-type': 'application/json',
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
return this.client.call(
|
|
1755
|
+
'put',
|
|
1756
|
+
uri,
|
|
1757
|
+
apiHeaders,
|
|
1758
|
+
payload
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
*
|
|
1764
|
+
* @param {string} params.databaseId - Database ID.
|
|
1765
|
+
* @param {string} params.collectionId - Collection ID.
|
|
1766
|
+
* @param {string} params.documentId - Document ID.
|
|
1767
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include only fields and value pairs to be updated.
|
|
1768
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1769
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
1770
|
+
* @throws {AppwriteException}
|
|
1771
|
+
* @returns {Promise<Document>}
|
|
1772
|
+
*/
|
|
1773
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>;
|
|
1774
|
+
/**
|
|
1775
|
+
*
|
|
1776
|
+
* @param {string} databaseId - Database ID.
|
|
1777
|
+
* @param {string} collectionId - Collection ID.
|
|
1778
|
+
* @param {string} documentId - Document ID.
|
|
1779
|
+
* @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include only fields and value pairs to be updated.
|
|
1780
|
+
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1781
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
1782
|
+
* @throws {AppwriteException}
|
|
1783
|
+
* @returns {Promise<Document>}
|
|
1784
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1785
|
+
*/
|
|
1786
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
|
|
1787
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(
|
|
1788
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string,
|
|
1789
|
+
...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?]
|
|
1790
|
+
): Promise<Document> {
|
|
1791
|
+
let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
|
|
1792
|
+
|
|
1793
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1794
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
|
|
1795
|
+
} else {
|
|
1796
|
+
params = {
|
|
1797
|
+
databaseId: paramsOrFirst as string,
|
|
1798
|
+
collectionId: rest[0] as string,
|
|
1799
|
+
documentId: rest[1] as string,
|
|
1800
|
+
data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>,
|
|
1801
|
+
permissions: rest[3] as string[],
|
|
1802
|
+
transactionId: rest[4] as string
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
const databaseId = params.databaseId;
|
|
1807
|
+
const collectionId = params.collectionId;
|
|
1808
|
+
const documentId = params.documentId;
|
|
1809
|
+
const data = params.data;
|
|
1810
|
+
const permissions = params.permissions;
|
|
1811
|
+
const transactionId = params.transactionId;
|
|
1812
|
+
|
|
1813
|
+
if (typeof databaseId === 'undefined') {
|
|
1814
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1815
|
+
}
|
|
1816
|
+
if (typeof collectionId === 'undefined') {
|
|
1817
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1818
|
+
}
|
|
1819
|
+
if (typeof documentId === 'undefined') {
|
|
1820
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1824
|
+
const payload: Payload = {};
|
|
1825
|
+
if (typeof data !== 'undefined') {
|
|
1826
|
+
payload['data'] = data;
|
|
1827
|
+
}
|
|
1828
|
+
if (typeof permissions !== 'undefined') {
|
|
1829
|
+
payload['permissions'] = permissions;
|
|
1830
|
+
}
|
|
1831
|
+
if (typeof transactionId !== 'undefined') {
|
|
1832
|
+
payload['transactionId'] = transactionId;
|
|
1833
|
+
}
|
|
1834
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1835
|
+
|
|
1836
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1837
|
+
'content-type': 'application/json',
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
return this.client.call(
|
|
1841
|
+
'patch',
|
|
1842
|
+
uri,
|
|
1843
|
+
apiHeaders,
|
|
1844
|
+
payload
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
*
|
|
1850
|
+
* @param {string} params.databaseId - Database ID.
|
|
1851
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1852
|
+
* @param {string} params.documentId - Document ID.
|
|
1853
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
1854
|
+
* @throws {AppwriteException}
|
|
1855
|
+
* @returns {Promise<{}>}
|
|
1856
|
+
*/
|
|
1857
|
+
deleteDocument(params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }): Promise<{}>;
|
|
1858
|
+
/**
|
|
1859
|
+
*
|
|
1860
|
+
* @param {string} databaseId - Database ID.
|
|
1861
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1862
|
+
* @param {string} documentId - Document ID.
|
|
1863
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
1864
|
+
* @throws {AppwriteException}
|
|
1865
|
+
* @returns {Promise<{}>}
|
|
1866
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1867
|
+
*/
|
|
1868
|
+
deleteDocument(databaseId: string, collectionId: string, documentId: string, transactionId?: string): Promise<{}>;
|
|
1869
|
+
deleteDocument(
|
|
1870
|
+
paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, transactionId?: string } | string,
|
|
1871
|
+
...rest: [(string)?, (string)?, (string)?]
|
|
1872
|
+
): Promise<{}> {
|
|
1873
|
+
let params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string };
|
|
1874
|
+
|
|
1875
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1876
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, transactionId?: string };
|
|
1877
|
+
} else {
|
|
1878
|
+
params = {
|
|
1879
|
+
databaseId: paramsOrFirst as string,
|
|
1880
|
+
collectionId: rest[0] as string,
|
|
1881
|
+
documentId: rest[1] as string,
|
|
1882
|
+
transactionId: rest[2] as string
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
const databaseId = params.databaseId;
|
|
1887
|
+
const collectionId = params.collectionId;
|
|
1888
|
+
const documentId = params.documentId;
|
|
1889
|
+
const transactionId = params.transactionId;
|
|
1890
|
+
|
|
1891
|
+
if (typeof databaseId === 'undefined') {
|
|
1892
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1893
|
+
}
|
|
1894
|
+
if (typeof collectionId === 'undefined') {
|
|
1895
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1896
|
+
}
|
|
1897
|
+
if (typeof documentId === 'undefined') {
|
|
1898
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
1902
|
+
const payload: Payload = {};
|
|
1903
|
+
if (typeof transactionId !== 'undefined') {
|
|
1904
|
+
payload['transactionId'] = transactionId;
|
|
1905
|
+
}
|
|
1906
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1907
|
+
|
|
1908
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1909
|
+
'content-type': 'application/json',
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
return this.client.call(
|
|
1913
|
+
'delete',
|
|
1914
|
+
uri,
|
|
1915
|
+
apiHeaders,
|
|
1916
|
+
payload
|
|
1917
|
+
);
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
/**
|
|
1921
|
+
*
|
|
1922
|
+
* @param {string} params.databaseId - Database ID.
|
|
1923
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1924
|
+
* @param {string[]} params.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. You may filter on the following attributes: key, type, status, attributes, error
|
|
1925
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
1926
|
+
* @throws {AppwriteException}
|
|
1927
|
+
* @returns {Promise<Models.IndexList>}
|
|
1928
|
+
*/
|
|
1929
|
+
listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>;
|
|
1930
|
+
/**
|
|
1931
|
+
*
|
|
1932
|
+
* @param {string} databaseId - Database ID.
|
|
1933
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1934
|
+
* @param {string[]} 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. You may filter on the following attributes: key, type, status, attributes, error
|
|
1935
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
1936
|
+
* @throws {AppwriteException}
|
|
1937
|
+
* @returns {Promise<Models.IndexList>}
|
|
1938
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1939
|
+
*/
|
|
1940
|
+
listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>;
|
|
1941
|
+
listIndexes(
|
|
1942
|
+
paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string,
|
|
1943
|
+
...rest: [(string)?, (string[])?, (boolean)?]
|
|
1944
|
+
): Promise<Models.IndexList> {
|
|
1945
|
+
let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean };
|
|
1946
|
+
|
|
1947
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1948
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean };
|
|
1949
|
+
} else {
|
|
1950
|
+
params = {
|
|
1951
|
+
databaseId: paramsOrFirst as string,
|
|
1952
|
+
collectionId: rest[0] as string,
|
|
1953
|
+
queries: rest[1] as string[],
|
|
1954
|
+
total: rest[2] as boolean
|
|
1955
|
+
};
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
const databaseId = params.databaseId;
|
|
1959
|
+
const collectionId = params.collectionId;
|
|
1960
|
+
const queries = params.queries;
|
|
1961
|
+
const total = params.total;
|
|
1962
|
+
|
|
1963
|
+
if (typeof databaseId === 'undefined') {
|
|
1964
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1965
|
+
}
|
|
1966
|
+
if (typeof collectionId === 'undefined') {
|
|
1967
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1971
|
+
const payload: Payload = {};
|
|
1972
|
+
if (typeof queries !== 'undefined') {
|
|
1973
|
+
payload['queries'] = queries;
|
|
1974
|
+
}
|
|
1975
|
+
if (typeof total !== 'undefined') {
|
|
1976
|
+
payload['total'] = total;
|
|
1977
|
+
}
|
|
1978
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1979
|
+
|
|
1980
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
return this.client.call(
|
|
1984
|
+
'get',
|
|
1985
|
+
uri,
|
|
1986
|
+
apiHeaders,
|
|
1987
|
+
payload
|
|
1988
|
+
);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
*
|
|
1993
|
+
* @param {string} params.databaseId - Database ID.
|
|
1994
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1995
|
+
* @param {string} params.key - Index Key.
|
|
1996
|
+
* @param {VectorsDBIndexType} params.type - Index type.
|
|
1997
|
+
* @param {string[]} params.attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
|
|
1998
|
+
* @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed.
|
|
1999
|
+
* @param {number[]} params.lengths - Length of index. Maximum of 100
|
|
2000
|
+
* @throws {AppwriteException}
|
|
2001
|
+
* @returns {Promise<Models.Index>}
|
|
2002
|
+
*/
|
|
2003
|
+
createIndex(params: { databaseId: string, collectionId: string, key: string, type: VectorsDBIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>;
|
|
2004
|
+
/**
|
|
2005
|
+
*
|
|
2006
|
+
* @param {string} databaseId - Database ID.
|
|
2007
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2008
|
+
* @param {string} key - Index Key.
|
|
2009
|
+
* @param {VectorsDBIndexType} type - Index type.
|
|
2010
|
+
* @param {string[]} attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
|
|
2011
|
+
* @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed.
|
|
2012
|
+
* @param {number[]} lengths - Length of index. Maximum of 100
|
|
2013
|
+
* @throws {AppwriteException}
|
|
2014
|
+
* @returns {Promise<Models.Index>}
|
|
2015
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2016
|
+
*/
|
|
2017
|
+
createIndex(databaseId: string, collectionId: string, key: string, type: VectorsDBIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>;
|
|
2018
|
+
createIndex(
|
|
2019
|
+
paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: VectorsDBIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string,
|
|
2020
|
+
...rest: [(string)?, (string)?, (VectorsDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?]
|
|
2021
|
+
): Promise<Models.Index> {
|
|
2022
|
+
let params: { databaseId: string, collectionId: string, key: string, type: VectorsDBIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] };
|
|
2023
|
+
|
|
2024
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2025
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: VectorsDBIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] };
|
|
2026
|
+
} else {
|
|
2027
|
+
params = {
|
|
2028
|
+
databaseId: paramsOrFirst as string,
|
|
2029
|
+
collectionId: rest[0] as string,
|
|
2030
|
+
key: rest[1] as string,
|
|
2031
|
+
type: rest[2] as VectorsDBIndexType,
|
|
2032
|
+
attributes: rest[3] as string[],
|
|
2033
|
+
orders: rest[4] as OrderBy[],
|
|
2034
|
+
lengths: rest[5] as number[]
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
const databaseId = params.databaseId;
|
|
2039
|
+
const collectionId = params.collectionId;
|
|
2040
|
+
const key = params.key;
|
|
2041
|
+
const type = params.type;
|
|
2042
|
+
const attributes = params.attributes;
|
|
2043
|
+
const orders = params.orders;
|
|
2044
|
+
const lengths = params.lengths;
|
|
2045
|
+
|
|
2046
|
+
if (typeof databaseId === 'undefined') {
|
|
2047
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2048
|
+
}
|
|
2049
|
+
if (typeof collectionId === 'undefined') {
|
|
2050
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2051
|
+
}
|
|
2052
|
+
if (typeof key === 'undefined') {
|
|
2053
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
2054
|
+
}
|
|
2055
|
+
if (typeof type === 'undefined') {
|
|
2056
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
2057
|
+
}
|
|
2058
|
+
if (typeof attributes === 'undefined') {
|
|
2059
|
+
throw new AppwriteException('Missing required parameter: "attributes"');
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2063
|
+
const payload: Payload = {};
|
|
2064
|
+
if (typeof key !== 'undefined') {
|
|
2065
|
+
payload['key'] = key;
|
|
2066
|
+
}
|
|
2067
|
+
if (typeof type !== 'undefined') {
|
|
2068
|
+
payload['type'] = type;
|
|
2069
|
+
}
|
|
2070
|
+
if (typeof attributes !== 'undefined') {
|
|
2071
|
+
payload['attributes'] = attributes;
|
|
2072
|
+
}
|
|
2073
|
+
if (typeof orders !== 'undefined') {
|
|
2074
|
+
payload['orders'] = orders;
|
|
2075
|
+
}
|
|
2076
|
+
if (typeof lengths !== 'undefined') {
|
|
2077
|
+
payload['lengths'] = lengths;
|
|
2078
|
+
}
|
|
2079
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2080
|
+
|
|
2081
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2082
|
+
'content-type': 'application/json',
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
return this.client.call(
|
|
2086
|
+
'post',
|
|
2087
|
+
uri,
|
|
2088
|
+
apiHeaders,
|
|
2089
|
+
payload
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
*
|
|
2095
|
+
* @param {string} params.databaseId - Database ID.
|
|
2096
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2097
|
+
* @param {string} params.key - Index Key.
|
|
2098
|
+
* @throws {AppwriteException}
|
|
2099
|
+
* @returns {Promise<Models.Index>}
|
|
2100
|
+
*/
|
|
2101
|
+
getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>;
|
|
2102
|
+
/**
|
|
2103
|
+
*
|
|
2104
|
+
* @param {string} databaseId - Database ID.
|
|
2105
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2106
|
+
* @param {string} key - Index Key.
|
|
2107
|
+
* @throws {AppwriteException}
|
|
2108
|
+
* @returns {Promise<Models.Index>}
|
|
2109
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2110
|
+
*/
|
|
2111
|
+
getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>;
|
|
2112
|
+
getIndex(
|
|
2113
|
+
paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string,
|
|
2114
|
+
...rest: [(string)?, (string)?]
|
|
2115
|
+
): Promise<Models.Index> {
|
|
2116
|
+
let params: { databaseId: string, collectionId: string, key: string };
|
|
2117
|
+
|
|
2118
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2119
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string };
|
|
2120
|
+
} else {
|
|
2121
|
+
params = {
|
|
2122
|
+
databaseId: paramsOrFirst as string,
|
|
2123
|
+
collectionId: rest[0] as string,
|
|
2124
|
+
key: rest[1] as string
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
const databaseId = params.databaseId;
|
|
2129
|
+
const collectionId = params.collectionId;
|
|
2130
|
+
const key = params.key;
|
|
2131
|
+
|
|
2132
|
+
if (typeof databaseId === 'undefined') {
|
|
2133
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2134
|
+
}
|
|
2135
|
+
if (typeof collectionId === 'undefined') {
|
|
2136
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2137
|
+
}
|
|
2138
|
+
if (typeof key === 'undefined') {
|
|
2139
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
2143
|
+
const payload: Payload = {};
|
|
2144
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2145
|
+
|
|
2146
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
return this.client.call(
|
|
2150
|
+
'get',
|
|
2151
|
+
uri,
|
|
2152
|
+
apiHeaders,
|
|
2153
|
+
payload
|
|
2154
|
+
);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
*
|
|
2159
|
+
* @param {string} params.databaseId - Database ID.
|
|
2160
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2161
|
+
* @param {string} params.key - Index Key.
|
|
2162
|
+
* @throws {AppwriteException}
|
|
2163
|
+
* @returns {Promise<{}>}
|
|
2164
|
+
*/
|
|
2165
|
+
deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>;
|
|
2166
|
+
/**
|
|
2167
|
+
*
|
|
2168
|
+
* @param {string} databaseId - Database ID.
|
|
2169
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
2170
|
+
* @param {string} key - Index Key.
|
|
2171
|
+
* @throws {AppwriteException}
|
|
2172
|
+
* @returns {Promise<{}>}
|
|
2173
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2174
|
+
*/
|
|
2175
|
+
deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}>;
|
|
2176
|
+
deleteIndex(
|
|
2177
|
+
paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string,
|
|
2178
|
+
...rest: [(string)?, (string)?]
|
|
2179
|
+
): Promise<{}> {
|
|
2180
|
+
let params: { databaseId: string, collectionId: string, key: string };
|
|
2181
|
+
|
|
2182
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2183
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string };
|
|
2184
|
+
} else {
|
|
2185
|
+
params = {
|
|
2186
|
+
databaseId: paramsOrFirst as string,
|
|
2187
|
+
collectionId: rest[0] as string,
|
|
2188
|
+
key: rest[1] as string
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
const databaseId = params.databaseId;
|
|
2193
|
+
const collectionId = params.collectionId;
|
|
2194
|
+
const key = params.key;
|
|
2195
|
+
|
|
2196
|
+
if (typeof databaseId === 'undefined') {
|
|
2197
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2198
|
+
}
|
|
2199
|
+
if (typeof collectionId === 'undefined') {
|
|
2200
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2201
|
+
}
|
|
2202
|
+
if (typeof key === 'undefined') {
|
|
2203
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
2207
|
+
const payload: Payload = {};
|
|
2208
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2209
|
+
|
|
2210
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2211
|
+
'content-type': 'application/json',
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
return this.client.call(
|
|
2215
|
+
'delete',
|
|
2216
|
+
uri,
|
|
2217
|
+
apiHeaders,
|
|
2218
|
+
payload
|
|
2219
|
+
);
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
*
|
|
2224
|
+
* @param {string} params.databaseId - Database ID.
|
|
2225
|
+
* @param {string} params.collectionId - Collection ID.
|
|
2226
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
2227
|
+
* @throws {AppwriteException}
|
|
2228
|
+
* @returns {Promise<Models.LogList>}
|
|
2229
|
+
*/
|
|
2230
|
+
listCollectionLogs(params: { databaseId: string, collectionId: string, queries?: string[] }): Promise<Models.LogList>;
|
|
2231
|
+
/**
|
|
2232
|
+
*
|
|
2233
|
+
* @param {string} databaseId - Database ID.
|
|
2234
|
+
* @param {string} collectionId - Collection ID.
|
|
2235
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
2236
|
+
* @throws {AppwriteException}
|
|
2237
|
+
* @returns {Promise<Models.LogList>}
|
|
2238
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2239
|
+
*/
|
|
2240
|
+
listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.LogList>;
|
|
2241
|
+
listCollectionLogs(
|
|
2242
|
+
paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[] } | string,
|
|
2243
|
+
...rest: [(string)?, (string[])?]
|
|
2244
|
+
): Promise<Models.LogList> {
|
|
2245
|
+
let params: { databaseId: string, collectionId: string, queries?: string[] };
|
|
2246
|
+
|
|
2247
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2248
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[] };
|
|
2249
|
+
} else {
|
|
2250
|
+
params = {
|
|
2251
|
+
databaseId: paramsOrFirst as string,
|
|
2252
|
+
collectionId: rest[0] as string,
|
|
2253
|
+
queries: rest[1] as string[]
|
|
2254
|
+
};
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
const databaseId = params.databaseId;
|
|
2258
|
+
const collectionId = params.collectionId;
|
|
2259
|
+
const queries = params.queries;
|
|
2260
|
+
|
|
2261
|
+
if (typeof databaseId === 'undefined') {
|
|
2262
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2263
|
+
}
|
|
2264
|
+
if (typeof collectionId === 'undefined') {
|
|
2265
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2269
|
+
const payload: Payload = {};
|
|
2270
|
+
if (typeof queries !== 'undefined') {
|
|
2271
|
+
payload['queries'] = queries;
|
|
2272
|
+
}
|
|
2273
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2274
|
+
|
|
2275
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
return this.client.call(
|
|
2279
|
+
'get',
|
|
2280
|
+
uri,
|
|
2281
|
+
apiHeaders,
|
|
2282
|
+
payload
|
|
2283
|
+
);
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
/**
|
|
2287
|
+
*
|
|
2288
|
+
* @param {string} params.databaseId - Database ID.
|
|
2289
|
+
* @param {string} params.collectionId - Collection ID.
|
|
2290
|
+
* @param {UsageRange} params.range - Date range.
|
|
2291
|
+
* @throws {AppwriteException}
|
|
2292
|
+
* @returns {Promise<Models.UsageCollection>}
|
|
2293
|
+
*/
|
|
2294
|
+
getCollectionUsage(params: { databaseId: string, collectionId: string, range?: UsageRange }): Promise<Models.UsageCollection>;
|
|
2295
|
+
/**
|
|
2296
|
+
*
|
|
2297
|
+
* @param {string} databaseId - Database ID.
|
|
2298
|
+
* @param {string} collectionId - Collection ID.
|
|
2299
|
+
* @param {UsageRange} range - Date range.
|
|
2300
|
+
* @throws {AppwriteException}
|
|
2301
|
+
* @returns {Promise<Models.UsageCollection>}
|
|
2302
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2303
|
+
*/
|
|
2304
|
+
getCollectionUsage(databaseId: string, collectionId: string, range?: UsageRange): Promise<Models.UsageCollection>;
|
|
2305
|
+
getCollectionUsage(
|
|
2306
|
+
paramsOrFirst: { databaseId: string, collectionId: string, range?: UsageRange } | string,
|
|
2307
|
+
...rest: [(string)?, (UsageRange)?]
|
|
2308
|
+
): Promise<Models.UsageCollection> {
|
|
2309
|
+
let params: { databaseId: string, collectionId: string, range?: UsageRange };
|
|
2310
|
+
|
|
2311
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2312
|
+
params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, range?: UsageRange };
|
|
2313
|
+
} else {
|
|
2314
|
+
params = {
|
|
2315
|
+
databaseId: paramsOrFirst as string,
|
|
2316
|
+
collectionId: rest[0] as string,
|
|
2317
|
+
range: rest[1] as UsageRange
|
|
2318
|
+
};
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
const databaseId = params.databaseId;
|
|
2322
|
+
const collectionId = params.collectionId;
|
|
2323
|
+
const range = params.range;
|
|
2324
|
+
|
|
2325
|
+
if (typeof databaseId === 'undefined') {
|
|
2326
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2327
|
+
}
|
|
2328
|
+
if (typeof collectionId === 'undefined') {
|
|
2329
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
const apiPath = '/vectorsdb/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2333
|
+
const payload: Payload = {};
|
|
2334
|
+
if (typeof range !== 'undefined') {
|
|
2335
|
+
payload['range'] = range;
|
|
2336
|
+
}
|
|
2337
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2338
|
+
|
|
2339
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
return this.client.call(
|
|
2343
|
+
'get',
|
|
2344
|
+
uri,
|
|
2345
|
+
apiHeaders,
|
|
2346
|
+
payload
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
*
|
|
2352
|
+
* @param {string} params.databaseId - Database ID.
|
|
2353
|
+
* @param {UsageRange} params.range - Date range.
|
|
2354
|
+
* @throws {AppwriteException}
|
|
2355
|
+
* @returns {Promise<Models.UsageVectorsDB>}
|
|
2356
|
+
*/
|
|
2357
|
+
getUsage(params: { databaseId: string, range?: UsageRange }): Promise<Models.UsageVectorsDB>;
|
|
2358
|
+
/**
|
|
2359
|
+
*
|
|
2360
|
+
* @param {string} databaseId - Database ID.
|
|
2361
|
+
* @param {UsageRange} range - Date range.
|
|
2362
|
+
* @throws {AppwriteException}
|
|
2363
|
+
* @returns {Promise<Models.UsageVectorsDB>}
|
|
2364
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2365
|
+
*/
|
|
2366
|
+
getUsage(databaseId: string, range?: UsageRange): Promise<Models.UsageVectorsDB>;
|
|
2367
|
+
getUsage(
|
|
2368
|
+
paramsOrFirst: { databaseId: string, range?: UsageRange } | string,
|
|
2369
|
+
...rest: [(UsageRange)?]
|
|
2370
|
+
): Promise<Models.UsageVectorsDB> {
|
|
2371
|
+
let params: { databaseId: string, range?: UsageRange };
|
|
2372
|
+
|
|
2373
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2374
|
+
params = (paramsOrFirst || {}) as { databaseId: string, range?: UsageRange };
|
|
2375
|
+
} else {
|
|
2376
|
+
params = {
|
|
2377
|
+
databaseId: paramsOrFirst as string,
|
|
2378
|
+
range: rest[0] as UsageRange
|
|
2379
|
+
};
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
const databaseId = params.databaseId;
|
|
2383
|
+
const range = params.range;
|
|
2384
|
+
|
|
2385
|
+
if (typeof databaseId === 'undefined') {
|
|
2386
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
const apiPath = '/vectorsdb/{databaseId}/usage'.replace('{databaseId}', databaseId);
|
|
2390
|
+
const payload: Payload = {};
|
|
2391
|
+
if (typeof range !== 'undefined') {
|
|
2392
|
+
payload['range'] = range;
|
|
2393
|
+
}
|
|
2394
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2395
|
+
|
|
2396
|
+
const apiHeaders: { [header: string]: string } = {
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
return this.client.call(
|
|
2400
|
+
'get',
|
|
2401
|
+
uri,
|
|
2402
|
+
apiHeaders,
|
|
2403
|
+
payload
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
}
|