From c0d99779628c683827fe892e027ce695e0c30ebf Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 5 Sep 2024 15:46:28 +1200 Subject: [PATCH] Fix function body type --- docs/examples/functions/create-execution.md | 2 +- src/services/functions.ts | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 7d61423..dfaf2ef 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -8,7 +8,7 @@ const functions = new Functions(client); const result = await functions.createExecution( '', // functionId - , // body (optional) + '', // body (optional) false, // async (optional) '', // path (optional) ExecutionMethod.GET, // method (optional) diff --git a/src/services/functions.ts b/src/services/functions.ts index 7143241..5bce133 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -815,7 +815,7 @@ Use the "command" param to set the entrypoint used to execute your cod * 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 {payload} body + * @param {string} body * @param {boolean} async * @param {string} xpath * @param {ExecutionMethod} method @@ -824,7 +824,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async createExecution(functionId: string, body?: payload, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress = (progress: UploadProgress) => {}): Promise { + async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -851,16 +851,15 @@ Use the "command" param to set the entrypoint used to execute your cod const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { - 'content-type': 'multipart/form-data', + 'content-type': 'application/json', } - return await this.client.chunkedUpload( + return await this.client.call( 'post', uri, apiHeaders, - payload, - onProgress + payload ); } /**