Lemmy.Net 2.0.0

dotnet add package Lemmy.Net --version 2.0.0
                    
NuGet\Install-Package Lemmy.Net -Version 2.0.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="Lemmy.Net" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lemmy.Net" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lemmy.Net" />
                    
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 Lemmy.Net --version 2.0.0
                    
#r "nuget: Lemmy.Net, 2.0.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 Lemmy.Net@2.0.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=Lemmy.Net&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lemmy.Net&version=2.0.0
                    
Install as a Cake Tool

Lemmy.Net

NuGet CI

A strongly typed .NET client for the Lemmy v3 API.

Support

Lemmy.Net targets .NET 10 and tracks the API used by Lemmy 0.19.20. Its generated models are pinned to commit 48bd89285e8c3da85cddb020ce8dbc3c94846670 of the upstream lemmy-js-client v0.19 branch.

The .NET Lemmy ecosystem remains small. As of September 2026, the other public NuGet clients (Lemmy.Net.Client and dotNETLemmy.API) have not received code updates since 2023. There is no maintained, dominant replacement for this library, so continued maintenance is useful rather than redundant.

Installation

dotnet add package Lemmy.Net

Usage

using Lemmy.Net;

using var client = new LemmyHttp("https://lemmy.ml");

await foreach (var postView in client.GetAllPosts())
{
    Console.WriteLine(postView.Post.Name);
}

Authenticated requests use a bearer token:

if (!await client.Login("username", "password"))
    throw new InvalidOperationException("Login failed.");

var replies = await client.GetReplies(new() { UnreadOnly = true });

See the examples and the upstream lemmy-js-client API documentation for the corresponding request and response types.

Regenerating API models

The model generator is deliberately dependency-light. It downloads an exact upstream commit, converts the ts-rs TypeScript declarations to nullable C# models, and replaces generated files in Lemmy.Net/Types while preserving the few handwritten support types.

Requirements are Node.js, curl, and tar:

./utils/generate-models.sh
dotnet test Lemmy.Net.sln

To update Lemmy support, change upstream_commit in utils/generate-models.sh, regenerate, then adapt the handwritten methods in Lemmy.Net/LemmyHttp.cs to upstream endpoint changes. CI reruns generation and fails if committed models have drifted.

Development and releases

Changes are made through pull requests. The CI workflow uses GitHub-hosted runners to regenerate models, build, test, and pack the library. Conventional commit messages drive Release Please on the default branch.

When a Release Please PR is merged, the release workflow:

  1. creates the GitHub release and changelog;
  2. publishes the NuGet and symbol packages to NuGet.org using the NUGET_API_KEY repository secret;
  3. publishes the same package files as an OCI artifact at ghcr.io/rickebo/lemmy.net:<version>; and
  4. attaches the package files to the GitHub release.

GHCR is an OCI registry rather than a NuGet feed. Consumers should install from NuGet.org; the GHCR artifact exists for provenance and mirroring.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net10.0

    • No dependencies.

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 117 9/8/2026
1.0.4 471 7/12/2023
1.0.3 326 7/4/2023
1.0.2 261 7/4/2023
1.0.1 268 7/2/2023
1.0.0 274 7/2/2023