JsonConfigParser

public struct JsonConfigParser

Parses a unified SDK configuration dictionary.

Wraps a [String: Any] dictionary and provides typed accessors that throw JsonConfigError on missing or incorrectly-typed fields.

  • Declaration

    Swift

    public init(_ json: [String : Any])
  • Returns the value for key cast to T. Throws .missingRequiredField when absent, .invalidType on wrong type.

    Declaration

    Swift

    public func required<T>(_ key: String, field: String) throws -> T
  • Returns the value for key cast to T, or defaultValue when absent. Throws .invalidType on wrong type.

    Declaration

    Swift

    public func optional<T>(_ key: String, field: String, default defaultValue: T) throws -> T
  • Returns the value for key cast to T, or nil when absent. Throws .invalidType on wrong type.

    Declaration

    Swift

    public func optionalValue<T>(_ key: String, field: String) throws -> T?
  • Parses "log" as a log-level string and returns the matching Logger. Defaults to LogManager.logger when absent. A present but wrong-type value is silently ignored (falls back to LogManager.none) rather than throwing, because log level is advisory and should never block SDK initialisation.

    Declaration

    Swift

    public func logLevel() -> Logger
  • Parses "timeout" as milliseconds and returns a TimeInterval in seconds. Defaults to defaultValue when absent.

    Declaration

    Swift

    public func timeoutSeconds(default defaultValue: TimeInterval = 15.0) throws -> TimeInterval