mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
35 lines
887 B
JavaScript
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;
|