interface Response { status: number, data?: T, } interface ErrorResponse extends Response { message: string, } type ResponseParams = { message?: string, data?: T, } export class NotFound implements ErrorResponse { public readonly status = 404 public readonly message: string constructor(params: ResponseParams) { this.message = params.message } } export class Created implements Response { public readonly status = 201 public readonly data: T constructor(params: ResponseParams) { this.data = params.data } } export class Saved implements Response { public readonly status = 200 public readonly data: T constructor(params: ResponseParams) { this.data = params.data } } export class Retrieved implements Response { public readonly status = 200 public readonly data: T constructor(params: ResponseParams) { this.data = params.data } } export class Destroyed implements Response { public readonly status = 204 }