diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-19 14:24:02 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-19 14:24:02 -0400 |
commit | d139c9e825d0149329d90684ebe2d6b31a728b16 (patch) | |
tree | 484dfe912010791e4eef9fa0152a4b1e3ba987e9 /web/react/utils/client.jsx | |
parent | fd69910fab332642a7793e64064169e89eb0c3de (diff) | |
parent | c7d00de68291f5a53353c1391d4548d3f2ec7c0c (diff) | |
download | chat-d139c9e825d0149329d90684ebe2d6b31a728b16.tar.gz chat-d139c9e825d0149329d90684ebe2d6b31a728b16.tar.bz2 chat-d139c9e825d0149329d90684ebe2d6b31a728b16.zip |
Merge pull request #1108 from mattermost/plt-235
PLT-235 Implement outgoing webhooks.
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r-- | web/react/utils/client.jsx | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index f6aee362c..f92633439 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -1182,3 +1182,61 @@ export function savePreferences(preferences, success, error) { } }); } + +export function addOutgoingHook(hook, success, error) { + $.ajax({ + url: '/api/v1/hooks/outgoing/create', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(hook), + success, + error: (xhr, status, err) => { + var e = handleError('addOutgoingHook', xhr, status, err); + error(e); + } + }); +} + +export function deleteOutgoingHook(data, success, error) { + $.ajax({ + url: '/api/v1/hooks/outgoing/delete', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: (xhr, status, err) => { + var e = handleError('deleteOutgoingHook', xhr, status, err); + error(e); + } + }); +} + +export function listOutgoingHooks(success, error) { + $.ajax({ + url: '/api/v1/hooks/outgoing/list', + dataType: 'json', + type: 'GET', + success, + error: (xhr, status, err) => { + var e = handleError('listOutgoingHooks', xhr, status, err); + error(e); + } + }); +} + +export function regenOutgoingHookToken(data, success, error) { + $.ajax({ + url: '/api/v1/hooks/outgoing/regen_token', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: (xhr, status, err) => { + var e = handleError('regenOutgoingHookToken', xhr, status, err); + error(e); + } + }); +} |