Skip to content

Commit

Permalink
Add int details methods
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcardell committed May 10, 2024
1 parent 4e67d71 commit ec91627
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ trait FeatureClient[F[_]] {
options: EvaluationOptions
): F[Int]

def getIntDetails(flagKey: String, default: Int): F[EvaluationDetails[Int]]
def getIntDetails(
flagKey: String,
default: Int,
context: EvaluationContext
): F[EvaluationDetails[Int]]
def getIntDetails(
flagKey: String,
default: Int,
context: EvaluationContext,
options: EvaluationOptions
): F[EvaluationDetails[Int]]

def getDoubleValue(flagKey: String, default: Double): F[Double]
def getDoubleValue(
flagKey: String,
Expand Down Expand Up @@ -253,13 +266,35 @@ protected final class OpenFeatureClient[F[_]: Monad](
context: EvaluationContext,
options: EvaluationOptions
): F[Int] =
getIntDetails(flagKey, default, context, options)
.map(_.value)

override def getIntDetails(
flagKey: String,
default: Int
): F[EvaluationDetails[Int]] =
getIntDetails(flagKey, default, EvaluationContext.empty)

override def getIntDetails(
flagKey: String,
default: Int,
context: EvaluationContext
): F[EvaluationDetails[Int]] =
getIntDetails(flagKey, default, context, EvaluationOptions.Defaults)

override def getIntDetails(
flagKey: String,
default: Int,
context: EvaluationContext,
options: EvaluationOptions
): F[EvaluationDetails[Int]] =
provider
.resolveIntValue(
flagKey,
default,
clientEvaluationContext ++ context
)
.map(_.value)
.map(EvaluationDetails[Int](flagKey, _))

override def getDoubleValue(flagKey: String, default: Double): F[Double] =
getDoubleValue(flagKey, default, EvaluationContext.empty)
Expand Down

0 comments on commit ec91627

Please sign in to comment.