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