From 3d089f5c48478d7151fcf5964aa545471a0afe5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Kj=C3=A6r=20Henneberg?= Date: Tue, 9 Apr 2024 01:31:59 +1200 Subject: [PATCH] fix: Fix Statsig nuget package name (#172) Signed-off-by: Jens Henneberg --- ...enFeature.Contrib.Providers.Statsig.csproj | 2 +- .../README.md | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Statsig/OpenFeature.Contrib.Providers.Statsig.csproj b/src/OpenFeature.Contrib.Providers.Statsig/OpenFeature.Contrib.Providers.Statsig.csproj index 712d5029..d3e6084b 100644 --- a/src/OpenFeature.Contrib.Providers.Statsig/OpenFeature.Contrib.Providers.Statsig.csproj +++ b/src/OpenFeature.Contrib.Providers.Statsig/OpenFeature.Contrib.Providers.Statsig.csproj @@ -1,7 +1,7 @@  - OpenFeature.Contrib.Provider.Statsig + OpenFeature.Contrib.Providers.Statsig 0.0.3 $(VersionNumber) preview diff --git a/src/OpenFeature.Contrib.Providers.Statsig/README.md b/src/OpenFeature.Contrib.Providers.Statsig/README.md index 20b68fd8..070c5571 100644 --- a/src/OpenFeature.Contrib.Providers.Statsig/README.md +++ b/src/OpenFeature.Contrib.Providers.Statsig/README.md @@ -10,32 +10,32 @@ The first things we will do is install the **Open Feature SDK** and the **Statsi ### .NET Cli ```shell -dotnet add package OpenFeature.Contrib.Provider.Statsig +dotnet add package OpenFeature.Contrib.Providers.Statsig ``` ### Package Manager ```shell -NuGet\Install-Package OpenFeature.Contrib.Provider.Statsig +NuGet\Install-Package OpenFeature.Contrib.Providers.Statsig ``` ### Package Reference ```xml - + ``` ### Packet cli ```shell -paket add OpenFeature.Contrib.Provider.Statsig +paket add OpenFeature.Contrib.Providers.Statsig ``` ### Cake ```shell -// Install OpenFeature.Contrib.Provider.Statsig as a Cake Addin -#addin nuget:?package= OpenFeature.Contrib.Provider.Statsig +// Install OpenFeature.Contrib.Providers.Statsig as a Cake Addin +#addin nuget:?package= OpenFeature.Contrib.Providers.Statsig -// Install OpenFeature.Contrib.Provider.Statsig as a Cake Tool -#tool nuget:?package= OpenFeature.Contrib.Provider.Statsig +// Install OpenFeature.Contrib.Providers.Statsig as a Cake Tool +#tool nuget:?package= OpenFeature.Contrib.Providers.Statsig ``` ## Using the Statsig Provider with the OpenFeature SDK @@ -44,7 +44,7 @@ The following example shows how to use the Statsig provider with the OpenFeature ```csharp using OpenFeature; -using OpenFeature.Contrib.Provider.Statsig; +using OpenFeature.Contrib.Providers.Statsig; using System; StatsigProvider statsigProvider = new StatsigProvider("#YOUR-SDK-KEY#"); @@ -52,7 +52,10 @@ StatsigProvider statsigProvider = new StatsigProvider("#YOUR-SDK-KEY#"); // Set the statsigProvider as the provider for the OpenFeature SDK await Api.Instance.SetProviderAsync(statsigProvider); -IFeatureClient client = OpenFeature.Api.Instance.GetClient(); +var eb = EvaluationContext.Builder(); +eb.SetTargetingKey("john@doe.acme"); + +IFeatureClient client = Api.Instance.GetClient(context: eb.Build()); bool isMyAwesomeFeatureEnabled = await client.GetBooleanValue("isMyAwesomeFeatureEnabled", false); @@ -65,10 +68,10 @@ if (isMyAwesomeFeatureEnabled) ### Customizing the Statsig Provider -The Statsig provider can be customized by passing a `Action` object to the constructor. +The Statsig provider can be customized by passing a `StatsigServerOptions` object to the constructor. ```csharp -var statsigProvider = new StatsigProvider("#YOUR-SDK-KEY#", options => options.LocalMode = true); +var statsigProvider = new StatsigProvider("#YOUR-SDK-KEY#", new StatsigServerOptions() { LocalMode = true }); ``` For a full list of options see the [Statsig documentation](https://docs.statsig.com/server/dotnetSDK#statsig-options).