import { Client, UploadProgress } from '../client'; import type { Models } from '../models'; import { Runtime } from '../enums/runtime'; import { FunctionUsageRange } from '../enums/function-usage-range'; import { ExecutionMethod } from '../enums/execution-method'; export declare class Functions { client: Client; constructor(client: Client); /** * List functions * * Get a list of all the project's functions. You can use the query params to filter your results. * * @param {string[]} queries * @param {string} search * @throws {AppwriteException} * @returns {Promise} */ list(queries?: string[], search?: string): Promise; /** * Create function * * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * * @param {string} functionId * @param {string} name * @param {Runtime} runtime * @param {string[]} execute * @param {string[]} events * @param {string} schedule * @param {number} timeout * @param {boolean} enabled * @param {boolean} logging * @param {string} entrypoint * @param {string} commands * @param {string[]} scopes * @param {string} installationId * @param {string} providerRepositoryId * @param {string} providerBranch * @param {boolean} providerSilentMode * @param {string} providerRootDirectory * @param {string} templateRepository * @param {string} templateOwner * @param {string} templateRootDirectory * @param {string} templateVersion * @param {string} specification * @throws {AppwriteException} * @returns {Promise} */ create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string, specification?: string): Promise; /** * List runtimes * * Get a list of all runtimes that are currently active on your instance. * * @throws {AppwriteException} * @returns {Promise} */ listRuntimes(): Promise; /** * List available function runtime specifications * * List allowed function specifications for this instance. * * @throws {AppwriteException} * @returns {Promise} */ listSpecifications(): Promise; /** * List function templates * * List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. * * @param {string[]} runtimes * @param {string[]} useCases * @param {number} limit * @param {number} offset * @throws {AppwriteException} * @returns {Promise} */ listTemplates(runtimes?: string[], useCases?: string[], limit?: number, offset?: number): Promise; /** * Get function template * * Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. * * @param {string} templateId * @throws {AppwriteException} * @returns {Promise} */ getTemplate(templateId: string): Promise; /** * Get functions usage * * * @param {FunctionUsageRange} range * @throws {AppwriteException} * @returns {Promise} */ getUsage(range?: FunctionUsageRange): Promise; /** * Get function * * Get a function by its unique ID. * * @param {string} functionId * @throws {AppwriteException} * @returns {Promise} */ get(functionId: string): Promise; /** * Update function * * Update function by its unique ID. * * @param {string} functionId * @param {string} name * @param {Runtime} runtime * @param {string[]} execute * @param {string[]} events * @param {string} schedule * @param {number} timeout * @param {boolean} enabled * @param {boolean} logging * @param {string} entrypoint * @param {string} commands * @param {string[]} scopes * @param {string} installationId * @param {string} providerRepositoryId * @param {string} providerBranch * @param {boolean} providerSilentMode * @param {string} providerRootDirectory * @param {string} specification * @throws {AppwriteException} * @returns {Promise} */ update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise; /** * Delete function * * Delete a function by its unique ID. * * @param {string} functionId * @throws {AppwriteException} * @returns {Promise<{}>} */ delete(functionId: string): Promise<{}>; /** * List deployments * * Get a list of all the project's code deployments. You can use the query params to filter your results. * * @param {string} functionId * @param {string[]} queries * @param {string} search * @throws {AppwriteException} * @returns {Promise} */ listDeployments(functionId: string, queries?: string[], search?: string): Promise; /** * 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](https://appwrite.io/docs/functions). Use the "command" param to set the entrypoint used to execute your code. * * @param {string} functionId * @param {File} code * @param {boolean} activate * @param {string} entrypoint * @param {string} commands * @throws {AppwriteException} * @returns {Promise} */ createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise; /** * Get deployment * * Get a code deployment by its unique ID. * * @param {string} functionId * @param {string} deploymentId * @throws {AppwriteException} * @returns {Promise} */ getDeployment(functionId: string, deploymentId: string): Promise; /** * Update 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. * * @param {string} functionId * @param {string} deploymentId * @throws {AppwriteException} * @returns {Promise} */ updateDeployment(functionId: string, deploymentId: string): Promise; /** * Delete deployment * * Delete a code deployment by its unique ID. * * @param {string} functionId * @param {string} deploymentId * @throws {AppwriteException} * @returns {Promise<{}>} */ deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; /** * Rebuild deployment * * * @param {string} functionId * @param {string} deploymentId * @param {string} buildId * @throws {AppwriteException} * @returns {Promise<{}>} */ createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}>; /** * Cancel deployment * * * @param {string} functionId * @param {string} deploymentId * @throws {AppwriteException} * @returns {Promise} */ updateDeploymentBuild(functionId: string, deploymentId: string): Promise; /** * Download deployment * * Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. * * @param {string} functionId * @param {string} deploymentId * @throws {AppwriteException} * @returns {string} */ getDeploymentDownload(functionId: string, deploymentId: string): string; /** * List executions * * Get a list of all the current user function execution logs. You can use the query params to filter your results. * * @param {string} functionId * @param {string[]} queries * @param {string} search * @throws {AppwriteException} * @returns {Promise} */ listExecutions(functionId: string, queries?: string[], search?: string): Promise; /** * 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. * * @param {string} functionId * @param {string} body * @param {boolean} async * @param {string} xpath * @param {ExecutionMethod} method * @param {object} headers * @param {string} scheduledAt * @throws {AppwriteException} * @returns {Promise} */ createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise; /** * Get execution * * Get a function execution log by its unique ID. * * @param {string} functionId * @param {string} executionId * @throws {AppwriteException} * @returns {Promise} */ getExecution(functionId: string, executionId: string): Promise; /** * Delete execution * * Delete a function execution by its unique ID. * * @param {string} functionId * @param {string} executionId * @throws {AppwriteException} * @returns {Promise<{}>} */ deleteExecution(functionId: string, executionId: string): Promise<{}>; /** * Get function usage * * * @param {string} functionId * @param {FunctionUsageRange} range * @throws {AppwriteException} * @returns {Promise} */ getFunctionUsage(functionId: string, range?: FunctionUsageRange): Promise; /** * List variables * * Get a list of all variables of a specific function. * * @param {string} functionId * @throws {AppwriteException} * @returns {Promise} */ listVariables(functionId: string): Promise; /** * Create variable * * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * * @param {string} functionId * @param {string} key * @param {string} value * @throws {AppwriteException} * @returns {Promise} */ createVariable(functionId: string, key: string, value: string): Promise; /** * Get variable * * Get a variable by its unique ID. * * @param {string} functionId * @param {string} variableId * @throws {AppwriteException} * @returns {Promise} */ getVariable(functionId: string, variableId: string): Promise; /** * Update variable * * Update variable by its unique ID. * * @param {string} functionId * @param {string} variableId * @param {string} key * @param {string} value * @throws {AppwriteException} * @returns {Promise} */ updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise; /** * Delete variable * * Delete a variable by its unique ID. * * @param {string} functionId * @param {string} variableId * @throws {AppwriteException} * @returns {Promise<{}>} */ deleteVariable(functionId: string, variableId: string): Promise<{}>; }