0
List Documents
One script reply has been approved by the moderators Verified
Created by adam186 381 days ago Viewed 5391 times
0
Submitted by adam186 Deno
Verified 381 days ago
1
import { Client, Databases } from "https://deno.land/x/appwrite@7.0.0/mod.ts";
2

3
/**
4
 * @param queries Array of query strings. Learn more about queries here:
5
 * https://appwrite.io/docs/queries
6
 */
7
type Appwrite = {
8
  endpoint: string;
9
  project: string;
10
  key: string;
11
  self_signed: boolean;
12
};
13
export async function main(
14
  auth: Appwrite,
15
  database_id: string,
16
  collection_id: string,
17
  queries?: string[],
18
) {
19
  const client = new Client()
20
    .setEndpoint(auth.endpoint)
21
    .setProject(auth.project)
22
    .setKey(auth.key);
23
  const db = new Databases(client);
24

25
  return await db.listDocuments(database_id, collection_id, queries);
26
}
27