{"id":15285875,"url":"https://github.com/hexenq/nest-gitlab","last_synced_at":"2025-04-13T02:44:20.660Z","repository":{"id":34970490,"uuid":"193448653","full_name":"hexenq/nest-gitlab","owner":"hexenq","description":"A Gitlab API library module for Nest framework.","archived":false,"fork":false,"pushed_at":"2022-12-10T20:01:38.000Z","size":426,"stargazers_count":9,"open_issues_count":11,"forks_count":8,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-13T02:43:43.493Z","etag":null,"topics":["api","gitbeaker","gitlab","nest","nestjs","node-gitlab"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexenq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-24T06:39:07.000Z","updated_at":"2024-08-19T23:03:00.000Z","dependencies_parsed_at":"2023-01-15T11:13:39.860Z","dependency_job_id":null,"html_url":"https://github.com/hexenq/nest-gitlab","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexenq%2Fnest-gitlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexenq%2Fnest-gitlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexenq%2Fnest-gitlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexenq%2Fnest-gitlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexenq","download_url":"https://codeload.github.com/hexenq/nest-gitlab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657857,"owners_count":21140843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","gitbeaker","gitlab","nest","nestjs","node-gitlab"],"created_at":"2024-09-30T15:08:02.241Z","updated_at":"2025-04-13T02:44:20.639Z","avatar_url":"https://github.com/hexenq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com\"\u003e\u003cimg src=\"https://nestjs.com/img/logo_text.svg\" alt=\"Nest Logo\" width=\"320\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A \u003ca href=\"https://github.com/jdalrymple/gitbeaker\"\u003egitbeaker\u003c/a\u003e wrapper for \u003ca href=\"https://github.com/nestjs/nest\"\u003eNestJS\u003c/a\u003e framework.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nest-gitlab\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/nest-gitlab.svg\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/hexenq/nest-gitlab\"\u003e\u003cimg src=\"https://travis-ci.org/hexenq/nest-gitlab.svg?branch=master\" alt=\"Travis build\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nest-gitlab\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/nest-gitlab.svg\" alt=\"Package License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Description\nGitlab API library module for \u003ca href=\"https://github.com/nestjs/nest\"\u003eNest\u003c/a\u003e.\n\n## Installation\n\n```bash\nnpm install --save nest-gitlab @gitbeaker/node\n```\n\n## Compatibility\n|           gitbeaker            | nest-gitlab |\n| :----------------------------: | :---------: |\n| node-gitlab (former gitbeaker) |     1.x     |\n|        19.0.0 ~ 23.5.0         |     2.x     |\n|            23.6.0 ~            |     3.x     |\n\n## Quick Start\n\nImport `GitlabModule` and configure it with the same initiating options as the gitbeaker package.\n\n```ts\nimport { GitlabModule } from 'nest-gitlab';\n\n@Module({\n  imports: [\n    GitlabModule.forRoot({\n      // options\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\nAfterward, the gitlab instance will be ready to be injected across the entire project using the `gitlab` injection token.\n\n```ts\nimport { Controller, Inject } from '@nestjs/common';\nimport { GitlabInstance } from 'nest-gitlab';\n\n@Controller('cats')\nexport class CatsController {\n  constructor(@Inject('gitlab') private readonly gitlab: GitlabInstance) { }\n}\n```\n\nYou could also use the `InjectGitlabInstance` decorator to inject gitlab instance.\n\n```ts\nimport { Controller, Inject } from '@nestjs/common';\nimport { GitlabInstance, InjectGitlabInstance } from 'nest-gitlab';\n\n@Controller('cats')\nexport class CatsController {\n  constructor(@InjectGitlabInstance() private readonly gitlab: GitlabInstance) { }\n\n  @Get('/projects')\n  public async getProjects() {\n    return await this.gitlab.Projects.all();\n  }\n}\n```\n\n## Async Configuration\n\nYou might want to asynchronously pass your module options. In such case, use the `forRootAsync()` method. The option object could be returned by `useFactory` method:\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { GitlabModule } from 'nest-gitlab';\n\n@Module({\n  imports: [\n    GitlabModule.forRootAsync({\n      imports: [ConfigModule],\n      useFactory: async (config: ConfigService) =\u003e {\n        // return options\n      },\n      inject: [ConfigService],\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n## Bundle Support\ngitbeaker provides [bundle](https://github.com/jdalrymple/gitbeaker#bundle-imports) feature which is a export for importing and instantiating all related API's of a specific resource at once. In order to use this feature, you could use the `InjectBundleRef` decorator combined with `forFeature` method:\n\n```ts\nimport { GitlabModule } from 'nest-gitlab';\n\n@Module({\n  imports: [\n    GitlabModule.forRoot({\n      // options\n    }),\n  ],\n})\nexport class AppModule {}\n```\n```ts\nimport { Module } from '@nestjs/common';\nimport { BundleType, GitlabModule } from 'nest-gitlab';\n\n@Module({\n  imports: [\n    GitlabModule.forFeature([BundleType.Projects]),\n  ],\n  controllers: [CatsController],\n  providers: [CatsService],\n})\nexport class CatsModule {}\n```\n`BundleType` could be `Projects`, `Users`, or `Groups`.\n```ts\nimport { Controller, Inject } from '@nestjs/common';\nimport { BundleType, GitlabInstance, InjectBundleRef, ProjectsBundleRef } from 'nest-gitlab';\n\n@Controller('cats')\nexport class CatsController {\n  constructor(@InjectBundleRef(BundleType.Projects) private readonly pbr: ProjectsBundleRef) { }\n\n  @Get('/projects')\n  public async getProjects() {\n    return await this.pbr.Projects.all();\n  }\n}\n```\n\n## Multiple GitLab Instances\nIn some cases, your projects may require multiple GitLab instances. This can be achieved by naming the gitlab instances:\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { GitlabModule } from 'nest-gitlab';\n\n@Module({\n  imports: [\n    GitlabModule.forRootAsync({\n      name: 'ins1',\n      imports: [ConfigModule],\n      useFactory: async (config: ConfigService) =\u003e {\n        // return options\n      },\n      inject: [ConfigService],\n    }),\n    GitlabModule.forRoot({\n      name: 'ins2',\n      // options\n    }),\n  ],\n})\nexport class AppModule {}\n```\n```ts\nimport { Module } from '@nestjs/common';\nimport { BundleType, GitlabModule } from 'nest-gitlab';\n\n@Module({\n  imports: [\n    GitlabModule.forFeature([BundleType.Projects], 'ins1'),\n  ],\n  controllers: [CatsController],\n  providers: [CatsService],\n})\nexport class CatsModule {}\n```\n```ts\nimport { Controller, Inject } from '@nestjs/common';\nimport { BundleType, GitlabInstance, InjectBundleRef, InjectGitlabInstance, ProjectsBundleRef } from 'nest-gitlab';\n\n@Controller('cats')\nexport class CatsController {\n  constructor(@InjectBundleRef(BundleType.Projects, 'ins1') private readonly pbr1: ProjectsBundleRef,\n              @InjectGitlabInstance('ins2') private readonly gitlab2: GitlabInstance) { }\n}\n```\n\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexenq%2Fnest-gitlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexenq%2Fnest-gitlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexenq%2Fnest-gitlab/lists"}