joystick-csharp 1.0.2-alpha

This is a prerelease version of joystick-csharp.
dotnet add package joystick-csharp --version 1.0.2-alpha
NuGet\Install-Package joystick-csharp -Version 1.0.2-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="joystick-csharp" Version="1.0.2-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add joystick-csharp --version 1.0.2-alpha
#r "nuget: joystick-csharp, 1.0.2-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install joystick-csharp as a Cake Addin
#addin nuget:?package=joystick-csharp&version=1.0.2-alpha&prerelease

// Install joystick-csharp as a Cake Tool
#tool nuget:?package=joystick-csharp&version=1.0.2-alpha&prerelease

.NET Client for Joystick Remote Config

This is a library that simplifies communicating with the Joystick API for using remote configs with your C# project. Joystick is a modern remote config platform where you manage all of your configurable parameters. We are natively multi-environment, preserve your version history, have advanced work-flow & permissions management, and much more. Have one API to use for any JSON configs.

Provided client is supporting .NET Standard 2.1+, .NET Core 3.1+, .NET 5.0+, .NET 6.0+, .NET 7.0+.

Installation

Using the [.NET Core command-line interface (CLI) tools][dotnet-core-cli-tools]:

dotnet add package Joystick

Using the [NuGet Command Line Interface (CLI)][nuget-cli]:

nuget install Joystick

Using the [Package Manager Console][package-manager-console]:

Install-Package Joystick

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "Joystick".
  5. Click on the Stripe.net package, select the appropriate version in the right-tab and click Install.

Usage

Using Joystick to get remote configurations in your .NET project is a breeze.

// Import the package.
using Joystick.Client;

// Initialize a client with a Joystick API Key
var config = new JoystickClientConfig()
{
    ApiKey = "<put-your-api_key-here>",
};
var joystickClient = new JoystickClient(config);

// Request a single configuration as Newtonsoft JObject
const contentId1 = await joystickClient.GetContentAsync("content-id1");

// Request a typed single configuration
const contentId1Typed = await joystickClient.GetContentAsync<TypeForContentId1>(
"content-id1"
);

// Request multiple configurations at the same time
const configurations = await joystickClient.GetContentsAsync(new[]{
    "content-id1",
    "content-id2",
});

// {
//     "content-id1": {...},
//     "content-id2": {...}
// }

Specifying Additional Parameters

When creating the Joystick object, you can specify additional parameters which will be used by all API calls to the Joystick API. These additional parameters are used for AB Testing (userId), segmentation (params), and backward-compatible version delivery (semVer).

For more details see API documentation.

// Initializing a client with options
var config = new JoystickClientConfig()
{
  ApiKey = "some-api-key",
  SemVer = "0.0.1",
  UserId = "user-id-1",
  Params = new Dictionary<string, object>()
  {
    { "Country", "PL" },
    { "UserPrc", 85.08 },
  },
  CacheOptions = new JoystickCacheOptions() {
    CacheExpirationSeconds = 600, // default 600 (10 mins)
  },
};

Error handling

The client can raise different types of exceptions with the base class of JoystickException.

try {
    const configurations = await joystickClient.GetContentsAsync(new[]{
        "content-id1",
        "content-id2",
    });
} 
catch (JoystickApiHttpException e) {
    // Handle HTTP error (i.e. timeout, or invalid HTTP code)
}
catch (MultipleContentsApiException e) {
    // Handle API exception (i.e. content is not found, or some of the keys can't be retrieved)
}

Caching

By default, the client uses JoystickDefaultCacheService, based on MemoryCache.

You can specify your own cache implementation by implementing the interface SdkCache.

Refresh option

To ignore the existing cache when requesting a config � pass this option as true.

var options = new JoystickContentOptions()
{
    Refresh = true;
}

await joystickClient
  .GetContentAsync("content-id1", options);

// OR

await joystickClient
  .GetContentsAsync(new[] {"content-id1", "content-id2"}, options);
Clear the cache

If you want to clear the cache:

joystickClient.ClearCache();

License

The MIT. Please see License File for more information.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2-alpha 82 8/18/2023
1.0.1-beta 137 11/30/2022
1.0.1-alpha 68 8/17/2023
1.0.0-beta 128 11/17/2022