@megatherium/gitlab-api
v0.15.1
Published
See the whole [documentation](https://megatherium.gitlab.io/gitlab-api) or the [coverage report](https://megatherium.gitlab.io/gitlab-api/coverage).
Readme
gitlab-api
See the whole documentation or the coverage report.
Getting started
Install the dependency:
$ npm install @megatherium/gitlab-api
Set up environment variables.
Start using it:
import gitlab from '@megatherium/gitlab-api';
(async() => {
await gitlab.createProject('my-test-project');
})();Configure an environment variable to give the module access to your GitLab API.
Environment variables
MEGATHERIUM_GITLAB_ACCESS_TOKENorGITLAB_TOKEN- the access token to login to GitLab instanceMEGATHERIUM_GITLAB_BASE_URL- the base url of the github repository; default:https://gitlab.com/api/v4
API (22)
Exports
- createProject
(pathOrName: string, additionalData?: object): PromiseCreates a new pipeline schedule for a project. - createProjectMember
(projectIdOrName: int | string, userId: int, accessLevel: int, additionalData?: object): Promise<object>Adds a member to a project. - createProjectPipelineSchedule
(projectIdOrName: int | string, description: string, cron: string, additionalData?: object): PromiseCreates a new project. - createProjectVariable
(projectIdOrName: int | string, variableData: object): PromiseCreates a new variable for a GitLab project. - createProjectVariable
(projectIdOrName: int | string, variableData: object): PromiseCreates a new variable for a GitLab project. - createUserKey
(parameters: object): PromiseAdds a new ssh key to the current user. - getProject
(projectIdOrName: int | string, additionalParameters?: object): PromiseRetrieves the information about a project. - listProjects
(additionalParameters?: object): Promise<Array<object>>Lists all projects from the current namespace, optionally filtered by parameters. - listProjectMembers
(projectIdOrName: int | string, additionalParameters?: object): Promise<Array<object>>Lists all the members of a project. - listProjectPipelineSchedules
(projectIdOrName: int | string, additionalParameters?: object): Promise<Array<object>>Lists the pipeline schedules from a specific project. - listProjectVariables
(projectIdOrName: int | string): Promise<Array<object>>Lists the variables added to a project. - listUserKeys
(): Promise<Array<object>>Lists the ssh keys from the current user. - listUsers
(additionalParameters?: object): Promise<Array<object>>Lists the users. Can be filtered. - request
(method: string, url: string, parameters?: object)Performs an authenticated API request on the GitLab API. - removeProject
(pathIdOrName: string): PromiseDeletes a project permanently. - removeProjectMember
(projectIdOrName: int | string, userId: int, additionalParameters?: object): PromiseRemoves a member from a project. - removeProjectPipelineSchedule
(projectIdOrName: int | string, pipelineScheduleId: int): PromiseRemoves a pipeline schedule from a project. - removeProjectVariable
(projectIdOrName: int | string, variableName: string, additionalParameters?: object): PromiseDeletes a variable from a project. - removeUserKey
(int: keyId): PromiseDeletes a key of the current user permanently. - updateProjectMember
(projectIdOrName: int | string, userId: int, accessLevel: int, additionalData?: object): Promise<object>Updates the member of a project. - updateProjectPipelineSchedule
(projectIdOrName: int | string, pipelineScheduleId: int, additionalData?: object): PromiseUpdates a pipeline schedule of a project. - updateProjectVariable
(projectIdOrName: int | string, variableName: string, variableValue: string, additionalData?: object): PromiseUpdates the data from a project variable.
Scripts
The following scripts can be executed using npm run:
buildBuilds the module.build-docsBuilds the documentation.build-sourceBuilds the source code.build-testsBuilds test-cases from jsdoc examples.clearClears the module from a previous build.clear-coverageClears the coverage reports and caches.clear-docsClears the previous documentation build.clear-sourceClears the previous source build.clear-testsClears the generated jsdoc example test files.fixRuns all automated fixes.fix-lintAutomatically fixes linting problems.releaseRuns semantic release. Meant to be only executed by the CI, not by human users.testExecutes all tests.test-coverageGenerates coverage reports from the test results using nyc.test-depsExecutes a depcheck.test-e2eExecutes End-to-End-Tests using cucumber.test-integrationExecutes integration tests using jest.test-lintExecutes linting tests using eslint.test-unitExecutes unit tests using mocha.updateChecks for dependency updates using renovate.
