Preps for Console SDK

This commit is contained in:
Matej Bačo
2025-02-27 10:04:11 +01:00
parent 93d00abfe1
commit ac51fcbf4e
8 changed files with 113 additions and 52 deletions
+30 -14
View File
@@ -4398,7 +4398,7 @@
"enum": [
"rules"
],
"x-enum-name": null,
"x-enum-name": "ConsoleResourceType",
"x-enum-keys": []
},
"in": "query"
@@ -23834,6 +23834,11 @@
"type": "string",
"description": "ID of function to be executed.",
"x-example": "<FUNCTION_ID>"
},
"branch": {
"type": "string",
"description": "Name of VCS branch to deploy changes automatically",
"x-example": "<BRANCH>"
}
},
"required": [
@@ -23904,8 +23909,8 @@
},
"target": {
"type": "string",
"description": "Target URL of redirection",
"x-example": "https:\/\/example.com"
"description": "Target domain (hostname) of redirection",
"x-example": null
}
},
"required": [
@@ -23978,6 +23983,11 @@
"type": "string",
"description": "ID of site to be executed.",
"x-example": "<SITE_ID>"
},
"branch": {
"type": "string",
"description": "Name of VCS branch to deploy changes automatically",
"x-example": "<BRANCH>"
}
},
"required": [
@@ -24405,8 +24415,14 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Allows: static, ssr",
"x-example": "<ADAPTER>"
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"installationId": {
"type": "string",
@@ -24972,8 +24988,14 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Usuallly allows: static, ssr",
"x-example": "<ADAPTER>"
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"fallbackFile": {
"type": "string",
@@ -37367,11 +37389,6 @@
"x-example": 128,
"format": "int32"
},
"domain": {
"type": "string",
"description": "Preview domain.",
"x-example": "deploy1-project1.appwrite.site"
},
"providerRepositoryName": {
"type": "string",
"description": "The name of the vcs provider repository",
@@ -37440,7 +37457,6 @@
"status",
"buildLogs",
"buildTime",
"domain",
"providerRepositoryName",
"providerRepositoryOwner",
"providerRepositoryUrl",
@@ -39992,7 +40008,7 @@
},
"automation": {
"type": "string",
"description": "Action that result in update of rule. If VCS branch, value can be of syntax \"branch=[name]\"",
"description": "Action that results in a rule update. If VCS branch, value can be of syntax \"branch=[name]\"",
"x-example": "branch=dev"
},
"status": {
+16 -10
View File
@@ -16526,8 +16526,14 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Allows: static, ssr",
"x-example": "<ADAPTER>"
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"installationId": {
"type": "string",
@@ -16871,8 +16877,14 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Usuallly allows: static, ssr",
"x-example": "<ADAPTER>"
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"fallbackFile": {
"type": "string",
@@ -27488,11 +27500,6 @@
"x-example": 128,
"format": "int32"
},
"domain": {
"type": "string",
"description": "Preview domain.",
"x-example": "deploy1-project1.appwrite.site"
},
"providerRepositoryName": {
"type": "string",
"description": "The name of the vcs provider repository",
@@ -27561,7 +27568,6 @@
"status",
"buildLogs",
"buildTime",
"domain",
"providerRepositoryName",
"providerRepositoryOwner",
"providerRepositoryUrl",
+32 -14
View File
@@ -4604,7 +4604,7 @@
"enum": [
"rules"
],
"x-enum-name": null,
"x-enum-name": "ConsoleResourceType",
"x-enum-keys": [],
"in": "query"
}
@@ -24324,6 +24324,12 @@
"description": "ID of function to be executed.",
"default": null,
"x-example": "<FUNCTION_ID>"
},
"branch": {
"type": "string",
"description": "Name of VCS branch to deploy changes automatically",
"default": "",
"x-example": "<BRANCH>"
}
},
"required": [
@@ -24397,9 +24403,9 @@
},
"target": {
"type": "string",
"description": "Target URL of redirection",
"description": "Target domain (hostname) of redirection",
"default": null,
"x-example": "https:\/\/example.com"
"x-example": null
}
},
"required": [
@@ -24476,6 +24482,12 @@
"description": "ID of site to be executed.",
"default": null,
"x-example": "<SITE_ID>"
},
"branch": {
"type": "string",
"description": "Name of VCS branch to deploy changes automatically",
"default": "",
"x-example": "<BRANCH>"
}
},
"required": [
@@ -24918,9 +24930,15 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Allows: static, ssr",
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"default": "",
"x-example": "<ADAPTER>"
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"installationId": {
"type": "string",
@@ -25497,9 +25515,15 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Usuallly allows: static, ssr",
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"default": "",
"x-example": "<ADAPTER>"
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"fallbackFile": {
"type": "string",
@@ -37960,11 +37984,6 @@
"x-example": 128,
"format": "int32"
},
"domain": {
"type": "string",
"description": "Preview domain.",
"x-example": "deploy1-project1.appwrite.site"
},
"providerRepositoryName": {
"type": "string",
"description": "The name of the vcs provider repository",
@@ -38033,7 +38052,6 @@
"status",
"buildLogs",
"buildTime",
"domain",
"providerRepositoryName",
"providerRepositoryOwner",
"providerRepositoryUrl",
@@ -40656,7 +40674,7 @@
},
"automation": {
"type": "string",
"description": "Action that result in update of rule. If VCS branch, value can be of syntax \"branch=[name]\"",
"description": "Action that results in a rule update. If VCS branch, value can be of syntax \"branch=[name]\"",
"x-example": "branch=dev"
},
"status": {
+16 -10
View File
@@ -17008,9 +17008,15 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Allows: static, ssr",
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"default": "",
"x-example": "<ADAPTER>"
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"installationId": {
"type": "string",
@@ -17369,9 +17375,15 @@
},
"adapter": {
"type": "string",
"description": "Framework adapter. Usuallly allows: static, ssr",
"description": "Framework adapter defining rendering strategy. Allowed values are: static, ssr",
"default": "",
"x-example": "<ADAPTER>"
"x-example": "static",
"enum": [
"static",
"ssr"
],
"x-enum-name": null,
"x-enum-keys": []
},
"fallbackFile": {
"type": "string",
@@ -28054,11 +28066,6 @@
"x-example": 128,
"format": "int32"
},
"domain": {
"type": "string",
"description": "Preview domain.",
"x-example": "deploy1-project1.appwrite.site"
},
"providerRepositoryName": {
"type": "string",
"description": "The name of the vcs provider repository",
@@ -28127,7 +28134,6 @@
"status",
"buildLogs",
"buildTime",
"domain",
"providerRepositoryName",
"providerRepositoryOwner",
"providerRepositoryUrl",
@@ -23,7 +23,7 @@ class Get extends Action
public static function getName()
{
return 'getResources';
return 'getResource';
}
public function __construct()
@@ -21,6 +21,7 @@ use Utopia\Platform\Action;
use Utopia\Platform\Scope\HTTP;
use Utopia\System\System;
use Utopia\Validator\Domain as ValidatorDomain;
use Utopia\Validator\Text;
class Create extends Action
{
@@ -61,6 +62,7 @@ class Create extends Action
->label('abuse-time', 60)
->param('domain', null, new ValidatorDomain(), 'Domain name.')
->param('functionId', '', new UID(), 'ID of function to be executed.')
->param('branch', '', new Text(255, 0), 'Name of VCS branch to deploy changes automatically', true)
->inject('response')
->inject('project')
->inject('queueForCertificates')
@@ -70,7 +72,7 @@ class Create extends Action
->callback([$this, 'action']);
}
public function action(string $domain, string $functionId, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject)
public function action(string $domain, string $functionId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject)
{
$mainDomain = System::getEnv('_APP_DOMAIN', '');
$sitesDomain = System::getEnv('_APP_DOMAIN_SITES', '');
@@ -131,7 +133,8 @@ class Create extends Action
'value' => $function->getAttribute('deployment', ''),
'certificateId' => '',
'automation' => 'function=' . $function->getId(),
'search' => implode(' ', [$ruleId, $domain->get()]),
'automation' => !empty($branch) ? ('branch=' . $branch) : ('function=' . $function->getId()),
'search' => implode(' ', [$ruleId, $domain->get(), $branch]),
]);
try {
@@ -133,7 +133,7 @@ class Create extends Action
'value' => $site->getAttribute('deploymentId', ''),
'certificateId' => '',
'automation' => !empty($branch) ? ('branch=' . $branch) : ('site=' . $site->getId()),
'search' => implode(' ', [$ruleId, $domain->get()]),
'search' => implode(' ', [$ruleId, $domain->get(), $branch]),
]);
try {
+12
View File
@@ -113,6 +113,18 @@ abstract class Format
protected function getEnumName(string $service, string $method, string $param): ?string
{
switch ($service) {
case 'console':
switch ($method) {
case 'getResource':
switch ($param) {
case 'type':
return 'ConsoleResourceType';
case 'value':
return 'ConsoleResourceValue';
}
break;
}
break;
case 'account':
switch ($method) {
case 'createOAuth2Session':