Installation

NuGet Package Manager

NuGet\Install-Package getstream-net -Version 11.0.0

Use the latest available SDK release when starting a new integration.
Check getstream-net releases and replace the version if a newer one is available.

.NET CLI

dotnet add package getstream-net --version 11.0.0

PackageReference

Add the following to your .csproj file:

<PackageReference Include="getstream-net" Version="11.0.0" />

GitHub repository: https://github.com/GetStream/getstream-net. Feel free to submit bug reports and feature requests.

The package is tested against these environments:

  • .NET 6.0+ (including .NET 7.0, .NET 8.0+, and .NET 9.0+)

To create a client, you'll need your API key and secret. Both of them can be found in your Stream Dashboard.

You can optionally configure request timeouts and the HTTP connection pool. The default request timeout is 30 seconds.

using GetStream;
using GetStream.Models;

class Program
{
    static async Task Main(string[] args)
    {
        string apiKey = "";
        string secret = "";

        // Create client using ClientBuilder
        var builder = new ClientBuilder()
            .ApiKey(apiKey)
            .ApiSecret(secret);

        // Build the main client
        var client = builder.Build();

        // Build the feeds client
        var feedsClient = builder.BuildFeedsClient();

        // Your feeds operations here...
    }
}

Alternative initialization

You can also initialize the client using configuration:

using GetStream;
using Microsoft.Extensions.Configuration;

// Using configuration
var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();

var builder = new ClientBuilder()
    .ApiKey(configuration["Stream:ApiKey"])
    .ApiSecret(configuration["Stream:Secret"]);

var client = builder.Build();
var feedsClient = builder.BuildFeedsClient();

Connection pool and timeouts

The SDK reuses a single HttpClient backed by a SocketsHttpHandler with keep-alive enabled. Tune it on the ClientBuilder:

MethodDefaultDescription
RequestTimeout30sPer-request timeout.
MaxConnsPerHost5Maximum concurrent connections per host.
IdleTimeout55sIdle connection lifetime.
ConnectTimeout10sTCP + TLS handshake timeout.
var builder = new ClientBuilder()
    .ApiKey(apiKey)
    .ApiSecret(secret)
    .MaxConnsPerHost(10)
    .IdleTimeout(TimeSpan.FromSeconds(55))
    .ConnectTimeout(TimeSpan.FromSeconds(10))
    .RequestTimeout(TimeSpan.FromSeconds(30));

var feedsClient = builder.BuildFeedsClient();

To take full control of the HTTP stack, pass your own HttpClient with .HttpClient(...). When set, the pool options above are not applied.