appwrite

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account service

func NewAccount

func NewAccount(clt Client) *Account

func (*Account) CreatePhoneVerification

func (srv *Account) CreatePhoneVerification() (*ClientResponse, error)

CreatePhoneVerification use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone) endpoint. Learn more about how to [complete the verification process](/docs/client/account#accountUpdatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.

func (*Account) CreateRecovery

func (srv *Account) CreateRecovery(Email string, Url string) (*ClientResponse, error)

CreateRecovery sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.

func (*Account) CreateVerification

func (srv *Account) CreateVerification(Url string) (*ClientResponse, error)

CreateVerification use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#accountUpdateEmailVerification). The verification link sent to the user's email address is valid for 7 days.

Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.

func (*Account) DeleteSession

func (srv *Account) DeleteSession(SessionId string) (*ClientResponse, error)

DeleteSession use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the Session ID argument, only the unique session ID provided is deleted.

func (*Account) DeleteSessions

func (srv *Account) DeleteSessions() (*ClientResponse, error)

DeleteSessions delete all sessions from the user account and remove any sessions cookies from the end client.

func (*Account) Get

func (srv *Account) Get() (*ClientResponse, error)

Get get currently logged in user data as JSON object.

func (*Account) GetPrefs

func (srv *Account) GetPrefs() (*ClientResponse, error)

GetPrefs get currently logged in user preferences as a key-value object.

func (*Account) GetSession

func (srv *Account) GetSession(SessionId string) (*ClientResponse, error)

GetSession use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.

func (*Account) ListLogs

func (srv *Account) ListLogs(Queries []interface{}) (*ClientResponse, error)

ListLogs get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.

func (*Account) ListSessions

func (srv *Account) ListSessions() (*ClientResponse, error)

ListSessions get currently logged in user list of active sessions across different devices.

func (*Account) UpdateEmail

func (srv *Account) UpdateEmail(Email string, Password string) (*ClientResponse, error)

UpdateEmail 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.

func (*Account) UpdateName

func (srv *Account) UpdateName(Name string) (*ClientResponse, error)

UpdateName update currently logged in user account name.

func (*Account) UpdatePassword

func (srv *Account) UpdatePassword(Password string, OldPassword string) (*ClientResponse, error)

UpdatePassword update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.

func (*Account) UpdatePhone

func (srv *Account) UpdatePhone(Phone string, Password string) (*ClientResponse, error)

UpdatePhone update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](/docs/client/account#accountCreatePhoneVerification) endpoint to send a confirmation SMS.

func (*Account) UpdatePhoneVerification

func (srv *Account) UpdatePhoneVerification(UserId string, Secret string) (*ClientResponse, error)

UpdatePhoneVerification use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.

func (*Account) UpdatePrefs

func (srv *Account) UpdatePrefs(Prefs interface{}) (*ClientResponse, error)

UpdatePrefs update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.

func (*Account) UpdateRecovery

func (srv *Account) UpdateRecovery(UserId string, Secret string, Password string, PasswordAgain string) (*ClientResponse, error)

UpdateRecovery use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](/docs/client/account#accountCreateRecovery) endpoint.

Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.

func (*Account) UpdateSession

func (srv *Account) UpdateSession(SessionId string) (*ClientResponse, error)

UpdateSession access tokens have limited lifespan and expire to mitigate security risks. If session was created using an OAuth provider, this route can be used to "refresh" the access token.

func (*Account) UpdateStatus

func (srv *Account) UpdateStatus() (*ClientResponse, error)

UpdateStatus block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.

func (*Account) UpdateVerification

func (srv *Account) UpdateVerification(UserId string, Secret string) (*ClientResponse, error)

UpdateVerification use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.

type AppwriteError

type AppwriteError struct {
	// contains filtered or unexported fields
}

AppwriteError represents an error of a client request

func (*AppwriteError) Error

func (ce *AppwriteError) Error() string

func (*AppwriteError) GetMessage

func (ce *AppwriteError) GetMessage() string

func (*AppwriteError) GetStatusCode

func (ce *AppwriteError) GetStatusCode() int

type Avatars

type Avatars struct {
	// contains filtered or unexported fields
}

Avatars service

func NewAvatars

func NewAvatars(clt Client) *Avatars

func (*Avatars) GetBrowser

func (srv *Avatars) GetBrowser(Code string, Width int, Height int, Quality int) (*ClientResponse, error)

GetBrowser 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.

func (*Avatars) GetCreditCard

func (srv *Avatars) GetCreditCard(Code string, Width int, Height int, Quality int) (*ClientResponse, error)

GetCreditCard 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.

func (*Avatars) GetFavicon

func (srv *Avatars) GetFavicon(Url string) (*ClientResponse, error)

GetFavicon use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.

func (*Avatars) GetFlag

func (srv *Avatars) GetFlag(Code string, Width int, Height int, Quality int) (*ClientResponse, error)

GetFlag 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.

func (*Avatars) GetImage

func (srv *Avatars) GetImage(Url string, Width int, Height int) (*ClientResponse, error)

GetImage 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.

func (*Avatars) GetInitials

func (srv *Avatars) GetInitials(Name string, Width int, Height int, Background string) (*ClientResponse, error)

GetInitials 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.

func (*Avatars) GetQR

func (srv *Avatars) GetQR(Text string, Size int, Margin int, Download bool) (*ClientResponse, error)

GetQR 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.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the client struct to access Appwrite services

func NewClient

func NewClient() Client

NewClient initializes a new Appwrite client with a given timeout

func (*Client) AddHeader

func (clt *Client) AddHeader(key string, value string)

AddHeader add a new custom header that the Client should send on each request

func (*Client) Call

func (clt *Client) Call(method string, path string, headers map[string]interface{}, params map[string]interface{}) (*ClientResponse, error)

Call an API using Client

func (*Client) SetEndpoint

func (clt *Client) SetEndpoint(endpoint string)

SetEndpoint sets the default endpoint to which the Client connects to

func (*Client) SetJWT

func (clt *Client) SetJWT(value string)

Your secret JSON Web Token

func (*Client) SetKey

func (clt *Client) SetKey(value string)

Your secret API key

func (*Client) SetLocale

func (clt *Client) SetLocale(value string)

func (*Client) SetProject

func (clt *Client) SetProject(value string)

Your project ID

func (*Client) SetSelfSigned

func (clt *Client) SetSelfSigned(status bool)

SetSelfSigned sets the condition that specify if the Client should allow connections to a server using a self-signed certificate

func (*Client) SetTimeout

func (clt *Client) SetTimeout(timeout time.Duration) error

func (*Client) String

func (clt *Client) String() string

type ClientResponse

type ClientResponse struct {
	Status     string
	StatusCode int
	Header     http.Header
	Result     string
}

ClientResponse - represents the client response

type Databases

type Databases struct {
	// contains filtered or unexported fields
}

Databases service

func NewDatabases

func NewDatabases(clt Client) *Databases

func (*Databases) Create

func (srv *Databases) Create(DatabaseId string, Name string) (*ClientResponse, error)

Create create a new Database.

func (*Databases) CreateBooleanAttribute

func (srv *Databases) CreateBooleanAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Default bool, Array bool) (*ClientResponse, error)

