Split for client and servers SDKs
This commit is contained in:
parent
45ee43064a
commit
b5a73340c2
2 changed files with 17 additions and 0 deletions
16
app/app.php
16
app/app.php
|
@ -452,6 +452,11 @@ $utopia->get('/v1/open-api-2.json')
|
||||||
'server' => ['Project' => [], 'Key' => []],
|
'server' => ['Project' => [], 'Key' => []],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$platforms = [
|
||||||
|
'client' => APP_PLATFORM_CLIENT,
|
||||||
|
'server' => APP_PLATFORM_SERVER,
|
||||||
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Specifications (v3.0.0):
|
* Specifications (v3.0.0):
|
||||||
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md
|
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md
|
||||||
|
@ -549,6 +554,13 @@ $utopia->get('/v1/open-api-2.json')
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($extensions) {
|
||||||
|
$output['securityDefinitions']['Project']['extensions'] = ['demo' => '5df5acd0d48c2'];
|
||||||
|
$output['securityDefinitions']['Key']['extensions'] = ['demo' => '919c2d18fb5d4...a2ae413da83346ad2'];
|
||||||
|
$output['securityDefinitions']['Locale']['extensions'] = ['demo' => 'en'];
|
||||||
|
$output['securityDefinitions']['Mode']['extensions'] = ['demo' => ''];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($utopia->getRoutes() as $key => $method) {
|
foreach ($utopia->getRoutes() as $key => $method) {
|
||||||
foreach ($method as $route) { /* @var $route \Utopia\Route */
|
foreach ($method as $route) { /* @var $route \Utopia\Route */
|
||||||
if (!$route->getLabel('docs', true)) {
|
if (!$route->getLabel('docs', true)) {
|
||||||
|
@ -559,6 +571,10 @@ $utopia->get('/v1/open-api-2.json')
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!in_array($platforms[$platform], $route->getLabel('sdk.platform', []))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$url = str_replace('/v1', '', $route->getURL());
|
$url = str_replace('/v1', '', $route->getURL());
|
||||||
$scope = $route->getLabel('scope', '');
|
$scope = $route->getLabel('scope', '');
|
||||||
$hide = $route->getLabel('sdk.hide', false);
|
$hide = $route->getLabel('sdk.hide', false);
|
||||||
|
|
|
@ -48,6 +48,7 @@ $utopia->get('/v1/account')
|
||||||
->label('sdk.namespace', 'account')
|
->label('sdk.namespace', 'account')
|
||||||
->label('sdk.method', 'getAccount')
|
->label('sdk.method', 'getAccount')
|
||||||
->label('sdk.description', '/docs/references/account/get.md')
|
->label('sdk.description', '/docs/references/account/get.md')
|
||||||
|
->label('sdk.response', ['200' => 'user'])
|
||||||
->action(
|
->action(
|
||||||
function () use ($response, &$user, $oauthKeys) {
|
function () use ($response, &$user, $oauthKeys) {
|
||||||
$response->json(array_merge($user->getArrayCopy(array_merge(
|
$response->json(array_merge($user->getArrayCopy(array_merge(
|
||||||
|
|
Loading…
Reference in a new issue