/
api_response.js
58 lines (44 loc) · 1.29 KB
/
api_response.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* This class is the common API response object.
*/
class APIResponse {
statusCode;
object;
headers;
/**
* Creates an APIResponse class instance with the specified parameters.
* @param {Map} headers The map containing the API Response headers
* @param {Integer} statusCode The integer containing the API response HTTP status code.
* @param {Object} object The object containing the API response class instance.
*/
constructor(headers, statusCode, object) {
this.headers = headers;
this.statusCode = statusCode;
this.object = object;
}
/**
* The method to get the API Response headers
* @returns {Map} The map containing the API Response headers
*/
getHeaders() {
return this.headers;
}
/**
* The method to get the API response HTTP status code.
* @returns {Integer} The integer containing the API response HTTP status code.
*/
getStatusCode() {
return this.statusCode;
}
/**
* The method to get the API response class instance.
* @returns {Object} The object containing the API response class instance.
*/
getObject() {
return this.object;
}
}
module.exports = {
MasterModel: APIResponse,
APIResponse: APIResponse
}