NetworkEndpoint

interface NetworkEndpoint

A type-safe description of one HTTP endpoint. Mirrors SwiftyNetwork's NetworkEndpoint.

Implement this (typically as an object or data class per route) and pass it to NetworkClient. Only baseUrl, path, and method are required; the rest default sensibly.

Properties

Link copied to clipboard

Per-request authorization; defaults to AuthorizationType.None (use the client provider).

Link copied to clipboard
abstract val baseUrl: String

The scheme + host (+ optional base path), e.g. https://api.example.com.

Link copied to clipboard
open val body: ByteArray?

A raw request body, or null. Ignored when a typed body is passed to the client.

Link copied to clipboard
open val headers: Map<String, String>?

Extra request headers, or null for none.

Link copied to clipboard
abstract val method: HttpMethod

The HTTP method.

Link copied to clipboard
abstract val path: String

The path relative to baseUrl, e.g. videos/42. Leading/trailing slashes are normalized.

Link copied to clipboard

Query parameters appended to the URL, or null for none.