0.1.1 • Published 6 years ago
sd-gitlab v0.1.1
gitlab
gitlab api 接口调用服务
Install
yarn add sd-gitlab
Use
Initialization
const GitLab = require('gitlab-api')
const gitLab = new GitLab({
baseUrl: 'https://example.com',
// gitlab个人令牌 https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
privateToken: '',
expires: 1 // 缓存天数
})
API
getAllProjects(options)
获取所有项目列表
options
参数 | 类型 | 描述 | 示例 |
---|---|---|---|
pick | Array | 获取的属性列表 | ['name'] |
filter | Object | 过滤条件,对象值为正则 | {name: /regex/} |
Example
gitLab.getAllProjects({
pick: ['name', 'path_with_namespace'],
filter: {
path_with_namespace: /^namespace/
}
}).then(data => {
console.log(data)
})