@@ -55,6 +55,7 @@ trait LaunchDarklyMTLClient[F[_]] {
55
55
* @return the flag value, suspended in the `F` effect. If evaluation fails for any reason, or the evaluated value cannot be represented as type Int, returns the default value.
56
56
* @see [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/server/interfaces/LDClientInterface.html#intVariation(java.lang.String,com.launchdarkly.sdk.LDContext,int) LDClientInterface#intVariation ]]
57
57
*/
58
+ def intVariation (featureKey : String , defaultValue : Int ): F [Int ]
58
59
59
60
/** @param featureKey the key of the flag to be evaluated
60
61
* @param defaultValue the value to use if evaluation fails for any reason
@@ -113,46 +114,52 @@ object LaunchDarklyMTLClient {
113
114
launchDarklyClient : LaunchDarklyClient [F ]
114
115
)(implicit F : Monad [F ], contextAsk : Ask [F , LDContext ]): LaunchDarklyMTLClient [F ] =
115
116
new LaunchDarklyMTLClient [F ] {
116
- def flush : F [Unit ] = launchDarklyClient.flush
117
+ override def flush : F [Unit ] = launchDarklyClient.flush
117
118
118
- def boolVariation (featureKey : String , defaultValue : Boolean ): F [Boolean ] =
119
+ override def boolVariation (featureKey : String , defaultValue : Boolean ): F [Boolean ] =
119
120
contextAsk.ask.flatMap(launchDarklyClient.boolVariation(featureKey, _, defaultValue))
120
121
121
- def doubleVariation (featureKey : String , defaultValue : Double ): F [Double ] =
122
+ override def intVariation (featureKey : String , defaultValue : Int ): F [Int ] =
123
+ contextAsk.ask.flatMap(launchDarklyClient.intVariation(featureKey, _, defaultValue))
124
+
125
+ override def doubleVariation (featureKey : String , defaultValue : Double ): F [Double ] =
122
126
contextAsk.ask.flatMap(launchDarklyClient.doubleVariation(featureKey, _, defaultValue))
123
127
124
- def jsonValueVariation (
128
+ override def jsonValueVariation (
125
129
featureKey : String ,
126
130
defaultValue : com.launchdarkly.sdk.LDValue ,
127
131
): F [com.launchdarkly.sdk.LDValue ] =
128
132
contextAsk.ask.flatMap(launchDarklyClient.jsonValueVariation(featureKey, _, defaultValue))
129
133
130
- def stringVariation (featureKey : String , defaultValue : String ): F [String ] =
134
+ override def stringVariation (featureKey : String , defaultValue : String ): F [String ] =
131
135
contextAsk.ask.flatMap(launchDarklyClient.stringVariation(featureKey, _, defaultValue))
132
136
133
- def trackFlagValueChanges (
137
+ override def trackFlagValueChanges (
134
138
featureKey : String
135
139
): fs2.Stream [F , com.launchdarkly.sdk.server.interfaces.FlagValueChangeEvent ] =
136
140
Stream .eval(contextAsk.ask).flatMap(launchDarklyClient.trackFlagValueChanges(featureKey, _))
137
141
}
138
142
139
143
def mapK [F [_], G [_]](ldc : LaunchDarklyMTLClient [F ])(fk : F ~> G ): LaunchDarklyMTLClient [G ] =
140
144
new LaunchDarklyMTLClient [G ] {
141
- def boolVariation (featureKey : String , defaultValue : Boolean ): G [Boolean ] =
145
+ override def boolVariation (featureKey : String , defaultValue : Boolean ): G [Boolean ] =
142
146
fk(ldc.boolVariation(featureKey, defaultValue))
143
147
144
- def stringVariation (featureKey : String , defaultValue : String ): G [String ] =
148
+ override def stringVariation (featureKey : String , defaultValue : String ): G [String ] =
145
149
fk(ldc.stringVariation(featureKey, defaultValue))
146
150
147
- def doubleVariation (featureKey : String , defaultValue : Double ): G [Double ] =
151
+ override def intVariation (featureKey : String , defaultValue : Int ): G [Int ] =
152
+ fk(ldc.intVariation(featureKey, defaultValue))
153
+
154
+ override def doubleVariation (featureKey : String , defaultValue : Double ): G [Double ] =
148
155
fk(ldc.doubleVariation(featureKey, defaultValue))
149
156
150
- def jsonValueVariation (featureKey : String , defaultValue : LDValue ): G [LDValue ] =
157
+ override def jsonValueVariation (featureKey : String , defaultValue : LDValue ): G [LDValue ] =
151
158
fk(ldc.jsonValueVariation(featureKey, defaultValue))
152
159
153
- def trackFlagValueChanges (featureKey : String ): Stream [G , FlagValueChangeEvent ] =
160
+ override def trackFlagValueChanges (featureKey : String ): Stream [G , FlagValueChangeEvent ] =
154
161
ldc.trackFlagValueChanges(featureKey).translate(fk)
155
162
156
- def flush : G [Unit ] = fk(ldc.flush)
163
+ override def flush : G [Unit ] = fk(ldc.flush)
157
164
}
158
165
}
0 commit comments