0
List Collections
One script reply has been approved by the moderators Verified
Created by adam186 614 days ago Viewed 9191 times
0
Submitted by adam186 Deno
Verified 614 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
 * @param search Search term to filter your list results.
8
 */
9
type Appwrite = {
10
  endpoint: string;
11
  project: string;
12
  key: string;
13
  self_signed: boolean;
14
};
15
export async function main(
16
  auth: Appwrite,
17
  database_id: string,
18
  queries?: string[],
19
  search?: string,
20
) {
21
  const client = new Client()
22
    .setEndpoint(auth.endpoint)
23
    .setProject(auth.project)
24
    .setKey(auth.key);
25
  const db = new Databases(client);
26

27
  return await db.listCollections(database_id, queries, search);
28
}
29