vncore / com.venuenext.vncore.http / HttpClient

HttpClient

open class HttpClient : HttpInterface

Constructors

<init>

HttpClient(context: Context)

Properties

context

val context: Context

Functions

call

Makes an HTTP request call, and serializes response.

open fun <T : Any> call(request: HttpRequest, serializer: KSerializer<T>?): HttpResponse<T>
open fun <T : Any> call(request: HttpRequest, serializer: KSerializer<T>?, success: (result: HttpResponse<T>) -> Unit, failure: (Exception) -> Unit): Unit

readErrorStream

fun readErrorStream(connection: HttpURLConnection): String

readInputStream

Reads response byte array to connection input stream.

open fun readInputStream(connection: HttpURLConnection): String

setRequestHeaders

Sets request headers in URL connection.

open fun setRequestHeaders(connection: HttpURLConnection, request: HttpRequest): Unit

writeBody

Writes body byte array to connection output stream.

open fun writeBody(connection: HttpURLConnection, request: HttpRequest): Unit

Extension Functions

delete

fun <T : Any> HttpClient.delete(url: String, authProvider: OAuth?, serializer: KSerializer<T>? = null, body: ByteArray? = null, contentType: String? = APPLICATION_JSON): HttpResponse<T>

get

fun <T : Any> HttpClient.get(url: String, authProvider: OAuth?, serializer: KSerializer<T>? = null, body: ByteArray? = null, contentType: String? = APPLICATION_JSON): HttpResponse<T>

patch

fun <T : Any> HttpClient.patch(url: String, authProvider: OAuth?, serializer: KSerializer<T>? = null, body: ByteArray? = null, contentType: String? = APPLICATION_JSON): HttpResponse<T>

post

fun <T : Any> HttpClient.post(url: String, authProvider: OAuth?, serializer: KSerializer<T>? = null, body: ByteArray? = null, contentType: String? = APPLICATION_JSON): HttpResponse<T>

Inheritors

DeviceService

DeviceService VenueNext

class DeviceService : HttpClient

EnvironmentService

EnvironmentService VenueNext

class EnvironmentService : HttpClient

UserService

UserService VenueNext

class UserService : HttpClient