Repository navigation
feat: SDK update for version 29.2.0 #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,7 +107,7 @@ export class Functions { | |
| * @param {Runtime} params.runtime - Execution runtime. | ||
| * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | ||
| * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. | ||
| * @param {string} params.schedule - Schedule CRON syntax. | ||
| * @param {string} params.schedule - Schedule CRON syntax. Cannot be combined with interval. | ||
| * @param {number} params.timeout - Function maximum execution time in seconds. | ||
| * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | ||
| * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. | ||
|
|
@@ -124,6 +124,7 @@ export class Functions { | |
| * @param {string} params.buildSpecification - Build specification for the function deployments. | ||
| * @param {string} params.runtimeSpecification - Runtime specification for the function executions. | ||
| * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | ||
| * @param {number} params.interval - Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.Function>} | ||
| */ | ||
|
|
@@ -150,6 +151,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| }): Promise<Models.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. | ||
|
|
@@ -159,7 +161,7 @@ export class Functions { | |
| * @param {Runtime} runtime - Execution runtime. | ||
| * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | ||
| * @param {string[]} events - Events list. Maximum of 100 events are allowed. | ||
| * @param {string} schedule - Schedule CRON syntax. | ||
| * @param {string} schedule - Schedule CRON syntax. Cannot be combined with interval. | ||
| * @param {number} timeout - Function maximum execution time in seconds. | ||
| * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | ||
| * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. | ||
|
|
@@ -176,6 +178,7 @@ export class Functions { | |
| * @param {string} buildSpecification - Build specification for the function deployments. | ||
| * @param {string} runtimeSpecification - Runtime specification for the function executions. | ||
| * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | ||
| * @param {number} interval - Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.Function>} | ||
| * @deprecated Use the object parameter style method for a better developer experience. | ||
|
|
@@ -203,6 +206,7 @@ export class Functions { | |
| buildSpecification?: string, | ||
| runtimeSpecification?: string, | ||
| deploymentRetention?: number, | ||
| interval?: number, | ||
| ): Promise<Models.Function>; | ||
| create( | ||
| paramsOrFirst: | ||
|
|
@@ -229,6 +233,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| } | ||
| | string, | ||
| ...rest: [ | ||
|
|
@@ -253,6 +258,7 @@ export class Functions { | |
| string?, | ||
| string?, | ||
| number?, | ||
| number?, | ||
| ] | ||
| ): Promise<Models.Function> { | ||
| let params: { | ||
|
|
@@ -278,6 +284,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| }; | ||
|
|
||
| if ( | ||
|
|
@@ -308,6 +315,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| }; | ||
| } else { | ||
| params = { | ||
|
|
@@ -333,6 +341,7 @@ export class Functions { | |
| buildSpecification: rest[18] as string, | ||
| runtimeSpecification: rest[19] as string, | ||
| deploymentRetention: rest[20] as number, | ||
| interval: rest[21] as number, | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -358,6 +367,7 @@ export class Functions { | |
| const buildSpecification = params.buildSpecification; | ||
| const runtimeSpecification = params.runtimeSpecification; | ||
| const deploymentRetention = params.deploymentRetention; | ||
| const interval = params.interval; | ||
| if (typeof functionId === 'undefined') { | ||
| throw new AppwriteException( | ||
| 'Missing required parameter: "functionId"', | ||
|
|
@@ -439,6 +449,9 @@ export class Functions { | |
| if (typeof deploymentRetention !== 'undefined') { | ||
| apiPayload['deploymentRetention'] = deploymentRetention; | ||
| } | ||
| if (typeof interval !== 'undefined') { | ||
| apiPayload['interval'] = interval; | ||
| } | ||
|
Comment on lines
+452
to
+454
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add coverage for interval serialization The existing create/update tests in Prompt To Fix With AIThis is a comment left during a code review.
Path: src/services/functions.ts
Line: 452-454
Comment:
**Add coverage for interval serialization**
The existing create/update tests in `test/services/functions.test.js` only check returned data and do not assert request payloads, so they would pass if `interval` were omitted or mapped incorrectly. Please cover interval serialization for the new API parameter, including the positional overload if it remains supported.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply. |
||
| const uri = new URL(this.client.config.endpoint + apiPath); | ||
|
|
||
| const apiHeaders: { [header: string]: string } = { | ||
|
|
@@ -585,7 +598,7 @@ export class Functions { | |
| * @param {Runtime} params.runtime - Execution runtime. | ||
| * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | ||
| * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. | ||
| * @param {string} params.schedule - Schedule CRON syntax. | ||
| * @param {string} params.schedule - Schedule CRON syntax. Cannot be combined with interval. | ||
| * @param {number} params.timeout - Maximum execution time in seconds. | ||
| * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | ||
| * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. | ||
|
|
@@ -602,6 +615,7 @@ export class Functions { | |
| * @param {string} params.buildSpecification - Build specification for the function deployments. | ||
| * @param {string} params.runtimeSpecification - Runtime specification for the function executions. | ||
| * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | ||
| * @param {number} params.interval - Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. When omitted, the current interval is kept unless schedule is set. | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.Function>} | ||
| */ | ||
|
|
@@ -628,6 +642,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| }): Promise<Models.Function>; | ||
| /** | ||
| * Update function by its unique ID. | ||
|
|
@@ -637,7 +652,7 @@ export class Functions { | |
| * @param {Runtime} runtime - Execution runtime. | ||
| * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | ||
| * @param {string[]} events - Events list. Maximum of 100 events are allowed. | ||
| * @param {string} schedule - Schedule CRON syntax. | ||
| * @param {string} schedule - Schedule CRON syntax. Cannot be combined with interval. | ||
| * @param {number} timeout - Maximum execution time in seconds. | ||
| * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. | ||
| * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. | ||
|
|
@@ -654,6 +669,7 @@ export class Functions { | |
| * @param {string} buildSpecification - Build specification for the function deployments. | ||
| * @param {string} runtimeSpecification - Runtime specification for the function executions. | ||
| * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | ||
| * @param {number} interval - Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. When omitted, the current interval is kept unless schedule is set. | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.Function>} | ||
| * @deprecated Use the object parameter style method for a better developer experience. | ||
|
|
@@ -681,6 +697,7 @@ export class Functions { | |
| buildSpecification?: string, | ||
| runtimeSpecification?: string, | ||
| deploymentRetention?: number, | ||
| interval?: number, | ||
| ): Promise<Models.Function>; | ||
| update( | ||
| paramsOrFirst: | ||
|
|
@@ -707,6 +724,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| } | ||
| | string, | ||
| ...rest: [ | ||
|
|
@@ -731,6 +749,7 @@ export class Functions { | |
| string?, | ||
| string?, | ||
| number?, | ||
| number?, | ||
| ] | ||
| ): Promise<Models.Function> { | ||
| let params: { | ||
|
|
@@ -756,6 +775,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| }; | ||
|
|
||
| if ( | ||
|
|
@@ -786,6 +806,7 @@ export class Functions { | |
| buildSpecification?: string; | ||
| runtimeSpecification?: string; | ||
| deploymentRetention?: number; | ||
| interval?: number; | ||
| }; | ||
| } else { | ||
| params = { | ||
|
|
@@ -811,6 +832,7 @@ export class Functions { | |
| buildSpecification: rest[18] as string, | ||
| runtimeSpecification: rest[19] as string, | ||
| deploymentRetention: rest[20] as number, | ||
| interval: rest[21] as number, | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -836,6 +858,7 @@ export class Functions { | |
| const buildSpecification = params.buildSpecification; | ||
| const runtimeSpecification = params.runtimeSpecification; | ||
| const deploymentRetention = params.deploymentRetention; | ||
| const interval = params.interval; | ||
| if (typeof functionId === 'undefined') { | ||
| throw new AppwriteException( | ||
| 'Missing required parameter: "functionId"', | ||
|
|
@@ -912,6 +935,9 @@ export class Functions { | |
| if (typeof deploymentRetention !== 'undefined') { | ||
| apiPayload['deploymentRetention'] = deploymentRetention; | ||
| } | ||
| if (typeof interval !== 'undefined') { | ||
| apiPayload['interval'] = interval; | ||
| } | ||
| const uri = new URL(this.client.config.endpoint + apiPath); | ||
|
|
||
| const apiHeaders: { [header: string]: string } = { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Examples combine mutually exclusive scheduling fields
This example still sets
scheduleto a CRON expression above, so copying it sendsscheduletogether withinterval: 0, which the API documentation says cannot be combined. The update example has the same conflict; please show only one scheduling option in each example.Prompt To Fix With AI
🟡 Minor · documentation · Reply if this doesn't apply.