import * as i0 from '@angular/core'; import { Signal, Provider, ResourceRef, InjectionToken, EnvironmentProviders } from '@angular/core'; import { Models, AuthenticationFactor, OAuthProvider, Browser, CreditCard, Flag, Query, AppwriteException, ExecutionMethod, ImageGravity, ImageFormat, UploadProgress, Client } from 'appwrite'; export { ID } from 'appwrite'; import { Observable } from 'rxjs'; declare class Account { private readonly _client; private readonly _account; private readonly _client$; private readonly _errorHandler; private _authWatchSubscription; private _auth$; constructor(); private initAuth; /** * Emits the currently logged in user, or null if no user is logged in. * * @template TPrefs - The type of the user's preferences. * @returns An observable that emits the currently logged in user, or null. */ onAuth$(): Observable | null>; getAuthSignal(): Signal | null>; /** * Get Account * * Get currently logged in user data as JSON object. * * @template TPrefs The type of the user's preferences. * @returns The user's data. */ get(): Promise>; /** * Create Account * * Use this endpoint to allow a new user to register a new account in your project. * After the user registration completes successfully, you can use the /account/verfication route * to start verifying the user email address. To allow the new user to login to their new account, * you need to create a new account session. * * @param email The user's email address. * @param password The user's password. * @param defaultPrefs The user's default preferences. * @param name The user's name. * @param userId The user's ID. * @returns The newly created user. */ create({ email, password, defaultPrefs, name, userId, }: { email: string; password: string; defaultPrefs: Preferences; name?: string; userId?: string; }): Promise>; /** * Update Email * * Update currently logged in user account email address. * After changing user address, the user confirmation status will get reset. * A new confirmation email is not sent automatically however you can use the * send confirmation email endpoint again to send the confirmation email. * For security measures, user password is required to complete this request. * This endpoint can also be used to convert an anonymous account to a normal one, * by passing an email address and a new password. * * * @param email The user's new email address. * @param password The user's password. * @returns The updated user. */ updateEmail({ email, password, }: { email: string; password: string; }): Promise>; /** * List Identities * * Get the list of identities for the currently logged in user. * * * @param queries An array of queries to filter the results. * @returns The list of identities. */ listIdentities({ queries, total, }: { queries?: string[]; total?: boolean; }): Promise; /** * Delete Identity * * Delete a user identity by id. * * @param id The ID of the identity to delete. * @returns An empty object. */ deleteIdentity({ identityId, }: { identityId: string; }): Promise>; /** * Create JWT * * Use this endpoint to create a JSON Web Token. You can use the resulting JWT * to authenticate on behalf of the current user when working with the * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes * from its creation and will be invalid if the user will logout in that time * frame. * * @returns A JSON Web Token. */ createJWT(): Promise; /** * List Logs * * Get the list of latest security activity logs for the currently logged in user. * Each log returns user IP address, location and date and time of log. * * @param queries An array of queries to filter the results. * @returns A list of security logs. */ listLogs({ queries, total, }: { queries?: string[]; total?: boolean; }): Promise; /** * Update MFA * * Enable or disable MFA on an account. * * @param mfa Whether to enable or disable MFA. * @returns The updated user. */ updateMFA({ mfa, }: { mfa: boolean; }): Promise>; /** * Add Authenticator * * Add an authenticator app to be used as an MFA factor. * Verify the authenticator using the verify authenticator method. * * @returns The MFA type. */ createMFAAuthenticator(): Promise; /** * Verify Authenticator * * Verify an authenticator app after adding it using the add authenticator method. * * @param otp The one-time password from the authenticator app. * @returns An empty object. */ updateMFAAuthenticator({ otp, }: { otp: string; }): Promise>; /** * Delete Authenticator * * Delete an authenticator app. * * @returns An empty object. */ deleteMFAAuthenticator(): Promise; /** * Create Challenge * * Create a challenge to be solved before continuing to a protected route. * * @param factor The authentication factor to use for the challenge. * @returns The MFA challenge. */ createMFAChallenge(factor: AuthenticationFactor): Promise; /** * Verify Challenge * * Verify a challenge to continue to a protected route. * * @param challengeId The ID of the challenge to verify. * @param otp The one-time password from the authenticator app. * @returns An empty object. */ updateMFAChallenge({ challengeId, otp, }: { challengeId: string; otp: string; }): Promise; /** * List Factors * * List the available MFA factors for the current user. * * @returns A list of MFA factors. */ listMFAFactors(): Promise; /** * Get Recovery Codes * * Get the recovery codes for the current user. * * @returns A list of MFA recovery codes. */ getMFARecoveryCodes(): Promise; /** * Create Recovery Codes * * Create a new set of recovery codes for the current user. * * @returns A list of MFA recovery codes. */ createMFARecoveryCodes(): Promise; /** * Update Recovery Codes * * Update the recovery codes for the current user. * * @returns A list of MFA recovery codes. */ updateMFARecoveryCodes(): Promise; /** * Update Name * * Update currently logged in user account name. * * @param name The user's new name. * @returns The updated user. */ updateName({ name, }: { name: string; }): Promise>; /** * Update Password * * Update currently logged in user account password. * For validation, user is required to pass the password twice. * * @param password The user's new password. * @param oldPassword The user's old password. * @returns The updated user. */ updatePassword({ password, oldPassword, }: { password: string; oldPassword?: string; }): Promise>; /** * Update Phone * * Update currently logged in user account phone number. * * @param phone The user's new phone number. * @param password The user's password. * @returns The updated user. */ updatePhone({ phone, password, }: { phone: string; password: string; }): Promise>; /** * Get Preferences * * Get currently logged in user preferences as a JSON object. * * @returns The user's preferences. */ getPrefs(): Promise; /** * Update Preferences * * Update currently logged in user preferences. * You can pass only the specific settings you wish to update. * * @param prefs The user's new preferences. * @returns The updated user. */ updatePrefs({ prefs, }: { prefs: TPrefs; }): Promise>; /** * Create Recovery * * Sends the user an email with a temporary secret key for password reset. * * @param email The user's email address. * @param url The URL to redirect the user to after the password reset. * @returns A token object. */ createRecovery({ email, url, }: { email: string; url: string; }): Promise; /** * Update Recovery * * Use this endpoint to complete the user account password reset. * * @param userId The user's ID. * @param secret The secret key from the recovery email. * @param password The user's new password. * @returns A token object. */ updateRecovery({ userId, secret, password, }: { userId: string; secret: string; password: string; }): Promise; /** * List Sessions * * Get the list of all the user sessions. * * @returns A list of sessions. */ listSessions(): Promise; /** * Delete Sessions * * Delete all the user sessions. * * @returns An empty object. */ deleteSessions(): Promise>; /** * Create Anonymous Session * * Use this endpoint to create a new anonymous account. * After the user registration completes successfully, you can use the * /account/verfication route to start verifying the user email address. * To allow the new user to login to their new account, * you need to create a new account session. * * @returns A session object. */ createAnonymousSession(): Promise; /** * Create Email/Password Session * * Allow the user to login into his account by providing his email and password. * * @param email The user's email address. * @param password The user's password. * @returns A session object. */ createEmailPasswordSession({ email, password, }: { email: string; password: string; }): Promise; /** * Create OAuth2 Session * * Allow the user to login to his account using the OAuth2 provider of his choice. * Each OAuth2 provider should be enabled from the Appwrite console. * * @param provider The OAuth2 provider to use. * @param success The URL to redirect the user to after a successful login. * @param failure The URL to redirect the user to after a failed login. * @param scopes An array of scopes to request. * @returns The OAuth2 session. */ createOAuth2Session({ provider, success, failure, scopes, }: { provider: OAuthProvider; success?: string; failure?: string; scopes?: string[]; }): Promise; /** * Create Session * * Use this endpoint to create a new session. * * @param userId The user's ID. * @param secret The secret from the token. * @returns A session object. */ createSession({ userId, secret, }: { userId: string; secret: string; }): Promise; /** * Get Session * * Get the session for the current user. * * @param sessionId The ID of the session to get. * @returns A session object. */ getSession({ sessionId, }: { sessionId?: string; }): Promise; /** * Update Session * * Update the session for the current user. * * @param sessionId The ID of the session to update. * @returns A session object. */ updateSession({ sessionId, }: { sessionId?: string; }): Promise; /** * Delete Session * * Delete the session for the current user. * * @param sessionId The ID of the session to delete. * @returns An empty object. */ deleteSession({ sessionId, }: { sessionId?: string; }): Promise>; /** * Update Status * * Update the user's status. * * @returns The updated user. */ updateStatus(): Promise>; /** * Create Push Target * * Create a new push target for the current user. * * @param targetId The ID of the push target. * @param identifier The identifier of the push target. * @param providerId The ID of the provider to use. * @returns A push target object. */ createPushTarget({ targetId, identifier, providerId, }: { targetId: string; identifier: string; providerId?: string; }): Promise; /** * Update Push Target * * Update a push target for the current user. * * @param targetId The ID of the push target. * @param identifier The identifier of the push target. * @returns A push target object. */ updatePushTarget({ targetId, identifier, }: { targetId: string; identifier: string; }): Promise; /** * Delete Push Target * * Delete a push target for the current user. * * @param targetId The ID of the push target. * @returns An empty object. */ deletePushTarget({ targetId, }: { targetId: string; }): Promise>; /** * Create Email Token * * Use this endpoint to create a new email token. * * @param userId The user's ID. * @param email The user's email address. * @param phrase Whether to use a phrase or a secret. * @returns A token object. */ createEmailToken({ userId, email, phrase, }: { userId: string; email: string; phrase?: boolean; }): Promise; /** * Create Magic URL Token * * Use this endpoint to create a new magic URL token. * * @param email The user's email address. * @param url The URL to redirect the user to after the magic URL is used. * @param userId The user's ID. * @param phrase Whether to use a phrase or a secret. * @returns A token object. */ createMagicURLToken({ userId, email, url, phrase, }: { userId: string; email: string; url?: string; phrase?: boolean; }): Promise; /** * Create OAuth2 Token * * Use this endpoint to create a new OAuth2 token. * * @param provider The OAuth2 provider to use. * @param success The URL to redirect the user to after a successful login. * @param failure The URL to redirect the user to after a failed login. * @param scopes An array of scopes to request. * @returns A new session. */ createOAuth2Token({ provider, success, failure, scopes, }: { provider: OAuthProvider; success?: string; failure?: string; scopes?: string[]; }): Promise; /** * Create Phone Token * * Use this endpoint to create a new phone token. * * @param userId The user's ID. * @param phone The user's phone number. * @returns A token object. */ createPhoneToken({ userId, phone, }: { userId: string; phone: string; }): Promise; /** * Create Verification * * Use this endpoint to send a verification email to the user. * * @param url The URL to redirect the user to after the verification. * @returns A token object. */ createEmailVerification({ url }: { url: string; }): Promise; /** * Update Verification * * Use this endpoint to complete the email verification process. * * @param userId The user's ID. * @param secret The secret from the verification email. * @returns A token object. */ updateEmailVerification({ userId, secret, }: { userId: string; secret: string; }): Promise; /** * Create Phone Verification * * Use this endpoint to send a verification SMS to the user. * * @returns A token object. */ createPhoneVerification(): Promise; /** * Update Phone Verification * * Use this endpoint to complete the phone verification process. * * @param userId The user's ID. * @param secret The secret from the verification SMS. * @returns A token object. */ updatePhoneVerification({ userId, secret, }: { userId: string; secret: string; }): Promise; /** * Convert Anonymous account with password * * This endpoint is a shortcut in order to convert an anonymous account * to a permanent one * * @param {string} email * @param {string} password * @param {ObjectSchema} prefsSchema * @throws {AppwriteException} * @returns {Promise>} */ convertAnonymousAccountWithEmailAndPassword({ email, password, }: { email: string; password: string; }): Promise>; /** * Logout - Shortcut for deleteSession * * @returns An empty object. */ logout(): Promise>; /** * Triggering an auth-check * * Trigger a check of all account and * session-related actions to enable * reactive monitoring of authentication status * @returns {void} */ updateAuthSubscription(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Account class. */ declare const AccountService: typeof Account; /** * A provider for the Account class. */ declare const provideAccount: () => Provider; declare abstract class AppwriteAdapter { private tables; protected abstract tablesId: string; protected abstract validationFn: undefined | ((data: unknown) => DocumentShape); /** * Create Document * * Create a new Document. Before using this route, you should create a new * collection resource using either a [server * integration](/docs/server/databases#databasesCreateCollection) API or * directly from your database console. * @param {DocumentShape} params.data * @param {string[]} [params.permissions] * @param {string} [params.rowId] * @param {string} [params.alternateDatabaseId] * @param {string} [params.transactionId] * @throws {AppwriteException} * @returns {Promise} */ createRow(params: { data: DocumentShape extends Models.DefaultRow ? Partial & Record : Partial & Omit; rowId?: string; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Update Row * * Updates a Row. Before using this route, you should create a new * collection resource using either a [server * integration](/docs/server/databases#databasesCreateCollection) API or * directly from your database console. * @param {Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>} params.data - Row data as JSON object. Include only columns and value pairs to be updated. * @param {string} params.rowId - Row ID. * @param {string[]} [params.permissions] * @param {string} [params.alternateDatabaseId] * @param {string} [params.transactionId] * @throws {AppwriteException} * @returns {Promise} */ updateRow(params: { data: DocumentShape extends Models.DefaultRow ? Partial & Record : Partial & Partial>; rowId: string; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Upsert Row * * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @param {Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>} params.data - Row data as JSON object. Include only columns and value pairs to be updated. * @param {string} params.rowId - Row ID. * @param {string[]} [params.permissions] * @param {string} [params.alternateDatabaseId] * @param {string} [params.transactionId] * @throws {AppwriteException} * @returns {Promise} */ upsertRow(params: { data: DocumentShape extends Models.DefaultRow ? Partial & Record : Partial & Partial>; rowId: string; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Delete Row * * Deletes a Row. * Takes either a document id or a document object with an id * @param {string} params.rowId - Row ID. * @param {string} [params.alternateDatabaseId] - Alternate database ID. * @throws {AppwriteException} * @returns {Promise} */ deleteRow(params: { rowId: string; alternateDatabaseId?: string; }): Promise>; getRow({ rowId, queries, alternateDatabaseId, transactionId, }: { rowId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; listRows({ queries, alternateDatabaseId, transactionId, }: { queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise>; listRows$({ queries, events, alternateDatabaseId, transactionId, }: { queries?: string[]; events?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Observable>; row$({ rowId, queries, alternateDatabaseId, transactionId, }: { rowId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Observable; $listRows(params: Signal<{ queries?: string[]; events?: string[]; alternateDatabaseId?: string; transactionId?: string; }>): { isLoading: Signal; error: Signal; data: Signal>; resource: ResourceRef>; }; $row(params: Signal<{ rowId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }>): { isLoading: Signal; error: Signal; data: Signal; resource: ResourceRef; }; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } interface AppwriteDocumentModel extends Models.Document { $id: string; $collectionId: string; $databaseId: string; $createdAt: string; $updatedAt: string; $permissions: string[]; $sequence: number; } interface AppwriteRowModel extends Models.Row { $id: string; $tableId: string; $databaseId: string; $createdAt: string; $updatedAt: string; $permissions: string[]; $sequence: number; } type WithoutAppwriteDocumentKeys = Omit; type WithoutAppwriteRowKeys = Omit; declare class Avatars { private readonly _client; private readonly _avatars; /** * Get Browser Icon * * You can use this endpoint to show different browser icons to your users. * The code argument receives the browser code as it appears in your user [GET * /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use * width, height and quality arguments to change the output settings. * * When one dimension is specified and the other is 0, the image is scaled * with preserved aspect ratio. If both dimensions are 0, the API provides an * image at source quality. If dimensions are not specified, the default size * of image returned is 100x100px. * * @param code The browser code. * @param width The image width. * @param height The image height. * @param quality The image quality. * @returns The browser icon URL. */ getBrowser({ code, width, height, quality, }: { code: Browser; width?: number; height?: number; quality?: number; }): string; /** * Get Credit Card Icon * * The credit card endpoint will return you the icon of the credit card * provider you need. Use width, height and quality arguments to change the * output settings. * * When one dimension is specified and the other is 0, the image is scaled * with preserved aspect ratio. If both dimensions are 0, the API provides an * image at source quality. If dimensions are not specified, the default size * of image returned is 100x100px. * * * @param code The credit card code. * @param width The image width. * @param height The image height. * @param quality The image quality. * @returns The credit card icon URL. */ getCreditCard({ code, width, height, quality, }: { code: CreditCard; width?: number; height?: number; quality?: number; }): string; /** * Get Favicon * * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote * website URL. * * * @param url The URL of the website. * @returns The favicon URL. */ getFavicon(url: string): string; /** * Get Country Flag * * You can use this endpoint to show different country flags icons to your * users. The code argument receives the 2 letter country code. Use width, * height and quality arguments to change the output settings. Country codes * follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard. * * When one dimension is specified and the other is 0, the image is scaled * with preserved aspect ratio. If both dimensions are 0, the API provides an * image at source quality. If dimensions are not specified, the default size * of image returned is 100x100px. * * * @param code The country code. * @param width The image width. * @param height The image height. * @param quality The image quality. * @returns The country flag URL. */ getFlag({ code, width, height, quality, }: { code: Flag; width?: number; height?: number; quality?: number; }): string; /** * Get Image from URL * * Use this endpoint to fetch a remote image URL and crop it to any image size * you want. This endpoint is very useful if you need to crop and display * remote images in your app or in case you want to make sure a 3rd party * image is properly served using a TLS protocol. * * When one dimension is specified and the other is 0, the image is scaled * with preserved aspect ratio. If both dimensions are 0, the API provides an * image at source quality. If dimensions are not specified, the default size * of image returned is 400x400px. * * * @param url The URL of the image. * @param width The image width. * @param height The image height. * @returns The image URL. */ getImage({ url, width, height, }: { url: string; width?: number; height?: number; }): string; /** * Get User Initials * * Use this endpoint to show your user initials avatar icon on your website or * app. By default, this route will try to print your logged-in user name or * email initials. You can also overwrite the user name if you pass the 'name' * parameter. If no name is given and no user is logged, an empty avatar will * be returned. * * You can use the color and background params to change the avatar colors. By * default, a random theme will be selected. The random theme will persist for * the user's initials when reloading the same theme will always return for * the same initials. * * When one dimension is specified and the other is 0, the image is scaled * with preserved aspect ratio. If both dimensions are 0, the API provides an * image at source quality. If dimensions are not specified, the default size * of image returned is 100x100px. * * * @param name The user's name. * @param width The image width. * @param height The image height. * @param background The background color. * @returns The user initials URL. */ getInitials({ name, width, height, background, }: { name?: string; width?: number; height?: number; background?: string; }): string; /** * Get QR Code * * Converts a given plain text to a QR code image. You can use the query * parameters to change the size and style of the resulting image. * * * @param text The text to convert to a QR code. * @param size The QR code size. * @param margin The QR code margin. * @param download Whether to download the QR code. * @returns The QR code URL. */ getQR({ text, size, margin, download, }: { text: string; size?: number; margin?: number; download?: boolean; }): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Avatars class. */ declare const AvatarsService: typeof Avatars; /** * A provider for the Avatars class. */ declare const provideAvatars: () => Provider; declare class Databases { private readonly _client; private readonly _defaultDatabaseId; private readonly _databases; private readonly _client$; private readonly _errorHandler; /** * List transactions across all databases. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). * @throws {AppwriteException} * @returns {Promise} */ listTransactions({ queries, }: { queries?: string[]; }): Promise; /** * Create a new transaction. * * @param {number} params.ttl - Seconds before the transaction expires. * @throws {AppwriteException} * @returns {Promise} */ createTransaction({ ttl }: { ttl: number; }): Promise; /** * Get a transaction by its unique ID. * * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} * @returns {Promise} */ getTransaction({ transactionId, }: { transactionId: string; }): Promise; /** * Update a transaction, to either commit or roll back its operations. * * @param {string} params.transactionId - Transaction ID. * @param {boolean} params.commit - Commit transaction? * @param {boolean} params.rollback - Rollback transaction? * @throws {AppwriteException} * @returns {Promise} */ updateTransaction({ transactionId, commit, rollback, }: { transactionId: string; commit?: boolean; rollback?: boolean; }): Promise; /** * Delete a transaction by its unique ID. * * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} * @returns {Promise<{}>} */ deleteTransaction({ transactionId, }: { transactionId: string; }): Promise>; /** * Create multiple operations in a single transaction. * * @param {string} params.transactionId - Transaction ID. * @param {object[]} params.operations - Array of staged operations. * @throws {AppwriteException} * @returns {Promise} */ createOperations({ transactionId, operations, }: { transactionId: string; operations: object[]; }): Promise; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @throws {AppwriteException} * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ listDocuments({ collectionId, queries, alternateDatabaseId, transactionId, }: { collectionId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise>; /** * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. * @param {string} params.documentId - Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit} params.data - Document data as JSON object. * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. */ createDocument({ collectionId, documentId, data, permissions, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.documentId - Document ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead. */ getDocument({ collectionId, documentId, queries, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} params.collectionId - Collection ID. * @param {string} params.documentId - Document ID. * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} params.data - Document data as JSON object. Include all required attributes of the document to be created or updated. * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead. */ upsertDocument({ collectionId, documentId, data, permissions, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; data: DocumentShape extends Models.DefaultDocument ? Partial & Record : Partial & Partial>; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. * @param {string} params.documentId - Document ID. * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead. */ updateDocument({ collectionId, documentId, data, permissions, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; data?: DocumentShape extends Models.DefaultDocument ? Partial & Record : Partial & Partial>; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Delete a document by its unique ID. * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.documentId - Document ID. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead. */ deleteDocument({ collectionId, documentId, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; alternateDatabaseId?: string; transactionId?: string; }): Promise>; /** * Decrement a specific attribute of a document by a given value. * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. * @param {string} params.documentId - Document ID. * @param {string} params.attribute - Attribute key. * @param {number} params.value - Value to increment the attribute by. The value must be a number. * @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead. */ decrementDocumentAttribute({ collectionId, documentId, attribute, value, min, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; attribute: string; value?: number; min?: number; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Increment a specific attribute of a document by a given value. * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. * @param {string} params.documentId - Document ID. * @param {string} params.attribute - Attribute key. * @param {number} params.value - Value to increment the attribute by. The value must be a number. * @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead. */ incrementDocumentAttribute({ collectionId, documentId, attribute, value, max, alternateDatabaseId, transactionId, }: { collectionId: string; documentId: string; attribute: string; value?: number; max?: number; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * This method returns an observable that will emit the collection list * and then listen for changes to the collection. * * @param params.collectionId The collection to watch * @param params.queries The queries to apply to the collection * @param params.events The events to listen for * @param params.alternateDatabaseId The database to use * @returns An observable of the collection */ collection$({ collectionId, queries, events, alternateDatabaseId, }: { collectionId: string; queries: (string | Query)[]; events?: string | string[]; alternateDatabaseId?: string; }): Observable>; /** * This method returns an observable that will emit the document * and then listen for changes to the document. * * @param params.collectionId The collection to watch * @param params.documentId The document to watch * @param params.queries The queries to apply to the document * @param params.events The events to listen for * @param params.alternateDatabaseId The database to use * @returns An observable of the document */ document$({ collectionId, documentId, queries, events, alternateDatabaseId, }: { collectionId: string; documentId: string; queries: (string | Query)[]; events?: string | string[]; alternateDatabaseId?: string; }): Observable; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Databases class. */ declare const DatabasesService: typeof Databases; /** * A provider for the Databases class. */ declare const provideDatabases: () => Provider; /** * Configuration options for the AppwriteErrorHandler. */ interface AppwriteErrorHandlerConfig { /** * Whether to log errors to console. Default: true */ logErrors?: boolean; /** * Whether to rethrow non-Appwrite errors. Default: true */ rethrowUnknownErrors?: boolean; /** * Custom error handler callback for Appwrite exceptions. */ onAppwriteError?: (error: AppwriteException) => void; /** * Custom error handler callback for unknown errors. */ onUnknownError?: (error: unknown) => void; } /** * Injection token for AppwriteErrorHandler configuration. */ declare const APPWRITE_ERROR_HANDLER_CONFIG: InjectionToken; /** * Centralized error handling service for Appwrite operations. * * This service provides consistent error handling across all Appwrite services. * It can be configured to log errors, rethrow unknown errors, and call custom * error handlers. * * @example * ```typescript * // In a service * private errorHandler = inject(AppwriteErrorHandler); * * async fetchData(): Promise { * try { * return await this.databases.listDocuments(...); * } catch (error) { * return this.errorHandler.handle(error, null); * } * } * ``` */ declare class AppwriteErrorHandler { private config; /** * Configure the error handler. */ configure(config: AppwriteErrorHandlerConfig): void; /** * Handle an error from an Appwrite operation. * * @param error - The error to handle * @param fallbackValue - The value to return if the error is handled * @returns The fallback value if the error is an AppwriteException, otherwise throws */ handle(error: unknown, fallbackValue: T): T; /** * Handle an AppwriteException. */ private handleAppwriteError; /** * Handle an unknown error. */ private handleUnknownError; /** * Wrap a promise with error handling. * * @param promise - The promise to wrap * @param fallbackValue - The value to return if an error occurs * @returns The promise result or fallback value */ wrap(promise: Promise, fallbackValue: T): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Provider for configuring the AppwriteErrorHandler. * * @example * ```typescript * // app.config.ts * export const appConfig: ApplicationConfig = { * providers: [ * provideAppwrite({ ... }), * provideAppwriteErrorHandler({ * logErrors: true, * rethrowUnknownErrors: false, * onAppwriteError: (error) => console.log('Appwrite error:', error), * }), * ], * }; * ``` */ declare const provideAppwriteErrorHandler: (config: AppwriteErrorHandlerConfig) => Provider; declare class Functions { private readonly _client; private readonly _functions; /** * A function that wraps a promise and handles AppwriteExceptions. * * @param promise - The promise to wrap. * @returns The result of the promise. * @throws If the promise rejects with a non-AppwriteException error. */ private _call; /** * List Executions * * Get a list of all the current user function execution logs. You can use the * query params to filter your results. * * @param functionId The function ID. * @param queries The queries to filter the results. * @param search The search string to filter the results. * @returns A list of executions. */ listExecutions(functionId: string, queries?: string[], search?: string): Promise; /** * Create Execution * * Trigger a function execution. The returned object will return you the * current execution status. You can ping the `Get Execution` endpoint to get * updates on the current execution status. Once this endpoint is called, your * function execution process will start asynchronously. * * @param functionId The function ID. * @param body The body of the request. * @param async Whether to execute the function asynchronously. * @param xpath The path of the request. * @param method The method of the request. * @param headers The headers of the request. * @returns An execution. */ createExecution({ functionId, body, async, xpath, method, headers, scheduledAt, }: { functionId: string; body?: string; async?: boolean; xpath?: string; method?: ExecutionMethod; headers?: object; scheduledAt?: string; }): Promise; /** * Get Execution * * Get a function execution log by its unique ID. * * @param functionId The function ID. * @param executionId The execution ID. * @returns An execution. */ getExecution({ functionId, executionId, }: { functionId: string; executionId: string; }): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Functions class. */ declare const FunctionsService: typeof Functions; /** * A provider for the Functions class. */ declare const provideFunctions: () => Provider; declare class Localization { private readonly _client; private readonly _locale; /** * A function that wraps a promise and handles AppwriteExceptions. * * @param promise - The promise to wrap. * @returns The result of the promise. * @throws If the promise rejects with a non-AppwriteException error. * */ private _call; /** * Get User Locale * * Get the current user location based on IP. Returns an object with user * country code, country name, continent name, continent code, ip address and * suggested currency. You can use the locale header to get the data in a * supported language. * * ([IP Geolocation by DB-IP](https://db-ip.com)) * * @returns The user's locale. */ get(): Promise; /** * List Continents * * List of all continents. You can use the locale header to get the data in a * supported language. * * @returns A list of continents. */ listContinents(): Promise; /** * List Countries * * List of all countries. You can use the locale header to get the data in a * supported language. * * @returns A list of countries. */ listCountries(): Promise; /** * List EU Countries * * List of all countries that are currently members of the EU. You can use the * locale header to get the data in a supported language. * * @returns A list of EU countries. */ listCountriesEU(): Promise; /** * List Countries Phone Codes * * List of all countries phone codes. You can use the locale header to get the * data in a supported language. * * @returns A list of phone codes. */ listCountriesPhones(): Promise; /** * List Currencies * * List of all currencies, including currency symbol, name, plural, and * decimal digits for all major and minor currencies. You can use the locale * header to get the data in a supported language. * * @returns A list of currencies. */ listCurrencies(): Promise; /** * List Languages * * List of all languages classified by ISO 639-1 including 2-letter code, name * in English, and name in the respective language. * * @returns A list of languages. */ listLanguages(): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Localization class. */ declare const LocalizationService: typeof Localization; /** * A provider for the Localization class. */ declare const provideLocalization: () => Provider; declare class Messaging { private readonly _client; private readonly _messaging; /** * A function that wraps a promise and handles AppwriteExceptions. * * @param promise - The promise to wrap. * @returns The result of the promise. * @throws If the promise rejects with a non-AppwriteException error. * */ private _call; /** * Create subscriber * * Create a new subscriber. * * @param topicId The topic ID. * @param subscriberId The subscriber ID. * @param targetId The target ID. * @returns The created subscriber. */ createSubscriber({ topicId, subscriberId, targetId, }: { topicId: string; subscriberId: string; targetId: string; }): Promise; /** * Delete subscriber * * Delete a subscriber by its unique ID. * * @param topicId The topic ID. * @param subscriberId The subscriber ID. * @returns An empty object. */ deleteSubscriber({ topicId, subscriberId, }: { topicId: string; subscriberId: string; }): Promise | null>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Messaging class. */ declare const MessagingService: typeof Messaging; /** * A provider for the Messaging class. */ declare const provideMessaging: () => Provider; declare class Storage { private readonly _client; private readonly _storage; private readonly _errorHandler; /** * List Files * * Get a list of all the user files. You can use the query params to filter * your results. * * @param buckedId The bucket ID. * @param queries The queries to filter the results. * @param search The search string to filter the results. * @returns A list of files. */ listFiles({ bucketId, queries, search, total, }: { bucketId: string; queries?: string[]; search?: string; total?: boolean; }): Promise; /** * Get File * * Get a file by its unique ID. This endpoint response returns a JSON object * with the file metadata. * * @param bucketId The bucket ID. * @param fileId The file ID. * @returns A file. */ getFile({ bucketId, fileId, }: { bucketId: string; fileId: string; }): Promise; /** * Get File Preview * * Get a file preview image. Currently, this method supports preview for image * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, * and spreadsheets, will return the file icon image. You can also pass query * string arguments for cutting and resizing your preview image. Preview is * supported only for image files smaller than 10MB. * * @param bucketId The bucket ID. * @param fileId The file ID. * @param width The width of the preview image. * @param height The height of the preview image. * @param gravity The gravity of the preview image. * @param quality The quality of the preview image. * @param borderWidth The border width of the preview image. * @param borderColor The border color of the preview image. * @param borderRadius The border radius of the preview image. * @param opacity The opacity of the preview image. * @param rotation The rotation of the preview image. * @param background The background color of the preview image. * @param output The output format of the preview image. * @param token The token to access the file preview. * @returns A URL to the file preview. */ getFilePreview({ bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token, }: { bucketId: string; fileId: string; width?: number; height?: number; gravity?: ImageGravity; quality?: number; borderWidth?: number; borderColor?: string; borderRadius?: number; opacity?: number; rotation?: number; background?: string; output?: ImageFormat; token?: string; }): string | null; /** * Get File for Download * * Get a file content by its unique ID. The endpoint response return with a * 'Content-Disposition: attachment' header that tells the browser to start * downloading the file to user downloads directory. * * @param bucketId The bucket ID. * @param fileId The file ID. * @param token The token to access the file download. * @returns A URL to the file. */ getFileDownload({ bucketId, fileId, token, }: { bucketId: string; fileId: string; token?: string; }): string | null; /** * Get File for View * * Get a file content by its unique ID. This endpoint is similar to the * download method but returns with no 'Content-Disposition: attachment' * header. * * @param bucketId The bucket ID. * @param fileId The file ID. * @param token The token to access the file view. * @returns A URL to the file. */ getFileForView({ bucketId, fileId, token, }: { bucketId: string; fileId: string; token?: string; }): string | null; /** * Create File * * Create a new file. Before using this route, you should create a new bucket * resource using either a [server * integration](/docs/server/storage#storageCreateBucket) API or directly from * your Appwrite console. * * Larger files should be uploaded using multiple requests with the * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) * header to send a partial request with a maximum supported chunk of `5MB`. * The `content-range` header values should always be in bytes. * * When the first request is sent, the server will return the **File** object, * and the subsequent part request must include the file's **id** in * `x-appwrite-id` header to allow the server to know that the partial upload * is for the existing file and not for a new one. * * If you're creating a new file using one of the Appwrite SDKs, all the * chunking logic will be managed by the SDK internally. * * * @param bucketId The bucket ID. * @param file The file to create. * @param fileId The file ID. * @param permissions The permissions for the file. * @param onProgress A callback to track the upload progress. * @returns The created file. */ createFile({ bucketId, file, fileId, permissions, onProgress, }: { bucketId: string; file: File; fileId?: string; permissions?: string[]; onProgress?: (progress: UploadProgress) => void; }): Promise; /** * Update File Permissions * * Update a file by its unique ID. Only users with write permissions have * access to update this resource. * * @param bucketId The bucket ID. * @param fileId The file ID. * @param name The new name for the file. * @param permissions The new permissions for the file. * @returns The updated file. */ updateFilePermissions({ bucketId, fileId, name, permissions, }: { bucketId: string; fileId: string; name?: string; permissions?: string[]; }): Promise; /** * Delete File * * Delete a file by its unique ID. Only users with write permissions have * access to delete this resource. * * @param bucketId The bucket ID. * @param fileId The file ID. * @returns An empty object. */ deleteFile({ bucketId, fileId, }: { bucketId: string; fileId: string; }): Promise | null>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Storage class. */ declare const StorageService: typeof Storage; /** * A provider for the Storage class. */ declare const provideStorage: () => Provider; declare class TablesDB { private readonly _client; private readonly _defaultDatabaseId; private readonly _databases; private readonly _client$; private readonly _errorHandler; /** * List transactions across all databases. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). * @throws {AppwriteException} * @returns {Promise} */ listTransactions({ queries, }: { queries?: string[]; }): Promise; /** * Create a new transaction. * * @param {number} params.ttl - Seconds before the transaction expires. * @throws {AppwriteException} * @returns {Promise} */ createTransaction({ ttl }: { ttl: number; }): Promise; /** * Get a transaction by its unique ID. * * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} * @returns {Promise} */ getTransaction({ transactionId, }: { transactionId: string; }): Promise; /** * Update a transaction, to either commit or roll back its operations. * * @param {string} params.transactionId - Transaction ID. * @param {boolean} params.commit - Commit transaction? * @param {boolean} params.rollback - Rollback transaction? * @throws {AppwriteException} * @returns {Promise} */ updateTransaction({ transactionId, commit, rollback, }: { transactionId: string; commit?: boolean; rollback?: boolean; }): Promise; /** * Delete a transaction by its unique ID. * * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} * @returns {Promise<{}>} */ deleteTransaction({ transactionId, }: { transactionId: string; }): Promise>; /** * Create multiple operations in a single transaction. * * @param {string} params.transactionId - Transaction ID. * @param {object[]} params.operations - Array of staged operations. * @throws {AppwriteException} * @returns {Promise} */ createOperations({ transactionId, operations, }: { transactionId: string; operations: object[]; }): Promise; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} */ listRows({ tableId, queries, alternateDatabaseId, transactionId, }: { tableId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise>; /** * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. * @param {string} params.rowId - Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {Row extends Models.DefaultRow ? Partial & Record : Partial & Omit} params.data - Row data as JSON object. * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} */ createRow({ tableId, rowId, data, permissions, alternateDatabaseId, transactionId, }: { tableId: string; rowId?: string; data: DocumentShape extends Models.DefaultRow ? Partial & Record : Partial & Omit; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.rowId - Row ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @throws {AppwriteException} * @returns {Promise} */ getRow({ tableId, rowId, queries, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; queries?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * * @param {string} params.tableId - Table ID. * @param {string} params.rowId - Row ID. * @param {Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>} params.data - Row data as JSON object. Include all required columns of the row to be created or updated. * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {string} params.alternateDatabaseId - Database ID. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} */ upsertRow({ tableId, rowId, data, permissions, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; data: DocumentShape extends Models.DefaultRow ? Partial & Record : Partial & Partial>; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. * * @param {string} params.tableId - Table ID. * @param {string} params.rowId - Row ID. * @param {Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>} params.data - Row data as JSON object. Include only columns and value pairs to be updated. * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {string} params.alternateDatabaseId - Database ID. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} */ updateRow({ tableId, rowId, data, permissions, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; data: DocumentShape extends Models.DefaultRow ? Partial & Record : Partial & Partial>; permissions?: string[]; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Delete a row by its unique ID. * * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string} params.rowId - Row ID. * @param {string} params.alternateDatabaseId - Database ID. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise<{}>} */ deleteRow({ tableId, rowId, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; alternateDatabaseId?: string; transactionId?: string; }): Promise>; /** * Decrement a specific column of a row by a given value. * * @param {string} params.tableId - Table ID. * @param {string} params.rowId - Row ID. * @param {string} params.column - Column key. * @param {number} params.value - Value to increment the column by. The value must be a number. * @param {number} params.min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. * @param {string} params.alternateDatabaseId - Database ID. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} */ decrementRowColumn({ tableId, rowId, column, value, min, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; column: string; value: number; min?: number; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * Increment a specific column of a row by a given value. * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. * @param {string} params.rowId - Row ID. * @param {string} params.column - Column key. * @param {number} params.value - Value to increment the column by. The value must be a number. * @param {number} params.max - Maximum value for the column. If the current value is greater than this value, an error will be thrown. * @param {string} params.alternateDatabaseId - Database ID. * @param {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} * @returns {Promise} */ incrementRowColumn({ tableId, rowId, column, value, max, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; column: string; value: number; max?: number; alternateDatabaseId?: string; transactionId?: string; }): Promise; /** * This method returns an observable that will emit the table list * and then listen for changes to the table. * * @param params.tableId The table to watch * @param params.queries The queries to apply to the table * @param params.events The events to listen for * @param params.alternateDatabaseId The database to use * @returns An observable of the collection */ listRows$({ tableId, queries, events, alternateDatabaseId, transactionId, }: { tableId: string; queries?: (string | Query)[]; events?: string | string[]; alternateDatabaseId?: string; transactionId?: string; }): Observable>; /** * This method returns an observable that will emit the row * and then listen for changes to the row. * * @param params.tableId The table to watch * @param params.rowId The row to watch * @param params.queries The queries to apply to the row * @param params.events The events to listen for * @param params.alternateDatabaseId The database to use * @returns An observable of the document */ row$({ tableId, rowId, queries, events, alternateDatabaseId, transactionId, }: { tableId: string; rowId: string; queries?: (string | Query)[]; events?: string | string[]; alternateDatabaseId?: string; transactionId?: string; }): Observable; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * An alias for the Databases class. */ declare const TablesDBService: typeof TablesDB; /** * A provider for the Databases class. */ declare const provideTablesDB: () => Provider; declare class Team { private readonly _client; private readonly _teams; /** * Create Team * * Create a new team. The user who creates the team will automatically be * assigned as the owner of the team. Only the users with the owner role can * invite new members, add new owners and delete or update the team. * * @param name The team's name. * @param roles The team's roles. * @param teamId The team's ID. * @returns The created team. */ create({ name, roles, teamId, }: { name: string; roles?: string[]; teamId: string; }): Promise>; /** * List Teams * * Get a list of all the teams in which the current user is a member. You can * use the parameters to filter your results. * * @param queries The queries to filter the results. * @param search The search string to filter the results. * @returns A list of teams. */ list({ queries, search, }: { queries?: string[]; search?: string; }): Promise>; /** * Get Team * * Get a team by its ID. All team members have read access for this resource. * * @param teamId The team's ID. * @returns A team. */ get(teamId: string): Promise>; /** * Update Team Name * * Update a team name using its ID. Only members with the owner role can update the * team. * * @param teamId The team's ID. * @param name The new name for the team. * @returns The updated team. */ updateName({ teamId, name, }: { teamId: string; name: string; }): Promise>; /** * Delete Team * * Delete a team using its ID. Only team members with the owner role can * delete the team. * * @param teamId The team's ID. * @returns An empty object. */ delete(teamId: string): Promise>; /** * Create Team Membership * * Invite a new member to join your team. If initiated from the client SDK, an * email with a link to join the team will be sent to the member's email * address and an account will be created for them should they not be signed * up already. If initiated from server-side SDKs, the new member will * automatically be added to the team. * * Use the 'url' parameter to redirect the user from the invitation email back * to your app. When the user is redirected, use the [Update Team Membership * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow * the user to accept the invitation to the team. * * Please note that to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) * the only valid redirect URL's are the once from domains you have set when * adding your platforms in the console interface. * * @param teamId The team's ID. * @param email The email of the new member. * @param roles The roles of the new member. * @param url The URL to redirect the user to after accepting the invitation. * @param name The name of the new member. * @returns The created membership. */ createMembership({ teamId, roles, email, userId, phone, url, name, }: { teamId: string; roles: string[]; email?: string; userId?: string; phone?: string; url?: string; name?: string; }): Promise; /** * List Team Memberships * * Use this endpoint to list a team's members using the team's ID. All team * members have read access to this endpoint. * * @param teamId The team's ID. * @param queries The queries to filter the results. * @param search The search string to filter the results. * @returns A list of memberships. */ listMemberships({ teamId, queries, search, }: { teamId: string; queries?: string[]; search?: string; }): Promise; /** * Get Team Membership * * Get a team member by the membership unique id. All team members have read * access for this resource. * * @param teamId The team's ID. * @param membershipId The membership ID. * @returns A membership. */ getMembership({ teamId, membershipId, }: { teamId: string; membershipId: string; }): Promise; /** * Update Membership * * Modify the roles of a team member. Only team members with the owner role * have access to this endpoint. Learn more about [roles and * permissions](/docs/permissions). * * @param teamId The team's ID. * @param membershipId The membership ID. * @param roles The new roles for the member. * @returns The updated membership. */ updateMembership({ teamId, membershipId, roles, }: { teamId: string; membershipId: string; roles: string[]; }): Promise; /** * Update Team Membership Status * * Use this endpoint to allow a user to accept an invitation to join a team * after being redirected back to your app from the invitation email received * by the user. * * If the request is successful, a session for the user is automatically * created. * * * @param teamId The team's ID. * @param membershipId The membership ID. * @param userId The user's ID. * @param secret The secret from the invitation. * @returns The updated membership. */ updateMembershipStatus({ teamId, membershipId, userId, secret, }: { teamId: string; membershipId: string; userId: string; secret: string; }): Promise; /** * Delete Team Membership * * This endpoint allows a user to leave a team or for a team owner to delete * the membership of any other team member. You can also use this endpoint to * delete a user membership even if it is not accepted. * * @param teamId The team's ID. * @param membershipId The membership ID. * @returns An empty object. */ deleteMembership({ teamId, membershipId, }: { teamId: string; membershipId: string; }): Promise>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const TeamsService: typeof Team; declare const provideTeams: () => Provider; interface AppwriteConfig { endpoint: string; project: string; defaultDatabase?: string; } /** * Injection token for the Appwrite Client. * Can be used to inject the client directly into services. */ declare const APPWRITE_CLIENT: InjectionToken; /** * Injection token for the default database ID. * Can be used to inject the default database ID directly into services. */ declare const APPWRITE_DEFAULT_DATABASE: InjectionToken; declare const provideAppwrite: (config: AppwriteConfig) => EnvironmentProviders; export { APPWRITE_CLIENT, APPWRITE_DEFAULT_DATABASE, APPWRITE_ERROR_HANDLER_CONFIG, Account, AccountService, AppwriteAdapter, AppwriteErrorHandler, Avatars, AvatarsService, Databases, DatabasesService, Functions, FunctionsService, Localization, LocalizationService, Messaging, MessagingService, Storage, StorageService, TablesDB, TablesDBService, Team, TeamsService, provideAccount, provideAppwrite, provideAppwriteErrorHandler, provideAvatars, provideDatabases, provideFunctions, provideLocalization, provideMessaging, provideStorage, provideTablesDB, provideTeams }; export type { AppwriteDocumentModel, AppwriteErrorHandlerConfig, AppwriteRowModel, WithoutAppwriteDocumentKeys, WithoutAppwriteRowKeys };