Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 28.2.0

* Added: optional `interval` parameter on `functions.create` and `functions.update` to run a function every N minutes
* Added: `interval` on the `Function` model and `functionsIntervalMinimum` on the `BillingPlan` model

## 28.1.0

* Added: optional `state` parameter on `createOAuth2Token`, returned unchanged on the success and failure URLs
Expand Down
2 changes: 1 addition & 1 deletion appwrite.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'appwrite'
spec.version = '28.1.0'
spec.version = '28.2.0'
spec.license = 'BSD-3-Clause'
spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API'
spec.author = 'Appwrite Team'
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ result = functions.create(
provider_paths: [], # optional
build_specification: 's-1vcpu-512mb', # optional
runtime_specification: 's-1vcpu-512mb', # optional
deployment_retention: 0 # optional
deployment_retention: 0, # optional
interval: 0 # optional
)
```
3 changes: 2 additions & 1 deletion docs/examples/functions/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ result = functions.update(
provider_paths: [], # optional
build_specification: 's-1vcpu-512mb', # optional
runtime_specification: 's-1vcpu-512mb', # optional
deployment_retention: 0 # optional
deployment_retention: 0, # optional
interval: 0 # optional
)
```
2 changes: 1 addition & 1 deletion lib/appwrite/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize
'x-sdk-name' => 'Ruby',
'x-sdk-platform' => 'server',
'x-sdk-language' => 'ruby',
'x-sdk-version' => '28.1.0',
'x-sdk-version' => '28.2.0',
'X-Appwrite-Response-Format' => '2.0.0'
}
@endpoint = 'https://cloud.appwrite.io/v1'
Expand Down
5 changes: 5 additions & 0 deletions lib/appwrite/models/billing_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class BillingPlan
attr_reader :backup_policies
attr_reader :deployment_size
attr_reader :build_size
attr_reader :functions_interval_minimum
attr_reader :databases_allow_encrypt
attr_reader :limits
attr_reader :group
Expand Down Expand Up @@ -143,6 +144,7 @@ def initialize(
backup_policies:,
deployment_size:,
build_size:,
functions_interval_minimum:,
databases_allow_encrypt:,
limits:,
group:,
Expand Down Expand Up @@ -216,6 +218,7 @@ def initialize(
@backup_policies = backup_policies
@deployment_size = deployment_size
@build_size = build_size
@functions_interval_minimum = functions_interval_minimum
@databases_allow_encrypt = databases_allow_encrypt
@limits = limits
@group = validate_group(group)
Expand Down Expand Up @@ -292,6 +295,7 @@ def self.from(map:)
backup_policies: map["backupPolicies"],
deployment_size: map["deploymentSize"],
build_size: map["buildSize"],
functions_interval_minimum: map["functionsIntervalMinimum"],
databases_allow_encrypt: map["databasesAllowEncrypt"],
limits: map["limits"].nil? ? nil : BillingPlanLimits.from(map: map["limits"]),
group: map["group"],
Expand Down Expand Up @@ -369,6 +373,7 @@ def to_map
"backupPolicies": @backup_policies,
"deploymentSize": @deployment_size,
"buildSize": @build_size,
"functionsIntervalMinimum": @functions_interval_minimum,
"databasesAllowEncrypt": @databases_allow_encrypt,
"limits": @limits&.to_map,
"group": @group,
Expand Down
5 changes: 5 additions & 0 deletions lib/appwrite/models/function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Function
attr_reader :vars
attr_reader :events
attr_reader :schedule
attr_reader :interval
attr_reader :timeout
attr_reader :entrypoint
attr_reader :commands
Expand Down Expand Up @@ -56,6 +57,7 @@ def initialize(
vars:,
events:,
schedule:,
interval:,
timeout:,
entrypoint:,
commands:,
Expand Down Expand Up @@ -89,6 +91,7 @@ def initialize(
@vars = vars
@events = events
@schedule = schedule
@interval = interval
@timeout = timeout
@entrypoint = entrypoint
@commands = commands
Expand Down Expand Up @@ -125,6 +128,7 @@ def self.from(map:)
vars: map["vars"].map { |it| Variable.from(map: it) },
events: map["events"],
schedule: map["schedule"],
interval: map["interval"],
timeout: map["timeout"],
entrypoint: map["entrypoint"],
commands: map["commands"],
Expand Down Expand Up @@ -162,6 +166,7 @@ def to_map
"vars": @vars.map { |it| it.to_map },
"events": @events,
"schedule": @schedule,
"interval": @interval,
"timeout": @timeout,
"entrypoint": @entrypoint,
"commands": @commands,
Expand Down
14 changes: 10 additions & 4 deletions lib/appwrite/services/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def list(
# @param [Runtime] runtime Execution runtime.
# @param [Array] 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 [Array] 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 [Integer] timeout Function maximum execution time in seconds.
# @param [] 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 [] logging When disabled, executions will exclude logs and errors, and will be slightly faster.
Expand All @@ -68,6 +68,7 @@ def list(
# @param [String] build_specification Build specification for the function deployments.
# @param [String] runtime_specification Runtime specification for the function executions.
# @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
# @param [Integer] interval Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule.
#
# @return [Function]
def create(
Expand All @@ -92,7 +93,8 @@ def create(
provider_paths: nil,
build_specification: nil,
runtime_specification: nil,
deployment_retention: nil
deployment_retention: nil,
interval: nil
)
api_path = '/functions'

Expand Down Expand Up @@ -131,6 +133,7 @@ def create(
buildSpecification: build_specification,
runtimeSpecification: runtime_specification,
deploymentRetention: deployment_retention,
interval: interval,
}

api_headers = {
Expand Down Expand Up @@ -237,7 +240,7 @@ def get(
# @param [Runtime] runtime Execution runtime.
# @param [Array] 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 [Array] 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 [Integer] timeout Maximum execution time in seconds.
# @param [] 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 [] logging When disabled, executions will exclude logs and errors, and will be slightly faster.
Expand All @@ -254,6 +257,7 @@ def get(
# @param [String] build_specification Build specification for the function deployments.
# @param [String] runtime_specification Runtime specification for the function executions.
# @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
# @param [Integer] 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.
#
# @return [Function]
def update(
Expand All @@ -278,7 +282,8 @@ def update(
provider_paths: nil,
build_specification: nil,
runtime_specification: nil,
deployment_retention: nil
deployment_retention: nil,
interval: nil
)
api_path = '/functions/{functionId}'
.gsub('{functionId}', function_id)
Expand Down Expand Up @@ -313,6 +318,7 @@ def update(
buildSpecification: build_specification,
runtimeSpecification: runtime_specification,
deploymentRetention: deployment_retention,
interval: interval,
}

api_headers = {
Expand Down
Loading