Network
-
Protocol for sending network requests and handling responses.
See moreDeclaration
Swift
public protocol NetworkClient -
The connection as it’s reported by the system monitors
See moreDeclaration
Swift
public enum NetworkConnection : Equatable -
An error returned from an http request.
See moreDeclaration
Swift
public struct NetworkError : Error -
Protocol defining methods for common, uncompressed network operations.
Implementations are a short-circuit for standard requests only; bodies are never compressed. For gzip or otherwise customized requests, use
See moreNetworkClientwith aRequestBuilder.Declaration
Swift
public protocol NetworkHelperProtocol -
A successful response returned by the NetworkClient
See moreDeclaration
Swift
public struct NetworkResponse -
NetworkResultFrom TealiumPrismCoreA successful Result with a NetworkResponse or a failed Result with NetworkError, returned by the NetworkClient
Declaration
Swift
public typealias NetworkResult = Result<NetworkResponse, NetworkError> -
Groups the networking utilities for a given
Tealiuminstance onto a single object.networkClientandnetworkHelpermake a single attempt for each request and never retry it. Every response still feeds the empirical connectivity of theconnectivityManager.To retry failed requests, derive a client with
See moreNetworkClient.newClient(withAdditionalInterceptors:), addingRequestInterceptors.retryWithBackoff()to retry retryable failures with a backoff and/orRequestInterceptors.retryWhenConnected(connectivityManager:)to wait for connectivity to return before retrying. UseNetworkClient.makeNetworkHelper()to send requests through the derived client with theNetworkHelperProtocolAPI.Declaration
Swift
public final class NetworkUtilities -
A manager that handles system connectivity monitor and empirical connectivity monitor to establish when connectivity is actually available or not on the device.
See
See moreconnectionAssumedAvailablefor how the two are combined.Declaration
Swift
public class ConnectivityManager : ConnectivityManagerProtocol, RequestInterceptor -
Protocol for managing network connectivity state and monitoring.
See moreDeclaration
Swift
public protocol ConnectivityManagerProtocol -
Protocol for intercepting and handling network requests and responses.
See moreDeclaration
Swift
public protocol RequestInterceptor : AnyObject -
Factories for the built-in
RequestInterceptors that add retry behavior to aNetworkClient.Pass the created interceptors to
NetworkClient.newClient(withAdditionalInterceptors:maxRetryCount:). Interceptors are consulted in reverse order, so addretryWhenConnected(connectivityManager:)last: it is then asked first and, while the connection is assumed unavailable, waits for it instead of lettingretryWithBackoff(...)use up its attempts:
See morelet client = context.network.networkClient.newClient(withAdditionalInterceptors: [ RequestInterceptors.retryWithBackoff(maxAttempts: 3), RequestInterceptors.retryWhenConnected(connectivityManager: context.network.connectivityManager) ], maxRetryCount: 10)Declaration
Swift
public enum RequestInterceptors -
Parameters for configuring a resource refresher.
See moreDeclaration
Swift
public struct RefreshParameters -
An object that refreshes a single resource at regular intervals.
Refresh is requested by the user of ths class, but it’s ignored unless the required intervals have passed. The resource is cached locally and it’s re-read only on initialization or when subscribing
onResourceLoaded.You can listen to resource updates by using the
See moreonResourceLoadedobservable. This will first push an event with a resource read from disk, if present, and then all refreshes from remote.Declaration
Swift
public class ResourceRefresher<Resource> where Resource : Decodable, Resource : Encodable -
A builder for
URLRequests to send through aNetworkClient.Use the
See moremakePOST(url:json:)/makeGET(url:etag:)factories to start a request, chain the builder methods to configure it, and hand the builder toNetworkClient.sendRequest(_:completion:)(which builds it for you). Request bodies are uncompressed by default; opt into gzip compression withgzip().Declaration
Swift
public class RequestBuilderextension RequestBuilder: CustomStringConvertible -
What to do when a
See moreRetry-Afterheader is above the maximum delay allowed for a retry.Declaration
Swift
public enum RetryAfterAboveMaxDelay -
The policy, returned by a
See moreRequestInterceptorthat theNetworkClientshould apply on a givenNetworkResponse.Declaration
Swift
public enum RetryPolicy -
Declaration
-
Declaration
-
A protocol used to receive requests with String/URL/URLComponents intercheangebly
See moreDeclaration
Swift
public protocol URLConvertible -
ErrorCooldownFrom TealiumPrismCoreAn object that increases a cooldown for every error event, and resets the cooldown to 0 when a non-error event happens.
Declaration
Swift
public class ErrorCooldown -
A response containing a decoded object and the HTTP response.
See moreDeclaration
Swift
public struct ObjectResponse<T> -
ObjectResultFrom TealiumPrismCoreA result type for object responses.
Declaration
Swift
public typealias ObjectResult<T> = Result<ObjectResponse<T>, NetworkError>
View on GitHub
Network Reference