CreateBooleanAttribute create a boolean attribute.

func (*Databases) CreateCollection

func (srv *Databases) CreateCollection(DatabaseId string, CollectionId string, Name string, Permissions []interface{}, DocumentSecurity bool) (*ClientResponse, error)

CreateCollection create a new Collection. Before using this route, you should create a new database resource using either a [server integration](/docs/server/databases#databasesCreateCollection) API or directly from your database console.

func (*Databases) CreateDatetimeAttribute

func (srv *Databases) CreateDatetimeAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Default string, Array bool) (*ClientResponse, error)

CreateDatetimeAttribute

func (*Databases) CreateDocument

func (srv *Databases) CreateDocument(DatabaseId string, CollectionId string, DocumentId string, Data interface{}, Permissions []interface{}) (*ClientResponse, error)

CreateDocument 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.

func (*Databases) CreateEmailAttribute

func (srv *Databases) CreateEmailAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Default string, Array bool) (*ClientResponse, error)

CreateEmailAttribute create an email attribute.

func (*Databases) CreateEnumAttribute

func (srv *Databases) CreateEnumAttribute(DatabaseId string, CollectionId string, Key string, Elements []interface{}, Required bool, Default string, Array bool) (*ClientResponse, error)

CreateEnumAttribute

func (*Databases) CreateFloatAttribute

func (srv *Databases) CreateFloatAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Min float64, Max float64, Default float64, Array bool) (*ClientResponse, error)

CreateFloatAttribute create a float attribute. Optionally, minimum and maximum values can be provided.

