gitbeaker/src/Models/ProjectHooks.js
Justin Dalrymple 64a8f8c772 Init commit
2017-06-21 12:13:17 -04:00

35 lines
887 B
JavaScript

const BaseModel = require('../BaseModel');
const Utils = require('../Utils');
class ProjectHooks extends BaseModel {
constructor(...args) {
super(...args);
}
list(projectId) {
return this.get(`projects/${Utils.parse(projectId)}/hooks`);
}
show(projectId, hookId) {
return this.get(`projects/${Utils.parse(projectId)}/hooks/${parseInt(hookId)}`);
}
add(projectId, options) {
if (typeof options === 'string') options = {url: options};
return this.post(`projects/${Utils.parse(projectId)}/hooks`, options);
}
update(projectId, hookId, url) {
return this.put(`projects/${Utils.parse(projectId)}/hooks/${parseInt(hookId)}`,{
access_level: parseInt(accessLevel)
});
}
remove(projectId, hookId) {
return this.delete(`projects/${Utils.parse(projectId)}/hooks/${parseInt(hookId)}`);
}
}
module.exports = ProjectHooks;