forked from kriskbx/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmergeRequest.js
More file actions
22 lines (17 loc) 路 795 Bytes
/
Copy pathmergeRequest.js
File metadata and controls
22 lines (17 loc) 路 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import CoreTask from './task.js';
import GitlabClient from './gitlab-client.js';
class MergeRequest extends CoreTask {
static resoureType = 'merge_requests';
constructor(config, data, client, project) {
super(config, data, client, MergeRequest.resoureType, project);
}
static list(config, project, state, my, client = new GitlabClient(config)) {
const query = `scope=${my ? "assigned-to-me" : "all"}&state=${state}`;
const path = project
? `projects/${encodeURIComponent(project)}/${MergeRequest.resoureType}?${query}`
: `${MergeRequest.resoureType}}/?${query}`;
return client.get(path)
.then(response => response.body.map(data => new this(config, data, client)));
}
}
export default MergeRequest;