func (*Databases) CreateIndex

func (srv *Databases) CreateIndex(DatabaseId string, CollectionId string, Key string, Type string, Attributes []interface{}, Orders []interface{}) (*ClientResponse, error)

CreateIndex

func (*Databases) CreateIntegerAttribute

func (srv *Databases) CreateIntegerAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Min int, Max int, Default int, Array bool) (*ClientResponse, error)

CreateIntegerAttribute create an integer attribute. Optionally, minimum and maximum values can be provided.

func (*Databases) CreateIpAttribute

func (srv *Databases) CreateIpAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Default string, Array bool) (*ClientResponse, error)

CreateIpAttribute create IP address attribute.

func (*Databases) CreateStringAttribute

func (srv *Databases) CreateStringAttribute(DatabaseId string, CollectionId string, Key string, Size int, Required bool, Default string, Array bool) (*ClientResponse, error)

CreateStringAttribute create a string attribute.

func (*Databases) CreateUrlAttribute

func (srv *Databases) CreateUrlAttribute(DatabaseId string, CollectionId string, Key string, Required bool, Default string, Array bool) (*ClientResponse, error)

CreateUrlAttribute create a URL attribute.

func (*Databases) Delete

func (srv *Databases) Delete(DatabaseId string) (*ClientResponse, error)

Delete delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.

func (*Databases) DeleteAttribute

func (srv *Databases) DeleteAttribute(DatabaseId string, CollectionId string, Key string) (*ClientResponse, error)

DeleteAttribute

func (*Databases) DeleteCollection

func (srv *Databases) DeleteCollection(DatabaseId string, CollectionId string) (*ClientResponse, error)

DeleteCollection delete a collection by its unique ID. Only users with write permissions have access to delete this resource.

func (*Databases) DeleteDocument

func (srv *Databases) DeleteDocument(DatabaseId string, CollectionId string, DocumentId string) (*ClientResponse, error)

DeleteDocument delete a document by its unique ID.

func (*Databases) DeleteIndex

func (srv *Databases) DeleteIndex(DatabaseId string, CollectionId string, Key string) (*ClientResponse, error)

DeleteIndex

func (*Databases) Get

func (srv *Databases) Get(DatabaseId string) (*ClientResponse, error)

Get get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.

func (*Databases) GetAttribute

func (srv *Databases) GetAttribute(DatabaseId string, CollectionId string, Key string) (*ClientResponse, error)

GetAttribute

func (*Databases) GetCollection

func (srv *Databases) GetCollection(DatabaseId string, CollectionId string) (*ClientResponse, error)

GetCollection get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.

func (*Databases) GetDocument

func (srv *Databases) GetDocument(DatabaseId string, CollectionId string, DocumentId string) (*ClientResponse, error)

GetDocument get a document by its unique ID. This endpoint response returns a JSON object with the document data.

func (*Databases) GetIndex

func (srv *Databases) GetIndex(DatabaseId string, CollectionId string, Key string) (*ClientResponse, error)

GetIndex

func (*Databases) List

func (srv *Databases) List(Queries []interface{}, Search string) (*ClientResponse, error)

List get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.

func (*Databases) ListAllCollections added in v0.0.3

func (srv *Databases) ListAllCollections(DatabaseId string) (*ClientResponse, error)

ListCollections get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.

func (*Databases) ListAttributes

func (srv *Databases) ListAttributes(DatabaseId string, CollectionId string) (*ClientResponse, error)

ListAttributes

func (*Databases) ListDocuments

func (srv *Databases) ListDocuments(DatabaseId string, CollectionId string, Queries []interface{}) (*ClientResponse, error)

ListDocuments get a list of all the user's documents in a given collection. You can use the query params to filter your results.

func (*Databases) ListIndexes

func (srv *Databases) ListIndexes(DatabaseId string, CollectionId string) (*ClientResponse, error)

ListIndexes

func (*Databases) SearchCollections added in v0.0.3

func (srv *Databases) SearchCollections(DatabaseId string, Queries []interface{}, Search string) (*ClientResponse, error)

func (*Databases) Update

func (srv *Databases) Update(DatabaseId string, Name string) (*ClientResponse, error)

Update update a database by its unique ID.

func (*Databases) UpdateCollection

func (srv *Databases) UpdateCollection(DatabaseId string, CollectionId string, Name string, Permissions []interface{}, DocumentSecurity bool, Enabled bool) (*ClientResponse, error)

