- Added addTimeEstimate, addTimeSpent, timeStats, resetTimeSpent and resetTimeEstimate to the Issues API. Requested in PR [#68](https://github.com/jdalrymple/node-gitlab-api/pull/68)

**Breaking Change**

- Renamed timeEstimate to addTimeEstimate, and timeSpend to addTimeSpent, in the MergeRequests API
This commit is contained in:
Justin 2018-04-16 19:06:49 -04:00
parent 027d2c44c4
commit aeb4cb484a
5 changed files with 62 additions and 26 deletions

View File

@ -366,6 +366,14 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
## Changelog
[3.1.0](https://github.com/jdalrymple/node-gitlab-api/tags/3.1.0) (2018-4-16)
------------------
- Added addTimeEstimate, addTimeSpent, timeStats, resetTimeSpent and resetTimeEstimate to the Issues API. Requested in PR [#68](https://github.com/jdalrymple/node-gitlab-api/pull/68)
**Breaking Change**
- Renamed timeEstimate to addTimeEstimate, and timeSpend to addTimeSpent, in the MergeRequests API
[3.0.4](https://github.com/jdalrymple/node-gitlab-api/tags/3.0.4) (2018-4-13)
------------------
- Fixed endpoint for MergeRequestNotes thanks to [Ev Haus](https://github.com/EvHaus) in PR [#63](https://github.com/jdalrymple/node-gitlab-api/pull/63)

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "gitlab",
"version": "3.0.4",
"version": "3.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "gitlab",
"version": "3.0.4",
"version": "3.1.0",
"description": "Full NodeJS implementation of the GitLab API. Supports Promises, Async/Await.",
"main": "dist/latest/index.js",
"engines": {

View File

@ -1,6 +1,22 @@
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';
@ -36,6 +52,18 @@ class Issues extends BaseService {
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);
@ -48,6 +76,12 @@ class Issues extends BaseService {
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);

View File

@ -7,6 +7,22 @@ class MergeRequests extends BaseService {
return RequestHelper.put(this, `projects/${pId}/merge_requests/${mId}/merge`, options);
}
addSpentTime(projectId, mergerequestId, duration) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
return RequestHelper.post(this, `projects/${pId}/issues/${mId}/add_spent_time`, {
duration,
});
}
addTimeEstimate(projectId, mergerequestId, duration) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
return RequestHelper.post(this, `projects/${pId}/issues/${mId}/time_estimate`, {
duration,
});
}
approve(projectId, mergerequestId, { sha }) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
@ -88,18 +104,6 @@ class MergeRequests extends BaseService {
return RequestHelper.delete(this, `projects/${pId}/merge_requests/${mId}`);
}
show(projectId, mergerequestId) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
return RequestHelper.get(this, `projects/${pId}/merge_requests/${mId}`);
}
subscribe(projectId, mergerequestId, options) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
return RequestHelper.post(this, `projects/${pId}/merge_requests/${mId}/subscribe`, options);
}
resetSpentTime(projectId, mergerequestId) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
@ -112,20 +116,10 @@ class MergeRequests extends BaseService {
return RequestHelper.post(this, `projects/${pId}/merge_requests/${mId}/reset_time_estimate`);
}
spentTime(projectId, mergerequestId, duration) {
show(projectId, mergerequestId) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
return RequestHelper.post(this, `projects/${pId}/merge_requests/${mId}/add_spent_time`, {
duration,
});
}
timeEstimate(projectId, mergerequestId, duration) {
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
return RequestHelper.post(this, `projects/${pId}/merge_requests/${mId}/time_estimate`, {
duration,
});
return RequestHelper.get(this, `projects/${pId}/merge_requests/${mId}`);
}
timeStats(projectId, mergerequestId) {