PortalRequests

open class PortalRequests(onUnauthorized: () -> Unit? = null, connectTimeoutMs: Int = DEFAULT_CONNECT_TIMEOUT_MS, readTimeoutMs: Int = DEFAULT_READ_TIMEOUT_MS)

Coroutine-based HTTP transport used by every API class in the SDK.

HTTP error semantics (since 9.0.0):

disconnect() is guaranteed on every path via a try/finally wrapper.

Timeouts: every request is bounded. HttpURLConnection defaults both timeouts to 0, meaning infinite, so a backend or proxy that accepts the TCP connection and never answers would otherwise suspend the caller until process death — and callers that hold a lock across a request (PortalAuth holds grantLock across the grant exchange, so a hang there wedges sign-out too) have no way to recover, since the blocking read on Dispatchers.IO is not cancellable and a withTimeout around it would not release the lock.

Parameters

onUnauthorized

See the property of the same name.

connectTimeoutMs

Cap on establishing the connection.

readTimeoutMs

Cap on waiting for response data. Matches the 60s iOS URLSessionConfiguration.default request timeout; postEnclaveMPCApi overrides it, see ENCLAVE_READ_TIMEOUT_MS.

Constructors

Link copied to clipboard
constructor(onUnauthorized: () -> Unit? = null, connectTimeoutMs: Int = DEFAULT_CONNECT_TIMEOUT_MS, readTimeoutMs: Int = DEFAULT_READ_TIMEOUT_MS)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Invoked when a request that carried a Portal bearer token comes back 401, so a dead credential is dropped rather than replayed on the next call.

Functions

Link copied to clipboard
open suspend fun delete(url: URL, bearerToken: String? = null, traceId: String? = null): String
Link copied to clipboard
open suspend fun get(url: URL, bearerToken: String? = null, traceId: String? = null): String
Link copied to clipboard
open suspend fun patch(url: URL, bearerToken: String? = null, payload: String, traceId: String? = null): String
Link copied to clipboard
open suspend fun post(url: URL, bearerToken: String? = null, payload: String?, traceId: String? = null): String
Link copied to clipboard
open suspend fun put(url: URL, bearerToken: String? = null, payload: String?, traceId: String? = null): String