diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e670e54..202c22d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Change Log
+## 18.3.0
+
+* Added: optional `interval` parameter on `Functions.create`, `Functions.update` and `Projects.createSchedule`
+* Updated: `schedule` is optional on `Projects.createSchedule`; pass either `schedule` or `interval`
+* Added: `interval` on the `Function` and `Schedule` models, `functionsIntervalMinimum` on `BillingPlan`
+
## 18.2.0
* Added: `Avatars.updatePhoto` and `Avatars.deletePhoto` to upload and remove the current user's profile photo; `updatePhoto` returns the new `Account` model
diff --git a/README.md b/README.md
index 5c484ff2..e0c0064a 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ import { Client, Account } from '@appwrite.io/console';
To install with a CDN (content delivery network) add the following scripts to the bottom of your
tag, but before you use any Appwrite services:
```html
-
+
```
## Getting Started
diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md
index aeb31eff..38dcc663 100644
--- a/docs/examples/functions/create.md
+++ b/docs/examples/functions/create.md
@@ -35,6 +35,7 @@ const result = await functions.create({
buildSpecification: 's-1vcpu-512mb', // optional
runtimeSpecification: 's-1vcpu-512mb', // optional
deploymentRetention: 0, // optional
+ interval: 0, // optional
});
console.log(result);
diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md
index ad32ec14..504ba736 100644
--- a/docs/examples/functions/update.md
+++ b/docs/examples/functions/update.md
@@ -35,6 +35,7 @@ const result = await functions.update({
buildSpecification: 's-1vcpu-512mb', // optional
runtimeSpecification: 's-1vcpu-512mb', // optional
deploymentRetention: 0, // optional
+ interval: 0, // optional
});
console.log(result);
diff --git a/docs/examples/projects/create-schedule.md b/docs/examples/projects/create-schedule.md
index 4ad15f22..4394c32b 100644
--- a/docs/examples/projects/create-schedule.md
+++ b/docs/examples/projects/create-schedule.md
@@ -11,9 +11,10 @@ const result = await projects.createSchedule({
projectId: '',
resourceType: ScheduleResourceType.Function,
resourceId: '',
- schedule: '0 0 * * *',
+ schedule: '0 0 * * *', // optional
active: false, // optional
data: {}, // optional
+ interval: 0, // optional
});
console.log(result);
diff --git a/package-lock.json b/package-lock.json
index bc930ed4..7b58eeaf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@appwrite.io/console",
- "version": "18.2.0",
+ "version": "18.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@appwrite.io/console",
- "version": "18.2.0",
+ "version": "18.3.0",
"license": "BSD-3-Clause",
"dependencies": {
"buffer": "6.0.3",
diff --git a/package.json b/package.json
index e12b00e4..8d979f4a 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "@appwrite.io/console",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
- "version": "18.2.0",
+ "version": "18.3.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
diff --git a/src/client.ts b/src/client.ts
index 74051f54..532c86a3 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -413,7 +413,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
- 'x-sdk-version': '18.2.0',
+ 'x-sdk-version': '18.3.0',
'X-Appwrite-Response-Format': '2.3.0',
};
diff --git a/src/models.ts b/src/models.ts
index eb63642c..c101a716 100644
--- a/src/models.ts
+++ b/src/models.ts
@@ -4573,6 +4573,10 @@ export namespace Models {
* Function execution schedule in CRON format.
*/
schedule: string;
+ /**
+ * Minutes between scheduled executions. 0 when the function has no interval.
+ */
+ interval?: number;
/**
* Function execution timeout in seconds.
*/
@@ -7919,6 +7923,10 @@ export namespace Models {
* The CRON schedule expression.
*/
schedule: string;
+ /**
+ * Minutes between runs. 0 when the schedule has no interval.
+ */
+ interval?: number;
/**
* Schedule data used to store resource-specific context needed for execution.
*/
@@ -9997,6 +10005,10 @@ export namespace Models {
* Maximum function and site deployment size in MB
*/
buildSize: number;
+ /**
+ * Shortest function schedule interval allowed, in minutes. 0 allows every interval.
+ */
+ functionsIntervalMinimum: number;
/**
* Does the plan support encrypted string attributes or not.
*/
diff --git a/src/services/functions.ts b/src/services/functions.ts
index d0bb37d9..e1ae628c 100644
--- a/src/services/functions.ts
+++ b/src/services/functions.ts
@@ -109,7 +109,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.
@@ -126,6 +126,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}
*/
@@ -152,6 +153,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
}): Promise;
/**
* 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.
@@ -161,7 +163,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.
@@ -178,6 +180,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}
* @deprecated Use the object parameter style method for a better developer experience.
@@ -205,6 +208,7 @@ export class Functions {
buildSpecification?: string,
runtimeSpecification?: string,
deploymentRetention?: number,
+ interval?: number,
): Promise;
create(
paramsOrFirst:
@@ -231,6 +235,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
}
| string,
...rest: [
@@ -255,6 +260,7 @@ export class Functions {
string?,
string?,
number?,
+ number?,
]
): Promise {
let params: {
@@ -280,6 +286,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
};
if (
@@ -310,6 +317,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
};
} else {
params = {
@@ -335,6 +343,7 @@ export class Functions {
buildSpecification: rest[18] as string,
runtimeSpecification: rest[19] as string,
deploymentRetention: rest[20] as number,
+ interval: rest[21] as number,
};
}
@@ -360,6 +369,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(
@@ -442,6 +452,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 } = {
@@ -814,7 +827,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.
@@ -831,6 +844,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}
*/
@@ -857,6 +871,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
}): Promise;
/**
* Update function by its unique ID.
@@ -866,7 +881,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.
@@ -883,6 +898,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}
* @deprecated Use the object parameter style method for a better developer experience.
@@ -910,6 +926,7 @@ export class Functions {
buildSpecification?: string,
runtimeSpecification?: string,
deploymentRetention?: number,
+ interval?: number,
): Promise;
update(
paramsOrFirst:
@@ -936,6 +953,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
}
| string,
...rest: [
@@ -960,6 +978,7 @@ export class Functions {
string?,
string?,
number?,
+ number?,
]
): Promise {
let params: {
@@ -985,6 +1004,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
};
if (
@@ -1015,6 +1035,7 @@ export class Functions {
buildSpecification?: string;
runtimeSpecification?: string;
deploymentRetention?: number;
+ interval?: number;
};
} else {
params = {
@@ -1040,6 +1061,7 @@ export class Functions {
buildSpecification: rest[18] as string,
runtimeSpecification: rest[19] as string,
deploymentRetention: rest[20] as number,
+ interval: rest[21] as number,
};
}
@@ -1065,6 +1087,7 @@ export class Functions {
const buildSpecification = params.buildSpecification;
const runtimeSpecification = params.runtimeSpecification;
const deploymentRetention = params.deploymentRetention;
+ const interval = params.interval;
if (typeof functionId === 'undefined' || functionId === '') {
throw new AppwriteException(
@@ -1142,6 +1165,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 } = {
diff --git a/src/services/projects.ts b/src/services/projects.ts
index 1b0b4e84..7326e4a9 100644
--- a/src/services/projects.ts
+++ b/src/services/projects.ts
@@ -570,9 +570,10 @@ export class Projects {
* @param {string} params.projectId - Project unique ID.
* @param {ScheduleResourceType} params.resourceType - The resource type for the schedule. Possible values: function, execution, message, backup.
* @param {string} params.resourceId - The resource ID to associate with this schedule.
- * @param {string} params.schedule - Schedule CRON expression.
+ * @param {string} params.schedule - Schedule CRON expression. Cannot be combined with interval.
* @param {boolean} params.active - Whether the schedule is active.
* @param {object} params.data - Schedule data as a JSON string. Used to store resource-specific context needed for execution.
+ * @param {number} params.interval - Minutes between runs, for function schedules only. Use 0 to disable. Cannot be combined with schedule.
* @throws {AppwriteException}
* @returns {Promise}
*/
@@ -580,9 +581,10 @@ export class Projects {
projectId: string;
resourceType: ScheduleResourceType;
resourceId: string;
- schedule: string;
+ schedule?: string;
active?: boolean;
data?: object;
+ interval?: number;
}): Promise;
/**
* Create a new schedule for a resource.
@@ -590,9 +592,10 @@ export class Projects {
* @param {string} projectId - Project unique ID.
* @param {ScheduleResourceType} resourceType - The resource type for the schedule. Possible values: function, execution, message, backup.
* @param {string} resourceId - The resource ID to associate with this schedule.
- * @param {string} schedule - Schedule CRON expression.
+ * @param {string} schedule - Schedule CRON expression. Cannot be combined with interval.
* @param {boolean} active - Whether the schedule is active.
* @param {object} data - Schedule data as a JSON string. Used to store resource-specific context needed for execution.
+ * @param {number} interval - Minutes between runs, for function schedules only. Use 0 to disable. Cannot be combined with schedule.
* @throws {AppwriteException}
* @returns {Promise}
* @deprecated Use the object parameter style method for a better developer experience.
@@ -601,9 +604,10 @@ export class Projects {
projectId: string,
resourceType: ScheduleResourceType,
resourceId: string,
- schedule: string,
+ schedule?: string,
active?: boolean,
data?: object,
+ interval?: number,
): Promise;
createSchedule(
paramsOrFirst:
@@ -611,20 +615,29 @@ export class Projects {
projectId: string;
resourceType: ScheduleResourceType;
resourceId: string;
- schedule: string;
+ schedule?: string;
active?: boolean;
data?: object;
+ interval?: number;
}
| string,
- ...rest: [ScheduleResourceType?, string?, string?, boolean?, object?]
+ ...rest: [
+ ScheduleResourceType?,
+ string?,
+ string?,
+ boolean?,
+ object?,
+ number?,
+ ]
): Promise {
let params: {
projectId: string;
resourceType: ScheduleResourceType;
resourceId: string;
- schedule: string;
+ schedule?: string;
active?: boolean;
data?: object;
+ interval?: number;
};
if (
@@ -636,9 +649,10 @@ export class Projects {
projectId: string;
resourceType: ScheduleResourceType;
resourceId: string;
- schedule: string;
+ schedule?: string;
active?: boolean;
data?: object;
+ interval?: number;
};
} else {
params = {
@@ -648,6 +662,7 @@ export class Projects {
schedule: rest[2] as string,
active: rest[3] as boolean,
data: rest[4] as object,
+ interval: rest[5] as number,
};
}
@@ -657,6 +672,7 @@ export class Projects {
const schedule = params.schedule;
const active = params.active;
const data = params.data;
+ const interval = params.interval;
if (typeof projectId === 'undefined' || projectId === '') {
throw new AppwriteException(
@@ -673,11 +689,6 @@ export class Projects {
'Missing required parameter: "resourceId"',
);
}
- if (typeof schedule === 'undefined') {
- throw new AppwriteException(
- 'Missing required parameter: "schedule"',
- );
- }
const apiPath = '/projects/{projectId}/schedules'.replace(
'{projectId}',
encodeURIComponent(String(projectId)),
@@ -698,6 +709,9 @@ export class Projects {
if (typeof data !== 'undefined') {
apiPayload['data'] = data;
}
+ if (typeof interval !== 'undefined') {
+ apiPayload['interval'] = interval;
+ }
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders: { [header: string]: string } = {