UpdateCollection update a collection by its unique ID.

func (*Databases) UpdateDocument

func (srv *Databases) UpdateDocument(DatabaseId string, CollectionId string, DocumentId string, Data interface{}, Permissions []interface{}) (*ClientResponse, error)

UpdateDocument update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.

type Functions

type Functions struct {
	// contains filtered or unexported fields
}

Functions service

func NewFunctions

func NewFunctions(clt Client) *Functions

func (*Functions) Create

func (srv *Functions) Create(FunctionId string, Name string, Execute []interface{}, Runtime string, Events []interface{}, Schedule string, Timeout int, Enabled bool) (*ClientResponse, error)

Create create a new function. You can pass a list of [permissions](/docs/permissions) to allow different project users or team with access to execute the function using the client API.

func (*Functions) CreateBuild

func (srv *Functions) CreateBuild(FunctionId string, DeploymentId string, BuildId string) (*ClientResponse, error)

CreateBuild

func (*Functions) CreateDeployment

func (srv *Functions) CreateDeployment(FunctionId string, Entrypoint string, Code string, Activate bool) (*ClientResponse, error)

CreateDeployment create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.

This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](/docs/functions).

Use the "command" param to set the entry point used to execute your code.

func (*Functions) CreateExecution

func (srv *Functions) CreateExecution(FunctionId string, Data string, Async bool) (*ClientResponse, error)

CreateExecution 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.

func (*Functions) CreateVariable

func (srv *Functions) CreateVariable(FunctionId string, Key string, Value string) (*ClientResponse, error)

CreateVariable create a new function variable. These variables can be accessed within function in the `env` object under the request variable.

func (*Functions) Delete

func (srv *Functions) Delete(FunctionId string) (*ClientResponse, error)

Delete delete a function by its unique ID.

func (*Functions) DeleteDeployment

func (srv *Functions) DeleteDeployment(FunctionId string, DeploymentId string) (*ClientResponse, error)

DeleteDeployment delete a code deployment by its unique ID.

func (*Functions) DeleteVariable

func (srv *Functions) DeleteVariable(FunctionId string, VariableId string) (*ClientResponse, error)

DeleteVariable delete a variable by its unique ID.

func (*Functions) Get

func (srv *Functions) Get(FunctionId string) (*ClientResponse, error)

Get get a function by its unique ID.

func (*Functions) GetDeployment

func (srv *Functions) GetDeployment(FunctionId string, DeploymentId string) (*ClientResponse, error)

GetDeployment get a code deployment by its unique ID.

func (*Functions) GetExecution

func (srv *Functions) GetExecution(FunctionId string, ExecutionId string) (*ClientResponse, error)

GetExecution get a function execution log by its unique ID.

func (*Functions) GetVariable

func (srv *Functions) GetVariable(FunctionId string, VariableId string) (*ClientResponse, error)

GetVariable get a variable by its unique ID.

func (*Functions) List

func (srv *Functions) List(Queries []interface{}, Search string) (*ClientResponse, error)

List get a list of all the project's functions. You can use the query params to filter your results.

func (*Functions) ListDeployments

func (srv *Functions) ListDeployments(FunctionId string, Queries []interface{}, Search string) (*ClientResponse, error)

ListDeployments get a list of all the project's code deployments. You can use the query params to filter your results.

func (*Functions) ListExecutions

func (srv *Functions) ListExecutions(FunctionId string, Queries []interface{}, Search string) (*ClientResponse, error)

ListExecutions get a list of all the current user function execution logs. You can use the query params to filter your results.

func (*Functions) ListRuntimes

func (srv *Functions) ListRuntimes() (*ClientResponse, error)

ListRuntimes get a list of all runtimes that are currently active on your instance.

func (*Functions) ListVariables

func (srv *Functions) ListVariables(FunctionId string) (*ClientResponse, error)

ListVariables get a list of all variables of a specific function.

func (*Functions) Update

func (srv *Functions) Update(FunctionId string, Name string, Execute []interface{}, Events []interface{}, Schedule string, Timeout int, Enabled bool) (*ClientResponse, error)

Update update function by its unique ID.

func (*Functions) UpdateDeployment

func (srv *Functions) UpdateDeployment(FunctionId string, DeploymentId string) (*ClientResponse, error)

UpdateDeployment update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.

func (*Functions) UpdateVariable

func (srv *Functions) UpdateVariable(FunctionId string, VariableId string, Key string, Value string) (*ClientResponse, error)

