add spotify feature

This commit is contained in:
Lee
2024-06-28 03:01:21 +01:00
parent 5c7a067f7a
commit fa10cf2019
70 changed files with 966 additions and 170 deletions

View File

@ -27,14 +27,15 @@ public class WebRequest {
* Gets a response from the given URL.
*
* @param url the url
* @return the response
* @param <T> the type of the response
* @return the response
*/
public static <T> T getAsEntity(String url, Class<T> clazz) throws RateLimitException {
ResponseEntity<T> responseEntity = CLIENT.get()
.uri(url)
.retrieve()
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
.onStatus(HttpStatusCode::isError, (request, response) -> {
}) // Don't throw exceptions on error
.toEntity(clazz);
if (responseEntity.getStatusCode().isError()) {
@ -56,7 +57,8 @@ public class WebRequest {
return CLIENT.get()
.uri(url)
.retrieve()
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
.onStatus(HttpStatusCode::isError, (request, response) -> {
}) // Don't throw exceptions on error
.toEntity(clazz);
}
@ -70,7 +72,8 @@ public class WebRequest {
return CLIENT.head()
.uri(url)
.retrieve()
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
.onStatus(HttpStatusCode::isError, (request, response) -> {
}) // Don't throw exceptions on error
.toEntity(clazz);
}
}