> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/server-side/integrations/open-feature/open-feature-js-1/open-feature-js-reference.md).

# 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

```swift

public class ABTastyProvider: FeatureProvider
```

### Metadata

The provider uses custom metadata structure:

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

### Initialization

```swift
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](https://docs.abtasty.com/server-side/sdks/ios/archived-versions/ios/swift-reference.md#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

```swift
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

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

### Feature Flag Evaluation Methods

#### Boolean Evaluation

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

#### String Evaluation

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

#### Integer Evaluation

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

#### Double Evaluation

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

#### Object Evaluation

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.abtasty.com/server-side/integrations/open-feature/open-feature-js-1/open-feature-js-reference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
