Skip to content

Commit

Permalink
Add install and usage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcardell committed May 9, 2024
1 parent 0349f07 commit eba7f17
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ lazy val docs =
)
}
)
.dependsOn(`flipt-sdk-server`.jvm)
41 changes: 41 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,44 @@
- Implementation of a Scala Flipt OpenFeature provider
- Implementation of a Scala LaunchDarkly OpenFeature provider, e.g. with
[Catalyst](https://typelevel.org/catapult)

## Installing

```scala
libraryDependencies += "io.cardell" % "ff4s-flipt-server-sdk" % "@VERSION@"
```

## Usage

```scala mdoc
import cats.effect.IO
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.Uri
import io.cardell.ff4s.flipt.FliptApi
import io.cardell.ff4s.flipt.EvaluationRequest
import io.cardell.ff4s.flipt.auth.AuthenticationStrategy

val url: Uri = Uri.unsafeFromString("https://flipt.example.com")
val token: String = "token"

val resource = EmberClientBuilder
.default[IO]
.build
.map(client =>
FliptApi[IO](client, url, AuthenticationStrategy.ClientToken("token"))
)

resource.use { flipt =>
for {
res <- flipt.evaluateBoolean(
EvaluationRequest(
namespaceKey = "default",
flagKey = "my-flag-1",
entityId = None,
context = Map.empty,
reference = None
)
)
} yield res.enabled
}
```
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
imports = [ typelevel-nix.typelevelShell ];
name = "ff4s-shell";
typelevelShell = {
jdk.package = pkgs.jdk8;
jdk.package = pkgs.jdk11;
nodejs.enable = true;
};
};
Expand Down

0 comments on commit eba7f17

Please sign in to comment.