Lemmy.Net.Client 0.7.4

dotnet add package Lemmy.Net.Client --version 0.7.4                
NuGet\Install-Package Lemmy.Net.Client -Version 0.7.4                
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.7.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lemmy.Net.Client --version 0.7.4                
#r "nuget: Lemmy.Net.Client, 0.7.4"                
#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.7.4

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

Nuget GitHub Workflow Status (with event)

</br> <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 259 7/10/2023
0.7.2 187 7/5/2023
0.7.1 161 7/5/2023
0.7.0 154 7/4/2023
0.6.13 166 7/2/2023
0.6.12 151 7/2/2023
0.6.11 158 7/2/2023
0.6.10 160 7/2/2023
0.6.9 164 7/1/2023
0.6.8 166 7/1/2023
0.6.6 101 6/28/2023
0.5.6 94 6/28/2023
0.5.5 91 6/28/2023
0.5.4 92 6/28/2023
0.5.3 91 6/27/2023
0.5.2 154 6/26/2023
0.1.1 131 6/21/2023
0.1.0 149 6/21/2023
0.0.5 149 6/21/2023
0.0.4 128 6/21/2023
0.0.3 159 6/19/2023
0.0.2 158 6/18/2023
0.0.1 168 6/18/2023