> 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](/server-side/sdks/ios/ios-1/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
