File size: 604 Bytes
484fdbc
 
 
 
 
f39e411
 
 
 
484fdbc
 
 
 
 
 
 
f39e411
484fdbc
f39e411
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
interface JsonResponseProps {
  status?: number;
  message?: string;
  data?: Record<string, any> | Record<string, any>[];
  meta?: {
    total: number;
    page: number;
    perPage: number;
  };
}

export class JsonResponse {
  public status: JsonResponseProps["status"];
  public message: JsonResponseProps["message"];
  public data: JsonResponseProps["data"];
  public meta?: JsonResponseProps["meta"];

  constructor(props: JsonResponseProps) {
    this.status = props.status || 200;
    this.message = props.message || "Success";
    this.data = props.data || {};
    this.meta = props.meta;
  }
}