import { Client, UploadProgress } from '../client.js'; import { Models } from '../models.js'; import { Runtime } from '../enums/runtime.js'; import { ExecutionMethod } from '../enums/execution-method.js'; import '../query.js'; 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} installationId * @param {string} providerRepositoryId * @param {string} providerBranch * @param {boolean} providerSilentMode * @param {string} providerRootDirectory * @param {string} templateRepository * @param {string} templateOwner * @param {string} templateRootDirectory * @param {string} templateBranch * @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, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateBranch?: string): Promise; /** * List runtimes * * Get a list of all runtimes that are currently active on your instance. * * @throws {AppwriteException} * @returns {Promise} */ listRuntimes(): 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} installationId * @param {string} providerRepositoryId * @param {string} providerBranch * @param {boolean} providerSilentMode * @param {string} providerRootDirectory * @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, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: 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 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. * * @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<{}>; /** * Create build * * Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build. * * @param {string} functionId * @param {string} deploymentId * @param {string} buildId * @throws {AppwriteException} * @returns {Promise<{}>} */ createBuild(functionId: string, deploymentId: string, buildId: 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 {Promise} */ downloadDeployment(functionId: string, deploymentId: string): Promise; /** * 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 * @throws {AppwriteException} * @returns {Promise} */ createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): 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; /** * 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<{}>; } export { Functions };