### Get File Preview with Custom Options Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/storage/get-file-preview.md Use this snippet to get a preview of a file. You can specify dimensions, quality, border, and output format. Ensure you have initialized the Appwrite client and Storage service. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with Storage storage = Storage(client); Uint8List result = await storage.getFilePreview( bucketId: '', fileId: '', width: 0, // (optional) height: 0, // (optional) gravity: enums.ImageGravity.center, // (optional) quality: -1, // (optional) borderWidth: 0, // (optional) borderColor: '', // (optional) borderRadius: 0, // (optional) opacity: 0, // (optional) rotation: -360, // (optional) background: '', // (optional) output: enums.ImageFormat.jpg, // (optional) token: '', // (optional) ); ``` -------------------------------- ### List MFA Factors Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/account/list-mfa-factors.md This example demonstrates how to retrieve a list of all MFA factors enabled for the current user. ```APIDOC ## List MFA Factors ### Description Retrieves a list of all MFA factors associated with the current user's account. ### Method GET ### Endpoint /account/mfa/factors ### Parameters None ### Response #### Success Response (200) - **factors** (array) - A list of MFA factors. - **type** (string) - The type of the MFA factor (e.g., 'totp', 'email', 'sms'). - **identity** (string) - The identity associated with the MFA factor (e.g., email address, phone number). - **isVerified** (boolean) - Indicates if the MFA factor is verified. #### Response Example ```json { "factors": [ { "type": "totp", "identity": "user@example.com", "isVerified": true }, { "type": "email", "identity": "user@example.com", "isVerified": true } ] } ``` ``` -------------------------------- ### Create Operations Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/databases/create-operations.md This example demonstrates how to use the `createOperations` method to perform a create operation within a transaction. ```APIDOC ## Create Operations ### Description This method allows you to execute multiple database operations, such as creating documents, within a single transaction. This is useful for ensuring data consistency. ### Method `databases.createOperations` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **transactionId** (string) - Required - The ID of the transaction to associate these operations with. - **operations** (array) - Required - An array of operations to perform. Each operation object should have: - **action** (string) - Required - The type of action to perform (e.g., "create"). - **databaseId** (string) - Required - The ID of the database. - **collectionId** (string) - Required - The ID of the collection. - **documentId** (string) - Optional - The ID of the document to create or modify. - **data** (object) - Required - The data to be included in the document. ### Request Example ```dart Transaction result = await databases.createOperations( transactionId: '', operations: [ { "action": "create", "databaseId": "", "collectionId": "", "documentId": "", "data": { "name": "Walter O\'Brien" } } ] ); ``` ### Response #### Success Response (200) - **transactionId** (string) - The ID of the transaction. - **status** (string) - The status of the transaction (e.g., "completed"). - **operations** (array) - An array of results for each operation performed. #### Response Example ```json { "transactionId": "", "status": "completed", "operations": [ { "action": "create", "success": true, "document": { "$id": "", "$createdAt": "", "name": "Walter O\'Brien" } } ] } ``` ``` -------------------------------- ### Get Deployment Download Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/functions/get-deployment-download.md Fetches the source code of a deployment. You can optionally specify the type of download. ```APIDOC ## Get Deployment Download ### Description Retrieves the source code of a specific deployment for a given function. ### Method GET ### Endpoint `/functions/{functionId}/deployments/{deploymentId}/download` ### Parameters #### Path Parameters - **functionId** (string) - Required - The ID of the function. - **deploymentId** (string) - Required - The ID of the deployment. #### Query Parameters - **type** (string) - Optional - The type of deployment download. Possible values are `source` or `build`. ### Response #### Success Response (200) - **file** (Uint8List) - The deployment source code as a byte array. ### Request Example ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Functions functions = Functions(client); Uint8List result = await functions.getDeploymentDownload( functionId: '', deploymentId: '', type: enums.DeploymentDownloadType.source, // (optional) ); ``` ``` -------------------------------- ### List Sites with Dart SDK Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/list.md Initialize the client and use the sites service to list sites. Ensure you replace placeholders with your actual project details. Optional query parameters can be added to filter or modify the results. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Sites sites = Sites(client); SiteList result = await sites.list( queries: [], // (optional) search: '', // (optional) total: false, // (optional) ); ``` -------------------------------- ### Get Screenshot of a URL Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/avatars/get-screenshot.md Use this function to capture a screenshot of a given URL. You can customize various aspects of the screenshot, such as dimensions, quality, and theme. Ensure you have the necessary client setup with your project ID and endpoint. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); Uint8List result = await avatars.getScreenshot( url: 'https://example.com', headers: { "Authorization": "Bearer token123", "X-Custom-Header": "value" }, // (optional) viewportWidth: 1920, // (optional) viewportHeight: 1080, // (optional) scale: 2, // (optional) theme: enums.Theme.dark, // (optional) userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', fullpage: true, // (optional) locale: 'en-US', // (optional) timezone: enums.Timezone.americaNewYork, // (optional) latitude: 37.7749, // (optional) longitude: -122.4194, // (optional) accuracy: 100, // (optional) touch: true, // (optional) permissions: [enums.BrowserPermission.geolocation, enums.BrowserPermission.notifications], // (optional) sleep: 3, // (optional) width: 800, // (optional) height: 600, // (optional) quality: 85, // (optional) output: enums.ImageFormat.jpeg, // (optional) ); ``` -------------------------------- ### List Frameworks with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/list-frameworks.md Initialize the Appwrite client and use the Sites service to fetch a list of available frameworks. Ensure you replace placeholders with your actual project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Sites sites = Sites(client); FrameworkList result = await sites.listFrameworks(); ``` -------------------------------- ### Get Presence Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/presences/get.md Retrieves the presence information for a specific user. You need to provide the user's ID to get their presence status. ```APIDOC ## Get Presence ### Description Retrieves the presence information for a specific user. ### Method GET ### Endpoint /users/{userId}/presence ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user whose presence you want to retrieve. ### Response #### Success Response (200) - **state** (string) - The current presence state of the user (e.g., 'online', 'offline'). - **lastSeen** (integer) - The timestamp of the last time the user was seen online. #### Response Example ```json { "state": "online", "lastSeen": 1677721800 } ``` ``` -------------------------------- ### Get Database Status - Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/health/get-db.md Use this snippet to get the database status. Ensure you have initialized the Appwrite client with your project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Health health = Health(client); HealthStatusList result = await health.getDB(); ``` -------------------------------- ### Initialize Client and Execute GraphQL Query Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/graphql/query.md Set up the Appwrite client with your project details and execute a basic GraphQL query. Ensure you replace placeholders with your actual API endpoint, project ID, and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Graphql graphql = Graphql(client); Any result = await graphql.query( query: {}, ); ``` -------------------------------- ### Create a New Site with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/create.md Use this snippet to create a new site. Ensure you have initialized the Appwrite client with your project details. Many parameters are optional and can be omitted if not needed. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Sites sites = Sites(client); Site result = await sites.create( siteId: '', name: '', framework: enums.Framework.analog, buildRuntime: enums.BuildRuntime.node145, enabled: false, // (optional) logging: false, // (optional) timeout: 1, // (optional) installCommand: '', // (optional) buildCommand: '', // (optional) startCommand: '', // (optional) outputDirectory: '', // (optional) adapter: enums.Adapter.static, // (optional) installationId: '', // (optional) fallbackFile: '', // (optional) providerRepositoryId: '', // (optional) providerBranch: '', // (optional) providerSilentMode: false, // (optional) providerRootDirectory: '', // (optional) buildSpecification: '', // (optional) runtimeSpecification: '', // (optional) deploymentRetention: 0, // (optional) ); ``` -------------------------------- ### Get Email Queue Status Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/health/get-queue-mails.md Use this method to get the current status of the email queue. You can optionally set a threshold to filter results. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Health health = Health(client); HealthQueue result = await health.getQueueMails( threshold: 0, // (optional) ); ``` -------------------------------- ### Get a Function by ID Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/functions/get.md Use the `get` method from the Functions service to retrieve a function. Ensure you have initialized the Client with your project details and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Functions functions = Functions(client); Func result = await functions.get( functionId: '', ); ``` -------------------------------- ### Initialize Appwrite Client Source: https://github.com/appwrite/sdk-for-dart/blob/main/example/README.md Set up the Appwrite client with your project ID and API key before making any requests. ```dart Client client = Client(); client .setProject('') .setKey(''); ``` -------------------------------- ### Get Antivirus Status with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/health/get-antivirus.md Initialize the Appwrite client and use the Health service to get the antivirus status. Ensure you replace placeholders with your actual project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Health health = Health(client); HealthAntivirus result = await health.getAntivirus(); ``` -------------------------------- ### Initialize Appwrite Client and Create User Source: https://github.com/appwrite/sdk-for-dart/blob/main/README.md Initialize the Appwrite client with your project ID and API key, then create a new user. Ensure you replace placeholders with your actual credentials. ```dart Client client = Client() .setProject('') .setKey(''); Users users = Users(client); User user = await users.create( userId: ID.unique(), email: 'email@example.com', phone: '+123456789', password: 'password', name: 'Walter O\'Brien' ); ``` -------------------------------- ### Get Database by ID - Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/tablesdb/get.md Use the `get` method from the `TablesDB` service to retrieve a specific database. Ensure you have initialized the Appwrite client with your project details and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key TablesDB tablesDB = TablesDB(client); Database result = await tablesDB.get( databaseId: '', ); ``` -------------------------------- ### List Project Keys with Dart SDK Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/project/list-keys.md Initialize the Appwrite client and use the Project service to fetch a list of keys for your project. Ensure you replace placeholders with your actual project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Project project = Project(client); KeyList result = await project.listKeys( queries: [], // (optional) total: false, // (optional) ); ``` -------------------------------- ### Get Queue Migrations Status Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/health/get-queue-migrations.md Use this method to get the status of queue migrations. You can optionally provide a threshold to filter results. Ensure your client is initialized with your project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Health health = Health(client); HealthQueue result = await health.getQueueMigrations( threshold: 0, // (optional) ); ``` -------------------------------- ### Create Linux Platform Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/project/create-linux-platform.md Use this snippet to create a new Linux platform. Ensure you have initialized the Appwrite client with your project details and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Project project = Project(client); PlatformLinux result = await project.createLinuxPlatform( platformId: '', name: '', packageName: '', ); ``` -------------------------------- ### Create Bucket with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/storage/create-bucket.md Use the `createBucket` method to create a new storage bucket. Ensure your client is initialized with your project details. Optional parameters allow for fine-grained control over bucket settings. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; import 'package:dart_appwrite/permission.dart'; import 'package:dart_appwrite/role.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Storage storage = Storage(client); Bucket result = await storage.createBucket( bucketId: '', name: '', permissions: [Permission.read(Role.any())], // (optional) fileSecurity: false, // (optional) enabled: false, // (optional) maximumFileSize: 1, // (optional) allowedFileExtensions: [], // (optional) compression: enums.Compression.none, // (optional) encryption: false, // (optional) antivirus: false, // (optional) transformations: false, // (optional) ); ``` -------------------------------- ### Get a Token by ID - Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/tokens/get.md Use the `get` method of the `Tokens` service to retrieve a specific token. Ensure your client is initialized with the correct endpoint, project ID, and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Tokens tokens = Tokens(client); ResourceToken result = await tokens.get( tokenId: '', ); ``` -------------------------------- ### Create Site Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/create.md Creates a new site with the specified details. You can configure build settings, runtime, and deployment options. ```APIDOC ## POST /sites ### Description Creates a new site resource. ### Method POST ### Endpoint /sites ### Parameters #### Path Parameters - **siteId** (string) - Required - The ID of the site to create. - **name** (string) - Required - The name of the site. - **framework** (enums.Framework) - Required - The framework used for the site. - **buildRuntime** (enums.BuildRuntime) - Required - The build runtime environment. - **installCommand** (string) - Optional - The command to install dependencies. - **buildCommand** (string) - Optional - The command to build the site. - **startCommand** (string) - Optional - The command to start the site. - **outputDirectory** (string) - Optional - The directory containing the build output. - **adapter** (enums.Adapter) - Optional - The adapter to use for serving the site. - **installationId** (string) - Optional - The ID of the installation. - **fallbackFile** (string) - Optional - The fallback file for the site. - **providerRepositoryId** (string) - Optional - The ID of the repository for deployment. - **providerBranch** (string) - Optional - The branch of the repository for deployment. - **providerSilentMode** (boolean) - Optional - Whether to use silent mode for deployment. - **providerRootDirectory** (string) - Optional - The root directory of the provider. - **buildSpecification** (string) - Optional - The build specification for the site. - **runtimeSpecification** (string) - Optional - The runtime specification for the site. - **deploymentRetention** (integer) - Optional - The number of deployments to retain. - **enabled** (boolean) - Optional - Whether the site is enabled. - **logging** (boolean) - Optional - Whether to enable logging for the site. - **timeout** (integer) - Optional - The timeout for build and deployment processes. ### Request Example ```json { "siteId": "", "name": "", "framework": "analog", "buildRuntime": "node145", "installCommand": "", "buildCommand": "", "startCommand": "", "outputDirectory": "", "adapter": "static", "installationId": "", "fallbackFile": "", "providerRepositoryId": "", "providerBranch": "", "providerSilentMode": false, "providerRootDirectory": "", "buildSpecification": "", "runtimeSpecification": "", "deploymentRetention": 0, "enabled": false, "logging": false, "timeout": 1 } ``` ### Response #### Success Response (200) - **$id** (string) - The unique identifier for the site. - **name** (string) - The name of the site. - **framework** (string) - The framework used for the site. - **buildRuntime** (string) - The build runtime environment. - **enabled** (boolean) - Whether the site is enabled. - **logging** (boolean) - Whether logging is enabled. - **timeout** (integer) - The timeout for build and deployment processes. - **installCommand** (string) - The command to install dependencies. - **buildCommand** (string) - The command to build the site. - **startCommand** (string) - The command to start the site. - **outputDirectory** (string) - The directory containing the build output. - **adapter** (string) - The adapter used for serving the site. - **installationId** (string) - The ID of the installation. - **fallbackFile** (string) - The fallback file for the site. - **providerRepositoryId** (string) - The ID of the repository for deployment. - **providerBranch** (string) - The branch of the repository for deployment. - **providerSilentMode** (boolean) - Whether silent mode is used for deployment. - **providerRootDirectory** (string) - The root directory of the provider. - **buildSpecification** (string) - The build specification for the site. - **runtimeSpecification** (string) - The runtime specification for the site. - **deploymentRetention** (integer) - The number of deployments to retain. - **createdAt** (string) - The date and time the site was created. - **updatedAt** (string) - The date and time the site was last updated. #### Response Example ```json { "$id": "60a7b1f4b3f3f3f3f3f3f3f3", "name": "My Awesome Site", "framework": "analog", "buildRuntime": "node145", "enabled": true, "logging": true, "timeout": 60, "installCommand": "npm install", "buildCommand": "npm run build", "startCommand": "npm start", "outputDirectory": "dist", "adapter": "static", "installationId": "12345", "fallbackFile": "index.html", "providerRepositoryId": "repo-123", "providerBranch": "main", "providerSilentMode": false, "providerRootDirectory": "/app", "buildSpecification": "", "runtimeSpecification": "", "deploymentRetention": 10, "createdAt": "2023-01-01T12:00:00.000Z", "updatedAt": "2023-01-01T12:00:00.000Z" } ``` ``` -------------------------------- ### Get Current Locale Information Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/locale/get.md Use the `get()` method from the Locale class to retrieve the current locale settings. Ensure your client is initialized with the correct endpoint, project ID, and session. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with Locale locale = Locale(client); Locale result = await locale.get(); ``` -------------------------------- ### List OAuth2 Providers Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/project/list-o-auth-2-providers.md This example demonstrates how to fetch a list of all OAuth2 providers configured for your project. You can optionally filter the results using queries and control whether the total count is returned. ```APIDOC ## List OAuth2 Providers ### Description Retrieves a list of all the OAuth2 providers configured in your project. ### Method `project.listOAuth2Providers()` ### Parameters #### Query Parameters - **queries** (list) - Optional - You can use this parameter to filter, sort, and paginate the results. For example, `queries: [Query.limit(10), Query.orderAsc('name')]`. - **total** (boolean) - Optional - If set to `true`, the response will include the total number of available providers. Defaults to `false`. ### Response #### Success Response (200) - **total** (integer) - The total number of providers available. - **providers** (list) - A list of OAuth2 provider objects. - **provider** (string) - The name of the OAuth2 provider (e.g., 'github', 'google'). - **key** (string) - The unique key for the provider. - **secret** (string) - The client secret for the provider. - **enabled** (boolean) - Whether the provider is enabled. - **scopes** (list) - A list of OAuth2 scopes. - **domain** (string) - The domain associated with the provider. - **convertToLocalUser** (boolean) - Whether to convert the user to a local user upon login. - **forceCreation** (boolean) - Whether to force creation of a new user. ### Request Example ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Project project = Project(client); OAuth2ProviderList result = await project.listOAuth2Providers( queries: [], // (optional) total: false, // (optional) ); ``` ### Response Example ```json { "total": 2, "providers": [ { "provider": "github", "key": "60a7b1f7a1b2c3d4e5f6", "secret": "********************************", "enabled": true, "scopes": ["read:user", "user:email"], "domain": "github.com", "convertToLocalUser": true, "forceCreation": false }, { "provider": "google", "key": "71b8c2e9d8f7e6d5c4b3", "secret": "********************************", "enabled": true, "scopes": ["openid", "email", "profile"], "domain": "google.com", "convertToLocalUser": true, "forceCreation": false } ] } ``` ``` -------------------------------- ### Create a Site Deployment with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/create-deployment.md Use this snippet to create a new deployment for a specific site. Ensure your client is configured with the correct endpoint, project ID, and API key. The `code` parameter expects an `InputFile` object pointing to your deployment files. ```dart import 'dart:io'; import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Sites sites = Sites(client); Deployment result = await sites.createDeployment( siteId: '', code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), installCommand: '', // (optional) buildCommand: '', // (optional) outputDirectory: '', // (optional) activate: false, // (optional) ); ``` -------------------------------- ### Get Browser Icon with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/avatars/get-browser.md Use this snippet to get a browser icon. Ensure you have initialized the Appwrite client with your project details and session. Optional parameters like width, height, and quality can be adjusted. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with Avatars avatars = Avatars(client); Uint8List result = await avatars.getBrowser( code: enums.Browser.avantBrowser, width: 0, // (optional) height: 0, // (optional) quality: -1, // (optional) ); ``` -------------------------------- ### Get Backup Archive using Dart SDK Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/backups/get-archive.md Initialize the Appwrite client and use the Backups service to get a specific archive by its ID. Ensure you replace placeholders with your actual project details and archive ID. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Backups backups = Backups(client); BackupArchive result = await backups.getArchive( archiveId: '', ); ``` -------------------------------- ### List Users with Dart SDK Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/users/list.md Initialize the client and use the Users service to list users. You can optionally provide queries or a search string. Setting 'total' to false can improve performance if the total count is not needed. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Users users = Users(client); UserList result = await users.list( queries: [], // (optional) search: '', // (optional) total: false, // (optional) ); ``` -------------------------------- ### Get Mock Phone Number with Dart SDK Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/project/get-mock-phone.md Initialize the Appwrite client and use the Project service to get a mock phone number. Ensure you replace placeholders with your actual project credentials and desired phone number. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Project project = Project(client); MockNumber result = await project.getMockPhone( number: '+12065550100', ); ``` -------------------------------- ### Get Deployment Details Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/functions/get-deployment.md Use this method to retrieve information about a specific deployment. Ensure your client is initialized with your project details and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Functions functions = Functions(client); Deployment result = await functions.getDeployment( functionId: '', deploymentId: '', ); ``` -------------------------------- ### Get Current User Account - Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/account/get.md Initialize the Appwrite client and account service, then call the get() method to retrieve the logged-in user's details. Ensure you have set your API endpoint, project ID, and user session. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with Account account = Account(client); User result = await account.get(); ``` -------------------------------- ### Get Message Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/messaging/get-message.md Fetches a message using its ID. ```APIDOC ## Get Message ### Description Retrieves a specific message by its unique ID. ### Method `getMessage` ### Parameters #### Path Parameters - **messageId** (string) - Required - The ID of the message to retrieve. ### Request Example ```dart Message result = await messaging.getMessage( messageId: '', ); ``` ### Response #### Success Response (200) - **message** (Message) - The retrieved message object. ``` -------------------------------- ### List Available Runtimes Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/functions/list-runtimes.md Initializes the Appwrite client and retrieves a list of all available runtimes for functions. Ensure you replace placeholders with your actual project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Functions functions = Functions(client); RuntimeList result = await functions.listRuntimes(); ``` -------------------------------- ### Get Webhook Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/webhooks/get.md Retrieves the details of a specific webhook by its ID. ```APIDOC ## GET /webhooks/{webhookId} ### Description Retrieves the details of a specific webhook. ### Method GET ### Endpoint /webhooks/{webhookId} ### Parameters #### Path Parameters - **webhookId** (string) - Required - The unique identifier of the webhook to retrieve. ### Response #### Success Response (200) - **webhook** (object) - The webhook object containing its details. ``` -------------------------------- ### List Reports with Dart SDK Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/advisor/list-reports.md Initialize the Appwrite client and use the Advisor service to fetch a list of reports. Ensure you replace placeholders with your actual project details. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Advisor advisor = Advisor(client); ReportList result = await advisor.listReports( queries: [], // (optional) total: false, // (optional) ); ``` -------------------------------- ### Create APNS Provider Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/messaging/create-apns-provider.md This example demonstrates how to create a new APNS provider by calling the `createAPNSProvider` method on the `Messaging` service. ```APIDOC ## Create APNS Provider ### Description Creates a new APNS provider to send push notifications to iOS devices. ### Method `messaging.createAPNSProvider` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **providerId** (string) - Required - The unique identifier for the APNS provider. - **name** (string) - Required - The name of the APNS provider. - **authKey** (string) - Optional - The authentication key for APNS. - **authKeyId** (string) - Optional - The ID of the authentication key for APNS. - **teamId** (string) - Optional - The team ID associated with the APNS provider. - **bundleId** (string) - Optional - The bundle ID of the iOS application. - **sandbox** (boolean) - Optional - Whether to use the sandbox environment for APNS. Defaults to `false`. - **enabled** (boolean) - Optional - Whether the APNS provider is enabled. Defaults to `false`. ### Request Example ```dart Provider result = await messaging.createAPNSProvider( providerId: '', name: '', authKey: '', // (optional) authKeyId: '', // (optional) teamId: '', // (optional) bundleId: '', // (optional) sandbox: false, // (optional) enabled: false, // (optional) ); ``` ### Response #### Success Response (200) - **Provider** (object) - The created APNS provider object. #### Response Example ```json { "$id": "6310f73a21906", "providerInternalId": "1", "providerType": "apns", "name": "My APNS Provider", "created manually": false, "enabled": false, "authenticator": { "type": "certificate", "authKeyId": "ABC123XYZ", "teamId": "TEAMID123", "keyId": "KEYID456" }, "app": { "bundleId": "com.example.app" }, "createdAt": "2023-10-27T10:00:00.000+00:00", "updatedAt": "2023-10-27T10:00:00.000+00:00" } ``` ``` -------------------------------- ### Get Token Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/tokens/get.md Retrieves a specific token by its unique ID. ```APIDOC ## Get Token ### Description Retrieves a specific token by its unique ID. ### Method GET ### Endpoint /tokens/{tokenId} ### Parameters #### Path Parameters - **tokenId** (string) - Required - The ID of the token to retrieve. ### Response #### Success Response (200) - **token** (object) - The token object containing token details. - **$id** (string) - The token ID. - **userId** (string) - The ID of the user associated with the token. - **type** (string) - The type of the token (e.g., 'access', 'refresh'). - **creationDate** (string) - The date and time the token was created. - **expireDate** (string) - The date and time the token expires. ### Request Example ```dart Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Tokens tokens = Tokens(client); ResourceToken result = await tokens.get( tokenId: '', ); ``` ### Response Example ```json { "$id": "60a7b0f0e1f1f1f1f1f1f1f1", "userId": "60a7b0f0e1f1f1f1f1f1f1f1", "type": "access", "creationDate": "2023-10-27T10:00:00.000+00:00", "expireDate": "2023-10-27T11:00:00.000+00:00" } ``` ``` -------------------------------- ### List Deployments for a Site Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/list-deployments.md Use this snippet to fetch a list of deployments for a given site. Ensure you have initialized the Appwrite client with your project details and API key. The `listDeployments` method accepts optional parameters like `queries`, `search`, and `total` for filtering and controlling the response. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Sites sites = Sites(client); DeploymentList result = await sites.listDeployments( siteId: '', queries: [], // (optional) search: '', // (optional) total: false, // (optional) ); ``` -------------------------------- ### Get Team Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/teams/get.md Retrieves the details of a specific team by its ID. ```APIDOC ## Get Team ### Description Retrieves the details of a specific team using its unique ID. ### Method GET ### Endpoint /teams/{teamId} ### Parameters #### Path Parameters - **teamId** (string) - Required - The ID of the team to retrieve. ### Response #### Success Response (200) - **$id** (string) - The team's unique ID. - **$createdAt** (string) - The date the team was created. - **$updatedAt** (string) - The date the team was last updated. - **name** (string) - The name of the team. - **total** (integer) - The total number of members in the team. - **joinInvitation** (boolean) - Indicates if team join invitations are enabled. - **role** (string) - The role of the user within the team. ### Request Example ```dart Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setSession(''); // The user session to authenticate with Teams teams = Teams(client); Team result = await teams.get( teamId: '', ); ``` ### Response Example ```json { "$id": "60a9b5c7d3f4a5b6c7d8", "$createdAt": "2023-01-01T10:00:00.000+00:00", "$updatedAt": "2023-01-01T10:00:00.000+00:00", "name": "Example Team", "total": 5, "joinInvitation": true, "role": "owner" } ``` ``` -------------------------------- ### Get Table Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/tablesdb/get-table.md Retrieves a specific table from the database by its ID. ```APIDOC ## Get Table ### Description Retrieves a specific table from the database by its ID. ### Method `getTable` ### Parameters #### Path Parameters - **databaseId** (string) - Required - The ID of the database. - **tableId** (string) - Required - The ID of the table. ### Request Example ```dart Table result = await tablesDB.getTable( databaseId: '', tableId: '', ); ``` ### Response #### Success Response (200) - **table** (Table) - The retrieved table object. ``` -------------------------------- ### Create Template Deployment with Dart Source: https://github.com/appwrite/sdk-for-dart/blob/main/docs/examples/sites/create-template-deployment.md Use this snippet to create a new deployment from a template repository. Ensure you have initialized the Appwrite client with your project details and API key. ```dart import 'package:dart_appwrite/dart_appwrite.dart'; import 'package:dart_appwrite/enums.dart' as enums; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key Sites sites = Sites(client); Deployment result = await sites.createTemplateDeployment( siteId: '', repository: '', owner: '', rootDirectory: '', type: enums.TemplateReferenceType.branch, reference: '', activate: false, // (optional) ); ```