Target filter
Search Kotlin docs
  • Back
  • Tealium Prism Kotlin SDK Reference
core/com.tealium.prism.core.api.network/NetworkClient

NetworkClient

interface NetworkClient

Utility class for making asynchronous Http requests.

Requests will be made on an IO thread, but any completions will be executed on the Tealium background thread.

Each client has a fixed list of RequestInterceptors that decide whether a failed request is retried. The shared client in NetworkUtilities.networkClient has none, so it makes a single attempt per request; use newClient to derive a client that retries, e.g. with RequestInterceptors.retryWithBackoff and RequestInterceptors.retryWhenConnected.

Functions

makeNetworkHelper
Link copied to clipboard
open fun makeNetworkHelper(): NetworkHelper

Creates a NetworkHelper that sends every request through this client.

newClient
Link copied to clipboard
open fun newClient(additionalInterceptors: List<RequestInterceptor>): NetworkClient

Same as newClient with a maxRetryCount, with no limit on the number of retries.

abstract fun newClient(additionalInterceptors: List<RequestInterceptor>, maxRetryCount: Int?): NetworkClient

Creates a new NetworkClient from this instance which will also use the given interceptors.

sendRequest
Link copied to clipboard
abstract fun sendRequest(request: HttpRequest, completion: Callback<NetworkResult>): Disposable

Sends an HTTP request asynchronously and returns the result to the provided completion block. The request is retried, when necessary, as decided by this client's interceptors, based on the provided request and the response NetworkResult.

abstract fun sendRequest(request: HttpRequest.Builder, completion: Callback<NetworkResult>): Disposable

Builds the request and sends it asynchronously, returning the result to the provided completion block.

Generated by Dokka
(c) Tealium 2026