Package blue.starry.penicillin.core.request

Types

Link copied to clipboard
class ApiRequest(val client: ApiClient, val builder: ApiRequestBuilder)

Represents api request methods.

Link copied to clipboard
data class ApiRequestBuilder(    val client: ApiClient,     val httpMethod: HttpMethod,     val host: EndpointHost,     val path: String)

The builder class to construct api request.

Link copied to clipboard
data class EndpointHost(    val domain: String,     val domainForSigning: String? = null,     val protocol: URLProtocol = URLProtocol.HTTPS,     val port: Int = protocol.defaultPort)

Represents endpoint host.

Link copied to clipboard
interface EnumRequestParameter

Represents an enum class can be serialized with "value" property.

Functions

Link copied to clipboard
fun FormBuilder.append(vararg pairs: Pair<String, Any?>)

Appends pairs.

Link copied to clipboard
fun ApiRequestBuilder.formBody(vararg pairs: Pair<String, Any?>, mode: EmulationMode? = null)

Creates "application/x-www-form-urlencoded" content.

Link copied to clipboard
fun ApiRequestBuilder.header(headers: Headers, mode: EmulationMode? = null)

Adds existing Headers instance to headers.

fun ApiRequestBuilder.header(    key: String,     value: Any?,     mode: EmulationMode? = null)

Sets a header key with value, or update existing one with value.

Link copied to clipboard
fun ApiRequestBuilder.headers(vararg pairs: Pair<String, Any?>, mode: EmulationMode? = null)

Sets header keys with value, or update existing one with value.

Link copied to clipboard
fun ApiRequestBuilder.jsonBody(vararg pairs: Pair<String, Any?>, mode: EmulationMode? = null)
fun ApiRequestBuilder.jsonBody(json: JsonObject, mode: EmulationMode? = null)

Creates "application/json" content.

Link copied to clipboard
fun JsonObjectContent(json: JsonObject): TextContent

The OutgoingContent.WriteChannelContent which provides "application/json".

Link copied to clipboard
fun ApiRequestBuilder.multiPartBody(mode: EmulationMode? = null, block: FormBuilder.() -> Unit)

Creates "multipart/form-data" content.

Link copied to clipboard
fun ApiRequestBuilder.parameter(    key: String,     value: Any?,     mode: EmulationMode? = null)

Sets a parameter key with value, or update existing one with value.

Link copied to clipboard
fun ApiRequestBuilder.parameters(vararg pairs: Pair<String, Any?>, mode: EmulationMode? = null)

Sets parameter keys with value, or update existing one with value.

Properties

Link copied to clipboard
val ApiRequestBuilder.url: String

Url string.