0
Update Collection
One script reply has been approved by the moderators Verified
Created by adam186 596 days ago Viewed 9079 times
0
Submitted by adam186 Deno
Verified 596 days ago
1
import { Client, Databases } from "https://deno.land/x/appwrite@7.0.0/mod.ts";
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_name: string,
13
  collection_id: string,
14
  collection_permissions?: string[],
15
  collection_document_security?: boolean,
16
  collection_enabled?: boolean,
17
) {
18
  const client = new Client()
19
    .setEndpoint(auth.endpoint)
20
    .setProject(auth.project)
21
    .setKey(auth.key);
22
  const db = new Databases(client);
23

24
  return await db.updateCollection(
25
    database_id,
26
    collection_id,
27
    collection_name,
28
    collection_permissions,
29
    collection_document_security,
30
    collection_enabled,
31
  );
32
}
33