Skip to main content
Module

x/appwrite/mod.ts>Functions

[READ-ONLY] Official Appwrite Deno SDK 🦕
Latest
class Functions
extends Service
Re-export
import { Functions } from "https://deno.land/x/appwrite@10.0.0/mod.ts";

Constructors

new
Functions(client: Client)

Methods

create(
functionId: string,
name: string,
runtime: Runtime,
execute?: string[],
events?: string[],
schedule?: string,
timeout?: number,
enabled?: boolean,
logging?: boolean,
entrypoint?: string,
commands?: string,
installationId?: string,
providerRepositoryId?: string,
providerBranch?: string,
providerSilentMode?: boolean,
providerRootDirectory?: string,
templateRepository?: string,
templateOwner?: string,
templateRootDirectory?: string,
templateBranch?: string,
): Promise<Models.Function>

Create function

Create a new function. You can pass a list of permissions to allow different project users or team with access to execute the function using the client API.

createBuild(
functionId: string,
deploymentId: string,
buildId: string,
): Promise<Response>

Create build

Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build.

createDeployment(
functionId: string,
code: InputFile,
activate: boolean,
entrypoint?: string,
commands?: string,
onProgress?,
): Promise<Models.Deployment>

Create deployment

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.

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

createExecution(
functionId: string,
body?: string,
async?: boolean,
xpath?: string,
method?: ExecutionMethod,
headers?: object,
): Promise<Models.Execution>

Create execution

Trigger a function execution. The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.

createVariable(
functionId: string,
key: string,
value: string,
): Promise<Models.Variable>

Create variable

Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.

delete(functionId: string): Promise<Response>

Delete function

Delete a function by its unique ID.

deleteDeployment(functionId: string, deploymentId: string): Promise<Response>

Delete deployment

Delete a code deployment by its unique ID.

deleteVariable(functionId: string, variableId: string): Promise<Response>

Delete variable

Delete a variable by its unique ID.

downloadDeployment(functionId: string, deploymentId: string): Promise<ArrayBuffer>

Download Deployment

Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.

get(functionId: string): Promise<Models.Function>

Get function

Get a function by its unique ID.

getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>

Get deployment

Get a code deployment by its unique ID.

getExecution(functionId: string, executionId: string): Promise<Models.Execution>

Get execution

Get a function execution log by its unique ID.

getVariable(functionId: string, variableId: string): Promise<Models.Variable>

Get variable

Get a variable by its unique ID.

list(queries?: string[], search?: string): Promise<Models.FunctionList>

List functions

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

listDeployments(
functionId: string,
queries?: string[],
search?: string,
): Promise<Models.DeploymentList>

List deployments

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

listExecutions(
functionId: string,
queries?: string[],
search?: string,
): Promise<Models.ExecutionList>

List executions

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

List runtimes

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

listVariables(functionId: string): Promise<Models.VariableList>

List variables

Get a list of all variables of a specific function.

update(
functionId: string,
name: string,
runtime?: Runtime,
execute?: string[],
events?: string[],
schedule?: string,
timeout?: number,
enabled?: boolean,
logging?: boolean,
entrypoint?: string,
commands?: string,
installationId?: string,
providerRepositoryId?: string,
providerBranch?: string,
providerSilentMode?: boolean,
providerRootDirectory?: string,
): Promise<Models.Function>

Update function

Update function by its unique ID.

updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>

Update function deployment

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.

updateVariable(
functionId: string,
variableId: string,
key: string,
value?: string,
): Promise<Models.Variable>

Update variable

Update variable by its unique ID.