-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathResponse.java
More file actions
58 lines (47 loc) · 1.08 KB
/
Response.java
File metadata and controls
58 lines (47 loc) · 1.08 KB
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
package com.sendgrid;
import java.util.Map;
/**
* Class Response provides a standard interface to an API's response.
*/
public class Response {
private int statusCode;
private String body;
private Map<String, String> headers;
/**
* Set the API's response.
*/
public Response(int statusCode, String responseBody, Map<String,String> responseHeaders) {
this.statusCode = statusCode;
this.body = responseBody;
this.headers = responseHeaders;
}
public Response() {
this.reset();
}
/**
* Place the object into an empty state.
*/
public void reset() {
this.statusCode = 0;
this.body = "";
this.headers = null;
}
public int getStatusCode() {
return this.statusCode;
}
public String getBody() {
return this.body;
}
public Map<String, String> getHeaders() {
return this.headers;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public void setBody(String body) {
this.body = body;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
}