java.lang.Object
gg.xp.xivapi.XivApiClient
- All Implemented Interfaces:
AutoCloseable
The main xivapi client class.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with default settingsXivApiClient(XivApiSettings settings) Constructor with a settings object.XivApiClient(Consumer<XivApiSettings.Builder> configurer) Constructor that assembles a builder for you and applies your lambda to it. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hc.core5.net.URIBuilderbuildUri()Given a lambda, configure a URIBuilder with that lambda.voidclose()Shut down this client.getAssetUri(String assetPath, AssetFormat format) getAssetUri(String assetPath, String format) <X extends XivApiObject>
XRetrieve a single item by primary key/row ID<X extends XivApiObject>
XivApiPaginator<X> getListIterator(Class<X> cls) getListIterator(Class, ListOptions)with default ListOptions.<X extends XivApiObject>
XivApiPaginator<X> getListIterator(Class<X> cls, ListOptions<? super X> options) Get a list iterator for an entire sheet.<X extends XivApiObject>
XivApiPaginator<X> getSearchIterator(Class<X> cls, SearchFilter filter) <X extends XivApiObject>
XivApiPaginator<X> getSearchIterator(Class<X> cls, SearchFilter filter, ListOptions<? super X> options) Get a list iterator for a search query.com.fasterxml.jackson.databind.JsonNodeSend a raw requestvoidsetDefaultListOpts(ListOptions<XivApiObject> defaultListOpts) <X extends XivApiObject>
voidvalidateModel(Class<X> clazz)
-
Constructor Details
-
XivApiClient
Constructor with a settings object.- Parameters:
settings- The built settings object- See Also:
-
XivApiClient
Constructor that assembles a builder for you and applies your lambda to it.- Parameters:
configurer- Configuration to apply to the builder- See Also:
-
XivApiClient
public XivApiClient()Constructor with default settings
-
-
Method Details
-
getSettings
- Returns:
- The settings used to construct this XivApiClient
-
getBaseUri
- Returns:
- The base URI for this client
-
sendGET
Send a raw request- Parameters:
uri- The URI- Returns:
- The root JSON node.
-
buildUri
public org.apache.hc.core5.net.URIBuilder buildUri()- Returns:
- A URI builder, initialized to the base URI plus default query params
-
buildUri
Given a lambda, configure a URIBuilder with that lambda. Starts withbuildUri().- Parameters:
func- The lambda to use to configure the builder- Returns:
- the built URI
-
getById
Retrieve a single item by primary key/row ID- Type Parameters:
X- The type/sheet to retrieve- Parameters:
cls- The type/sheet to retrieveid- The ID to retrieve- Returns:
- The mapped object
-
setDefaultListOpts
-
getListIterator
getListIterator(Class, ListOptions)with default ListOptions.- Type Parameters:
X- The element type of the list- Parameters:
cls- The element type of the list- Returns:
- An iterator for the list.
-
getListIterator
public <X extends XivApiObject> XivApiPaginator<X> getListIterator(Class<X> cls, ListOptions<? super X> options) Get a list iterator for an entire sheet. Note that by default, this returns a fairly dumb paginator implementation. It does not do any prefetching or buffering, so itsIterator.hasNext()method will block whenever a new sheet needs to be retrieved.- Type Parameters:
X- The element type of the list- Parameters:
cls- The element type of the listoptions- List options to configure number per page, stop condition, and other future settings.- Returns:
- An iterator for the list.
-
getSearchIterator
public <X extends XivApiObject> XivApiPaginator<X> getSearchIterator(Class<X> cls, SearchFilter filter) -
getSearchIterator
public <X extends XivApiObject> XivApiPaginator<X> getSearchIterator(Class<X> cls, SearchFilter filter, ListOptions<? super X> options) Get a list iterator for a search query. Note that by default, this returns a fairly dumb paginator implementation. It does not do any prefetching or buffering, so itsIterator.hasNext()method will block whenever a new sheet needs to be retrieved.This does not support querying across multiple sheets.
- Type Parameters:
X- The element type of the list- Parameters:
cls- The element type of the listfilter- The search filter to use for the query.options- List options to configure number per page, stop condition, and other future settings.- Returns:
- An iterator for the list.
-
getGameVersions
- Returns:
- The list of available game versions.
-
getAssetUri
-
getAssetUri
-
validateModel
-
getUrlResolver
-
close
public void close()Shut down this client.- Specified by:
closein interfaceAutoCloseable
-