mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Add event information into specs
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
Submodule app/console updated: 0a007a3b1b...49d039ed07
Generated
+64
-96
@@ -688,50 +688,11 @@
|
||||
"version": "0.6.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:mustangostang/spyc.git",
|
||||
"url": "https://github.com/mustangostang/spyc",
|
||||
"reference": "4627c838b16550b666d15aeae1e5289dd5b77da0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mustangostang/spyc/zipball/4627c838b16550b666d15aeae1e5289dd5b77da0",
|
||||
"reference": "4627c838b16550b666d15aeae1e5289dd5b77da0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.3.*@dev"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.5.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"Spyc.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "mustangostang",
|
||||
"email": "vlad.andersen@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A simple YAML loader/dumper class for PHP",
|
||||
"homepage": "https://github.com/mustangostang/spyc/",
|
||||
"keywords": [
|
||||
"spyc",
|
||||
"yaml",
|
||||
"yml"
|
||||
],
|
||||
"time": "2019-09-10T13:16:29+00:00"
|
||||
"notification-url": "https://packagist.org/downloads/"
|
||||
},
|
||||
{
|
||||
"name": "phpmailer/phpmailer",
|
||||
@@ -1187,16 +1148,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "0.45.6",
|
||||
"version": "0.45.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "c7cc6d57683a4c13d9772dbeea343adb72c443fd"
|
||||
"reference": "f508c5fcec8e4b2c323a12dd4355a8cb0cc6ad03"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/c7cc6d57683a4c13d9772dbeea343adb72c443fd",
|
||||
"reference": "c7cc6d57683a4c13d9772dbeea343adb72c443fd",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/f508c5fcec8e4b2c323a12dd4355a8cb0cc6ad03",
|
||||
"reference": "f508c5fcec8e4b2c323a12dd4355a8cb0cc6ad03",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1204,7 +1165,7 @@
|
||||
"ext-pdo": "*",
|
||||
"php": ">=8.0",
|
||||
"utopia-php/cache": "0.9.*",
|
||||
"utopia-php/framework": "0.*.*",
|
||||
"utopia-php/framework": "0.33.*",
|
||||
"utopia-php/mongo": "0.3.*"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -1237,9 +1198,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/0.45.6"
|
||||
"source": "https://github.com/utopia-php/database/tree/0.45.7"
|
||||
},
|
||||
"time": "2024-02-01T02:33:43+00:00"
|
||||
"time": "2024-03-05T10:28:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/domains",
|
||||
@@ -2764,16 +2725,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v5.0.1",
|
||||
"version": "v5.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "2218c2252c874a4624ab2f613d86ac32d227bc69"
|
||||
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69",
|
||||
"reference": "2218c2252c874a4624ab2f613d86ac32d227bc69",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13",
|
||||
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2816,26 +2777,27 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.1"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2"
|
||||
},
|
||||
"time": "2024-02-21T19:24:10+00:00"
|
||||
"time": "2024-03-05T20:51:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/manifest.git",
|
||||
"reference": "97803eca37d319dfa7826cc2437fc020857acb53"
|
||||
"reference": "54750ef60c58e43759730615a392c31c80e23176"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
|
||||
"reference": "97803eca37d319dfa7826cc2437fc020857acb53",
|
||||
"url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
|
||||
"reference": "54750ef60c58e43759730615a392c31c80e23176",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-phar": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"phar-io/version": "^3.0.1",
|
||||
@@ -2876,9 +2838,15 @@
|
||||
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
|
||||
"support": {
|
||||
"issues": "https://github.com/phar-io/manifest/issues",
|
||||
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
|
||||
"source": "https://github.com/phar-io/manifest/tree/2.0.4"
|
||||
},
|
||||
"time": "2021-07-20T11:28:43+00:00"
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/theseer",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-03T12:33:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/version",
|
||||
@@ -3217,16 +3185,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "9.2.30",
|
||||
"version": "9.2.31",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089"
|
||||
"reference": "48c34b5d8d983006bd2adc2d0de92963b9155965"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089",
|
||||
"reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965",
|
||||
"reference": "48c34b5d8d983006bd2adc2d0de92963b9155965",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3283,7 +3251,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30"
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3291,7 +3259,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-22T06:47:57+00:00"
|
||||
"time": "2024-03-02T06:37:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
@@ -3689,16 +3657,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/cli-parser.git",
|
||||
"reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2"
|
||||
"reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2",
|
||||
"reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b",
|
||||
"reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3733,7 +3701,7 @@
|
||||
"homepage": "https://github.com/sebastianbergmann/cli-parser",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
|
||||
"source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1"
|
||||
"source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3741,7 +3709,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-09-28T06:08:49+00:00"
|
||||
"time": "2024-03-02T06:27:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit",
|
||||
@@ -3987,16 +3955,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "4.0.5",
|
||||
"version": "4.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131"
|
||||
"reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131",
|
||||
"reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc",
|
||||
"reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4041,7 +4009,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.5"
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -4049,7 +4017,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-07T05:35:17+00:00"
|
||||
"time": "2024-03-02T06:30:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -4116,16 +4084,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "4.0.5",
|
||||
"version": "4.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d"
|
||||
"reference": "78c00df8f170e02473b682df15bfcdacc3d32d72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d",
|
||||
"reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72",
|
||||
"reference": "78c00df8f170e02473b682df15bfcdacc3d32d72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4181,7 +4149,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5"
|
||||
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -4189,20 +4157,20 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-09-14T06:03:37+00:00"
|
||||
"time": "2024-03-02T06:33:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
"version": "5.0.6",
|
||||
"version": "5.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/global-state.git",
|
||||
"reference": "bde739e7565280bda77be70044ac1047bc007e34"
|
||||
"reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34",
|
||||
"reference": "bde739e7565280bda77be70044ac1047bc007e34",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9",
|
||||
"reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4245,7 +4213,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/global-state/issues",
|
||||
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6"
|
||||
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -4253,7 +4221,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-08-02T09:26:13+00:00"
|
||||
"time": "2024-03-02T06:35:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/lines-of-code",
|
||||
@@ -4973,16 +4941,16 @@
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/theseer/tokenizer.git",
|
||||
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96"
|
||||
"reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
|
||||
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
|
||||
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
|
||||
"reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5011,7 +4979,7 @@
|
||||
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
|
||||
"support": {
|
||||
"issues": "https://github.com/theseer/tokenizer/issues",
|
||||
"source": "https://github.com/theseer/tokenizer/tree/1.2.2"
|
||||
"source": "https://github.com/theseer/tokenizer/tree/1.2.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -5019,7 +4987,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-20T00:12:19+00:00"
|
||||
"time": "2024-03-03T12:36:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
|
||||
@@ -217,6 +217,7 @@ class Specs extends Action
|
||||
}
|
||||
|
||||
$models = $response->getModels();
|
||||
$events = $this->generateEvents(Config::getParam('events', []));
|
||||
|
||||
foreach ($models as $key => $value) {
|
||||
if ($platform !== APP_PLATFORM_CONSOLE && !$value->isPublic()) {
|
||||
@@ -224,7 +225,15 @@ class Specs extends Action
|
||||
}
|
||||
}
|
||||
|
||||
$arguments = [new App('UTC'), $services, $routes, $models, $keys[$platform], $authCounts[$platform] ?? 0];
|
||||
$arguments = [
|
||||
new App('UTC'),
|
||||
$services,
|
||||
$routes,
|
||||
$models,
|
||||
$keys[$platform],
|
||||
$authCounts[$platform] ?? 0,
|
||||
$events,
|
||||
];
|
||||
foreach (['swagger2', 'open-api3'] as $format) {
|
||||
$formatInstance = match ($format) {
|
||||
'swagger2' => new Swagger2(...$arguments),
|
||||
@@ -274,4 +283,53 @@ class Specs extends Action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function generateEvents(array $events, $parentModel = null)
|
||||
{
|
||||
$nodeEvents = [];
|
||||
// go through each subNode's to find resources
|
||||
foreach ($events as $key => $subNode) {
|
||||
$pattern = "";
|
||||
// if it's not an array of nodes, but something description or model, skip
|
||||
if (!is_array($subNode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// add wild card if applicable
|
||||
if ($subNode['$resource'] ?? false) {
|
||||
$pattern = "{$key}.*";
|
||||
} else {
|
||||
$pattern = "{$key}";
|
||||
}
|
||||
|
||||
$model = isset($subNode['$model']) ? $subNode['$model'] : $parentModel;
|
||||
|
||||
// add events for the current node.
|
||||
$nodeEvents[] = [
|
||||
'pattern' => $pattern,
|
||||
'$model' => $model,
|
||||
'$description' => $subNode['$description'],
|
||||
];
|
||||
|
||||
// recursively get events from child nodes
|
||||
$subEvents = $this::generateEvents($subNode, $model);
|
||||
|
||||
// update child nodes bu appending the root node's event pattern
|
||||
// for example, joining databases.* with the child event collections.*
|
||||
foreach ($subEvents as $key => $subEvent) {
|
||||
$nodeEvents[] = [
|
||||
"pattern" => $pattern . "." . $subEvent["pattern"],
|
||||
'$model' =>
|
||||
$subEvent['$model'] === null
|
||||
? $subNode['$model']
|
||||
: $subEvent['$model'],
|
||||
'$description' =>
|
||||
$subEvent['$description'] === ""
|
||||
? $subNode['$description']
|
||||
: $subEvent['$description'],
|
||||
];
|
||||
}
|
||||
}
|
||||
return $nodeEvents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,22 +21,27 @@ abstract class Format
|
||||
*/
|
||||
protected array $models;
|
||||
|
||||
/**
|
||||
* @var Event []
|
||||
*/
|
||||
protected array $events;
|
||||
|
||||
protected array $services;
|
||||
protected array $keys;
|
||||
protected int $authCount;
|
||||
protected array $params = [
|
||||
'name' => '',
|
||||
'description' => '',
|
||||
'endpoint' => 'https://localhost',
|
||||
'version' => '1.0.0',
|
||||
'terms' => '',
|
||||
'support.email' => '',
|
||||
'support.url' => '',
|
||||
'contact.name' => '',
|
||||
'contact.email' => '',
|
||||
'contact.url' => '',
|
||||
'license.name' => '',
|
||||
'license.url' => '',
|
||||
"name" => "",
|
||||
"description" => "",
|
||||
"endpoint" => "https://localhost",
|
||||
"version" => "1.0.0",
|
||||
"terms" => "",
|
||||
"support.email" => "",
|
||||
"support.url" => "",
|
||||
"contact.name" => "",
|
||||
"contact.email" => "",
|
||||
"contact.url" => "",
|
||||
"license.name" => "",
|
||||
"license.url" => "",
|
||||
];
|
||||
|
||||
/*
|
||||
@@ -44,20 +49,28 @@ abstract class Format
|
||||
*/
|
||||
protected array $enumBlacklist = [
|
||||
[
|
||||
'namespace' => 'users',
|
||||
'method' => 'getUsage',
|
||||
'parameter' => 'provider'
|
||||
]
|
||||
"namespace" => "users",
|
||||
"method" => "getUsage",
|
||||
"parameter" => "provider",
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct(App $app, array $services, array $routes, array $models, array $keys, int $authCount)
|
||||
{
|
||||
public function __construct(
|
||||
App $app,
|
||||
array $services,
|
||||
array $routes,
|
||||
array $models,
|
||||
array $keys,
|
||||
int $authCount,
|
||||
array $events
|
||||
) {
|
||||
$this->app = $app;
|
||||
$this->services = $services;
|
||||
$this->routes = $routes;
|
||||
$this->models = $models;
|
||||
$this->keys = $keys;
|
||||
$this->authCount = $authCount;
|
||||
$this->events = $events;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,73 +118,76 @@ abstract class Format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParam(string $key, string $default = ''): string
|
||||
public function getParam(string $key, string $default = ""): string
|
||||
{
|
||||
return $this->params[$key] ?? $default;
|
||||
}
|
||||
|
||||
protected function getEnumName(string $service, string $method, string $param): ?string
|
||||
{
|
||||
protected function getEnumName(
|
||||
string $service,
|
||||
string $method,
|
||||
string $param
|
||||
): ?string {
|
||||
switch ($service) {
|
||||
case 'account':
|
||||
case "account":
|
||||
switch ($method) {
|
||||
case 'createOAuth2Session':
|
||||
return 'Provider';
|
||||
case "createOAuth2Session":
|
||||
return "Provider";
|
||||
}
|
||||
break;
|
||||
case 'avatars':
|
||||
case "avatars":
|
||||
switch ($method) {
|
||||
case 'getBrowser':
|
||||
return 'Browser';
|
||||
case 'getCreditCard':
|
||||
return 'CreditCard';
|
||||
case 'getFlag':
|
||||
return 'Flag';
|
||||
case "getBrowser":
|
||||
return "Browser";
|
||||
case "getCreditCard":
|
||||
return "CreditCard";
|
||||
case "getFlag":
|
||||
return "Flag";
|
||||
}
|
||||
break;
|
||||
case 'storage':
|
||||
case "storage":
|
||||
switch ($method) {
|
||||
case 'getFilePreview':
|
||||
case "getFilePreview":
|
||||
switch ($param) {
|
||||
case 'gravity':
|
||||
return 'ImageGravity';
|
||||
case 'output':
|
||||
return 'ImageFormat';
|
||||
case "gravity":
|
||||
return "ImageGravity";
|
||||
case "output":
|
||||
return "ImageFormat";
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'databases':
|
||||
case "databases":
|
||||
switch ($method) {
|
||||
case 'createRelationshipAttribute':
|
||||
case "createRelationshipAttribute":
|
||||
switch ($param) {
|
||||
case 'type':
|
||||
return 'RelationshipType';
|
||||
case 'onDelete':
|
||||
return 'RelationMutate';
|
||||
case "type":
|
||||
return "RelationshipType";
|
||||
case "onDelete":
|
||||
return "RelationMutate";
|
||||
}
|
||||
break;
|
||||
case 'updateRelationshipAttribute':
|
||||
case "updateRelationshipAttribute":
|
||||
switch ($param) {
|
||||
case 'onDelete':
|
||||
return 'RelationMutate';
|
||||
case "onDelete":
|
||||
return "RelationMutate";
|
||||
}
|
||||
break;
|
||||
case 'createIndex':
|
||||
case "createIndex":
|
||||
switch ($param) {
|
||||
case 'type':
|
||||
return 'IndexType';
|
||||
case 'orders':
|
||||
return 'OrderBy';
|
||||
case "type":
|
||||
return "IndexType";
|
||||
case "orders":
|
||||
return "OrderBy";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'projects':
|
||||
case "projects":
|
||||
switch ($method) {
|
||||
case 'createPlatform':
|
||||
case "createPlatform":
|
||||
switch ($param) {
|
||||
case 'type':
|
||||
return 'PlatformType';
|
||||
case "type":
|
||||
return "PlatformType";
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -179,68 +195,91 @@ abstract class Format
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public function getEnumKeys(string $service, string $method, string $param): array
|
||||
{
|
||||
public function getEnumKeys(
|
||||
string $service,
|
||||
string $method,
|
||||
string $param
|
||||
): array {
|
||||
$values = [];
|
||||
switch ($service) {
|
||||
case 'avatars':
|
||||
case "avatars":
|
||||
switch ($method) {
|
||||
case 'getBrowser':
|
||||
$codes = Config::getParam('avatar-browsers');
|
||||
case "getBrowser":
|
||||
$codes = Config::getParam("avatar-browsers");
|
||||
foreach ($codes as $code => $value) {
|
||||
$values[] = $value['name'];
|
||||
$values[] = $value["name"];
|
||||
}
|
||||
return $values;
|
||||
case 'getCreditCard':
|
||||
$codes = Config::getParam('avatar-credit-cards');
|
||||
case "getCreditCard":
|
||||
$codes = Config::getParam("avatar-credit-cards");
|
||||
foreach ($codes as $code => $value) {
|
||||
$values[] = $value['name'];
|
||||
$values[] = $value["name"];
|
||||
}
|
||||
return $values;
|
||||
case 'getFlag':
|
||||
$codes = Config::getParam('avatar-flags');
|
||||
case "getFlag":
|
||||
$codes = Config::getParam("avatar-flags");
|
||||
foreach ($codes as $code => $value) {
|
||||
$values[] = $value['name'];
|
||||
$values[] = $value["name"];
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
break;
|
||||
case 'databases':
|
||||
case "databases":
|
||||
switch ($method) {
|
||||
case 'getUsage':
|
||||
case 'getCollectionUsage':
|
||||
case 'getDatabaseUsage':
|
||||
case "getUsage":
|
||||
case "getCollectionUsage":
|
||||
case "getDatabaseUsage":
|
||||
// Range Enum Keys
|
||||
$values = ['Twenty Four Hours', 'Seven Days', 'Thirty Days', 'Ninety Days'];
|
||||
$values = [
|
||||
"Twenty Four Hours",
|
||||
"Seven Days",
|
||||
"Thirty Days",
|
||||
"Ninety Days",
|
||||
];
|
||||
return $values;
|
||||
}
|
||||
break;
|
||||
case 'function':
|
||||
case "function":
|
||||
switch ($method) {
|
||||
case 'getUsage':
|
||||
case 'getFunctionUsage':
|
||||
case "getUsage":
|
||||
case "getFunctionUsage":
|
||||
// Range Enum Keys
|
||||
$values = ['Twenty Four Hours', 'Seven Days', 'Thirty Days', 'Ninety Days'];
|
||||
$values = [
|
||||
"Twenty Four Hours",
|
||||
"Seven Days",
|
||||
"Thirty Days",
|
||||
"Ninety Days",
|
||||
];
|
||||
return $values;
|
||||
}
|
||||
break;
|
||||
case 'users':
|
||||
case "users":
|
||||
switch ($method) {
|
||||
case 'getUsage':
|
||||
case 'getUserUsage':
|
||||
case "getUsage":
|
||||
case "getUserUsage":
|
||||
// Range Enum Keys
|
||||
if ($param == 'range') {
|
||||
$values = ['Twenty Four Hours', 'Seven Days', 'Thirty Days', 'Ninety Days'];
|
||||
if ($param == "range") {
|
||||
$values = [
|
||||
"Twenty Four Hours",
|
||||
"Seven Days",
|
||||
"Thirty Days",
|
||||
"Ninety Days",
|
||||
];
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'storage':
|
||||
case "storage":
|
||||
switch ($method) {
|
||||
case 'getUsage':
|
||||
case 'getBucketUsage':
|
||||
case "getUsage":
|
||||
case "getBucketUsage":
|
||||
// Range Enum Keys
|
||||
$values = ['Twenty Four Hours', 'Seven Days', 'Thirty Days', 'Ninety Days'];
|
||||
$values = [
|
||||
"Twenty Four Hours",
|
||||
"Seven Days",
|
||||
"Thirty Days",
|
||||
"Ninety Days",
|
||||
];
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Appwrite\Specification\Format;
|
||||
|
||||
use Utopia\Config\Config;
|
||||
use Appwrite\Specification\Format;
|
||||
use Appwrite\Template\Template;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
@@ -90,6 +91,7 @@ class OpenAPI3 extends Format
|
||||
'description' => $this->getParam('docs.description'),
|
||||
'url' => $this->getParam('docs.url'),
|
||||
],
|
||||
'x-appwrite-events' => $this->events,
|
||||
];
|
||||
|
||||
if (isset($output['components']['securitySchemes']['Project'])) {
|
||||
@@ -119,6 +121,7 @@ class OpenAPI3 extends Format
|
||||
$scope = $route->getLabel('scope', '');
|
||||
$hide = $route->getLabel('sdk.hide', false);
|
||||
$consumes = [$route->getLabel('sdk.request.type', 'application/json')];
|
||||
$event = $route->getLabel('event', '');
|
||||
|
||||
if ($hide) {
|
||||
continue;
|
||||
@@ -174,6 +177,7 @@ class OpenAPI3 extends Format
|
||||
'offline-model' => $route->getLabel('sdk.offline.model', ''),
|
||||
'offline-key' => $route->getLabel('sdk.offline.key', ''),
|
||||
'offline-response-key' => $route->getLabel('sdk.offline.response.key', '$id'),
|
||||
'event' => $event,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ class Swagger2 extends Format
|
||||
'description' => $this->getParam('docs.description'),
|
||||
'url' => $this->getParam('docs.url'),
|
||||
],
|
||||
'x-appwrite-events' => $this->events,
|
||||
];
|
||||
|
||||
if (isset($output['securityDefinitions']['Project'])) {
|
||||
@@ -118,6 +119,7 @@ class Swagger2 extends Format
|
||||
$scope = $route->getLabel('scope', '');
|
||||
$hide = $route->getLabel('sdk.hide', false);
|
||||
$consumes = [$route->getLabel('sdk.request.type', 'application/json')];
|
||||
$event = $route->getLabel('event', '');
|
||||
|
||||
if ($hide) {
|
||||
continue;
|
||||
@@ -175,6 +177,7 @@ class Swagger2 extends Format
|
||||
'offline-model' => $route->getLabel('sdk.offline.model', ''),
|
||||
'offline-key' => $route->getLabel('sdk.offline.key', ''),
|
||||
'offline-response-key' => $route->getLabel('sdk.offline.response.key', '$id'),
|
||||
'event' => $event,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user