export type Token = { /** * Token ID. */ $id: string; /** * User ID. */ userId: string; /** * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. */ secret: string; /** * Token expiration date in Unix timestamp. */ expire: number; }; export type User = { /** * User ID. */ $id: string; /** * User name. */ name: string; /** * User registration date in Unix timestamp. */ registration: number; /** * User status. 0 for Unactivated, 1 for active and 2 is blocked. * @deprecated according to developers */ status: number; /** * User email address. */ email: string; /** * Email verification status. */ emailVerification: boolean; /** * User preferences as a key-value object */ prefs: Record; }; export type UsersList = { /** * Total sum of items in the list. */ sum: number; /** * List of users. */ users: User[]; }; export type Error = { /** * Error message. */ message: string; /** * Error code. */ code: string; /** * Server version number. */ version: string; }; export type Session = { /** * Session ID. */ $id: string; /** * User ID. */ userId: string; /** * Session expiration date in Unix timestamp. */ expire: number; /** * IP in use when the session was created. */ ip: string; /** * Returns true if this the current user session. */ current: boolean; } & ClientInfo; export type Log = { /** * Event name. */ event: string; /** * IP session in use when the session was created. */ ip: string; /** * Log creation time in Unix timestamp. */ time: number; } & ClientInfo; type ClientInfo = { /** * Operating system code name. View list of possible values: * https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json */ osCode: string; /** * Operating system name. */ osName: string; /** * Operating system version. */ osVersion: string; /** * Client type. */ clientType: string; /** * Client code name. View list of possible values: * https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json */ clientCode: string; /** * Client name. */ clientName: string; /** * Client version. */ clientVersion: string; /** * Client engine name. */ clientEngine: string; /** * Client engine version. */ clientEngineVersion: string; /** * Device name. */ deviceName: string; /** * Device brand name. */ deviceBrand: string; /** * Device model name. */ deviceModel: string; /** * Country two-character ISO 3166-1 alpha code. */ countryCode: string; /** * Country name. */ countryName: string; }; export type Team = { /** * Team ID. */ $id: string; /** * Team name. */ name: string; /** * Team creation date in Unix timestamp. */ dateCreated: number; /** * Total sum of team members. */ sum: number; }; type Membership = { /** * Membership ID. */ $id: string; /** * User ID. */ userId: string; /** * Team ID. */ teamId: string; /** * User name. */ name: string; /** * User email address. */ email: string; /** * Date, the user has been invited to join the team in Unix timestamp. */ invited: number; /** * Date, the user has accepted the invitation to join the team in Unix timestamp. */ joined: number; /** * User confirmation status, true if the user has joined the team or false otherwise. */ confirm: boolean; /** * User list of roles */ roles: string[]; }; export type FilesList = { sum: number; files: File[]; }; export type File = { '$id': string; '$permissions': Permissions; name: string; dateCreated: number; signature: string; mimeType: string; sizeOriginal: number; }; export type Collection = { $id: string; $permissions: Permissions; name: string; dateCreated: number; dateUpdated: number; rules: Rule[]; }; export type CreatedCollection = Partial & Pick; export type CollectionsList = { sum: number; collections: Collection[]; }; export type CreatedRule = Omit; export type Rule = { $id: string; $collection: string; type: string; key: string; label: string; default: string; array: boolean; required: boolean; list: string[]; }; interface Permissions { read: string[]; write: string[]; } export type Client = { // Your API Endpoint setEndpoint: (endpoint: string) => Client; // Your project ID setProject: (projectId: string) => Client; // Your secret API key setKey: (key: string) => Client; }; export type UsersClient = { deleteUser: (id: string) => Promise; deleteSessions: (id: string) => Promise; create: (email: string, password: string, name?: string) => Promise; getLogs: (id: string) => Promise; }; export type DatabaseClient = { listCollections: () => Promise; listDocuments: (collectionId: string) => Promise; updateCollection: (collectionId: string, name: string, read: string[], write: string[], rules?: (Rule | CreatedRule)[]) => Promise; deleteCollection: (collectionId: string) => Promise; getCollection: (collectionId: string) => Promise; deleteDocument: (collectionId: string, documentId: string) => Promise; createCollection: (name: string, read: string[], write: string[], rules: Rule[]) => Promise; }; export type DocumentsList = { sum: number; documents: any[]; }; type GetHealth = () => any; export type HealthClient = { get: GetHealth; getDB: GetHealth; getCache: GetHealth; getTime: GetHealth; getQueueWebhooks: GetHealth; getQueueTasks: GetHealth; getQueueLogs: GetHealth; getQueueUsage: GetHealth; getQueueCertificates: GetHealth; getQueueFunctions: GetHealth; getStorageLocal: GetHealth; getAntiVirus: GetHealth; }; export type AppwriteHealth = { HTTP: any; DB: any; Cache: any; Time: any; QueueWebhooks: any; QueueTasks: any; QueueLogs: any; QueueUsage: any; QueueCertificates: any; QueueFunctions: any; StorageLocal: any; AntiVirus: any; }; export type StorageClient = { createFile: (file: any, read: string[], write: string[]) => Promise; listFiles: () => Promise; getFile: (fileId: string) => Promise; } export type SDK = { Client: new () => Client; Users: new (client: Client) => UsersClient; Health: new (client: Client) => HealthClient; Database: new (client: Client) => DatabaseClient; Storage: new (client: Client) => StorageClient; };