Comparing version 0.1.1 to 0.1.2
13
cli.js
@@ -22,3 +22,3 @@ const { | ||
- node gitlab_cli.js project | ||
- node gitlab_cli.js mergeRequests`); | ||
- node gitlab_cli.js mergeRequest`); | ||
process.exit(1); | ||
@@ -30,3 +30,3 @@ } | ||
- node gitlab_cli.js project | ||
- node gitlab_cli.js mergeRequests`); | ||
- node gitlab_cli.js mergeRequest`); | ||
process.exit(1); | ||
@@ -38,2 +38,3 @@ } | ||
- node gitlab_cli.js project all | ||
- node gitlab_cli.js project search $searchCriteria | ||
- node gitlab_cli.js project owned $userId`); | ||
@@ -43,7 +44,7 @@ process.exit(1); | ||
if (!action && command === 'project') { | ||
if (!action && command === 'mergeRequest') { | ||
msg(`Action has to be provided. Supported: | ||
- node gitlab_cli.js mergeRequests list $projectId | ||
- node gitlab_cli.js mergeRequests get $projectId $mergeRequestId | ||
- node gitlab_cli.js mergeRequests notes $projectId $mergeRequestId`); | ||
- node gitlab_cli.js mergeRequest list $projectId | ||
- node gitlab_cli.js mergeRequest get $projectId $mergeRequestId | ||
- node gitlab_cli.js mergeRequest notes $projectId $mergeRequestId`); | ||
process.exit(1); | ||
@@ -50,0 +51,0 @@ } |
{ | ||
"name": "gitlab-js", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "gitlab JS interface", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"lint": "eslint src", | ||
"prepublishOnly": "npm test", | ||
@@ -8,0 +9,0 @@ "test": "jest", |
@@ -5,2 +5,3 @@ ### Gitlab JS interface | ||
[![codecov](https://codecov.io/gh/rumax/gitlab-js/branch/master/graph/badge.svg)](https://codecov.io/gh/rumax/gitlab-js) | ||
[![npm version](https://badge.fury.io/js/gitlab-js.svg)](https://badge.fury.io/js/gitlab-js) | ||
@@ -7,0 +8,0 @@ JS implementation for [gitlab API](https://docs.gitlab.com/ee/api/README.html). |
@@ -23,2 +23,11 @@ jest.mock('../utils/api', () => jest.fn()); | ||
it('list with opts', async () => { | ||
const response = await mergeRequest.list('projectId', { simple: false }); | ||
expect(response).toMatchSnapshot(); | ||
expect(api).toHaveBeenCalledTimes(1); | ||
expect(api.mock.calls).toMatchSnapshot(); | ||
}); | ||
it('list, no params', async () => { | ||
@@ -25,0 +34,0 @@ const response = await mergeRequest.list(); |
@@ -23,2 +23,11 @@ jest.mock('../utils/api', () => jest.fn()); | ||
it('all with opts', async () => { | ||
const response = await project.all({ simple: false, owned: true }); | ||
expect(response).toMatchSnapshot(); | ||
expect(api).toHaveBeenCalledTimes(1); | ||
expect(api.mock.calls).toMatchSnapshot(); | ||
}); | ||
it('owned', async () => { | ||
@@ -25,0 +34,0 @@ const response = await project.owned('userId'); |
@@ -5,5 +5,7 @@ const { msg } = require('extra-log'); | ||
const defaultOpts = { simple: true }; | ||
module.exports = { | ||
async list(projectId) { | ||
async list(projectId, opts = {}) { | ||
if (!projectId) { | ||
@@ -14,7 +16,10 @@ msg('projectId has to be provided to get merge requests'); | ||
const path = `/projects/${projectId}/merge_requests`; | ||
return api(path); | ||
return api(path, { | ||
...defaultOpts, | ||
...opts, | ||
}); | ||
}, | ||
async get(projectId, mergeRequestId) { | ||
async get(projectId, mergeRequestId, opts = {}) { | ||
if (!projectId) { | ||
@@ -29,7 +34,10 @@ msg('projectId has to be provided to get merge requests'); | ||
const path = `/projects/${projectId}/merge_requests/${mergeRequestId}`; | ||
return api(path); | ||
return api(path, { | ||
...defaultOpts, | ||
...opts, | ||
}); | ||
}, | ||
async notes(projectId, mergeRequestId) { | ||
async notes(projectId, mergeRequestId, opts = {}) { | ||
if (!projectId) { | ||
@@ -44,3 +52,6 @@ msg('projectId has to be provided to get merge requests'); | ||
const path = `/projects/${projectId}/merge_requests/${mergeRequestId}/notes`; | ||
return api(path); | ||
return api(path, { | ||
...defaultOpts, | ||
...opts, | ||
}); | ||
}, | ||
@@ -47,0 +58,0 @@ |
@@ -5,11 +5,30 @@ const { msg } = require('extra-log'); | ||
const defaultOpts = { simple: true }; | ||
module.exports = { | ||
async all() { | ||
async all(opts = {}) { | ||
const path = '/projects'; | ||
return api(path); | ||
return api(path, { | ||
...defaultOpts, | ||
...opts, | ||
}); | ||
}, | ||
async owned(userId) { | ||
async search(search, opts = {}) { | ||
if (!search) { | ||
msg('search criteria is required'); | ||
return undefined; | ||
} | ||
const path = '/projects'; | ||
return api(path, { | ||
...defaultOpts, | ||
...opts, | ||
search, | ||
}); | ||
}, | ||
async owned(userId, opts = {}) { | ||
if (!userId) { | ||
@@ -20,4 +39,7 @@ msg('userId is required to get owned projects'); | ||
const path = `/users/${userId}/projects`; | ||
return api(path); | ||
return api(path, { | ||
...defaultOpts, | ||
...opts, | ||
}); | ||
}, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19290
386
27