Package com.reign.api.kat.models
Class ApiModel
java.lang.Object
com.reign.api.kat.models.ApiModel
- Direct Known Subclasses:
ApiGuild
,ApiGuildData
,ApiMemberData
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends ApiModel,
Y extends ApiResponse<?>>
booleanCommit model data to the api provider.protected static <Y extends ApiResponse<?>>
YRetrieves data from the API Provider.abstract boolean
save()
Save the ApiModel to the Api.toString()
-
Field Details
-
log
protected static final org.slf4j.Logger log -
provider
-
-
Constructor Details
-
ApiModel
public ApiModel()
-
-
Method Details
-
toString
-
save
public abstract boolean save()Save the ApiModel to the Api. -
commit
protected <T extends ApiModel,Y extends ApiResponse<?>> boolean commit(String endpoint, T apiModel, Class<Y> responseClass) Commit model data to the api provider.- Type Parameters:
T
- class of the model extends ApiModelY
- class of the response extends ApiResponse- Parameters:
endpoint
- Endpoint to send the data to.apiModel
- Model to serialize.responseClass
- Class of the response object- Returns:
- boolean if commit was successful.
-
fetch
Retrieves data from the API Provider.- Type Parameters:
Y
- extends ApiResponse- Parameters:
endpoint
- Endpoint to fetchresponseClass
- Response class to serialize into.- Returns:
- complete response class
-