UpdateVariable update variable by its unique ID.

type Graphql

type Graphql struct {
	// contains filtered or unexported fields
}

Graphql service

func NewGraphql

func NewGraphql(clt Client) *Graphql

func (*Graphql) Mutation

func (srv *Graphql) Mutation(Query interface{}) (*ClientResponse, error)

Mutation execute a GraphQL mutation.

func (*Graphql) Query

func (srv *Graphql) Query(Query interface{}) (*ClientResponse, error)

Query execute a GraphQL mutation.

type Health

type Health struct {
	// contains filtered or unexported fields
}

Health service

func NewHealth

func NewHealth(clt Client) *Health

func (*Health) Get

func (srv *Health) Get() (*ClientResponse, error)

Get check the Appwrite HTTP server is up and responsive.

func (*Health) GetAntivirus

func (srv *Health) GetAntivirus() (*ClientResponse, error)

GetAntivirus check the Appwrite Antivirus server is up and connection is successful.

func (*Health) GetCache

func (srv *Health) GetCache() (*ClientResponse, error)

GetCache check the Appwrite in-memory cache server is up and connection is successful.

func (*Health) GetDB

func (srv *Health) GetDB() (*ClientResponse, error)

GetDB check the Appwrite database server is up and connection is successful.

func (*Health) GetQueueCertificates

func (srv *Health) GetQueueCertificates() (*ClientResponse, error)

GetQueueCertificates get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.

func (*Health) GetQueueFunctions

func (srv *Health) GetQueueFunctions() (*ClientResponse, error)

GetQueueFunctions

func (*Health) GetQueueLogs

func (srv *Health) GetQueueLogs() (*ClientResponse, error)

GetQueueLogs get the number of logs that are waiting to be processed in the Appwrite internal queue server.

func (*Health) GetQueueWebhooks

func (srv *Health) GetQueueWebhooks() (*ClientResponse, error)

GetQueueWebhooks get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.

func (*Health) GetStorageLocal

func (srv *Health) GetStorageLocal() (*ClientResponse, error)

GetStorageLocal check the Appwrite local storage device is up and connection is successful.

func (*Health) GetTime

func (srv *Health) GetTime() (*ClientResponse, error)

GetTime check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.

type Locale

type Locale struct {
	// contains filtered or unexported fields
}

Locale service

func NewLocale

func NewLocale(clt Client) *Locale

func (*Locale) Get

func (srv *Locale) Get() (*ClientResponse, error)

Get 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))

func (*Locale) ListContinents

func (srv *Locale) ListContinents() (*ClientResponse, error)

ListContinents list of all continents. You can use the locale header to get the data in a supported language.

func (*Locale) ListCountries

func (srv *Locale) ListCountries() (*ClientResponse, error)

ListCountries list of all countries. You can use the locale header to get the data in a supported language.

func (*Locale) ListCountriesEU

func (srv *Locale) ListCountriesEU() (*ClientResponse, error)

ListCountriesEU 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.

func (*Locale) ListCountriesPhones

func (srv *Locale) ListCountriesPhones() (*ClientResponse, error)

ListCountriesPhones list of all countries phone codes. You can use the locale header to get the data in a supported language.

func (*Locale) ListCurrencies

func (srv *Locale) ListCurrencies() (*ClientResponse, error)

ListCurrencies 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.

func (*Locale) ListLanguages

func (srv *Locale) ListLanguages() (*ClientResponse, error)

ListLanguages list of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage service

func NewStorage

func NewStorage(clt Client) *Storage

func (*Storage) CreateBucket

func (srv *Storage) CreateBucket(BucketId string, Name string, Permissions []interface{}, FileSecurity bool, Enabled bool, MaximumFileSize int, AllowedFileExtensions []interface{}, Compression string, Encryption bool, Antivirus bool) (*ClientResponse, error)

CreateBucket create a new storage bucket.

func (*Storage) CreateFile

func (srv *Storage) CreateFile(BucketId string, FileId string, File string, Permissions []interface{}) (*ClientResponse, error)

CreateFile 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.

func (*Storage) DeleteBucket

func (srv *Storage) DeleteBucket(BucketId string) (*ClientResponse, error)

DeleteBucket delete a storage bucket by its unique ID.

func (*Storage) DeleteFile

func (srv *Storage) DeleteFile(BucketId string, FileId string) (*ClientResponse, error)

