The Chalk C# client library provides a convenient way to query features from your C# and .NET applications.


Installation

Install the Chalk C# client using the .NET CLI:

dotnet add package Chalk.Client

Or using the Package Manager Console:

Install-Package Chalk.Client

Basic Usage

Here’s a quick example of how to use the Chalk C# client:

using Chalk;
using Chalk.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        // Initialize the client
        IChalkClient client = ChalkClient.Builder()
            .WithClientId("your-client-id")
            .WithClientSecret("your-client-secret")
            .WithEnvironmentId("your-environment-id")
            .Build();

        // Query features
        OnlineQueryResult result = await client.OnlineQueryAsync(new OnlineQueryParams
        {
            Inputs = new Dictionary<string, IList<object?>>
            {
                { "user.id", new List<object?> { "user123" } }
            },
            Outputs = new List<string>
            {
                "user.credit_score",
                "user.account_age_days"
            }
        });

        Console.WriteLine(result);
    }
}

Next Steps