gitbeaker/src/services/ProjectHooks.js
2018-03-19 14:41:10 -04:00

36 lines
1007 B
JavaScript

import { BaseService, RequestHelper } from '../infrastructure';
class ProjectHooks extends BaseService {
all(projectId, options) {
const pId = encodeURIComponent(projectId);
return RequestHelper.get(this, `projects/${pId}/hooks`, options);
}
show(projectId, hookId) {
const [pId, hId] = [projectId, hookId].map(encodeURIComponent);
return RequestHelper.get(this, `projects/${pId}/hooks/${hId}`);
}
add(projectId, url, options) {
const pId = encodeURIComponent(projectId);
return RequestHelper.post(this, `projects/${pId}/hooks`, { url, ...options });
}
edit(projectId, hookId, url, options) {
const [pId, hId] = [projectId, hookId].map(encodeURIComponent);
return RequestHelper.put(this, `projects/${pId}/hooks/${hId}`, { url, ...options });
}
remove(projectId, hookId) {
const [pId, hId] = [projectId, hookId].map(encodeURIComponent);
return RequestHelper.delete(this, `projects/${pId}/hooks/${hId}`);
}
}
export default ProjectHooks;