Seam 1.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Seam --version 1.4.0
                    
NuGet\Install-Package Seam -Version 1.4.0
                    
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="Seam" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Seam" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Seam" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Seam --version 1.4.0
                    
#r "nuget: Seam, 1.4.0"
                    
#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.
#:package Seam@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Seam&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Seam&version=1.4.0
                    
Install as a Cake Tool

Seam C#

GitHub Actions

SDK for the Seam API written in C#.

Installation

Use NuGet to install.

Usage

using Seam.Client;

var seam = new SeamClient(apiToken: "YOUR_API_KEY");

var myDevices = seam.Devices.List();

Console.WriteLine("First Device Name: " + myDevices[0].Properties.Name);

var accessCode = seam.AccessCodes.Create(deviceId: myDevices[0].DeviceId, code: "1234");

Setting a value to null

The Seam API distinguishes three states for an updatable parameter: omitted (leave the stored value unchanged), null (unset the stored value), and a value (set it).

C#'s null means omitted. The SDK removes null parameters from the request entirely, so passing null never unsets a value. To unset a value, pass the Null.Value sentinel, which the SDK sends as JSON null in request bodies and as an empty value in query strings:

// Omits custom_metadata, leaving the stored metadata unchanged.
seam.Devices.Update(deviceId: deviceId, customMetadata: null);

// Unsets the sync key of the stored metadata.
seam.Devices.Update(
    deviceId: deviceId,
    customMetadata: new Dictionary<string, object> { ["sync"] = Null.Value }
);

Only pass Null.Value where the Seam API documents a value as nullable. A parameter typed as a specific C# type, e.g. string?, does not accept the sentinel: pass it wherever a parameter is typed object, and to the URL search params serializer below.

Advanced Usage

Setting the request timeout

Requests time out after 30 seconds by default. Pass the timeout option, in milliseconds, to override this:

var seam = new SeamClient(apiToken: "YOUR_API_KEY", timeout: 60000);

The default may also be changed for every client at once:

GlobalSeamRequestConfiguration.Instance.Timeout = 60000;

Serializing URL search params

The Seam API parses URL search params as complex types. The SDK serializes the params of every endpoint the Seam API prefers to receive as a GET or DELETE this way. If you call the API with your own HTTP client, StrictUrlSearchParamsSerializer is exported for that purpose. The _strict=true parameter is added to any non-empty query so the Seam API uses strict, schema-aware parsing. A query with no serializable parameters remains empty.

using Seam.Client;

var query = StrictUrlSearchParamsSerializer.Serialize(
    new Dictionary<string, object> { ["device_ids"] = new[] { "device1", "device2" } }
);

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your-api-key");

var devices = await client.GetStringAsync($"https://connect.getseam.com/devices/list?{query}");

The serialization defines the name and value of each search param, where every value is a string. UrlSearchParams holds those pairs and renders the query string, as URLSearchParams does for the reference implementation:

using Seam.Client;

var searchParams = new UrlSearchParams();

StrictUrlSearchParamsSerializer.Update(
    searchParams,
    new Dictionary<string, object> { ["device_ids"] = new[] { "device1", "device2" } }
);

searchParams.Select(pair => (pair.Key, pair.Value)).ToList();
// => [("device_ids", "device1"), ("device_ids", "device2"), ("_strict", "true")]

searchParams.ToString();
// => "device_ids=device1&device_ids=device2&_strict=true"

Pass either the query string or the pairs to your HTTP client. A client may percent-encode a few characters differently than URLSearchParams does, which the Seam API reads as the same params either way.

A parameter set to null is omitted, while a parameter set to Null.Value is serialized to an empty value, which the Seam API reads as null, as described in Setting a value to null. A parameter that cannot be represented throws an UnserializableParamError.

The Seam API parses these params with the corresponding parser.

Development and Testing

Quickstart

Install the .NET SDK 10.0 or later, just and Node.js, then run

$ git clone git@github.com:seamapi/csharp.git
$ cd csharp
$ npm install
$ dotnet tool restore

Primary development tasks are defined in the justfile and available via just. View them with

$ just --list
Task Command
Run the tests just test
Lint just lint
Format just format
Build the package just build
Generate the SDK npm run generate

The npm scripts only drive the codegen layer: npm run generate regenerates the SDK, and npm run lint and npm run format cover the TypeScript, JSON, YAML and Markdown sources with ESLint and Prettier. C# sources are formatted by CSharpier, pinned as a local dotnet tool in .config/dotnet-tools.json.

Run the full suite with

$ just test

To run the tests for a single target framework, pass it as an argument

$ just test net8.0

Requirements

The package targets .NET 8.0 and .NET 10.0, the supported LTS releases. Continuous integration exercises both target frameworks.

Publishing

Automatic

New versions are released automatically from main by the Semantic Release workflow, which reads Conventional Commits and dispatches the Version workflow.

Manual

Run the Version workflow with the version to cut. It runs npm version, which bumps the version field in package.json, injects that version into Seam.csproj, creates a signed v* git tag and pushes it. Pushing the tag triggers the Publish workflow, which packs the library with dotnet pack and pushes the package to NuGet and GitHub Packages.

The version lives in package.json, the development manifest that drives the codegen. version.ts, wired to the version lifecycle script, injects it into the <Version> element of Seam.csproj, which npm runs after the bump but before the commit, so the updated project file is part of the tagged commit and MSBuild surfaces the version at runtime through AssemblyInformationalVersionAttribute. Never edit the version in Seam.csproj by hand.

License

This C# SDK is licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
2.0.0-beta.5 37 8/27/2026
2.0.0-beta.4 35 8/27/2026
2.0.0-beta.3 52 8/20/2026
2.0.0-beta.2 51 8/20/2026
2.0.0-beta.1 62 8/20/2026
1.5.0 77 8/26/2026
1.4.0 297 8/20/2026
1.3.0 98 8/19/2026
1.2.0 950 8/14/2026
1.1.0 103 8/11/2026
1.0.1 671 8/6/2026
1.0.0 121 7/31/2026
0.99.0 238 7/29/2026
0.98.0 181 7/24/2026
0.97.0 126 7/23/2026
0.96.0 8,965 1/21/2026
0.95.0 729 9/18/2025
0.94.1 454 9/17/2025
0.94.0 2,059 9/5/2025
0.93.0 274 9/5/2025
Loading failed