Lemmy.Net.Client 0.6.12

There is a newer version of this package available.
See the version list below for details.
dotnet add package Lemmy.Net.Client --version 0.6.12                
NuGet\Install-Package Lemmy.Net.Client -Version 0.6.12                
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.Client" Version="0.6.12" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lemmy.Net.Client --version 0.6.12                
#r "nuget: Lemmy.Net.Client, 0.6.12"                
#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 Lemmy.Net.Client as a Cake Addin
#addin nuget:?package=Lemmy.Net.Client&version=0.6.12

// Install Lemmy.Net.Client as a Cake Tool
#tool nuget:?package=Lemmy.Net.Client&version=0.6.12                

<img src="logo.png" width="200"/>

A (WIP) DI http client for Lemmy in dotnet

Usage

Run

dotnet add package Lemmy.Net.Client

Add this to you Startup


var services = new ServiceCollection();

services.AddLemmyClient(
    new Uri("<LEMMY INSTANCE URL>"),
    "<USERNAME>",
    "<PASSWORD>",
    //Optionally, add a pair of methods to read and write tokens.
    //This avoid having to reauthenticate on every request
    //WARNING: The file IO below is for demo purposes only!
    //please use something other than files to save your tokens!
    async username => File.Exists($"{username}.txt") ? File.ReadAllText($"{username}.txt") : "",                
    (username, jwtToken) =>  File.WriteAllText($"{username}.txt", jwtToken)                
);
var provider = services.BuildServiceProvider();

Then start the service

var lemmyService = provider.GetRequiredService<ILemmyService>();

or use it in your DI consumers

using Microsoft.AspNetCore.Mvc;
using YourNamespace.Services;

namespace YourNamespace.Controllers
{
    public class YourController : Controller
    {
        private readonly ILemmyService _lemmyService;

        public YourController(ILemmyService lemmyService)
        {
            _lemmyService = lemmyService;
        }

        // Your action methods go here
        public void DoAThing(){
            //Prints the names of all the communities on the instance
            foreach(var c in _lemmyService.Community.List().Communities)
            {
                Console.WriteLine(c.Community.Name);
            }
        }
        
    }
}

Supports

  • CRUD for Communities
  • CRUD for Posts (and voting)
  • CRUD for Comments (and voting)
  • CRUD for Private messages (and reporting)
  • Site actions
  • Reporting and Resolving
  • Modding and Admin actions
  • Captachs, registrations, password resets and email validation
  • Replies, Mentions and Notifications
  • Exponential retry policy

TODO

  • Better querying
  • Test Coverage
  • Model reuse
Product Compatible and additional computed target framework versions.
.NET 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. 
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
0.7.4 262 7/10/2023
0.7.2 188 7/5/2023
0.7.1 162 7/5/2023
0.7.0 155 7/4/2023
0.6.13 167 7/2/2023
0.6.12 152 7/2/2023
0.6.11 159 7/2/2023
0.6.10 161 7/2/2023
0.6.9 165 7/1/2023
0.6.8 167 7/1/2023
0.6.6 102 6/28/2023
0.5.6 95 6/28/2023
0.5.5 92 6/28/2023
0.5.4 93 6/28/2023
0.5.3 92 6/27/2023
0.5.2 155 6/26/2023
0.1.1 132 6/21/2023
0.1.0 150 6/21/2023
0.0.5 150 6/21/2023
0.0.4 131 6/21/2023
0.0.3 160 6/19/2023
0.0.2 159 6/18/2023
0.0.1 169 6/18/2023