Class ApiModel

java.lang.Object
com.reign.api.kat.models.ApiModel
Direct Known Subclasses:
ApiGuild, ApiGuildData, ApiMemberData

public abstract class ApiModel extends Object
  • Field Details

    • log

      protected static final org.slf4j.Logger log
    • provider

      public static IApiProvider provider
  • Constructor Details

    • ApiModel

      public ApiModel()
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 ApiModel
      Y - 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

      protected static <Y extends ApiResponse<?>> Y fetch(String endpoint, Class<Y> responseClass)
      Retrieves data from the API Provider.
      Type Parameters:
      Y - extends ApiResponse
      Parameters:
      endpoint - Endpoint to fetch
      responseClass - Response class to serialize into.
      Returns:
      complete response class