Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
node-gitlab
Advanced tools
Gitlab API Node.js client
$ npm install node-gitlab --save
var gitlab = require('node-gitlab');
var client = gitlab.create({
api: 'https://gitlab.com/api/v3',
privateToken: 'your private token'
});
client.milestones.list({id: 1}, function (err, milestones) {
console.log(err, milestones);
});
Require co and node >= 0.11.12
:
var co = require('co');
var gitlab = require('node-gitlab');
var client = gitlab.createThunk({
api: 'https://gitlab.com/api/v3',
privateToken: 'your private token'
});
co(function* () {
var milestones = yield client.milestones.list({id: 1});
})();
Require node >= 0.11.13
or bluebird:
var gitlab = require('node-gitlab');
var client = gitlab.createPromise({
api: 'https://gitlab.com/api/v3',
privateToken: 'your private token'
});
client.milestones.list({id: 1})
.then(function (milestones) {
console.log(milestones);
})
.catch(function (err) {
throw err;
});
@see Gitlab API document.
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md
Get a list of projects accessible by the authenticated user.
Parameters:
id
, name
, path
, created_at
, updated_at
or last_activity_at
fields. Default is created_at
asc
or desc
order. Default is desc
[
{
"id": 4,
"description": null,
"default_branch": "master",
"public": false,
"visibility_level": 0,
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
"web_url": "http://example.com/diaspora/diaspora-client",
"tag_list": [
"example",
"disapora client"
],
"owner": {
"id": 3,
"name": "Diaspora",
"created_at": "2013-09-30T13: 46: 02Z"
},
"name": "Diaspora Client",
"name_with_namespace": "Diaspora / Diaspora Client",
"path": "diaspora-client",
"path_with_namespace": "diaspora/diaspora-client",
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": false,
"created_at": "2013-09-30T13: 46: 02Z",
"last_activity_at": "2013-09-30T13: 46: 02Z",
"creator_id": 3,
"namespace": {
"created_at": "2013-09-30T13: 46: 02Z",
"description": "",
"id": 3,
"name": "Diaspora",
"owner_id": 1,
"path": "diaspora",
"updated_at": "2013-09-30T13: 46: 02Z"
},
"archived": false,
"avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png"
},
// ...
]
Get a specific project
Parameters:
{
"id": 3,
"description": null,
"default_branch": "master",
"public": false,
"visibility_level": 0,
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
"http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
"web_url": "http://example.com/diaspora/diaspora-project-site",
"tag_list": [
"example",
"disapora project"
],
"owner": {
"id": 3,
"name": "Diaspora",
"created_at": "2013-09-30T13: 46: 02Z"
},
"name": "Diaspora Project Site",
"name_with_namespace": "Diaspora / Diaspora Project Site",
"path": "diaspora-project-site",
"path_with_namespace": "diaspora/diaspora-project-site",
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"snippets_enabled": false,
"created_at": "2013-09-30T13: 46: 02Z",
"last_activity_at": "2013-09-30T13: 46: 02Z",
"creator_id": 3,
"namespace": {
"created_at": "2013-09-30T13: 46: 02Z",
"description": "",
"id": 3,
"name": "Diaspora",
"owner_id": 1,
"path": "diaspora",
"updated_at": "2013-09-30T13: 46: 02Z"
},
"permissions": {
"project_access": {
"access_level": 10,
"notification_level": 3
},
"group_access": {
"access_level": 50,
"notification_level": 3
}
},
"archived": false,
"avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png"
}
wiki_enabled, snippets_enabled, public, visibility_level, import_url})
Creates a new project owned by the authenticated user.
Parameters:
wiki_enabled, snippets_enabled, public, visibility_level})
Updates an existing project
Parameters:
On success, method returns 200 with the updated project. If parameters are invalid, 400 is returned.
Removes a project including all associated resources (issues, merge requests etc.)
Parameters:
Search for projects by name which are accessible to the authenticated user.
Parameters:
id
, name
, created_at
or last_activity_at
fieldsasc
or desc
orderForks a project into the user namespace of the authenticated user.
Parameters:
Get the events for the specified project. Sorted from newest to latest
Parameters:
[
{
"title": null,
"project_id": 15,
"action_name": "closed",
"target_id": 830,
"target_type": "Issue",
"author_id": 1,
"author_username": "john",
"data": null,
"target_title": "Public project search field"
},
{
"title": null,
"project_id": 15,
"action_name": "opened",
"target_id": null,
"target_type": null,
"author_id": 1,
"author_username": "john",
"data": {
"before": "50d4420237a9de7be1304607147aec22e4a14af7",
"after": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
"ref": "refs/heads/master",
"user_id": 1,
"user_name": "Dmitriy Zaporozhets",
"repository": {
"name": "gitlabhq",
"url": "git@dev.gitlab.org:gitlab/gitlabhq.git",
"description": "GitLab: self hosted Git management software. \r\nDistributed under the MIT License.",
"homepage": "https://dev.gitlab.org/gitlab/gitlabhq"
},
"commits": [
{
"id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
"message": "Add simple search to projects in public area",
"timestamp": "2013-05-13T18:18:08+00:00",
"url": "https://dev.gitlab.org/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428",
"author": {
"name": "Dmitriy Zaporozhets",
"email": "dmitriy.zaporozhets@gmail.com"
}
}
],
"total_commits_count": 1
},
"target_title": null
},
{
"title": null,
"project_id": 15,
"action_name": "closed",
"target_id": 840,
"target_type": "Issue",
"author_id": 1,
"author_username": "john",
"data": null,
"target_title": "Finish & merge Code search PR"
}
]
Get the labels for the specified project.
Parameters:
[
{ "name": "Bug", color: "#A8D695" },
{ "name": "Feature", color: "#5CB85C" }
]
Create a label for the specified project.
Parameters:
[
{ "name": "Bug", color: "#A8D695" },
{ "name": "Feature", color: "#5CB85C" }
]
Update a label for the specified project.
Parameters:
Delete a label for the specified project.
Parameters:
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#team-members
Get a list of a project's team members.
Parameters:
Gets a project team member.
Parameters:
{
"id": 1,
"username": "john_smith",
"email": "john@example.com",
"name": "John Smith",
"state": "active",
"created_at": "2012-05-23T08:00:58Z",
"access_level": 40
}
Adds a user to a project team. This is an idempotent method and can be called multiple times with the same parameters. Adding team membership to a user that is already a member does not affect the existing membership.
Parameters:
Updates a project team member to a specified access level.
Parameters:
Removes a user from a project team.
Parameters:
This method is idempotent and can be called multiple times with the same parameters. Revoking team membership for a user who is not currently a team member is considered success. Please note that the returned JSON currently differs slightly. Thus you should not rely on the returned JSON structure.
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/deploy_keys.md
Get a list of a project's deploy keys.
Parameters:
{String}
id
(required) - The ID or NAMESPACE/PROJECT_NAME of a projectGets a project deploy key.
Parameters:
{String}
id
(required) - The ID or NAMESPACE/PROJECT_NAME of a project{String}
key_id
(required) - The ID of a key{
"id": 1,
"title": "Public key",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
"created_at": "2013-10-02T10:12:29Z"
}
Creates a new deploy key for a project. If deploy key already exists in another project - it will be joined to project but only if original one was is accessible by same user
Parameters:
{String}
id
(required) - The ID or NAMESPACE/PROJECT_NAME of a project{String}
title
(required) - New deploy key's title{String}
key
(required) - New deploy keyDelete a deploy key from a project.
Parameters:
{String}
id
(required) - The ID or NAMESPACE/PROJECT_NAME of a project{String}
key_id
(required) - The ID of the deploy keyhttps://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#branches
Lists all branches of a project.
Parameters:
[
{
"name": "async",
"commit": {
"id": "a2b702edecdf41f07b42653eb1abe30ce98b9fca",
"parents": [
{
"id": "3f94fc7c85061973edc9906ae170cc269b07ca55"
}
],
"tree": "c68537c6534a02cc2b176ca1549f4ffa190b58ee",
"message": "give Caolan credit where it's due (up top)",
"author": {
"name": "Jeremy Ashkenas",
"email": "jashkenas@example.com"
},
"committer": {
"name": "Jeremy Ashkenas",
"email": "jashkenas@example.com"
},
"authored_date": "2010-12-08T21:28:50+00:00",
"committed_date": "2010-12-08T21:28:50+00:00"
},
"protected": false
},
{
"name": "gh-pages",
"commit": {
"id": "101c10a60019fe870d21868835f65c25d64968fc",
"parents": [
{
"id": "9c15d2e26945a665131af5d7b6d30a06ba338aaa"
}
],
"tree": "fb5cc9d45da3014b17a876ad539976a0fb9b352a",
"message": "Underscore.js 1.5.2",
"author": {
"name": "Jeremy Ashkenas",
"email": "jashkenas@example.com"
},
"committer": {
"name": "Jeremy Ashkenas",
"email": "jashkenas@example.com"
},
"authored_date": "2013-09-07T12: 58: 21+00: 00",
"committed_date": "2013-09-07T12: 58: 21+00: 00"
},
"protected": false
}
]
Lists a specific branch of a project.
Parameters:
Create a repository branch on a project.
Parameters:
Delete repository branch
Parameters:
It return 200 if succeed, 404 if the branch to be deleted does not exist or 400 for other reasons. In case of an error, an explaining message is provided.
Success response:
{
"branch_name": "my-removed-branch"
}
Protects a single branch of a project.
Parameters:
Unprotects a single branch of a project.
Parameters:
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/issues.md
Get a list of project issues. This function accepts pagination parameters page and per_page to return the list of project issues.
Parameters:
iid
all
issues or just those that are opened
or closed
created_at
or updated_at
fields. Default is created_at
asc
or desc
order. Default is desc
Gets a single project issue.
Parameters:
{
"id": 42,
"iid": 3,
"project_id": 8,
"title": "Add user settings",
"description": "",
"labels": [
"feature"
],
"milestone": {
"id": 1,
"title": "v1.0",
"description": "",
"due_date": "2012-07-20",
"state": "closed",
"updated_at": "2012-07-04T13:42:48Z",
"created_at": "2012-07-04T13:42:48Z"
},
"assignee": {
"id": 2,
"username": "jack_smith",
"email": "jack@example.com",
"name": "Jack Smith",
"state": "active",
"created_at": "2012-05-23T08:01:01Z"
},
"author": {
"id": 1,
"username": "john_smith",
"email": "john@example.com",
"name": "John Smith",
"state": "active",
"created_at": "2012-05-23T08:00:58Z"
},
"state": "opened",
"updated_at": "2012-07-12T13:43:19Z",
"created_at": "2012-06-28T12:58:06Z"
}
Creates a new project issue.
Parameters:
If the operation is successful, 200 and the newly created issue is returned. If an error occurs, an error number and a message explaining the reason is returned.
Updates an existing project issue. This function is also used to mark an issue as closed.
Parameters:
If the operation is successful, 200 and the updated issue is returned. If an error occurs, an error number and a message explaining the reason is returned.
Gets a list of all notes for a single issue.
Parameters:
[
{
"id": 302,
"body": "Status changed to closed",
"attachment": null,
"author": {
"id": 1,
"username": "pipin",
"email": "admin@example.com",
"name": "Pip",
"state": "active",
"created_at": "2013-09-30T13:46:01Z"
},
"created_at": "2013-10-02T09:22:45Z"
},
{
"id": 305,
"body": "Text of the comment\r\n",
"attachment": null,
"author": {
"id": 1,
"username": "pipin",
"email": "admin@example.com",
"name": "Pip",
"state": "active",
"created_at": "2013-09-30T13:46:01Z"
},
"created_at": "2013-10-02T09:56:03Z"
}
]
Returns a single note for a specific project issue
Parameters:
Creates a new note to a single project issue.
Parameters:
Modify existing note of an issue.
Parameters:
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/merge_requests.md
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/notes.md#merge-requests
Get all merge requests for the project. This function accepts pagination parameters page and per_page to return the list of merge requests.
Parameters:
Gets a single project merge request.
Parameters:
Creates a new merge request.
Parameters:
If the operation is successful, 200 and the newly created merge request is returned. If an error occurs, an error number and a message explaining the reason is returned.
Updates an existing merge request. You can change the target branch, title, or even close the MR.
Parameters:
If the operation is successful, 200 and the updated merge request is returned. If an error occurs, an error number and a message explaining the reason is returned.
Merge changes submitted with MR using this API.
Parameters:
If merge success you get 200 OK. If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged'. If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed' If you don't have permissions to accept this merge request - you'll get a 401
Gets a list of all notes/comments for a single merge request.
Parameters:
Returns a single note for a given merge request.
Parameters:
Creates a new note for a single merge request.
Parameters:
Modify existing note of a merge request.
Parameters:
Gets a list of all commits for a single merge request.
Parameters:
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/milestones.md
Returns a list of project milestones.
[
{
"id": 12,
"iid": 3,
"project_id": 16,
"title": "10.0",
"description": "Version",
"due_date": "2013-11-29",
"state": "active",
"updated_at": "2013-10-02T09:24:18Z",
"created_at": "2013-10-02T09:24:18Z"
}
]
Parameters:
Gets a single project milestone.
Parameters:
Creates a new project milestone.
Parameters:
Updates an existing project milestone.
Parameters:
close
|activate
)Gets all issues assigned to a single project milestone.
Parameters:
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#hooks
Get a list of project hooks.
Parameters:
Get a specific hook for a project.
{
"id": 1,
"url": "http://example.com/hook",
"project_id": 3,
"push_events": "true",
"issues_events": "true",
"merge_requests_events": "true",
"created_at": "2012-10-12T17:04:47Z"
}
Parameters:
Adds a hook to a specified project.
Parameters:
true
Edits a hook for a specified project.
Parameters:
true
Removes a hook from a project. This is an idempotent method and can be called multiple times. Either the hook is available or not.
Parameters:
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repository_files.md
Get file from repository. Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded.
{
"file_name": "key.rb",
"file_path": "app/models/key.rb",
"size": 1476,
"encoding": "base64",
"content": "IyA9PSBTY2hlbWEgSW5mb3...",
"ref": "master",
"blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83",
"commit_id": "d5a3ff139356ce33e37e73add446f16869741b50"
}
Parameters:
Create new file in repository
Parameters:
Update existing file in repository
Parameters:
Delete existing file in repository
Parameters:
(The MIT License)
Copyright (c) 2015 repo-utils Copyright (c) 2013 - 2014 fengmk2 fengmk2@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Gitlab API nodejs client.
We found that node-gitlab demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.