This module facilitates the usage of Octokit in NestJS.
Octokit is "The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno".
Using nestjs-octokit
you can register the Octokit module and configure it the way NestJS suggests, then inject it as a standard NestJS injectable.
On Yarn:
yarn add nestjs-octokit
On NPM:
npm install nestjs-octokit
First register the module:
import { OctokitModule } from 'nestjs-octokit';
@Module({
imports: [
OctokitModule.forRoot({
isGlobal: true,
octokitOptions: {
auth: 'my-github-token',
},
}),
// ...
],
})
export class AppModule {}
Or if want to inject any dependency:
import { OctokitModule } from 'nestjs-octokit';
@Module({
imports: [
OctokitModule.forRootAsync({
isGlobal: true,
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
octokitOptions: {
auth: configService.get<string>('GITHUB_AUTH_TOKEN'),
},
}),
}),
// ...
],
})
export class AppModule {}
Then you can inject the service:
import { OctokitService } from 'octokit-nestjs';
@Controller()
export class SomeController {
constructor(private readonly octokitService: OctokitService) {}
@Get('/')
someEndpoint() {
const response = await this.octokitService.rest.search.repos({
q: 'nest-js',
});
return response.data.items;
}
}
To use plugins:
import { OctokitModule } from 'octokit-nestjs';
import { throttling } from '@octokit/plugin-throttling';
@Module({
imports: [
OctokitModule.forRoot({
isGlobal: true,
plugins: [throttling], // Pass them here
octokitOptions: {
// Plugin options:
throttle: {
onRateLimit: (retryAfter, options, octokit) => {
octokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
);
},
onAbuseLimit: (retryAfter, options, octokit) => {
octokit.log.warn(
`Abuse detected for request ${options.method} ${options.url}`
);
},
},
},
}),
],
})
export class AppModule {}
This repo is about our Practical Git course, and contains a list of users that successfully finished the course.
Hi I'm Parsa
🔍Generate details your statistics of Github data information when searching
Write a large text on your GitHub profile, with your commits history (contribution graph).
:octocat: Generate an image of all your Github contributions
:octocat: 👽A beatiful, powerful, Github client to Categorize Starred Repositories
A extension that adds a set of useful features to Github Gists
Who I am !?