| 1 | import { |
| 2 | Body, |
| 3 | Controller, |
| 4 | Get, |
| 5 | HttpCode, |
| 6 | Param, |
| 7 | Post, |
| 8 | UseFilters, |
| 9 | } from '@nestjs/common'; |
| 10 | import { ApiOperation, ApiTags |
| 11 | import { AllowAnonymous } |
| 12 | |
| 13 | import type { GithubViewer |
| 14 | import { Viewer } |
| 15 | import { GithubRestFilter } |
| 16 | import { GithubAddKeyDTO } |
| 17 | import { GithubUsersService } |
| 18 | |
| 19 | @Controller('v3') |
| 20 | @ApiTags('GitHub compatibility') |
| 21 | @AllowAnonymous() |
| 22 | @UseFilters(GithubRestFilter) |
| 23 | export class UsersController |
| 24 | constructor(private readonly |
| 25 | |
| 26 | @Get('user' |
| 27 | @ApiOperation({ summary |
| 28 | me(@Viewer() |
| 29 | return this.users |
| 30 | } |
| 31 | |
| 32 | @Get('users/:login' |
| 33 | @ApiOperation({ |
| 34 | summary: 'A user or organization by login, in GitHub REST shape', |
| 35 | }) |
| 36 | byLogin(@Param( |
| 37 | return this.users |
| 38 | } |
| 39 | |
| 40 | @Get('user/keys' |
| 41 | @ApiOperation({ |
| 42 | summary: "The authenticated user's SSH keys, in GitHub REST shape", |
| 43 | }) |
| 44 | keys(@Viewer() |
| 45 | return this.users |
| 46 | } |
| 47 | |
| 48 | @Post('user/keys' |
| 49 | @HttpCode(201) |
| 50 | @ApiOperation({ summary |
| 51 | addKey(@Body() |
| 52 | return this.users |
| 53 | } |
| 54 | } |