public class ApiProvider extends Object implements AutoCloseable
close()ed in order to not leak WebServiceClients that weren't already closed by
ApiProvider.ApiWrapper.close().| Modifier and Type | Class and Description |
|---|---|
static class |
ApiProvider.ApiWrapper<T>
Represents a close-able RESTEasy client proxy.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
LOGGER |
| Constructor and Description |
|---|
ApiProvider() |
| Modifier and Type | Method and Description |
|---|---|
ApiProvider.ApiWrapper<ZonkyApi> |
anonymous()
Retrieve user-specific Zonky API which does not require authentication.
|
ApiProvider.ApiWrapper<ZonkyApi> |
authenticated(ZonkyApiToken token)
Retrieve user-specific Zonky API which requires authentication.
|
void |
close() |
ApiProvider.ApiWrapper<ZonkyOAuthApi> |
oauth()
Retrieve Zonky's OAuth endpoint.
|
protected <T> ApiProvider.ApiWrapper<T> |
obtain(Class<T> api,
String url,
RoboZonkyFilter filter)
Instantiate an API as a RESTEasy client proxy.
|
protected <T> ApiProvider.ApiWrapper<T> obtain(Class<T> api, String url, RoboZonkyFilter filter)
T - API type.api - RESTEasy endpoint.url - URL to the web API represented by the endpoint.filter - Filter to use when communicating with the endpoint.public ApiProvider.ApiWrapper<ZonkyOAuthApi> oauth()
IllegalStateException - If close() already called.public ApiProvider.ApiWrapper<ZonkyApi> anonymous()
IllegalStateException - If close() already called.public ApiProvider.ApiWrapper<ZonkyApi> authenticated(ZonkyApiToken token)
token - The Zonky API token, representing an authenticated user.IllegalStateException - If close() already called.public void close()
close in interface AutoCloseableCopyright © 2017. All rights reserved.