Package 

Interface ApiService

    • Method Summary

      Modifier and Type Method Description
      abstract Unit overrideBearerToken(String token) Overrides the bearer token used in all subsequent API requests.
      abstract <T extends Any> Result<T> get(String endpoint, KClass<T> responseCast) Makes a GET request to the Fortress API and deserializes the JSON response.
      abstract <T extends Any> Result<T> post(String endpoint, Object body, KClass<T> responseCast) Makes a POST request to the Fortress API with a JSON body and deserializes the response.
      abstract <T extends Any> Result<T> patch(String endpoint, Object body, KClass<T> responseCast) Makes a PATCH request to the Fortress API with a JSON body and deserializes the response.
      abstract <T extends Any> Result<T> delete(String endpoint, Object body, KClass<T> responseCast) Makes a DELETE request to the Fortress API with a JSON body and deserializes the response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • overrideBearerToken

         abstract Unit overrideBearerToken(String token)

        Overrides the bearer token used in all subsequent API requests.

        Parameters:
        token - The OAuth/JWT bearer token, or null to clear authentication.
      • get

         abstract <T extends Any> Result<T> get(String endpoint, KClass<T> responseCast)

        Makes a GET request to the Fortress API and deserializes the JSON response.

        Parameters:
        endpoint - The API endpoint path (e.g., "/shipments" or "/users/profile?id=123").
        responseCast - The Kotlin class to deserialize the response into.
      • post

         abstract <T extends Any> Result<T> post(String endpoint, Object body, KClass<T> responseCast)

        Makes a POST request to the Fortress API with a JSON body and deserializes the response.

        Parameters:
        endpoint - The API endpoint path (e.g., "/shipments" or "/shipment_scans").
        body - The request body object to serialize as JSON.
        responseCast - The Kotlin class to deserialize the response into.
      • patch

         abstract <T extends Any> Result<T> patch(String endpoint, Object body, KClass<T> responseCast)

        Makes a PATCH request to the Fortress API with a JSON body and deserializes the response. Used for partial updates to existing resources.

        Parameters:
        endpoint - The API endpoint path (e.g., "/shipments/{id}").
        body - The request body object to serialize as JSON.
        responseCast - The Kotlin class to deserialize the response into.
      • delete

         abstract <T extends Any> Result<T> delete(String endpoint, Object body, KClass<T> responseCast)

        Makes a DELETE request to the Fortress API with a JSON body and deserializes the response.

        Parameters:
        endpoint - The API endpoint path (e.g., "/shipments/{id}").
        body - The request body object to serialize as JSON.
        responseCast - The Kotlin class to deserialize the response into.