-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d0eae5
commit 35e13f6
Showing
18 changed files
with
370 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'appwrite' | ||
|
||
include Appwrite | ||
|
||
client = Client.new | ||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint | ||
.set_project('<YOUR_PROJECT_ID>') # Your project ID | ||
|
||
functions = Functions.new(client) | ||
|
||
result = functions.get_template( | ||
template_id: '<TEMPLATE_ID>' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'appwrite' | ||
|
||
include Appwrite | ||
|
||
client = Client.new | ||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint | ||
.set_project('<YOUR_PROJECT_ID>') # Your project ID | ||
|
||
functions = Functions.new(client) | ||
|
||
result = functions.list_templates( | ||
runtimes: [], # optional | ||
use_cases: [], # optional | ||
limit: 1, # optional | ||
offset: 0 # optional | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#frozen_string_literal: true | ||
|
||
module Appwrite | ||
module Models | ||
class TemplateFunction | ||
attr_reader :icon | ||
attr_reader :id | ||
attr_reader :name | ||
attr_reader :tagline | ||
attr_reader :permissions | ||
attr_reader :events | ||
attr_reader :cron | ||
attr_reader :timeout | ||
attr_reader :use_cases | ||
attr_reader :runtimes | ||
attr_reader :instructions | ||
attr_reader :vcs_provider | ||
attr_reader :provider_repository_id | ||
attr_reader :provider_owner | ||
attr_reader :provider_version | ||
attr_reader :variables | ||
attr_reader :scopes | ||
|
||
def initialize( | ||
icon:, | ||
id:, | ||
name:, | ||
tagline:, | ||
permissions:, | ||
events:, | ||
cron:, | ||
timeout:, | ||
use_cases:, | ||
runtimes:, | ||
instructions:, | ||
vcs_provider:, | ||
provider_repository_id:, | ||
provider_owner:, | ||
provider_version:, | ||
variables:, | ||
scopes: | ||
) | ||
@icon = icon | ||
@id = id | ||
@name = name | ||
@tagline = tagline | ||
@permissions = permissions | ||
@events = events | ||
@cron = cron | ||
@timeout = timeout | ||
@use_cases = use_cases | ||
@runtimes = runtimes | ||
@instructions = instructions | ||
@vcs_provider = vcs_provider | ||
@provider_repository_id = provider_repository_id | ||
@provider_owner = provider_owner | ||
@provider_version = provider_version | ||
@variables = variables | ||
@scopes = scopes | ||
end | ||
|
||
def self.from(map:) | ||
TemplateFunction.new( | ||
icon: map["icon"], | ||
id: map["id"], | ||
name: map["name"], | ||
tagline: map["tagline"], | ||
permissions: map["permissions"], | ||
events: map["events"], | ||
cron: map["cron"], | ||
timeout: map["timeout"], | ||
use_cases: map["useCases"], | ||
runtimes: map["runtimes"].map { |it| TemplateRuntime.from(map: it) }, | ||
instructions: map["instructions"], | ||
vcs_provider: map["vcsProvider"], | ||
provider_repository_id: map["providerRepositoryId"], | ||
provider_owner: map["providerOwner"], | ||
provider_version: map["providerVersion"], | ||
variables: map["variables"].map { |it| TemplateVariable.from(map: it) }, | ||
scopes: map["scopes"] | ||
) | ||
end | ||
|
||
def to_map | ||
{ | ||
"icon": @icon, | ||
"id": @id, | ||
"name": @name, | ||
"tagline": @tagline, | ||
"permissions": @permissions, | ||
"events": @events, | ||
"cron": @cron, | ||
"timeout": @timeout, | ||
"useCases": @use_cases, | ||
"runtimes": @runtimes.map { |it| it.to_map }, | ||
"instructions": @instructions, | ||
"vcsProvider": @vcs_provider, | ||
"providerRepositoryId": @provider_repository_id, | ||
"providerOwner": @provider_owner, | ||
"providerVersion": @provider_version, | ||
"variables": @variables.map { |it| it.to_map }, | ||
"scopes": @scopes | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#frozen_string_literal: true | ||
|
||
module Appwrite | ||
module Models | ||
class TemplateFunctionList | ||
attr_reader :total | ||
attr_reader :templates | ||
|
||
def initialize( | ||
total:, | ||
templates: | ||
) | ||
@total = total | ||
@templates = templates | ||
end | ||
|
||
def self.from(map:) | ||
TemplateFunctionList.new( | ||
total: map["total"], | ||
templates: map["templates"].map { |it| TemplateFunction.from(map: it) } | ||
) | ||
end | ||
|
||
def to_map | ||
{ | ||
"total": @total, | ||
"templates": @templates.map { |it| it.to_map } | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#frozen_string_literal: true | ||
|
||
module Appwrite | ||
module Models | ||
class TemplateRuntime | ||
attr_reader :name | ||
attr_reader :commands | ||
attr_reader :entrypoint | ||
attr_reader :provider_root_directory | ||
|
||
def initialize( | ||
name:, | ||
commands:, | ||
entrypoint:, | ||
provider_root_directory: | ||
) | ||
@name = name | ||
@commands = commands | ||
@entrypoint = entrypoint | ||
@provider_root_directory = provider_root_directory | ||
end | ||
|
||
def self.from(map:) | ||
TemplateRuntime.new( | ||
name: map["name"], | ||
commands: map["commands"], | ||
entrypoint: map["entrypoint"], | ||
provider_root_directory: map["providerRootDirectory"] | ||
) | ||
end | ||
|
||
def to_map | ||
{ | ||
"name": @name, | ||
"commands": @commands, | ||
"entrypoint": @entrypoint, | ||
"providerRootDirectory": @provider_root_directory | ||
} | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.