mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
**Breaking Change** - Renamed timeEstimate to addTimeEstimate, and timeSpend to addTimeSpent, in the MergeRequests API
93 lines
2.9 KiB
JavaScript
93 lines
2.9 KiB
JavaScript
import { BaseService, RequestHelper } from '../infrastructure';
|
|
|
|
class Issues extends BaseService {
|
|
addSpentTime(projectId, issueId, duration) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues/${iId}/add_spent_time`, {
|
|
duration,
|
|
});
|
|
}
|
|
|
|
addTimeEstimate(projectId, issueId, duration) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues/${iId}/time_estimate`, {
|
|
duration,
|
|
});
|
|
}
|
|
|
|
all({ projectId, ...options }) {
|
|
const url = projectId ? `projects/${encodeURIComponent(projectId)}/issues` : 'issues';
|
|
|
|
return RequestHelper.get(this, url, options);
|
|
}
|
|
|
|
create(projectId, options) {
|
|
const pId = encodeURIComponent(projectId);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues`, options);
|
|
}
|
|
|
|
edit(projectId, issueId, options) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.put(this, `projects/${pId}/issues/${iId}`, options);
|
|
}
|
|
|
|
link(projectId, issueIId, targetProjectId, targetIssueId, options = {}) {
|
|
const [pId, iId] = [projectId, issueIId].map(encodeURIComponent);
|
|
const [targetpId, targetIId] = [targetProjectId, targetIssueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues/${iId}/links`, {
|
|
targetProjectId: targetpId,
|
|
targetIssueId: targetIId,
|
|
...options,
|
|
});
|
|
}
|
|
|
|
remove(projectId, issueId) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.delete(this, `projects/${pId}/issues/${iId}`);
|
|
}
|
|
|
|
resetSpentTime(projectId, mergerequestId) {
|
|
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues/${mId}/reset_spent_time`);
|
|
}
|
|
|
|
resetTimeEstimate(projectId, mergerequestId) {
|
|
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues/${mId}/reset_time_estimate`);
|
|
}
|
|
|
|
show(projectId, issueId) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.get(this, `projects/${pId}/issues/${iId}`);
|
|
}
|
|
|
|
subscribe(projectId, issueId, options) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/issues/${iId}/subscribe`, options);
|
|
}
|
|
|
|
timeStats(projectId, mergerequestId) {
|
|
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.get(this, `projects/${pId}/issues/${mId}/time_stats`);
|
|
}
|
|
|
|
unsubscribe(projectId, issueId) {
|
|
const [pId, iId] = [projectId, issueId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.delete(this, `projects/${pId}/issues/${iId}/unsubscribe`);
|
|
}
|
|
}
|
|
|
|
export default Issues;
|