post

abstract suspend fun <T : Any> post(endpoint: String, body: Any, responseCast: KClass<T>): Result<T>

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

Return

A Result containing the deserialized object on success, or an exception on failure (network error, deserialization error, or HTTP error response).

Parameters

endpoint

The API endpoint path (e.g., "/shipments" or "/shipment_scans"). Will be appended to the base Fortress API URL.

body

The request body object to serialize as JSON.

responseCast

The Kotlin class to deserialize the response into.