82 lines
1.9 KiB
JavaScript
Raw Normal View History

2021-09-08 16:16:16 +02:00
'use strict';
module.exports = [
{
method: 'GET',
path: '/webhooks',
handler: 'webhooks.listWebhooks',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.read'] } },
2021-09-08 16:16:16 +02:00
],
},
},
{
method: 'POST',
path: '/webhooks',
handler: 'webhooks.createWebhook',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.create'] } },
2021-09-08 16:16:16 +02:00
],
},
},
{
method: 'GET',
path: '/webhooks/:id',
handler: 'webhooks.getWebhook',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.read'] } },
2021-09-08 16:16:16 +02:00
],
},
},
{
method: 'PUT',
path: '/webhooks/:id',
handler: 'webhooks.updateWebhook',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.update'] } },
2021-09-08 16:16:16 +02:00
],
},
},
{
method: 'DELETE',
path: '/webhooks/:id',
handler: 'webhooks.deleteWebhook',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.delete'] } },
2021-09-08 16:16:16 +02:00
],
},
},
{
method: 'POST',
path: '/webhooks/batch-delete',
handler: 'webhooks.deleteWebhooks',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.delete'] } },
2021-09-08 16:16:16 +02:00
],
},
},
{
method: 'POST',
path: '/webhooks/:id/trigger',
handler: 'webhooks.triggerWebhook',
2021-09-08 16:16:16 +02:00
config: {
policies: [
'admin::isAuthenticatedAdmin',
2022-08-09 17:20:19 +02:00
{ name: 'admin::hasPermissions', config: { actions: ['admin::webhooks.update'] } },
],
2021-09-08 16:16:16 +02:00
},
},
];