import { HttpStatusCodes } from '../Server' ; import { Response } from './Response' ; export class ClientErrorResponse extends Response { public static create ( statusCode , message ? , data ? , meta ? ) { return new this ( { statusCode , message , data , meta } ) ; } public static badRequest ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . BadRequest , message , data , meta ) ; } public static unauthorized ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . Unauthorized , message , data , meta ) ; } public static paymentRequired ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . PaymentRequired , message , data , meta ) ; } public static forbidden ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . Forbidden , message , data , meta ) ; } public static notFound ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . NotFound , message , data , meta ) ; } public static methodNotAllowed ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . MethodNotAllowed , message , data , meta ) ; } public static notAcceptable ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . NotAcceptable , message , data , meta ) ; } public static proxyAuthenticationRequired ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . ProxyAuthenticationRequired , message , data , meta ) ; } public static requestTimeout ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . RequestTimeout , message , data , meta ) ; } public static conflict ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . Conflict , message , data , meta ) ; } public static gone ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . Gone , message , data , meta ) ; } public static lengthRequired ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . LengthRequired , message , data , meta ) ; } public static preconditionFailed ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . PreconditionFailed , message , data , meta ) ; } public static payloadTooLarge ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . PayloadTooLarge , message , data , meta ) ; } public static uriTooLong ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . UriTooLong , message , data , meta ) ; } public static unsupportedMediaType ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . UnsupportedMediaType , message , data , meta ) ; } public static rangeNotSatisfiable ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . RangeNotSatisfiable , message , data , meta ) ; } public static expectationFailed ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . ExpectationFailed , message , data , meta ) ; } public static iAmATeapot ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . IAmATeapot , message , data , meta ) ; } public static misdirectedRequest ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . MisdirectedRequest , message , data , meta ) ; } public static unprocessableEntity ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . UnprocessableEntity , message , data , meta ) ; } public static locked ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . Locked , message , data , meta ) ; } public static failedDependency ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . FailedDependency , message , data , meta ) ; } public static upgradeRequired ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . UpgradeRequired , message , data , meta ) ; } public static preconditionRequired ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . PreconditionRequired , message , data , meta ) ; } public static tooManyRequests ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . TooManyRequests , message , data , meta ) ; } public static requestHeaderFieldsTooLarge ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . RequestHeaderFieldsTooLarge , message , data , meta ) ; } public static unavailableForLegalReasons ( message ? , data ? , meta ? ) { return this . create ( HttpStatusCodes . UnavailableForLegalReasons , message , data , meta ) ; } format ( ) { return { message : this . message , data : this . data } ; } }