← Back to Documentation Home

CLASS

HttpClient

public class HttpClient: HttpClientProtocol

HTTP client for communicating with the Omniconvert API

Properties

hasCacheBypass

public var hasCacheBypass: Bool

Check if cache bypass is enabled

Methods

init(apiKey:baseUrl:cacheBypass:)

public init(apiKey: String, baseUrl: String = "https://app.omniconvert.com/", cacheBypass: Bool = false)

Initialize HTTP client - Parameters: - apiKey: The API key for authentication - baseUrl: The base URL for the API (defaults to production) - cacheBypass: Whether to bypass cache (for development)

Parameters

Name Description
apiKey The API key for authentication
baseUrl The base URL for the API (defaults to production)
cacheBypass Whether to bypass cache (for development)

requestExperiments()

public func requestExperiments() async throws -> ApiResponse

Request experiments configuration from the API - Returns: ApiResponse containing experiments data - Throws: HttpClientError for various error conditions

track(_:value:details:)

public func track(_ event: String, value: Double? = nil, details: [String: Any]? = nil) async throws

Track an event to the API - Parameters: - event: The event name - value: Optional event value - details: Optional event details - Throws: HttpClientError for various error conditions

Parameters

Name Description
event The event name
value Optional event value
details Optional event details

trackWithQueryParams(_:)

public func trackWithQueryParams(_ params: [String: String]) async throws

Track an event using GET with query parameters (matching Kotlin/PHP implementation) - Parameter params: Query parameters as key-value pairs - Throws: HttpClientError for various error conditions

Parameters

Name Description
params Query parameters as key-value pairs