The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/data/integration.helper.js

44 lines
840 B

import { api, credentials, request } from './api-data';
export const createIntegration = (integration, userCredentials) =>
new Promise((resolve, reject) => {
request
.post(api('integrations.create'))
.set(userCredentials)
.send(integration)
.end((err, res) => {
if (err) {
reject(err);
return;
}
if (!res.body.success) {
reject(res.body);
return;
}
resolve(res.body.integration);
});
});
export const removeIntegration = (integrationId, type) =>
new Promise((resolve, reject) => {
request
.post(api('integrations.remove'))
.set(credentials)
.send({
type: `webhook-${type}`,
integrationId,
})
.end((err, res) => {
if (err) {
console.warn(err);
}
if (!res.body.success) {
console.warn(res.body);
}
resolve();
});
});