Reference

Overview

ABTastyProvider is an implementation of OpenFeature's FeatureProvider protocol that integrates with AB Tasty's feature flag management system through the Flagship SDK. It provides a bridge between OpenFeature's standardized API and AB Tasty's functionality.

Class Definition


public class ABTastyProvider: FeatureProvider

Metadata

The provider uses custom metadata structure:

public struct ABTastyMetadata: ProviderMetadata {
    public var name: String? = "FlagshipProvider"
}

Initialization

public init(
    envId: String,
    apiKey: String,
    configurator: FlagshipConfig
)

Parameter
Type
Description

envId

String

Environment ID provided by Flagship

apiKey

String

Api authentication key provided by Flagship.

configurator

FlagshipConfig

Custom flagship configuration. see SDK configuration

Core Methods

Initialize

Initializes the provider with optional context data. This method:

- Processes the initial context into Flagship format

- Extracts consent information

- Creates an AB Tasty client instance

public func initialize(
    initialContext: (any OpenFeature.EvaluationContext)?
) async throws

Context Management

Updates the provider context with new evaluation context data. This method:

- Converts OpenFeature context to Flagship format

- Updates consent status

- Updates visitor ID

- Updates ABTasty client with new context

public func onContextSet(
    oldContext: (any OpenFeature.EvaluationContext)?, 
    newContext: any OpenFeature.EvaluationContext
) async throws

Feature Flag Evaluation Methods

Boolean Evaluation

public func getBooleanEvaluation(
    key: String,
    defaultValue: Bool,
    context: (any OpenFeature.EvaluationContext)?
) throws -> OpenFeature.ProviderEvaluation<Bool>

String Evaluation

public func getStringEvaluation(
    key: String,
    defaultValue: String,
    context: (any OpenFeature.EvaluationContext)?
) throws -> OpenFeature.ProviderEvaluation<String>

Integer Evaluation

public func getIntegerEvaluation(
    key: String,
    defaultValue: Int64,
    context: (any OpenFeature.EvaluationContext)?
) throws -> OpenFeature.ProviderEvaluation<Int64>

Double Evaluation

public func getDoubleEvaluation(
    key: String,
    defaultValue: Double,
    context: (any OpenFeature.EvaluationContext)?
) throws -> OpenFeature.ProviderEvaluation<Double>

Object Evaluation

public func getObjectEvaluation(
    key: String,
    defaultValue: OpenFeature.Value,
    context: (any OpenFeature.EvaluationContext)?
) throws -> OpenFeature.ProviderEvaluation<OpenFeature.Value>

Last updated

Was this helpful?