CLASS
ExploreClient
public class ExploreClient: ExploreClientProtocol
Main client for the Omniconvert Server Side Testing SDK
Methods
init(httpClient:storage:userProvider:config:decisionManager:tracker:logger:)
public init(
httpClient: HttpClientProtocol,
storage: StorageFacadeProtocol,
userProvider: UserProviderProtocol,
config: ClientConfig? = nil,
decisionManager: DecisionManagerProtocol? = nil,
tracker: TrackerProtocol? = nil,
logger: LoggerProtocol? = nil
)
Initialize the ExploreClient - Parameters: - httpClient: HTTP client for API communication - storage: Storage facade for data persistence - userProvider: User provider for user management - config: Optional client configuration - decisionManager: Optional custom decision manager - tracker: Optional custom tracker - logger: Optional custom logger
Parameters
| Name | Description |
|---|---|
| httpClient | HTTP client for API communication |
| storage | Storage facade for data persistence |
| userProvider | User provider for user management |
| config | Optional client configuration |
| decisionManager | Optional custom decision manager |
| tracker | Optional custom tracker |
| logger | Optional custom logger |
decide(_:experimentKey:)
public func decide(_ context: Context, experimentKey: String = "") async -> [Decision]
Make decisions for experiments based on context - Parameters: - context: The context containing user and environment information - experimentKey: Optional specific experiment key to decide for - Returns: Array of decisions made
Parameters
| Name | Description |
|---|---|
| context | The context containing user and environment information |
| experimentKey | Optional specific experiment key to decide for |
fetchAndStoreExperimentsConfig()
public func fetchAndStoreExperimentsConfig() async throws -> Bool
Fetch and store experiments configuration from the API - Returns: True if experiments were successfully fetched and stored - Throws: ExploreClientError if API request fails
getConfig()
public func getConfig() -> ClientConfig
Get the client configuration - Returns: The client configuration
getWebsiteId()
public func getWebsiteId() -> String
Get the website ID - Returns: The website ID or empty string if not set
getExperimentsConfig()
public func getExperimentsConfig() -> [String: Experiment]
Get experiments configuration - Returns: Dictionary of experiments
getTracker()
public func getTracker() -> TrackerProtocol
Get the tracker instance - Returns: The tracker
getDecisionManager()
public func getDecisionManager() -> DecisionManagerProtocol
Get the decision manager instance - Returns: The decision manager
getLastDecisions()
public func getLastDecisions() -> [Decision]
Get the last decisions made - Returns: Array of last decisions