Merge branch '11290-get-webhooks-api' of https://github.com/cvuorinen/habitica into cvuorinen-11290-get-webhooks-api

This commit is contained in:
Matteo Pagliazzi
2019-09-20 16:38:42 +02:00
2 changed files with 51 additions and 0 deletions
@@ -95,6 +95,24 @@ api.addWebhook = {
},
};
/**
* @api {get} /api/v3/user/webhook Get webhooks - BETA
* @apiName UserGetWebhook
* @apiGroup Webhook
*
* @apiSuccess {Array} data User's webhooks
*/
api.getWebhook = {
method: 'GET',
middlewares: [authWithHeaders()],
url: '/user/webhook',
async handler (req, res) {
let user = res.locals.user;
res.respond(200, user.webhooks);
},
};
/**
* @api {put} /api/v3/user/webhook/:id Edit a webhook - BETA
* @apiName UserUpdateWebhook