0
Get Collection
One script reply has been approved by the moderators Verified
Created by adam186 623 days ago Viewed 10009 times
0
Submitted by adam186 Deno
Verified 623 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_id: string,
13
) {
14
  const client = new Client()
15
    .setEndpoint(auth.endpoint)
16
    .setProject(auth.project)
17
    .setKey(auth.key);
18
  const db = new Databases(client);
19

20
  return await db.getCollection(database_id, collection_id);
21
}
22