import { Client, Databases, ID } from "[email protected]";
/**
* @param id ID of the user to be created. Leave blank to generate a unique ID.
*/
type Appwrite = {
endpoint: string;
project: string;
key: string;
self_signed: boolean;
};
export async function main(auth: Appwrite, name: string, id?: string) {
const client = new Client()
.setEndpoint(auth.endpoint)
.setProject(auth.project)
.setKey(auth.key);
const db = new Databases(client);
return await db.create(id || ID.unique(), name);
}
Submitted by hugo989 1 day ago