1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +12:00

Improved events avlidation

This commit is contained in:
Eldad Fux 2020-07-09 12:11:42 +03:00
parent 05c0caa945
commit ea1d7062a2

View file

@ -466,7 +466,7 @@ App::post('/v1/projects/:projectId/webhooks')
->label('sdk.method', 'createWebhook') ->label('sdk.method', 'createWebhook')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.')
->param('name', null, function () { return new Text(256); }, 'Webhook name.') ->param('name', null, function () { return new Text(256); }, 'Webhook name.')
->param('events', null, function () { return new ArrayList(new Text(256)); }, 'Webhook events list.') ->param('events', null, function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Webhook events list.')
->param('url', null, function () { return new Text(2000); }, 'Webhook URL.') ->param('url', null, function () { return new Text(2000); }, 'Webhook URL.')
->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.')
->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true) ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true)
@ -502,7 +502,7 @@ App::post('/v1/projects/:projectId/webhooks')
'name' => $name, 'name' => $name,
'events' => $events, 'events' => $events,
'url' => $url, 'url' => $url,
'security' => (int) $security, 'security' => $security,
'httpUser' => $httpUser, 'httpUser' => $httpUser,
'httpPass' => $httpPass, 'httpPass' => $httpPass,
]); ]);
@ -602,7 +602,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, function () { return new UID(); }, 'Project unique ID.')
->param('webhookId', null, function () { return new UID(); }, 'Webhook unique ID.') ->param('webhookId', null, function () { return new UID(); }, 'Webhook unique ID.')
->param('name', null, function () { return new Text(256); }, 'Webhook name.') ->param('name', null, function () { return new Text(256); }, 'Webhook name.')
->param('events', null, function () { return new ArrayList(new Text(256)); }, 'Webhook events list.') ->param('events', null, function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Webhook events list.')
->param('url', null, function () { return new Text(2000); }, 'Webhook URL.') ->param('url', null, function () { return new Text(2000); }, 'Webhook URL.')
->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true) ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true)
->param('httpPass', '', function () { return new Text(256); }, 'Webhook HTTP password.', true) ->param('httpPass', '', function () { return new Text(256); }, 'Webhook HTTP password.', true)
@ -638,7 +638,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
->setAttribute('name', $name) ->setAttribute('name', $name)
->setAttribute('events', $events) ->setAttribute('events', $events)
->setAttribute('url', $url) ->setAttribute('url', $url)
->setAttribute('security', (int) $security) ->setAttribute('security', $security)
->setAttribute('httpUser', $httpUser) ->setAttribute('httpUser', $httpUser)
->setAttribute('httpPass', $httpPass) ->setAttribute('httpPass', $httpPass)
; ;
@ -898,7 +898,7 @@ App::post('/v1/projects/:projectId/tasks')
'updated' => \time(), 'updated' => \time(),
'previous' => null, 'previous' => null,
'next' => $next, 'next' => $next,
'security' => (int) $security, 'security' => $security,
'httpMethod' => $httpMethod, 'httpMethod' => $httpMethod,
'httpUrl' => $httpUrl, 'httpUrl' => $httpUrl,
'httpHeaders' => $httpHeaders, 'httpHeaders' => $httpHeaders,
@ -1052,7 +1052,7 @@ App::put('/v1/projects/:projectId/tasks/:taskId')
->setAttribute('schedule', $schedule) ->setAttribute('schedule', $schedule)
->setAttribute('updated', \time()) ->setAttribute('updated', \time())
->setAttribute('next', $next) ->setAttribute('next', $next)
->setAttribute('security', (int) $security) ->setAttribute('security', $security)
->setAttribute('httpMethod', $httpMethod) ->setAttribute('httpMethod', $httpMethod)
->setAttribute('httpUrl', $httpUrl) ->setAttribute('httpUrl', $httpUrl)
->setAttribute('httpHeaders', $httpHeaders) ->setAttribute('httpHeaders', $httpHeaders)