Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Commit ae397ae

Browse files
committed
Lombok ApiResponse
1 parent a789837 commit ae397ae

1 file changed

Lines changed: 18 additions & 45 deletions

File tree

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,24 @@
11
package com.thebluealliance.api.v3.requests;
22

3+
import lombok.Value;
4+
35
/**
4-
* Holds a response from The Blue Alliance API com.thebluealliance.api.v3
6+
* A response from The Blue Alliance API com.thebluealliance.api.v3
57
*/
6-
public class APIResponse {
7-
8-
private final String jsonContent;
9-
private final String lastModified;
10-
private final int responseCode;
11-
12-
/**
13-
* Creates an APIResponse object
14-
*
15-
* @param jsonContent JSON data returned by the API
16-
* @param lastModified The <code>Last-Modified</code> response header
17-
* @param responseCode The HTTP response code
18-
*/
19-
public APIResponse(String jsonContent, String lastModified, int responseCode) {
20-
this.jsonContent = jsonContent;
21-
this.lastModified = lastModified;
22-
this.responseCode = responseCode;
23-
}
24-
25-
/**
26-
* @return The JSON string returned by the API. May be null if the <code>
27-
* responseCode</code> is not 200.
28-
*/
29-
public String getJson() {
30-
return jsonContent;
31-
}
32-
33-
/**
34-
* @return The date and time the data returned was last updated. Used by clients in the `If-Modified-Since`
35-
* request header.
36-
*/
37-
public String getLastModified() {
38-
return lastModified;
39-
}
40-
41-
/**
42-
* @return The HTTP response code given by the API.
43-
* Value is 200 if the response is successful, 304 if data was not modified and the <code>If-Modified-Since</code>
44-
* header is used, 401 if no TBA com.thebluealliance.api.v3 API Key was provided, or it is not valid, or 404 if
45-
* the URL or parameter(s) provided is invalid
46-
*/
47-
public int getResponseCode() {
48-
return responseCode;
49-
}
8+
@Value public class APIResponse {
509

10+
/**
11+
* @return The JSON string returned by the API. May be null if the <code>
12+
* responseCode</code> is not 200.
13+
*/
14+
String json;
15+
/**
16+
* @return The date and time the data returned was last updated. Used by clients in the `If-Modified-Since` request header.
17+
*/
18+
String lastModified;
19+
/**
20+
* @return The HTTP response code given by the API. Value is 200 if the response is successful, 304 if data was not modified and the <code>If-Modified-Since</code> header is used, 401 if no TBA
21+
* com.thebluealliance.api.v3 API Key was provided, or it is not valid, or 404 if the URL or parameter(s) provided is invalid
22+
*/
23+
int responseCode;
5124
}

0 commit comments

Comments
 (0)