Interface GemmaRestApiClient
- All Known Implementing Classes:
GemmaRestApiClientImpl
public interface GemmaRestApiClient
A minimalist client for accessing Gemma's RESTful API.
- Author:
- poirigui
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfaceFor endpoints that return no data (i.e.static interfaceFor endpoints that may return an error.static interfaceA response from the API, which is either aGemmaRestApiClient.DataResponseorGemmaRestApiClient.ErrorResponse. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear any credentials.Issue aDELETEagainst a given REST endpoint.Access a given REST endpoint.Access a given endpoint REST endpoint with parameters.voidsetAuthentication(org.springframework.security.core.Authentication authentication) Set credentials used for authenticating API requests.
-
Method Details
-
getHostUrl
String getHostUrl() -
perform
Access a given REST endpoint.- Throws:
IOException
-
perform
GemmaRestApiClient.Response perform(String endpoint, org.springframework.util.MultiValueMap<String, Object> params) throws IOExceptionAccess a given endpoint REST endpoint with parameters.- Throws:
IOException- if anything goes wrong with I/O including issues with JSON deserialization
-
perform
GemmaRestApiClient.Response perform(String endpoint, String firstParamName, Object firstParamValue, Object... otherParams) throws IOException - Throws:
IOException
-
delete
Issue aDELETEagainst a given REST endpoint.Exists for the admin cache surface, which is only reachable by
DELETE. A CLI that rebuilds a table can evict its own JVM's Hibernate regions, but gemma-rest is a different process and learns nothing from that — so the only way for a rebuild to stop the server serving what it cached beforehand is a call like this one.- Returns:
- an
GemmaRestApiClient.EmptyResponseon a 204, which is what the cache endpoints return on success, or anGemmaRestApiClient.ErrorResponsethe caller is expected to inspect - Throws:
IOException
-
setAuthentication
void setAuthentication(org.springframework.security.core.Authentication authentication) Set credentials used for authenticating API requests. -
clearAuthentication
void clearAuthentication()Clear any credentials.
-