DeleteFile delete a file by its unique ID. Only users with write permissions have access to delete this resource.

func (*Storage) GetBucket

func (srv *Storage) GetBucket(BucketId string) (*ClientResponse, error)

GetBucket get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.

func (*Storage) GetFile

func (srv *Storage) GetFile(BucketId string, FileId string) (*ClientResponse, error)

GetFile get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.

func (*Storage) GetFileDownload

func (srv *Storage) GetFileDownload(BucketId string, FileId string) (*ClientResponse, error)

GetFileDownload 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.

func (*Storage) GetFilePreview

func (srv *Storage) GetFilePreview(BucketId string, FileId string, Width int, Height int, Gravity string, Quality int, BorderWidth int, BorderColor string, BorderRadius int, Opacity float64, Rotation int, Background string, Output string) (*ClientResponse, error)

GetFilePreview 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.

func (*Storage) GetFileView

func (srv *Storage) GetFileView(BucketId string, FileId string) (*ClientResponse, error)

GetFileView get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.

func (*Storage) ListBuckets

func (srv *Storage) ListBuckets(Queries []interface{}, Search string) (*ClientResponse, error)

ListBuckets get a list of all the storage buckets. You can use the query params to filter your results.

func (*Storage) ListFiles

func (srv *Storage) ListFiles(BucketId string, Queries []interface{}, Search string) (*ClientResponse, error)

ListFiles get a list of all the user files. You can use the query params to filter your results.

func (*Storage) UpdateBucket

func (srv *Storage) UpdateBucket(BucketId string, Name string, Permissions []interface{}, FileSecurity bool, Enabled bool, MaximumFileSize int, AllowedFileExtensions []interface{}, Compression string, Encryption bool, Antivirus bool) (*ClientResponse, error)

UpdateBucket update a storage bucket by its unique ID.

func (*Storage) UpdateFile

func (srv *Storage) UpdateFile(BucketId string, FileId string, Permissions []interface{}) (*ClientResponse, error)

UpdateFile update a file by its unique ID. Only users with write permissions have access to update this resource.

type Teams

type Teams struct {
	// contains filtered or unexported fields
}

Teams service

func NewTeams

func NewTeams(clt Client) *Teams

func (*Teams) Create

func (srv *Teams) Create(TeamId string, Name string, Roles []interface{}) (*ClientResponse, error)

Create 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.

func (*Teams) CreateMembership

func (srv *Teams) CreateMembership(TeamId string, Email string, Roles []interface{}, Url string, Name string) (*ClientResponse, error)

CreateMembership 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.

func (*Teams) Delete

func (srv *Teams) Delete(TeamId string) (*ClientResponse, error)

Delete delete a team using its ID. Only team members with the owner role can delete the team.

func (*Teams) DeleteMembership

func (srv *Teams) DeleteMembership(TeamId string, MembershipId string) (*ClientResponse, error)

DeleteMembership 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.

func (*Teams) Get

func (srv *Teams) Get(TeamId string) (*ClientResponse, error)

Get get a team by its ID. All team members have read access for this resource.

func (*Teams) GetMembership

func (srv *Teams) GetMembership(TeamId string, MembershipId string) (*ClientResponse, error)

GetMembership get a team member by the membership unique id. All team members have read access for this resource.

func (*Teams) List

func (srv *Teams) List(Queries []interface{}, Search string) (*ClientResponse, error)

List get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.

func (*Teams) ListMemberships

func (srv *Teams) ListMemberships(TeamId string, Queries []interface{}, Search string) (*ClientResponse, error)

ListMemberships use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.

func (*Teams) Update

func (srv *Teams) Update(TeamId string, Name string) (*ClientResponse, error)

Update update a team using its ID. Only members with the owner role can update the team.

func (*Teams) UpdateMembershipRoles

func (srv *Teams) UpdateMembershipRoles(TeamId string, MembershipId string, Roles []interface{}) (*ClientResponse, error)

UpdateMembershipRoles 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).

func (*Teams) UpdateMembershipStatus

func (srv *Teams) UpdateMembershipStatus(TeamId string, MembershipId string, UserId string, Secret string) (*ClientResponse, error)

UpdateMembershipStatus 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.

type Users

type Users struct {
	// contains filtered or unexported fields
}

Users service

func NewUsers

func NewUsers(clt Client) *Users

func (*Users) Create

