agentbase-web-sdk 2.6.0-fix1
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/LICENSE +0 -0
- package/README.md +41 -0
- package/dist/cjs/sdk.js +13833 -0
- package/dist/cjs/sdk.js.map +1 -0
- package/dist/esm/sdk.js +13805 -0
- package/dist/esm/sdk.js.map +1 -0
- package/dist/iife/sdk.js +17632 -0
- package/package.json +50 -0
- package/types/channel.d.ts +79 -0
- package/types/client.d.ts +289 -0
- package/types/enums/authentication-factor.d.ts +6 -0
- package/types/enums/authenticator-type.d.ts +3 -0
- package/types/enums/browser-permission.d.ts +22 -0
- package/types/enums/browser.d.ts +16 -0
- package/types/enums/credit-card.d.ts +19 -0
- package/types/enums/distillation-message-role.d.ts +6 -0
- package/types/enums/distillation-mode.d.ts +4 -0
- package/types/enums/distillation-tool-status.d.ts +4 -0
- package/types/enums/execution-method.d.ts +9 -0
- package/types/enums/execution-status.d.ts +7 -0
- package/types/enums/execution-trigger.d.ts +5 -0
- package/types/enums/export-job-mode.d.ts +4 -0
- package/types/enums/export-mode.d.ts +3 -0
- package/types/enums/feedback-type.d.ts +5 -0
- package/types/enums/flag.d.ts +197 -0
- package/types/enums/format.d.ts +4 -0
- package/types/enums/image-format.d.ts +9 -0
- package/types/enums/image-gravity.d.ts +11 -0
- package/types/enums/kind.d.ts +6 -0
- package/types/enums/kinds.d.ts +6 -0
- package/types/enums/knowledge-base-data-source-document-import-result-status.d.ts +5 -0
- package/types/enums/memory-access-mode.d.ts +4 -0
- package/types/enums/memory-batch-operation.d.ts +5 -0
- package/types/enums/memory-bulk-delete-item-status.d.ts +4 -0
- package/types/enums/memory-bulk-delete-response-status.d.ts +4 -0
- package/types/enums/memory-handling-policy.d.ts +5 -0
- package/types/enums/memory-message-role.d.ts +5 -0
- package/types/enums/memory-record-kind.d.ts +5 -0
- package/types/enums/memory-record-sensitivity.d.ts +5 -0
- package/types/enums/memory-scope.d.ts +7 -0
- package/types/enums/memory-sensitivity.d.ts +6 -0
- package/types/enums/memory-share-subject-type.d.ts +4 -0
- package/types/enums/o-auth-provider.d.ts +45 -0
- package/types/enums/organization-project-deletion-deletion-status.d.ts +5 -0
- package/types/enums/organization-role.d.ts +8 -0
- package/types/enums/organization-usage-range.d.ts +5 -0
- package/types/enums/outcome.d.ts +6 -0
- package/types/enums/profile-extraction-mode.d.ts +4 -0
- package/types/enums/profile-type.d.ts +4 -0
- package/types/enums/project-deletion-restore-status.d.ts +3 -0
- package/types/enums/project-deletion-result-deletion-status.d.ts +5 -0
- package/types/enums/project-deletion-result-status.d.ts +5 -0
- package/types/enums/record-kind.d.ts +5 -0
- package/types/enums/retention-policy.d.ts +3 -0
- package/types/enums/scope.d.ts +5 -0
- package/types/enums/source-type.d.ts +6 -0
- package/types/enums/status.d.ts +17 -0
- package/types/enums/theme.d.ts +4 -0
- package/types/enums/timezone.d.ts +422 -0
- package/types/enums/transaction-action.d.ts +12 -0
- package/types/enums/validation-status.d.ts +6 -0
- package/types/enums/verification-source.d.ts +5 -0
- package/types/id.d.ts +20 -0
- package/types/index.d.ts +87 -0
- package/types/models.d.ts +2537 -0
- package/types/operator.d.ts +180 -0
- package/types/permission.d.ts +43 -0
- package/types/query.d.ts +442 -0
- package/types/role.d.ts +70 -0
- package/types/service.d.ts +11 -0
- package/types/services/account.d.ts +1267 -0
- package/types/services/ai-gateway.d.ts +738 -0
- package/types/services/avatars.d.ts +320 -0
- package/types/services/databases.d.ts +437 -0
- package/types/services/documents-db.d.ts +405 -0
- package/types/services/functions.d.ts +91 -0
- package/types/services/graphql.d.ts +43 -0
- package/types/services/knowledge-bases.d.ts +117 -0
- package/types/services/llm-gateway.d.ts +282 -0
- package/types/services/locale.d.ts +64 -0
- package/types/services/memory.d.ts +1765 -0
- package/types/services/messaging.d.ts +53 -0
- package/types/services/projects.d.ts +129 -0
- package/types/services/realtime.d.ts +197 -0
- package/types/services/self-hosted-organizations.d.ts +495 -0
- package/types/services/storage.d.ts +259 -0
- package/types/services/tables-db.d.ts +434 -0
- package/types/services/teams.d.ts +341 -0
- package/types/services/vectors-db.d.ts +297 -0
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { Client } from '../client';
|
|
2
|
+
import type { Models } from '../models';
|
|
3
|
+
export declare class Databases {
|
|
4
|
+
client: Client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
/**
|
|
7
|
+
* List transactions across all databases.
|
|
8
|
+
*
|
|
9
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries).
|
|
10
|
+
* @throws {AgentbaseException}
|
|
11
|
+
* @returns {Promise<Models.TransactionList>}
|
|
12
|
+
*/
|
|
13
|
+
listTransactions(params?: {
|
|
14
|
+
queries?: string[];
|
|
15
|
+
}): Promise<Models.TransactionList>;
|
|
16
|
+
/**
|
|
17
|
+
* List transactions across all databases.
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries).
|
|
20
|
+
* @throws {AgentbaseException}
|
|
21
|
+
* @returns {Promise<Models.TransactionList>}
|
|
22
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
23
|
+
*/
|
|
24
|
+
listTransactions(queries?: string[]): Promise<Models.TransactionList>;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new transaction.
|
|
27
|
+
*
|
|
28
|
+
* @param {number} params.ttl - Seconds before the transaction expires.
|
|
29
|
+
* @throws {AgentbaseException}
|
|
30
|
+
* @returns {Promise<Models.Transaction>}
|
|
31
|
+
*/
|
|
32
|
+
createTransaction(params?: {
|
|
33
|
+
ttl?: number;
|
|
34
|
+
}): Promise<Models.Transaction>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new transaction.
|
|
37
|
+
*
|
|
38
|
+
* @param {number} ttl - Seconds before the transaction expires.
|
|
39
|
+
* @throws {AgentbaseException}
|
|
40
|
+
* @returns {Promise<Models.Transaction>}
|
|
41
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
42
|
+
*/
|
|
43
|
+
createTransaction(ttl?: number): Promise<Models.Transaction>;
|
|
44
|
+
/**
|
|
45
|
+
* Get a transaction by its unique ID.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
48
|
+
* @throws {AgentbaseException}
|
|
49
|
+
* @returns {Promise<Models.Transaction>}
|
|
50
|
+
*/
|
|
51
|
+
getTransaction(params: {
|
|
52
|
+
transactionId: string;
|
|
53
|
+
}): Promise<Models.Transaction>;
|
|
54
|
+
/**
|
|
55
|
+
* Get a transaction by its unique ID.
|
|
56
|
+
*
|
|
57
|
+
* @param {string} transactionId - Transaction ID.
|
|
58
|
+
* @throws {AgentbaseException}
|
|
59
|
+
* @returns {Promise<Models.Transaction>}
|
|
60
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
61
|
+
*/
|
|
62
|
+
getTransaction(transactionId: string): Promise<Models.Transaction>;
|
|
63
|
+
/**
|
|
64
|
+
* Update a transaction, to either commit or roll back its operations.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
67
|
+
* @param {boolean} params.commit - Commit transaction?
|
|
68
|
+
* @param {boolean} params.rollback - Rollback transaction?
|
|
69
|
+
* @throws {AgentbaseException}
|
|
70
|
+
* @returns {Promise<Models.Transaction>}
|
|
71
|
+
*/
|
|
72
|
+
updateTransaction(params: {
|
|
73
|
+
transactionId: string;
|
|
74
|
+
commit?: boolean;
|
|
75
|
+
rollback?: boolean;
|
|
76
|
+
}): Promise<Models.Transaction>;
|
|
77
|
+
/**
|
|
78
|
+
* Update a transaction, to either commit or roll back its operations.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} transactionId - Transaction ID.
|
|
81
|
+
* @param {boolean} commit - Commit transaction?
|
|
82
|
+
* @param {boolean} rollback - Rollback transaction?
|
|
83
|
+
* @throws {AgentbaseException}
|
|
84
|
+
* @returns {Promise<Models.Transaction>}
|
|
85
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
86
|
+
*/
|
|
87
|
+
updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>;
|
|
88
|
+
/**
|
|
89
|
+
* Delete a transaction by its unique ID.
|
|
90
|
+
*
|
|
91
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
92
|
+
* @throws {AgentbaseException}
|
|
93
|
+
* @returns {Promise<{}>}
|
|
94
|
+
*/
|
|
95
|
+
deleteTransaction(params: {
|
|
96
|
+
transactionId: string;
|
|
97
|
+
}): Promise<{}>;
|
|
98
|
+
/**
|
|
99
|
+
* Delete a transaction by its unique ID.
|
|
100
|
+
*
|
|
101
|
+
* @param {string} transactionId - Transaction ID.
|
|
102
|
+
* @throws {AgentbaseException}
|
|
103
|
+
* @returns {Promise<{}>}
|
|
104
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
105
|
+
*/
|
|
106
|
+
deleteTransaction(transactionId: string): Promise<{}>;
|
|
107
|
+
/**
|
|
108
|
+
* Create multiple operations in a single transaction.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
111
|
+
* @param {Models.DatabaseTransactionOperation[]} params.operations - Array of staged operations.
|
|
112
|
+
* @throws {AgentbaseException}
|
|
113
|
+
* @returns {Promise<Models.Transaction>}
|
|
114
|
+
*/
|
|
115
|
+
createOperations(params: {
|
|
116
|
+
transactionId: string;
|
|
117
|
+
operations?: Models.DatabaseTransactionOperation[];
|
|
118
|
+
}): Promise<Models.Transaction>;
|
|
119
|
+
/**
|
|
120
|
+
* Create multiple operations in a single transaction.
|
|
121
|
+
*
|
|
122
|
+
* @param {string} transactionId - Transaction ID.
|
|
123
|
+
* @param {Models.DatabaseTransactionOperation[]} operations - Array of staged operations.
|
|
124
|
+
* @throws {AgentbaseException}
|
|
125
|
+
* @returns {Promise<Models.Transaction>}
|
|
126
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
127
|
+
*/
|
|
128
|
+
createOperations(transactionId: string, operations?: Models.DatabaseTransactionOperation[]): Promise<Models.Transaction>;
|
|
129
|
+
/**
|
|
130
|
+
* Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} params.databaseId - Database ID.
|
|
133
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
|
|
134
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
135
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
136
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
137
|
+
* @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
|
|
138
|
+
* @throws {AgentbaseException}
|
|
139
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
140
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.
|
|
141
|
+
*/
|
|
142
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
143
|
+
databaseId: string;
|
|
144
|
+
collectionId: string;
|
|
145
|
+
queries?: string[];
|
|
146
|
+
transactionId?: string;
|
|
147
|
+
total?: boolean;
|
|
148
|
+
ttl?: number;
|
|
149
|
+
}): Promise<Models.DocumentList<Document>>;
|
|
150
|
+
/**
|
|
151
|
+
* Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
|
|
152
|
+
*
|
|
153
|
+
* @param {string} databaseId - Database ID.
|
|
154
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
|
|
155
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
156
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
157
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
158
|
+
* @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
|
|
159
|
+
* @throws {AgentbaseException}
|
|
160
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
161
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
162
|
+
*/
|
|
163
|
+
listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>;
|
|
164
|
+
/**
|
|
165
|
+
* Create a new Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} params.databaseId - Database ID.
|
|
168
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
169
|
+
* @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.
|
|
170
|
+
* @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.
|
|
171
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions]([HOSTNAME]/docs/permissions).
|
|
172
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
173
|
+
* @throws {AgentbaseException}
|
|
174
|
+
* @returns {Promise<Document>}
|
|
175
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead.
|
|
176
|
+
*/
|
|
177
|
+
createDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
178
|
+
databaseId: string;
|
|
179
|
+
collectionId: string;
|
|
180
|
+
documentId: string;
|
|
181
|
+
data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>;
|
|
182
|
+
permissions?: string[];
|
|
183
|
+
transactionId?: string;
|
|
184
|
+
}): Promise<Document>;
|
|
185
|
+
/**
|
|
186
|
+
* Create a new Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
187
|
+
*
|
|
188
|
+
* @param {string} databaseId - Database ID.
|
|
189
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
190
|
+
* @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.
|
|
191
|
+
* @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.
|
|
192
|
+
* @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions]([HOSTNAME]/docs/permissions).
|
|
193
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
194
|
+
* @throws {AgentbaseException}
|
|
195
|
+
* @returns {Promise<Document>}
|
|
196
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
197
|
+
*/
|
|
198
|
+
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[], transactionId?: string): Promise<Document>;
|
|
199
|
+
/**
|
|
200
|
+
* Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
201
|
+
*
|
|
202
|
+
*
|
|
203
|
+
* @param {string} params.databaseId - Database ID.
|
|
204
|
+
* @param {string} params.collectionId - Collection ID.
|
|
205
|
+
* @param {object[]} params.documents - Array of document data as JSON objects. May contain partial documents.
|
|
206
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
207
|
+
* @throws {AgentbaseException}
|
|
208
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
209
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.
|
|
210
|
+
*/
|
|
211
|
+
upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
212
|
+
databaseId: string;
|
|
213
|
+
collectionId: string;
|
|
214
|
+
documents: object[];
|
|
215
|
+
transactionId?: string;
|
|
216
|
+
}): Promise<Models.DocumentList<Document>>;
|
|
217
|
+
/**
|
|
218
|
+
* Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
219
|
+
*
|
|
220
|
+
*
|
|
221
|
+
* @param {string} databaseId - Database ID.
|
|
222
|
+
* @param {string} collectionId - Collection ID.
|
|
223
|
+
* @param {object[]} documents - Array of document data as JSON objects. May contain partial documents.
|
|
224
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
225
|
+
* @throws {AgentbaseException}
|
|
226
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
|
227
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
228
|
+
*/
|
|
229
|
+
upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>;
|
|
230
|
+
/**
|
|
231
|
+
* Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
|
|
232
|
+
*
|
|
233
|
+
* @param {string} params.databaseId - Database ID.
|
|
234
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
|
|
235
|
+
* @param {string} params.documentId - Document ID.
|
|
236
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
237
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
238
|
+
* @throws {AgentbaseException}
|
|
239
|
+
* @returns {Promise<Document>}
|
|
240
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead.
|
|
241
|
+
*/
|
|
242
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
243
|
+
databaseId: string;
|
|
244
|
+
collectionId: string;
|
|
245
|
+
documentId: string;
|
|
246
|
+
queries?: string[];
|
|
247
|
+
transactionId?: string;
|
|
248
|
+
}): Promise<Document>;
|
|
249
|
+
/**
|
|
250
|
+
* Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
|
|
251
|
+
*
|
|
252
|
+
* @param {string} databaseId - Database ID.
|
|
253
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
|
|
254
|
+
* @param {string} documentId - Document ID.
|
|
255
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
256
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
257
|
+
* @throws {AgentbaseException}
|
|
258
|
+
* @returns {Promise<Document>}
|
|
259
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
260
|
+
*/
|
|
261
|
+
getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string): Promise<Document>;
|
|
262
|
+
/**
|
|
263
|
+
* Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
264
|
+
*
|
|
265
|
+
* @param {string} params.databaseId - Database ID.
|
|
266
|
+
* @param {string} params.collectionId - Collection ID.
|
|
267
|
+
* @param {string} params.documentId - Document ID.
|
|
268
|
+
* @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 attributes of the document to be created or updated.
|
|
269
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
|
|
270
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
271
|
+
* @throws {AgentbaseException}
|
|
272
|
+
* @returns {Promise<Document>}
|
|
273
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.
|
|
274
|
+
*/
|
|
275
|
+
upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
276
|
+
databaseId: string;
|
|
277
|
+
collectionId: string;
|
|
278
|
+
documentId: string;
|
|
279
|
+
data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>;
|
|
280
|
+
permissions?: string[];
|
|
281
|
+
transactionId?: string;
|
|
282
|
+
}): Promise<Document>;
|
|
283
|
+
/**
|
|
284
|
+
* Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
|
285
|
+
*
|
|
286
|
+
* @param {string} databaseId - Database ID.
|
|
287
|
+
* @param {string} collectionId - Collection ID.
|
|
288
|
+
* @param {string} documentId - Document ID.
|
|
289
|
+
* @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 attributes of the document to be created or updated.
|
|
290
|
+
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
|
|
291
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
292
|
+
* @throws {AgentbaseException}
|
|
293
|
+
* @returns {Promise<Document>}
|
|
294
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
295
|
+
*/
|
|
296
|
+
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>;
|
|
297
|
+
/**
|
|
298
|
+
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
299
|
+
*
|
|
300
|
+
* @param {string} params.databaseId - Database ID.
|
|
301
|
+
* @param {string} params.collectionId - Collection ID.
|
|
302
|
+
* @param {string} params.documentId - Document ID.
|
|
303
|
+
* @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 attribute and value pairs to be updated.
|
|
304
|
+
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
|
|
305
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
306
|
+
* @throws {AgentbaseException}
|
|
307
|
+
* @returns {Promise<Document>}
|
|
308
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead.
|
|
309
|
+
*/
|
|
310
|
+
updateDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
311
|
+
databaseId: string;
|
|
312
|
+
collectionId: string;
|
|
313
|
+
documentId: string;
|
|
314
|
+
data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>;
|
|
315
|
+
permissions?: string[];
|
|
316
|
+
transactionId?: string;
|
|
317
|
+
}): Promise<Document>;
|
|
318
|
+
/**
|
|
319
|
+
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
320
|
+
*
|
|
321
|
+
* @param {string} databaseId - Database ID.
|
|
322
|
+
* @param {string} collectionId - Collection ID.
|
|
323
|
+
* @param {string} documentId - Document ID.
|
|
324
|
+
* @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 attribute and value pairs to be updated.
|
|
325
|
+
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
|
|
326
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
327
|
+
* @throws {AgentbaseException}
|
|
328
|
+
* @returns {Promise<Document>}
|
|
329
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
330
|
+
*/
|
|
331
|
+
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>;
|
|
332
|
+
/**
|
|
333
|
+
* Delete a document by its unique ID.
|
|
334
|
+
*
|
|
335
|
+
* @param {string} params.databaseId - Database ID.
|
|
336
|
+
* @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
|
|
337
|
+
* @param {string} params.documentId - Document ID.
|
|
338
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
339
|
+
* @throws {AgentbaseException}
|
|
340
|
+
* @returns {Promise<{}>}
|
|
341
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead.
|
|
342
|
+
*/
|
|
343
|
+
deleteDocument(params: {
|
|
344
|
+
databaseId: string;
|
|
345
|
+
collectionId: string;
|
|
346
|
+
documentId: string;
|
|
347
|
+
transactionId?: string;
|
|
348
|
+
}): Promise<{}>;
|
|
349
|
+
/**
|
|
350
|
+
* Delete a document by its unique ID.
|
|
351
|
+
*
|
|
352
|
+
* @param {string} databaseId - Database ID.
|
|
353
|
+
* @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
|
|
354
|
+
* @param {string} documentId - Document ID.
|
|
355
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
356
|
+
* @throws {AgentbaseException}
|
|
357
|
+
* @returns {Promise<{}>}
|
|
358
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
359
|
+
*/
|
|
360
|
+
deleteDocument(databaseId: string, collectionId: string, documentId: string, transactionId?: string): Promise<{}>;
|
|
361
|
+
/**
|
|
362
|
+
* Decrement a specific attribute of a document by a given value.
|
|
363
|
+
*
|
|
364
|
+
* @param {string} params.databaseId - Database ID.
|
|
365
|
+
* @param {string} params.collectionId - Collection ID.
|
|
366
|
+
* @param {string} params.documentId - Document ID.
|
|
367
|
+
* @param {string} params.attribute - Attribute key.
|
|
368
|
+
* @param {number} params.value - Value to increment the attribute by. The value must be a number.
|
|
369
|
+
* @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
|
|
370
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
371
|
+
* @throws {AgentbaseException}
|
|
372
|
+
* @returns {Promise<Document>}
|
|
373
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead.
|
|
374
|
+
*/
|
|
375
|
+
decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
376
|
+
databaseId: string;
|
|
377
|
+
collectionId: string;
|
|
378
|
+
documentId: string;
|
|
379
|
+
attribute: string;
|
|
380
|
+
value?: number;
|
|
381
|
+
min?: number;
|
|
382
|
+
transactionId?: string;
|
|
383
|
+
}): Promise<Document>;
|
|
384
|
+
/**
|
|
385
|
+
* Decrement a specific attribute of a document by a given value.
|
|
386
|
+
*
|
|
387
|
+
* @param {string} databaseId - Database ID.
|
|
388
|
+
* @param {string} collectionId - Collection ID.
|
|
389
|
+
* @param {string} documentId - Document ID.
|
|
390
|
+
* @param {string} attribute - Attribute key.
|
|
391
|
+
* @param {number} value - Value to increment the attribute by. The value must be a number.
|
|
392
|
+
* @param {number} min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
|
|
393
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
394
|
+
* @throws {AgentbaseException}
|
|
395
|
+
* @returns {Promise<Document>}
|
|
396
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
397
|
+
*/
|
|
398
|
+
decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string): Promise<Document>;
|
|
399
|
+
/**
|
|
400
|
+
* Increment a specific attribute of a document by a given value.
|
|
401
|
+
*
|
|
402
|
+
* @param {string} params.databaseId - Database ID.
|
|
403
|
+
* @param {string} params.collectionId - Collection ID.
|
|
404
|
+
* @param {string} params.documentId - Document ID.
|
|
405
|
+
* @param {string} params.attribute - Attribute key.
|
|
406
|
+
* @param {number} params.value - Value to increment the attribute by. The value must be a number.
|
|
407
|
+
* @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
|
|
408
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
409
|
+
* @throws {AgentbaseException}
|
|
410
|
+
* @returns {Promise<Document>}
|
|
411
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead.
|
|
412
|
+
*/
|
|
413
|
+
incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: {
|
|
414
|
+
databaseId: string;
|
|
415
|
+
collectionId: string;
|
|
416
|
+
documentId: string;
|
|
417
|
+
attribute: string;
|
|
418
|
+
value?: number;
|
|
419
|
+
max?: number;
|
|
420
|
+
transactionId?: string;
|
|
421
|
+
}): Promise<Document>;
|
|
422
|
+
/**
|
|
423
|
+
* Increment a specific attribute of a document by a given value.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} databaseId - Database ID.
|
|
426
|
+
* @param {string} collectionId - Collection ID.
|
|
427
|
+
* @param {string} documentId - Document ID.
|
|
428
|
+
* @param {string} attribute - Attribute key.
|
|
429
|
+
* @param {number} value - Value to increment the attribute by. The value must be a number.
|
|
430
|
+
* @param {number} max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
|
|
431
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
432
|
+
* @throws {AgentbaseException}
|
|
433
|
+
* @returns {Promise<Document>}
|
|
434
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
435
|
+
*/
|
|
436
|
+
incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string): Promise<Document>;
|
|
437
|
+
}
|