index.d.ts 1015 B

1234567891011121314151617181920212223242526272829303132333435
  1. declare module "@pablo/pablo-rest-api-standard" {
  2. const PRAS: {
  3. responseMiddleware(): (req: any, resp: any, next?: () => void) => void;
  4. };
  5. export default PRAS;
  6. }
  7. declare namespace Express {
  8. export interface Response {
  9. pras: {
  10. ok(message: string, data?: any, code?: string, extra?: any): void;
  11. created(message: string, data?: any, code?: string, extra?: any): void;
  12. badRequest(message: string, data?: any, code?: string, extra?: any): void;
  13. unauthorized(
  14. message: string,
  15. data?: any,
  16. code?: string,
  17. extra?: any
  18. ): void;
  19. forbidden(message: string, data?: any, code?: string, extra?: any): void;
  20. notFound(message: string, data?: any, code?: string, extra?: any): void;
  21. serverError(
  22. message: string,
  23. data?: any,
  24. code?: string,
  25. extra?: any
  26. ): void;
  27. customMessage(
  28. message: string,
  29. data?: any,
  30. code?: string,
  31. extra?: any
  32. ): void;
  33. };
  34. }
  35. }