func (srv *Users) Create(UserId string, Email string, Phone string, Password string, Name string) (*ClientResponse, error)

Create create a new user.

func (*Users) CreateArgon2User

func (srv *Users) CreateArgon2User(UserId string, Email string, Password string, Name string) (*ClientResponse, error)

CreateArgon2User create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateBcryptUser

func (srv *Users) CreateBcryptUser(UserId string, Email string, Password string, Name string) (*ClientResponse, error)

CreateBcryptUser create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateMD5User

func (srv *Users) CreateMD5User(UserId string, Email string, Password string, Name string) (*ClientResponse, error)

CreateMD5User create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreatePHPassUser

func (srv *Users) CreatePHPassUser(UserId string, Email string, Password string, Name string) (*ClientResponse, error)

CreatePHPassUser create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateSHAUser

func (srv *Users) CreateSHAUser(UserId string, Email string, Password string, PasswordVersion string, Name string) (*ClientResponse, error)

CreateSHAUser create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateScryptModifiedUser

func (srv *Users) CreateScryptModifiedUser(UserId string, Email string, Password string, PasswordSalt string, PasswordSaltSeparator string, PasswordSignerKey string, Name string) (*ClientResponse, error)

CreateScryptModifiedUser create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateScryptUser

func (srv *Users) CreateScryptUser(UserId string, Email string, Password string, PasswordSalt string, PasswordCpu int, PasswordMemory int, PasswordParallel int, PasswordLength int, Name string) (*ClientResponse, error)

CreateScryptUser create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) Delete

func (srv *Users) Delete(UserId string) (*ClientResponse, error)

Delete delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus) endpoint instead.

func (*Users) DeleteSession

func (srv *Users) DeleteSession(UserId string, SessionId string) (*ClientResponse, error)

DeleteSession delete a user sessions by its unique ID.

func (*Users) DeleteSessions

func (srv *Users) DeleteSessions(UserId string) (*ClientResponse, error)

DeleteSessions delete all user's sessions by using the user's unique ID.

func (*Users) Get

func (srv *Users) Get(UserId string) (*ClientResponse, error)

Get get a user by its unique ID.

func (*Users) GetPrefs

func (srv *Users) GetPrefs(UserId string) (*ClientResponse, error)

GetPrefs get the user preferences by its unique ID.

func (*Users) List

func (srv *Users) List(Queries []interface{}, Search string) (*ClientResponse, error)

List get a list of all the project's users. You can use the query params to filter your results.

func (*Users) ListLogs

func (srv *Users) ListLogs(UserId string, Queries []interface{}) (*ClientResponse, error)

ListLogs get the user activity logs list by its unique ID.

func (*Users) ListMemberships

func (srv *Users) ListMemberships(UserId string) (*ClientResponse, error)

ListMemberships get the user membership list by its unique ID.

func (*Users) ListSessions

func (srv *Users) ListSessions(UserId string) (*ClientResponse, error)

ListSessions get the user sessions list by its unique ID.

func (*Users) UpdateEmail

func (srv *Users) UpdateEmail(UserId string, Email string) (*ClientResponse, error)

UpdateEmail update the user email by its unique ID.

func (*Users) UpdateEmailVerification

func (srv *Users) UpdateEmailVerification(UserId string, EmailVerification bool) (*ClientResponse, error)

UpdateEmailVerification update the user email verification status by its unique ID.

func (*Users) UpdateName

func (srv *Users) UpdateName(UserId string, Name string) (*ClientResponse, error)

UpdateName update the user name by its unique ID.

func (*Users) UpdatePassword

func (srv *Users) UpdatePassword(UserId string, Password string) (*ClientResponse, error)

UpdatePassword update the user password by its unique ID.

func (*Users) UpdatePhone

func (srv *Users) UpdatePhone(UserId string, Number string) (*ClientResponse, error)

UpdatePhone update the user phone by its unique ID.

func (*Users) UpdatePhoneVerification

func (srv *Users) UpdatePhoneVerification(UserId string, PhoneVerification bool) (*ClientResponse, error)

UpdatePhoneVerification update the user phone verification status by its unique ID.

func (*Users) UpdatePrefs

func (srv *Users) UpdatePrefs(UserId string, Prefs interface{}) (*ClientResponse, error)

UpdatePrefs update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.

func (*Users) UpdateStatus

func (srv *Users) UpdateStatus(UserId string, Status bool) (*ClientResponse, error)

UpdateStatus update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL