import { inject } from '../ServiceManager/decorators' ; import { ResponseService } from './ResponseService' ; import { SuccessfulResponse } from './SuccessfulResponse' ; import { ClientErrorResponse } from './ClientErrorResponse' ; import { ServerErrorResponse } from './ServerErrorResponse' ; import { RedirectionResponse } from './RedirectionResponse' ; export class AbstractResponseHelper { @ inject ( ResponseService ) protected responseService : ResponseService ; protected getResponseService ( ) { return this . responseService ; } protected okResponse ( data ? , meta ? ) { return this . responseService . successful ( ) . ok ( data , meta ) ; } protected createdResponse ( data ? , meta ? ) { return this . responseService . successful ( ) . created ( data , meta ) ; } protected notFoundResponse ( message ? , data ? , meta ? ) { return this . responseService . clientError ( ) . notFound ( message , data , meta ) ; } protected requestTimeoutResponse ( message ? , data ? , meta ? ) { return this . responseService . clientError ( ) . requestTimeout ( message , data , meta ) ; } protected forbiddenResponse ( message ? , data ? , meta ? ) { return this . responseService . clientError ( ) . forbidden ( message , data , meta ) ; } protected badRequestResponse ( message ? , data ? , meta ? ) { return this . responseService . clientError ( ) . badRequest ( message , data , meta ) ; } protected unauthorizedResponse ( message ? , data ? , meta ? ) { return this . responseService . clientError ( ) . unauthorized ( message , data , meta ) ; } protected internalServerErrorResponse ( message ? , data ? , meta ? ) { return this . responseService . serverError ( ) . internalServerError ( message , data , meta ) ; } protected permanentRedirectResponse ( location , alt ? , meta ? ) { return this . responseService . redirection ( ) . permanentRedirect ( location , alt , meta ) ; } }