node-gitlab-api
Advanced tools
Comparing version 1.3.0 to 2.0.0-rc.1
@@ -15,3 +15,3 @@ ## Project Members | ||
```javascript | ||
let members = GitlabAPI.projects.members.list(projectId); | ||
let members = GitlabAPI.projects.members.all(projectId); | ||
``` | ||
@@ -18,0 +18,0 @@ **Parameters**: [List all members](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/members.md#list-all-members-of-a-group-or-project) |
{ | ||
"name": "node-gitlab-api", | ||
"version": "1.3.0", | ||
"version": "2.0.0-rc.1", | ||
"description": "Full NodeJS implementation of the GitLab API. Supports Promises, Async/Await.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -124,2 +124,21 @@ [![dependencies Status](https://david-dm.org/jdalrymple/node-gitlab-api/status.svg)](https://david-dm.org/jdalrymple/node-gitlab-api)[![devDependencies Status](https://david-dm.org/jdalrymple/node-gitlab-api/dev-status.svg)](https://david-dm.org/jdalrymple/node-gitlab-api?type=dev)[![Code Climate](https://codeclimate.com/github/jdalrymple/node-gitlab-api/badges/gpa.svg)](https://codeclimate.com/github/jdalrymple/node-gitlab-api)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[2.0.0rc](https://github.com/jdalrymple/node-gitlab-api/7246896c7bad7b238179109d1d6a391b0c2ef302) (2017-11-25) | ||
------------------ | ||
- Updated project docs for clarity | ||
- Cleaned up many linting problems within the class models | ||
- Removed mutator operations on the options arguments | ||
- Renamed ProjectKeys to ProjectDeployKeys | ||
- Renamed `list` functions to `all` for consistency | ||
- Renamed `update` functions to `edit` for consistency | ||
- Renaming addKey just to add in UserKeys class | ||
- Renaming deploy_keys and merge_requests to deployKeys and mergeRequests for consistancy | ||
- Adding Project Access Requests | ||
- Removing old group member functions from the groups class as they have been moved to the GroupMembers class. This includes the addMember, listMembers, editMember, and removeMember. These functions can now be access via group.members.add, group.members.all, group.members.edit and group.members.remove respectively. | ||
- Removed the old group project functions from the Group class. These are now located in the GroupProject class. The functions that have been removed are listProjects, addProjects. These functions can be access by group.projects.all, and group.projects.add respectively. | ||
- Methods in the ProjectDeployKeys class updated for consistency | ||
- Methods in the ProjectHooks updated for consistency | ||
- Updated the structure of the ProjectRepository class with commits, branches, tags and files properties. | ||
- Added contributors, showBlob and showBlobRaw functions to the ProjectRepository class | ||
[1.3.0](https://github.com/jdalrymple/node-gitlab-api/3048a3989fabe3992044baccdab1e53257f0f379) (2017-11-25) | ||
@@ -126,0 +145,0 @@ ------------------ |
const Request = require('request-promise'); | ||
const { Groups, Projects, Issues, Runners, Users, Labels } = require('./Models'); | ||
function defaultRequest(url, endpoint, { headers, body, qs, formData, resolveWithFullResponse = false}) { | ||
function defaultRequest(url, endpoint, { headers, body, qs, formData, resolveWithFullResponse = false }) { | ||
const params = { | ||
@@ -6,0 +6,0 @@ url: `${url}${endpoint}`, |
@@ -6,3 +6,3 @@ const LinkParser = require('parse-link-header'); | ||
if(!response.headers['x-page']){ | ||
if (!response.headers['x-page']) { | ||
return response; | ||
@@ -9,0 +9,0 @@ } |
@@ -8,2 +8,2 @@ const Groups = require('./Groups'); | ||
module.exports = { Groups, Projects, Runners, Issues, Users, Labels }; | ||
module.exports = { Groups, Projects, Runners, Issues, Users, Labels }; |
const BaseModel = require('./BaseModel'); | ||
const Utils = require('../Utils'); | ||
@@ -4,0 +3,0 @@ class Issues extends BaseModel { |
@@ -20,5 +20,3 @@ const BaseModel = require('./BaseModel'); | ||
options.name = labelName; | ||
return this.put(`projects/${pId}/labels`, options); | ||
return this.put(`projects/${pId}/labels`, Object.assign({ name: labelName }, options)); | ||
} | ||
@@ -25,0 +23,0 @@ |
const BaseModel = require('./BaseModel'); | ||
const Utils = require('../Utils'); | ||
class ProjectKeys extends BaseModel { | ||
listKeys(projectId) { | ||
class ProjectDeployKeys extends BaseModel { | ||
all(projectId) { | ||
const pId = Utils.parse(projectId); | ||
@@ -11,3 +11,3 @@ | ||
getKey(projectId, keyId) { | ||
show(projectId, keyId) { | ||
const [pId, kId] = [projectId, keyId].map(Utils.parse); | ||
@@ -18,3 +18,3 @@ | ||
addKey(projectId, options = {}) { | ||
add(projectId, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
@@ -26,2 +26,2 @@ | ||
module.exports = ProjectKeys; | ||
module.exports = ProjectDeployKeys; |
@@ -5,3 +5,3 @@ const BaseModel = require('./BaseModel'); | ||
class ProjectHooks extends BaseModel { | ||
list(projectId) { | ||
all(projectId) { | ||
const pId = Utils.parse(projectId); | ||
@@ -19,13 +19,11 @@ | ||
add(projectId, url, options = {}) { | ||
options.url = url; | ||
const pId = Utils.parse(projectId); | ||
return this.post(`projects/${pId}/hooks`, options); | ||
return this.post(`projects/${pId}/hooks`, Object.assign({ url }, options)); | ||
} | ||
edit(projectId, hookId, url, options) { | ||
options.url = url; | ||
edit(projectId, hookId, url, options = {}) { | ||
const [pId, hId] = [projectId, hookId].map(Utils.parse); | ||
return this.put(`projects/${pId}/hooks/${hId}`, options); | ||
return this.put(`projects/${pId}/hooks/${hId}`, Object.assign({ url }, options)); | ||
} | ||
@@ -32,0 +30,0 @@ |
@@ -30,2 +30,9 @@ const BaseModel = require('./BaseModel'); | ||
link(projectId, issueIId, targetProjectId, targetIssueId, options = {}) { | ||
const [pId, iId] = [projectId, issueIId].map(Utils.parse); | ||
const [targetpId, targetIId] = [targetProjectId, targetIssueId].map(Utils.parse); | ||
return this.post(`projects/${pId}/issues/${iId}/links`, Object.assign({ target_project_id: targetpId, target_issue_id: targetIId }, options)); | ||
} | ||
remove(projectId, issueId) { | ||
@@ -54,13 +61,4 @@ const [pId, iId] = [projectId, issueId].map(Utils.parse); | ||
} | ||
link(projectId, issueIId, targetProjectId, targetIssueId, options = {}) { | ||
const [pId, iId] = [projectId, issueIId].map(Utils.parse); | ||
const [targetpId, targetIId] = [targetProjectId, targetIssueId].map(Utils.parse); | ||
options.target_project_id = targetpId; | ||
options.target_issue_id = targetIId; | ||
return this.post(`projects/${pId}/issues/${iId}/links`, options); | ||
} | ||
} | ||
module.exports = ProjectIssues; |
@@ -5,3 +5,3 @@ const BaseModel = require('./BaseModel'); | ||
class ProjectMembers extends BaseModel { | ||
list(projectId) { | ||
all(projectId) { | ||
const pId = Utils.parse(projectId); | ||
@@ -12,8 +12,2 @@ | ||
show(projectId, userId) { | ||
const [pId, uId] = [projectId, userId].map(Utils.parse); | ||
return this.get(`projects/${pId}/members/${uId}`); | ||
} | ||
add(projectId, userId, accessLevel = 30) { | ||
@@ -41,4 +35,10 @@ const [pId, uId] = [projectId, userId].map(Utils.parse); | ||
} | ||
show(projectId, userId) { | ||
const [pId, uId] = [projectId, userId].map(Utils.parse); | ||
return this.get(`projects/${pId}/members/${uId}`); | ||
} | ||
} | ||
module.exports = ProjectMembers; |
@@ -5,17 +5,4 @@ const BaseModel = require('./BaseModel'); | ||
class ProjectMergeRequests extends BaseModel { | ||
list(projectId, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/merge_requests`, options); | ||
} | ||
show(projectId, mergerequestId) { | ||
const [pId, mId] = [projectId, mergerequestId].map(Utils.parse); | ||
return this.get(`projects/${pId}/merge_requests/${mId}`); | ||
} | ||
add(projectId, sourceBranch, targetBranch, assigneeId, title) { | ||
const [pId, aId] = [projectId, assigneeId].map(Utils.parse); | ||
const options = { | ||
@@ -33,9 +20,6 @@ id: pId, | ||
update(projectId, mergerequestId, options = {}) { | ||
const [pId, mId] = [projectId, mergerequestId].map(Utils.parse); | ||
all(projectId, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
options.id = pId; | ||
options.merge_request_id = mId; | ||
return this.put(`projects/${pId}/merge_requests/${mId}`, options); | ||
return this.get(`projects/${pId}/merge_requests`, options); | ||
} | ||
@@ -50,4 +34,16 @@ | ||
} | ||
edit(projectId, mergerequestId, options = {}) { | ||
const [pId, mId] = [projectId, mergerequestId].map(Utils.parse); | ||
return this.put(`projects/${pId}/merge_requests/${mId}`, options); | ||
} | ||
show(projectId, mergerequestId) { | ||
const [pId, mId] = [projectId, mergerequestId].map(Utils.parse); | ||
return this.get(`projects/${pId}/merge_requests/${mId}`); | ||
} | ||
} | ||
module.exports = ProjectMergeRequests; |
@@ -5,2 +5,8 @@ const BaseModel = require('./BaseModel'); | ||
class ProjectMilestones extends BaseModel { | ||
add(projectId, title, options) { | ||
const pId = Utils.parse(projectId); | ||
return this.post(`projects/${pId}/milestones`, options); | ||
} | ||
all(projectId, options = {}) { | ||
@@ -12,27 +18,12 @@ const pId = Utils.parse(projectId); | ||
show(projectId, milestoneId) { | ||
edit(projectId, milestoneId, options) { | ||
const [pId, mId] = [projectId, milestoneId].map(Utils.parse); | ||
return this.get(`projects/${pId}/milestones/${mId}`); | ||
return this.put(`projects/${pId}/milestones/${mId}`, options); | ||
} | ||
add(projectId, title, { description, due_date }) { | ||
const pId = Utils.parse(projectId); | ||
return this.post(`projects/${pId}/milestones`, { | ||
title, | ||
description, | ||
due_date, | ||
}); | ||
} | ||
update(projectId, milestoneId, { title, description, due_date, state_event }) { | ||
show(projectId, milestoneId) { | ||
const [pId, mId] = [projectId, milestoneId].map(Utils.parse); | ||
return this.put(`projects/${pId}/milestones/${mId}`, { | ||
title, | ||
description, | ||
due_date, | ||
state_event, | ||
}); | ||
return this.get(`projects/${pId}/milestones/${mId}`); | ||
} | ||
@@ -39,0 +30,0 @@ } |
const BaseModel = require('./BaseModel'); | ||
const ProjectRepositoryBranches = require('./ProjectRepositoryBranches'); | ||
const ProjectRepositoryTags = require('./ProjectRepositoryTags'); | ||
const ProjectRepositoryCommits = require('./ProjectRepositoryCommits'); | ||
const ProjectRepositoryFiles = require('./ProjectRepositoryFiles'); | ||
const Utils = require('../Utils'); | ||
class ProjectRepository extends BaseModel { | ||
listBranches(projectId) { | ||
const pId = Utils.parse(projectId); | ||
constructor(...args) { | ||
super(...args); | ||
return this.get(`projects/${pId}/repository/branches`); | ||
this.branches = new ProjectRepositoryBranches(...args); | ||
this.tags = new ProjectRepositoryTags(...args); | ||
this.commits = new ProjectRepositoryCommits(...args); | ||
this.files = new ProjectRepositoryFiles(...args); | ||
} | ||
showBranch(projectId, branchName) { | ||
compare(projectId, from, to) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/branches/${encodeURI(branchId)}`); | ||
return this.get(`projects/${pId}/repository/compare`, { from, to }); | ||
} | ||
protectBranch(projectId, branchName, options = {}) { | ||
contributors(projectId) { | ||
const pId = Utils.parse(projectId); | ||
return this.put(`projects/${pId}/repository/branches/${encodeURI(branchName)}/protect`, options); | ||
return this.get(`projects/${pId}/repository/contributors`); | ||
} | ||
unprotectBranch(projectId, branchName) { | ||
showArchive(projectId, { sha }) { | ||
const pId = Utils.parse(projectId); | ||
return this.put(`projects/${pId}/repository/branches/${encodeURI(branchName)}/unprotect`); | ||
return this.get(`projects/${pId}/repository/archive`, { sha }); | ||
} | ||
createBranch(projectId, branch, ref) { | ||
showBlob(projectId, sha) { | ||
const pId = Utils.parse(projectId); | ||
return this.post(`projects/${pId}/repository/branches`, { branch, ref }); | ||
return this.get(`projects/${pId}/repository/blobs/${sha}`); | ||
} | ||
deleteBranch(projectId, branchId) { | ||
showBlobRaw(projectId, sha) { | ||
const pId = Utils.parse(projectId); | ||
return this.delete(`projects/${pId}/repository/branches/${encodeURI(branchId)}`); | ||
return this.get(`projects/${pId}/repository/blobs/${sha}/raw`); | ||
} | ||
addTag(projectId, options = {}) { | ||
tree(projectId, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.post(`projects/${pId}/repository/tags`, options); | ||
} | ||
deleteTag(projectId, tagName) { | ||
const pId = Utils.parse(projectId); | ||
return this.delete(`projects/${pId}/repository/tags/${encodeURI(tagName)}`); | ||
} | ||
showTag(projectId, tagName) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/tags/${encodeURI(tagName)}`); | ||
} | ||
listTags(projectId) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/tags`); | ||
} | ||
listCommits(projectId) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/commits`); | ||
} | ||
showCommit(projectId, sha) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/commits/${sha}`); | ||
} | ||
diffCommit(projectId, sha) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/commits/${sha}/diff`); | ||
} | ||
listTree(projectId, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/tree`, options); | ||
} | ||
showFile(projectId, filePath, ref) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/files/${filePath}`, { ref: options.ref }); | ||
} | ||
showRawFile(projectId, filePath, ref) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/files/${filePath}/raw`, { ref: options.ref }); | ||
} | ||
createFile(projectId, filePath, branch, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.post(`projects/${pId}/repository/files/${filePath}`, Object.assign({ branch }, options)); | ||
} | ||
updateFile(projectId, filePath, branch, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.put(`projects/${pId}/repository/files/${filePath}`, Object.assign({ branch }, options)); | ||
} | ||
deleteFile(projectId, filePath, branch, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.delete(`projects/${pId}/repository/files/${filePath}`, Object.assign({ branch }, options)); | ||
} | ||
compare(projectId, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/repository/compare`, options); | ||
} | ||
} | ||
module.exports = ProjectRepository; | ||
module.exports = ProjectRepository; |
@@ -8,7 +8,3 @@ const BaseModel = require('./BaseModel'); | ||
if (projectId != null) { | ||
return this.get(`projects/${pId}/runners`, options); | ||
} | ||
return this.get('runners', options); | ||
return this.get(`projects/${pId}/runners`, options); | ||
} | ||
@@ -29,5 +25,4 @@ | ||
} | ||
} | ||
module.exports = ProjectRunners; |
@@ -28,4 +28,4 @@ const Fs = require('fs'); | ||
this.milestones = new ProjectMilestones(...args); | ||
this.deploy_keys = new ProjectDeployKeys(...args); | ||
this.merge_requests = new ProjectMergeRequests(...args); | ||
this.deployKeys = new ProjectDeployKeys(...args); | ||
this.mergeRequests = new ProjectMergeRequests(...args); | ||
this.services = new ProjectServices(...args); | ||
@@ -32,0 +32,0 @@ this.triggers = new ProjectTriggers(...args); |
@@ -5,18 +5,18 @@ const BaseModel = require('./BaseModel'); | ||
class ProjectServices extends BaseModel { | ||
show(projectId, serviceName) { | ||
edit(projectId, serviceName, options = {}) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/services/${serviceName}`); | ||
return this.put(`projects/${pId}/services/${serviceName}`, options); | ||
} | ||
update(projectId, serviceName, options = {}) { | ||
remove(projectId, serviceName) { | ||
const pId = Utils.parse(projectId); | ||
return this.put(`projects/${pId}/services/${serviceName}`, options); | ||
return this.delete(`projects/${pId}/services/${serviceName}`); | ||
} | ||
remove(projectId, serviceName) { | ||
show(projectId, serviceName) { | ||
const pId = Utils.parse(projectId); | ||
return this.delete(`projects/${pId}/services/${serviceName}`); | ||
return this.get(`projects/${pId}/services/${serviceName}`); | ||
} | ||
@@ -23,0 +23,0 @@ } |
@@ -11,2 +11,8 @@ const BaseModel = require('./BaseModel'); | ||
all(projectId) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/triggers`); | ||
} | ||
edit(projectId, triggerId, options = {}) { | ||
@@ -18,8 +24,2 @@ const [pId, tId] = [projectId, triggerId].map(Utils.parse); | ||
list(projectId) { | ||
const pId = Utils.parse(projectId); | ||
return this.get(`projects/${pId}/triggers`); | ||
} | ||
remove(projectId, triggerId) { | ||
@@ -26,0 +26,0 @@ const [pId, tId] = [projectId, triggerId].map(Utils.parse); |
@@ -9,18 +9,18 @@ const BaseModel = require('./BaseModel'); | ||
show(runnerId) { | ||
edit(runnerId, attributes) { | ||
const rId = Utils.parse(runnerId); | ||
return this.get(`runners/${rId}`); | ||
return this.put(`runners/${rId}`, attributes); | ||
} | ||
update(runnerId, attributes) { | ||
remove(runnerId) { | ||
const rId = Utils.parse(runnerId); | ||
return this.put(`runners/${rId}`, attributes); | ||
return this.delete(`runners/${rId}`); | ||
} | ||
remove(runnerId) { | ||
show(runnerId) { | ||
const rId = Utils.parse(runnerId); | ||
return this.delete(`runners/${rId}`); | ||
return this.get(`runners/${rId}`); | ||
} | ||
@@ -27,0 +27,0 @@ } |
@@ -11,3 +11,3 @@ const BaseModel = require('./BaseModel'); | ||
addKey(userId, title, key) { | ||
add(userId, title, key) { | ||
const uId = Utils.parse(userId); | ||
@@ -14,0 +14,0 @@ |
@@ -16,2 +16,6 @@ const BaseModel = require('./BaseModel'); | ||
create(options = {}) { | ||
return this.post('users', options); | ||
} | ||
current() { | ||
@@ -21,12 +25,2 @@ return this.get('user'); | ||
show(userId) { | ||
const uId = Utils.parse(userId); | ||
return this.get(`users/${uId}`); | ||
} | ||
create(options = {}) { | ||
return this.post('users', options); | ||
} | ||
session(email, password) { | ||
@@ -44,4 +38,10 @@ return this.post('session', { | ||
} | ||
show(userId) { | ||
const uId = Utils.parse(userId); | ||
return this.get(`users/${uId}`); | ||
} | ||
} | ||
module.exports = Users; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
67986
52
917
249
2