1 | import { Client, Databases, ID } from "[email protected]"; |
2 |
|
3 | type Appwrite = { |
4 | endpoint: string; |
5 | project: string; |
6 | key: string; |
7 | self_signed: boolean; |
8 | }; |
9 | export async function main( |
10 | auth: Appwrite, |
11 | database_id: string, |
12 | collection_id: string, |
13 | document_id: string, |
14 | document_data?: Record<string | number, any>, |
15 | document_permissions?: string[], |
16 | ) { |
17 | const client = new Client() |
18 | .setEndpoint(auth.endpoint) |
19 | .setProject(auth.project) |
20 | .setKey(auth.key); |
21 | const db = new Databases(client); |
22 |
|
23 | return await db.updateDocument( |
24 | database_id, |
25 | collection_id, |
26 | document_id, |
27 | document_data, |
28 | document_permissions, |
29 | ); |
30 | } |
31 |
|