Updated webhooks event list
This commit is contained in:
parent
aa391df411
commit
cdbe1d4bc0
|
@ -7,6 +7,8 @@
|
|||
* Update docs example with auth info
|
||||
* Allow non-web platform skip origin header
|
||||
* Limited to console UI to show max 5 alerts at the same time
|
||||
* Added new webhooks events
|
||||
* Normnailized all webhooks event names
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
|
|
67
app/app.php
67
app/app.php
|
@ -410,7 +410,7 @@ $utopia->get('/v1/proxy')
|
|||
}
|
||||
);
|
||||
|
||||
$utopia->get('/v1/open-api-2.json')
|
||||
$utopia->get('/v1/open-api-2.json')
|
||||
->label('scope', 'public')
|
||||
->label('docs', false)
|
||||
->param('platform', 'client', function () {return new WhiteList(['client', 'server']);}, 'Choose target platform.', true)
|
||||
|
@ -733,6 +733,71 @@ $utopia->get('/v1/open-api-2.json')
|
|||
}
|
||||
);
|
||||
|
||||
|
||||
$utopia->get('/v1/debug')
|
||||
->label('scope', 'public')
|
||||
->label('docs', false)
|
||||
->action(
|
||||
function () use ($response, $request, $utopia, $domain, $services) {
|
||||
$output = [
|
||||
'webhooks' => [],
|
||||
'methods' => [],
|
||||
'routes' => [],
|
||||
];
|
||||
|
||||
foreach ($services as $service) { /* @noinspection PhpIncludeInspection */
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
if($service['tests']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
include_once $service['controller'];
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($utopia->getRoutes() as $key => $method) {
|
||||
foreach ($method as $route) { /* @var $route \Utopia\Route */
|
||||
if (!$route->getLabel('docs', true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty($route->getLabel('sdk.namespace', null))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($route->getLabel('webhook', false)) {
|
||||
if(array_key_exists($route->getLabel('webhook', false), $output['webhooks'])) {
|
||||
throw new Exception('Webhook ('.$route->getLabel('webhook', false).') is already in use by another route', 500);
|
||||
}
|
||||
|
||||
$output['webhooks'][$route->getLabel('webhook', false)] = $route->getMethod().' '.$route->getURL();
|
||||
}
|
||||
|
||||
if ($route->getLabel('sdk.namespace', false)) {
|
||||
$method = $route->getLabel('sdk.namespace', false).'->'.$route->getLabel('sdk.method', false).'()';
|
||||
if(array_key_exists($method, $output['methods'])) {
|
||||
throw new Exception('Method ('.$method.') is already in use by another route', 500);
|
||||
}
|
||||
|
||||
$output['methods'][$method] = $route->getMethod().' '.$route->getURL();
|
||||
}
|
||||
|
||||
$output['routes'][$route->getURL().' ('.$route->getMethod().')'] = [];
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($output['webhooks']);
|
||||
ksort($output['methods']);
|
||||
ksort($output['routes']);
|
||||
|
||||
$response
|
||||
->json($output);
|
||||
}
|
||||
);
|
||||
|
||||
$name = APP_NAME;
|
||||
|
||||
if (array_key_exists($service, $services)) { /** @noinspection PhpIncludeInspection */
|
||||
|
|
|
@ -20,13 +20,13 @@ return [
|
|||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/auth' => [ // Add to docs later: You can also learn how to [configure support for our supported OAuth providers](/docs/oauth)
|
||||
'name' => 'Auth',
|
||||
'description' => '/docs/services/auth.md',
|
||||
'controller' => 'controllers/api/auth.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
// 'v1/auth' => [ // Add to docs later: You can also learn how to [configure support for our supported OAuth providers](/docs/oauth)
|
||||
// 'name' => 'Auth',
|
||||
// 'description' => '/docs/services/auth.md',
|
||||
// 'controller' => 'controllers/api/auth.php',
|
||||
// 'sdk' => true,
|
||||
// 'tests' => false,
|
||||
// ],
|
||||
'v1/avatars' => [
|
||||
'name' => 'Avatars',
|
||||
'description' => '/docs/services/avatars.md',
|
||||
|
@ -88,35 +88,34 @@ return [
|
|||
'sdk' => false,
|
||||
'tests' => true,
|
||||
],
|
||||
|
||||
'v1/keys' => [
|
||||
'name' => 'Keys',
|
||||
'description' => '',
|
||||
'controller' => 'controllers/api/keys.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/platforms' => [
|
||||
'name' => 'Platforms',
|
||||
'description' => '',
|
||||
'controller' => 'controllers/api/platforms.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/tasks' => [
|
||||
'name' => 'Tasks',
|
||||
'description' => '',
|
||||
'controller' => 'controllers/api/tasks.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/webhooks' => [
|
||||
'name' => 'Webhooks',
|
||||
'description' => '',
|
||||
'controller' => 'controllers/api/webhooks.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
// 'v1/keys' => [
|
||||
// 'name' => 'Keys',
|
||||
// 'description' => '',
|
||||
// 'controller' => 'controllers/api/keys.php',
|
||||
// 'sdk' => true,
|
||||
// 'tests' => false,
|
||||
// ],
|
||||
// 'v1/platforms' => [
|
||||
// 'name' => 'Platforms',
|
||||
// 'description' => '',
|
||||
// 'controller' => 'controllers/api/platforms.php',
|
||||
// 'sdk' => true,
|
||||
// 'tests' => false,
|
||||
// ],
|
||||
// 'v1/tasks' => [
|
||||
// 'name' => 'Tasks',
|
||||
// 'description' => '',
|
||||
// 'controller' => 'controllers/api/tasks.php',
|
||||
// 'sdk' => true,
|
||||
// 'tests' => false,
|
||||
// ],
|
||||
// 'v1/webhooks' => [
|
||||
// 'name' => 'Webhooks',
|
||||
// 'description' => '',
|
||||
// 'controller' => 'controllers/api/webhooks.php',
|
||||
// 'sdk' => true,
|
||||
// 'tests' => false,
|
||||
// ],
|
||||
'v1/graphql' => [
|
||||
'name' => 'GraphQL',
|
||||
'description' => 'GraphQL Endpoint',
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
<?php
|
||||
|
||||
$events = [
|
||||
'database.collections.create',
|
||||
'database.collections.update',
|
||||
'database.collections.delete',
|
||||
'database.documents.create',
|
||||
'database.documents.patch',
|
||||
'database.documents.update',
|
||||
'database.documents.delete',
|
||||
'auth.register',
|
||||
'auth.confirm',
|
||||
'auth.login',
|
||||
'auth.logout',
|
||||
'account.update-name',
|
||||
'account.update-email',
|
||||
'account.update-password',
|
||||
'storage.files.create',
|
||||
'storage.files.update',
|
||||
'storage.files.delete',
|
||||
// 'auth.register',
|
||||
// 'auth.confirm',
|
||||
// 'auth.login',
|
||||
// 'auth.logout',
|
||||
'account.create',
|
||||
'account.update.email',
|
||||
'account.update.name',
|
||||
'account.update.password',
|
||||
'account.update.prefs',
|
||||
'account.delete',
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue