Skip to content

Commit

Permalink
Fix function body type
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Sep 5, 2024
1 parent 3702899 commit c0d9977
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/examples/functions/create-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const functions = new Functions(client);

const result = await functions.createExecution(
'<FUNCTION_ID>', // functionId
, // body (optional)
'<BODY>', // body (optional)
false, // async (optional)
'<PATH>', // path (optional)
ExecutionMethod.GET, // method (optional)
Expand Down
11 changes: 5 additions & 6 deletions src/services/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ Use the &quot;command&quot; 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
Expand All @@ -824,7 +824,7 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
async createExecution(functionId: string, body?: payload, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress = (progress: UploadProgress) => {}): Promise<Models.Execution> {
async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution> {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
Expand All @@ -851,16 +851,15 @@ Use the &quot;command&quot; 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
);
}
/**
Expand Down

0 comments on commit c0d9977

Please sign in to comment.