MCPcopy
hub / github.com/lukeautry/tsoa / MethodController

Class MethodController

tests/fixtures/controllers/methodController.ts:34–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32@Route('MethodTest')
33@Tags('MethodTest')
34export class MethodController extends Controller {
35 @Options('Options')
36 public async optionsMethod(): Promise<TestModel> {
37 return new ModelService().getModel();
38 }
39
40 @Get('Get')
41 public async getMethod(): Promise<RenamedModel> {
42 return new ModelService().getModel();
43 }
44
45 @Post('Post')
46 public async postMethod(): Promise<TestModel> {
47 return new ModelService().getModel();
48 }
49
50 @Patch('Patch')
51 public async patchMethod(): Promise<TestModel> {
52 return new ModelService().getModel();
53 }
54
55 @Put('Put')
56 public async putMethod(): Promise<TestModel> {
57 return new ModelService().getModel();
58 }
59
60 @Delete('Delete')
61 public async deleteMethod(): Promise<TestModel> {
62 return new ModelService().getModel();
63 }
64
65 /**
66 * method description
67 */
68 @Get('Description')
69 public async description(): Promise<TestModel> {
70 return new ModelService().getModel();
71 }
72
73 @Tags('Tag1', 'Tag2', 'Tag3')
74 @Get('Tags')
75 public async tags(): Promise<TestModel> {
76 return new ModelService().getModel();
77 }
78
79 @Response<ErrorResponseModel>('400', 'Bad Request', { status: 400, message: 'reason 1' })
80 @Response<ErrorResponseModel>('400', 'Bad Request', { status: 400, message: 'reason 2' })
81 @Response<ErrorResponseModel>('401', 'Unauthorized')
82 @Response<ErrorResponseModel>('default', 'Unexpected error', { status: 500, message: 'Something went wrong!' })
83 @Get('MultiResponse')
84 public async multiResponse(): Promise<TestModel> {
85 return new ModelService().getModel();
86 }
87
88 @Tags(TEST_ENUM.TAG)
89 @Security(TEST_ENUM.SECURITY, [TEST_ENUM.ADMIN, TEST_ENUM.OWNER])
90 @Security(TEST_SEC)
91 @Response<ErrorResponseModel>(TEST_OBJECT_CONST.unAuthCode, TEST_OBJECT_CONST.unAuthText)

Callers

nothing calls this directly

Calls 12

OptionsFunction · 0.90
GetFunction · 0.90
PostFunction · 0.90
PatchFunction · 0.90
PutFunction · 0.90
DeleteFunction · 0.90
TagsFunction · 0.90
ResponseInterface · 0.90
SecurityInterface · 0.90
SuccessResponseFunction · 0.90
ExampleFunction · 0.90
ExtensionFunction · 0.90

Tested by

no test coverage detected