Skip to main content
Module

x/appwrite/mod.ts>Functions

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

Methods

create(
name: string,
execute: string[],
runtime: string,
vars?: object,
events?: string[],
schedule?: string,
timeout?: number,
): 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.

createExecution(functionId: string, data?: string): 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.

createTag(
functionId: string,
command: string,
code: File | Blob,
): Promise<Models.Tag>

Create Tag

Create a new function code tag. 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 tag to use your new tag 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 entry point used to execute your code.

delete(functionId: string): Promise<Response>

Delete Function

Delete a function by its unique ID.

deleteTag(functionId: string, tagId: string): Promise<Response>

Delete Tag

Delete a code tag by its unique ID.

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

Get Function

Get a function by its unique ID.

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

Get Execution

Get a function execution log by its unique ID.

getTag(functionId: string, tagId: string): Promise<Models.Tag>

Get Tag

Get a code tag by its unique ID.

list(
search?: string,
limit?: number,
offset?: number,
orderType?: 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.

listExecutions(
functionId: string,
search?: string,
limit?: number,
offset?: number,
orderType?: 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. On admin mode, this endpoint will return a list of all of the project's executions. Learn more about different API modes.

listTags(
functionId: string,
search?: string,
limit?: number,
offset?: number,
orderType?: string,
): Promise<Models.TagList>

List Tags

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

update(
functionId: string,
name: string,
execute: string[],
vars?: object,
events?: string[],
schedule?: string,
timeout?: number,
): Promise<Models.Function>

Update Function

Update function by its unique ID.

updateTag(functionId: string, tag: string): Promise<Models.Function>

Update Function Tag

Update the function code tag ID using the unique function ID. Use this endpoint to switch the code tag that should be executed by the execution endpoint.