mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
36 lines
1007 B
JavaScript
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;
|