post

abstract suspend fun <T : Any, R : Any> post(path: String, request: T, requestBodyType: KClass<T>, responseType: KClass<R>): R(source)

Sends an HTTP POST request to the specified path with the provided request payload. The type of the request body and the expected response must be explicitly specified using requestBodyType and responseType, respectively.

Return

The response payload, deserialized into the specified type.

Parameters

path

The endpoint path to which the HTTP POST request is sent.

request

The request payload to be sent in the POST request.

requestBodyType

The Kotlin class reference representing the type of the request body.

responseType

The Kotlin class reference representing the expected type of the response.

Throws

if the request fails or the response cannot be deserialized.


open suspend fun post(path: String, request: String): String(source)

Sends an HTTP POST request to the specified path with the provided request payload.

Return

The response payload from the server, represented as a string.

Parameters

path

The endpoint path to which the HTTP POST request is sent.

request

The request payload to be sent in the POST request. It must be a string.