-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Client / Provider implementation
- Loading branch information
1 parent
12cc54b
commit d37b5dc
Showing
3 changed files
with
86 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
open-feature/sdk/src/main/scala/io/cardell/openfeature/OpenFeature.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
package io.cardell.openfeature | ||
|
||
import io.cardell.openfeature.provider.ProviderMetadata | ||
import cats.Monad | ||
import cats.syntax.all.* | ||
import io.cardell.openfeature.EvaluationContext | ||
import io.cardell.openfeature.provider.Provider | ||
|
||
trait OpenFeature[F[_]] { | ||
def client: FeatureClient[F] | ||
def providerMetadata: ProviderMetadata | ||
|
||
/** Create a client using the default provider | ||
*/ | ||
def client: F[FeatureClient[F]] | ||
} | ||
|
||
protected[openfeature] class OpenFeatureSdk[F[_]: Monad](provider: Provider[F]) | ||
extends OpenFeature[F] { | ||
def client: F[FeatureClient[F]] = | ||
new OpenFeatureClient[F](provider, EvaluationContext.empty).pure[F].widen | ||
} |