Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.network/NetworkHelper

NetworkHelper

interface NetworkHelper

Utility interface for making basic async network requests. For more complex requirements, use the NetworkClient instead.

Types

HttpValue
Link copied to clipboard
data class HttpValue<T>(val value: T, val httpResponse: HttpResponse)

Data class for holding a generic value along with the HttpResponse

Functions

get
Link copied to clipboard
abstract fun get(url: URL, etag: String? = null, additionalHeaders: Map<String, String>? = null, completion: NetworkCallback<NetworkResult>): Disposable
abstract fun get(url: String, etag: String? = null, additionalHeaders: Map<String, String>? = null, completion: NetworkCallback<NetworkResult>): Disposable

Asynchronously fetches the given url. An optional etag can be supplied if the resource being requested is already available on the device and may be able to be re-used.

getDataItemConvertible
Link copied to clipboard
abstract fun <T> getDataItemConvertible(url: URL, etag: String? = null, additionalHeaders: Map<String, String>? = null, converter: DataItemConverter<T>, completion: DeserializedNetworkCallback<T>): Disposable
abstract fun <T> getDataItemConvertible(url: String, etag: String? = null, additionalHeaders: Map<String, String>? = null, converter: DataItemConverter<T>, completion: DeserializedNetworkCallback<T>): Disposable

Asynchronously fetches the given url and returns the payload parsed as a DataItem and then converted to an instance of T using by the given converter.

getDataObject
Link copied to clipboard
abstract fun getDataObject(url: URL, etag: String? = null, additionalHeaders: Map<String, String>? = null, completion: DeserializedNetworkCallback<DataObject>): Disposable
abstract fun getDataObject(url: String, etag: String? = null, additionalHeaders: Map<String, String>? = null, completion: DeserializedNetworkCallback<DataObject>): Disposable

Asynchronously fetches the given url and returns the payload parsed as a DataObject An optional etag can be supplied if the resource being requested is already available on the device and may be able to be re-used.

getDeserializable
Link copied to clipboard
abstract fun <T> getDeserializable(url: URL, etag: String? = null, additionalHeaders: Map<String, String>? = null, deserializer: Deserializer<String, T?>, completion: DeserializedNetworkCallback<T>): Disposable
abstract fun <T> getDeserializable(url: String, etag: String? = null, additionalHeaders: Map<String, String>? = null, deserializer: Deserializer<String, T?>, completion: DeserializedNetworkCallback<T>): Disposable

Asynchronously fetches the given url and returns the payload parsed as a String and then converted to an instance of T using by the given deserializer.

getJson
Link copied to clipboard
abstract fun getJson(url: URL, etag: String? = null, additionalHeaders: Map<String, String>? = null, completion: DeserializedNetworkCallback<JSONObject>): Disposable
abstract fun getJson(url: String, etag: String? = null, additionalHeaders: Map<String, String>? = null, completion: DeserializedNetworkCallback<JSONObject>): Disposable

Asynchronously fetches the given url and returns the payload parsed as a JSONObject An optional etag can be supplied if the resource being requested is already available on the device and may be able to be re-used.

post
Link copied to clipboard
abstract fun post(url: URL, payload: DataObject?, additionalHeaders: Map<String, String>? = null, completion: NetworkCallback<NetworkResult>): Disposable
abstract fun post(url: String, payload: DataObject?, additionalHeaders: Map<String, String>? = null, completion: NetworkCallback<NetworkResult>): Disposable

Asynchronously POSTs the payload to the given url.

Generated by Dokka
(c) Tealium 2026