### Install Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/README.md Install the Appwrite Go SDK using the `go get` command. Ensure you are using the correct version tag. ```bash go get github.com/appwrite/sdk-for-go/v5 ``` -------------------------------- ### Example Output of Document Creation Source: https://github.com/appwrite/sdk-for-go/blob/main/README.md This is an example of the output you should expect after successfully running the Go program to create a document. It shows the details of the newly created document. ```bash 2021/10/16 03:41:17 Created document: map[$collection:616a095b20180 $id:616a2dbd4df16 $permissions:map[read:[] write:[]] hello:world] ``` -------------------------------- ### List User Targets with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/users/list-targets.md Initializes the Appwrite client and uses the users service to list targets for a given user ID. This example demonstrates basic client setup and the ListTargets method call. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/users" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := users.New(client) response, error := service.ListTargets( "", users.WithListTargetsQueries([]string{}), users.WithListTargetsTotal(false), ) ``` -------------------------------- ### List Teams with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/teams/list.md Initializes the Appwrite client and uses the teams service to list teams. This example demonstrates basic client setup and calling the List function with optional queries. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/teams" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := teams.New(client) response, error := service.List( teams.WithListQueries([]string{}), teams.WithListSearch(""), teams.WithListTotal(false), ) ``` -------------------------------- ### Get Queue Builds in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-queue-builds.md This snippet demonstrates how to initialize the Appwrite client and use the health service to get queue builds. Ensure you replace placeholders with your actual project details. The `WithGetQueueBuildsThreshold(0)` option retrieves all builds. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetQueueBuilds( health.WithGetQueueBuildsThreshold(0), ) ``` -------------------------------- ### List Project Keys in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/list-keys.md Initializes the Appwrite client and uses the Project service to list API keys for your project. This snippet demonstrates basic client setup and the call to the ListKeys function. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.ListKeys( project.WithListKeysQueries([]string{}), project.WithListKeysTotal(false), ) ``` -------------------------------- ### Get Document in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/databases/get-document.md Demonstrates how to initialize the Appwrite client and use the GetDocument method to retrieve a document. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/databases" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := databases.New(client) response, error := service.GetDocument( "", "", "", databases.WithGetDocumentQueries([]string{}), databases.WithGetDocumentTransactionId(""), ) ``` -------------------------------- ### Get Deployment Details in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/get-deployment.md Retrieves a specific deployment for a given website. Ensure you have initialized the Appwrite client with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.GetDeployment( "", "", ) ``` -------------------------------- ### Get Project Details in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/organization/get-project.md Initializes the Appwrite client with endpoint, project ID, and API key, then uses the organization service to fetch a specific project's details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/organization" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := organization.New(client) response, error := service.GetProject( "", ) ``` -------------------------------- ### Get Project Details in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/get.md Initializes the Appwrite Go SDK client and uses the Project service to fetch project details. Ensure you replace placeholders with your actual project credentials and region. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.Get()) ``` -------------------------------- ### Create a New Site with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/create.md This snippet demonstrates how to initialize the Appwrite client and create a new site using the `sites.Create` method. It includes various optional parameters for configuring the site's build process, deployment settings, and source control integration. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.Create( "", "", "analog", "node-14.5", sites.WithCreateEnabled(false), sites.WithCreateLogging(false), sites.WithCreateTimeout(1), sites.WithCreateInstallCommand(""), sites.WithCreateBuildCommand(""), sites.WithCreateStartCommand(""), sites.WithCreateOutputDirectory(""), sites.WithCreateAdapter("static"), sites.WithCreateInstallationId(""), sites.WithCreateFallbackFile(""), sites.WithCreateProviderRepositoryId(""), sites.WithCreateProviderBranch(""), sites.WithCreateProviderSilentMode(false), sites.WithCreateProviderRootDirectory(""), sites.WithCreateProviderBranches([]string{}), sites.WithCreateProviderPaths([]string{}), sites.WithCreateBuildSpecification(""), sites.WithCreateRuntimeSpecification(""), sites.WithCreateDeploymentRetention(0) ) ``` -------------------------------- ### Update OAuth2 Yahoo Configuration in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/update-o-auth-2-yahoo.md Use this snippet to update the OAuth2 Yahoo configuration for your project. Ensure you have the Appwrite Go SDK installed and imported. This example demonstrates disabling the Yahoo OAuth2 provider. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.UpdateOAuth2Yahoo( project.WithUpdateOAuth2YahooClientId(""), project.WithUpdateOAuth2YahooClientSecret(""), project.WithUpdateOAuth2YahooEnabled(false), ) ``` -------------------------------- ### List Backup Policies in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/backups/list-policies.md This Go snippet shows how to initialize the Appwrite client and use the backups service to list all backup policies. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/backups" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := backups.New(client) response, error := service.ListPolicies( backups.WithListPoliciesQueries([]string{}), ) ``` -------------------------------- ### Create Template Deployment with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/create-template-deployment.md Initializes the Appwrite client and creates a template deployment from a Git repository. Ensure you replace placeholders like , , , , , , , and with your actual values. The Activate parameter is set to false to prevent immediate activation. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.CreateTemplateDeployment( "", "", "", "", "branch", "", sites.WithCreateTemplateDeploymentActivate(false), ) ``` -------------------------------- ### Get File Download in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/storage/get-file-download.md This snippet shows how to initialize the Appwrite client and storage service, then retrieve a file for download using its bucket and file IDs, along with an optional download token. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/storage" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := storage.New(client) response, error := service.GetFileDownload( "", "", storage.WithGetFileDownloadToken(""), ) ``` -------------------------------- ### Get File Preview with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/storage/get-file-preview.md Use this snippet to fetch a preview of a file. Customize preview dimensions, quality, borders, and more. Ensure you have initialized the Appwrite client and storage service. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/storage" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := storage.New(client) response, error := service.GetFilePreview( "", "", storage.WithGetFilePreviewWidth(0), storage.WithGetFilePreviewHeight(0), storage.WithGetFilePreviewGravity("center"), storage.WithGetFilePreviewQuality(-1), storage.WithGetFilePreviewBorderWidth(0), storage.WithGetFilePreviewBorderColor(""), storage.WithGetFilePreviewBorderRadius(0), storage.WithGetFilePreviewOpacity(0), storage.WithGetFilePreviewRotation(-360), storage.WithGetFilePreviewBackground(""), storage.WithGetFilePreviewOutput("jpg"), storage.WithGetFilePreviewToken(""), ) ``` -------------------------------- ### Create Document using Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/README.md Example Go program demonstrating how to initialize the Appwrite client and create a new document in a specified collection. It uses environment variables for configuration and logs the created document or any errors. ```go package main import ( "log" "os" "time" "github.com/appwrite/sdk-for-go/v5/appwrite" "github.com/appwrite/sdk-for-go/v5/id" ) func main() { client := appwrite.NewClient( appwrite.WithEndpoint(os.Getenv("YOUR_ENDPOINT")), appwrite.WithProject(os.Getenv("YOUR_PROJECT_ID")), appwrite.WithKey(os.Getenv("YOUR_KEY")), ) databases := appwrite.NewDatabases(client) data := map[string]interface{}{ "hello": "world", } doc, err := databases.CreateDocument( os.Getenv("DATABASE_ID"), os.Getenv("COLLECTION_ID"), id.Unique(), data, ) if err != nil { log.Printf("Error creating document: %v", err) } log.Printf("Created document: %v", doc) } ``` -------------------------------- ### Get Queue Audits in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-queue-audits.md Initializes the Appwrite client and uses the health service to retrieve queue audit information. Set the threshold to 0 to get all audits. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetQueueAudits( health.WithGetQueueAuditsThreshold(0), ) ``` -------------------------------- ### Get Favicon using Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/avatars/get-favicon.md Use this snippet to get a favicon for a given URL. Ensure the Appwrite client is initialized with your project details and endpoint. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/avatars" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := avatars.New(client) response, error := service.GetFavicon( "https://example.com", ) ``` -------------------------------- ### Initialize Appwrite Go Client and Get Project Key Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/get-key.md Demonstrates how to initialize the Appwrite client with endpoint, project ID, and API key, and then retrieve a specific project key using the Go SDK. Ensure you replace placeholders with your actual credentials and key ID. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.GetKey( "", ) ``` -------------------------------- ### Get Screenshot with Custom Options Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/avatars/get-screenshot.md Demonstrates how to fetch a screenshot of a URL with various customization options like viewport size, scale, theme, and more. Ensure you have initialized the Appwrite client and Avatars service before use. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/avatars" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := avatars.New(client) response, error := service.GetScreenshot( "https://example.com", avatars.WithGetScreenshotHeaders(map[string]interface{}{ "Authorization": "Bearer token123", "X-Custom-Header": "value" }), avatars.WithGetScreenshotViewportWidth(1920), avatars.WithGetScreenshotViewportHeight(1080), avatars.WithGetScreenshotScale(2), avatars.WithGetScreenshotTheme("dark"), avatars.WithGetScreenshotUserAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15"), avatars.WithGetScreenshotFullpage(true), avatars.WithGetScreenshotLocale("en-US"), avatars.WithGetScreenshotTimezone("America/New_York"), avatars.WithGetScreenshotLatitude(37.7749), avatars.WithGetScreenshotLongitude(-122.4194), avatars.WithGetScreenshotAccuracy(100), avatars.WithGetScreenshotTouch(true), avatars.WithGetScreenshotPermissions([]string{"geolocation","notifications"}), avatars.WithGetScreenshotSleep(3), avatars.WithGetScreenshotWidth(800), avatars.WithGetScreenshotHeight(600), avatars.WithGetScreenshotQuality(85), avatars.WithGetScreenshotOutput("jpeg") ) ``` -------------------------------- ### List Buckets in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/storage/list-buckets.md Initializes the Appwrite client and uses the storage service to list buckets. This example demonstrates setting up the client with endpoint, project ID, and API key, then calling the ListBuckets method with optional query parameters. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/storage" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := storage.New(client) response, error := service.ListBuckets( storage.WithListBucketsQueries([]string{}), storage.WithListBucketsSearch(""), storage.WithListBucketsTotal(false), ) ``` -------------------------------- ### Get Queue Messaging Status in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-queue-messaging.md Use this snippet to get the current status of your queue messaging. Ensure you have initialized the Appwrite client with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetQueueMessaging( health.WithGetQueueMessagingThreshold(0), ) ``` -------------------------------- ### List Platforms in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/list-platforms.md This snippet shows how to initialize the Appwrite client and use the project service to list platforms. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.ListPlatforms( project.WithListPlatformsQueries([]string{}), project.WithListPlatformsTotal(false), ) ``` -------------------------------- ### Get Cache Status in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-cache.md This snippet demonstrates how to initialize the Appwrite client and use the health service to get the cache status. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetCache()) ``` -------------------------------- ### Get Deployment Download Link - Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/get-deployment-download.md Use this snippet to get a download link for a specific deployment of your Appwrite site. Ensure you have initialized the Appwrite client with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.GetDeploymentDownload( "", "", sites.WithGetDeploymentDownloadType("source"), ) ``` -------------------------------- ### Get Target User in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/users/get-target.md This snippet demonstrates how to initialize the Appwrite client and use the Users service to get a specific target user. Ensure you replace placeholders with your actual project details and IDs. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/users" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := users.New(client) response, error := service.GetTarget( "", "", ) ``` -------------------------------- ### List Mock Phones in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/list-mock-phones.md Initializes the Appwrite client and uses the Project service to list mock phones. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.ListMockPhones( project.WithListMockPhonesQueries([]string{}), project.WithListMockPhonesTotal(false), ) ``` -------------------------------- ### Get Certificate using Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-certificate.md Initializes the Appwrite client and health service, then calls `GetCertificate` to check a domain's certificate. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetCertificate( health.WithGetCertificateDomain(""), ) ``` -------------------------------- ### Get Local Storage Status in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-storage-local.md This snippet demonstrates how to initialize the Appwrite client and use the health service to get the local storage status. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetStorageLocal()) ``` -------------------------------- ### Initialize Client and Get Antivirus Status (Go) Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-antivirus.md Initializes the Appwrite client with your project details and then uses the health service to retrieve the Antivirus status. Ensure you replace placeholders with your actual project ID, API key, and region. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetAntivirus()) ``` -------------------------------- ### List Site Specifications in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/list-specifications.md Initializes the Appwrite client and uses the sites service to list specifications. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.ListSpecifications()) ``` -------------------------------- ### Get Appwrite Health Status in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get.md This snippet demonstrates how to initialize the Appwrite client and use the health service to get the API's health status. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.Get()) ``` -------------------------------- ### Get Database Audits Status with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-audits-db.md This snippet demonstrates how to initialize the Appwrite client and use the health service to get the database audits status. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetAuditsDB()) ``` -------------------------------- ### List Restorations in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/backups/list-restorations.md This snippet shows how to initialize the Appwrite client and use the backups service to list all restorations. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/backups" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := backups.New(client) response, error := service.ListRestorations( backups.WithListRestorationsQueries([]string{}), ) ``` -------------------------------- ### List Deployments for a Site in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/list-deployments.md Initializes the Appwrite client and uses the sites service to list deployments for a given site ID. This snippet demonstrates setting up the client with endpoint, project ID, and API key, then calling the ListDeployments method with optional query parameters. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.ListDeployments( "", sites.WithListDeploymentsQueries([]string{}), sites.WithListDeploymentsSearch(""), sites.WithListDeploymentsTotal(false), ) ``` -------------------------------- ### Get Avatar Image with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/avatars/get-image.md This snippet demonstrates how to initialize the Appwrite client and use the avatars service to get an image. Ensure you replace placeholders with your actual project details and desired image dimensions. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/avatars" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := avatars.New(client) response, error := service.GetImage( "https://example.com", avatars.WithGetImageWidth(0), avatars.WithGetImageHeight(0), ) ``` -------------------------------- ### List Sites with Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/list.md Initializes the Appwrite client and uses the sites service to list sites. This snippet demonstrates basic client configuration and calling the List method with optional queries. ```Go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.List( sites.WithListQueries([]string{}), sites.WithListSearch(""), sites.WithListTotal(false), ) ``` -------------------------------- ### Get Report using Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/advisor/get-report.md This snippet demonstrates how to initialize the Appwrite client and use the advisor service to get a report by its ID. Ensure you replace placeholders with your actual project details and report ID. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/advisor" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := advisor.New(client) response, error := service.GetReport( "", ) ``` -------------------------------- ### List Users with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/users/list.md This snippet demonstrates how to initialize the Appwrite client and use the users service to list users. It includes options for queries, search, and controlling the total count. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/users" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := users.New(client) response, error := service.List( users.WithListQueries([]string{}), users.WithListSearch(""), users.WithListTotal(false), ) ``` -------------------------------- ### Get Queue Usage in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/health/get-queue-usage.md This snippet demonstrates how to initialize the Appwrite client and use the health service to get queue usage statistics. Ensure you replace placeholders with your actual project details. The `WithGetQueueUsageThreshold(0)` option is used to retrieve all queue usage data. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/health" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := health.New(client) response, error := service.GetQueueUsage( health.WithGetQueueUsageThreshold(0), ) ``` -------------------------------- ### Create Deployment with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/create-deployment.md Use this snippet to create a new deployment for a given site ID. Ensure you have initialized the Appwrite client with your endpoint, project ID, and API key. You can specify installation and build commands, the output directory, and whether to activate the deployment immediately. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.CreateDeployment( "", file.NewInputFile("/path/to/file.png", "file.png"), sites.WithCreateDeploymentInstallCommand(""), sites.WithCreateDeploymentBuildCommand(""), sites.WithCreateDeploymentOutputDirectory(""), sites.WithCreateDeploymentActivate(false), ) ``` -------------------------------- ### Get Country Flag using Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/avatars/get-flag.md This snippet shows how to initialize the Appwrite client and use the avatars service to get a country flag. It includes optional parameters for image dimensions and quality. Ensure you replace placeholders with your actual project ID and region. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/avatars" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := avatars.New(client) response, error := service.GetFlag( "af", avatars.WithGetFlagWidth(0), avatars.WithGetFlagHeight(0), avatars.WithGetFlagQuality(-1), ) ``` -------------------------------- ### List Appwrite Functions with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/functions/list.md Initializes the Appwrite client and uses the Functions service to list functions. This example demonstrates setting the endpoint, project ID, API key, and optional query parameters for listing. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/functions" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := functions.New(client) response, error := service.List( functions.WithListQueries([]string{}), functions.WithListSearch(""), functions.WithListTotal(false), ) ``` -------------------------------- ### Get Browser Icon with Appwrite Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/avatars/get-browser.md This snippet demonstrates how to initialize the Appwrite client and use the avatars service to get a browser icon. It includes options for setting the width, height, and quality of the icon. Ensure you replace placeholders with your actual project ID and region. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/avatars" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := avatars.New(client) response, error := service.GetBrowser( "aa", avatars.WithGetBrowserWidth(0), avatars.WithGetBrowserHeight(0), avatars.WithGetBrowserQuality(-1), ) ``` -------------------------------- ### Get Locale Information Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/locale/get.md Retrieves the current locale information. This includes details about supported languages, countries, and currencies. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/locale" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := locale.New(client) response, error := service.Get()) ``` -------------------------------- ### List Topics with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/messaging/list-topics.md This snippet demonstrates how to initialize the Appwrite client and use the messaging service to list topics. It includes options for queries, search, and disabling total count. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/messaging" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := messaging.New(client) response, error := service.ListTopics( messaging.WithListTopicsQueries([]string{}), messaging.WithListTopicsSearch(""), messaging.WithListTopicsTotal(false), ) ``` -------------------------------- ### Get Database Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/databases/get.md Retrieves a specific database by its ID. Ensure you have initialized the Appwrite client with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/databases" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := databases.New(client) response, error := service.Get( "", ) ``` -------------------------------- ### Create Account in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/account/create.md Initializes the Appwrite client and creates a new user account. Ensure you replace placeholders with your actual project details and user information. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/account" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithSession("") ) service := account.New(client) response, error := service.Create( "", "email@example.com", "", account.WithCreateName(""), ) ``` -------------------------------- ### Get Transaction by ID - Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/databases/get-transaction.md Use this snippet to retrieve a transaction by its ID. Ensure you have initialized the Appwrite client and the databases service. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/databases" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := databases.New(client) response, error := service.GetTransaction( "", ) ``` -------------------------------- ### Create a Topic in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/messaging/create-topic.md This snippet demonstrates how to initialize the Appwrite client, create a messaging service instance, and then use it to create a new topic. Ensure you replace placeholders with your actual project details and desired topic information. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/messaging" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := messaging.New(client) response, error := service.CreateTopic( "", "", messaging.WithCreateTopicSubscribe([]string{"any"}), ) ``` -------------------------------- ### Get Table by ID in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/tablesdb/get.md Retrieves a table from the database using its ID. Ensure the client is initialized with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/tablesdb" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := tablesdb.New(client) response, error := service.Get( "", ) ``` -------------------------------- ### Get OAuth2 Provider Configuration Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/get-o-auth-2-provider.md Retrieves the configuration details for a specific OAuth2 provider. Ensure you have initialized the Appwrite client with your project credentials. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.GetOAuth2Provider( "amazon", ) ``` -------------------------------- ### List Project Policies in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/project/list-policies.md Initializes the Appwrite client and uses the project service to list policies. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/project" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := project.New(client) response, error := service.ListPolicies( project.WithListPoliciesQueries([]string{}), project.WithListPoliciesTotal(false), ) ``` -------------------------------- ### Get User Details in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/users/get.md Retrieves a user document by its unique ID. Ensure you have initialized the Appwrite client with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/users" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := users.New(client) response, error := service.Get( "", ) ``` -------------------------------- ### Initialize Client and List Reports Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/advisor/list-reports.md Initializes the Appwrite client with endpoint, project ID, and API key, then creates an advisor service to list reports. Use this to retrieve advisor reports for your project. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/advisor" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := advisor.New(client) response, error := service.ListReports( advisor.WithListReportsQueries([]string{}), advisor.WithListReportsTotal(false), ) ``` -------------------------------- ### Create Database with Go SDK Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/databases/create.md Initializes the Appwrite client and creates a new database. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/databases" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := databases.New(client) response, error := service.Create( "", "", databases.WithCreateEnabled(false), ) ``` -------------------------------- ### Get Index from Table - Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/tablesdb/get-index.md Retrieves a specific index from a given table. Ensure you have initialized the Appwrite client and the tablesdb service with your project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/tablesdb" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := tablesdb.New(client) response, error := service.GetIndex( "", "", "", ) ``` -------------------------------- ### List Proxy Rules in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/proxy/list-rules.md Initializes the Appwrite client, creates a proxy service, and calls the ListRules method. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/proxy" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := proxy.New(client) response, error := service.ListRules( proxy.WithListRulesQueries([]string{}), proxy.WithListRulesTotal(false), ) ``` -------------------------------- ### List Site Variables in Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/sites/list-variables.md This snippet demonstrates how to initialize the Appwrite client and use the `sites.ListVariables` method to fetch variables for a given site. Ensure you replace placeholders with your actual project details. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/sites" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := sites.New(client) response, error := service.ListVariables( "", sites.WithListVariablesQueries([]string{}), sites.WithListVariablesTotal(false), ) ``` -------------------------------- ### Get Topic by ID - Go Source: https://github.com/appwrite/sdk-for-go/blob/main/docs/examples/messaging/get-topic.md Retrieves a specific topic using its ID. Ensure the Appwrite client is initialized with your project details and API key. ```go package main import ( "fmt" "github.com/appwrite/sdk-for-go/v5/client" "github.com/appwrite/sdk-for-go/v5/messaging" ) client := client.New( client.WithEndpoint("https://.cloud.appwrite.io/v1") client.WithProject("") client.WithKey("") ) service := messaging.New(client) response, error := service.GetTopic( "", ) ```