Lemmy.Net.Client
0.5.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Lemmy.Net.Client --version 0.5.3
NuGet\Install-Package Lemmy.Net.Client -Version 0.5.3
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.5.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lemmy.Net.Client --version 0.5.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lemmy.Net.Client, 0.5.3"
#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.5.3 // Install Lemmy.Net.Client as a Cake Tool #tool nuget:?package=Lemmy.Net.Client&version=0.5.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<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
- RSS links
- Test Coverage
- Model reuse
- Json snake-case naming policy
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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.
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Http (>= 7.0.0)
- Microsoft.Extensions.Http.Polly (>= 7.0.8)
- Polly (>= 8.0.0-alpha.4)
- Polly.Extensions.Http (>= 3.0.0)
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 | 267 | 7/10/2023 |
0.7.2 | 193 | 7/5/2023 |
0.7.1 | 167 | 7/5/2023 |
0.7.0 | 160 | 7/4/2023 |
0.6.13 | 172 | 7/2/2023 |
0.6.12 | 157 | 7/2/2023 |
0.6.11 | 164 | 7/2/2023 |
0.6.10 | 166 | 7/2/2023 |
0.6.9 | 170 | 7/1/2023 |
0.6.8 | 173 | 7/1/2023 |
0.6.6 | 107 | 6/28/2023 |
0.5.6 | 100 | 6/28/2023 |
0.5.5 | 97 | 6/28/2023 |
0.5.4 | 98 | 6/28/2023 |
0.5.3 | 97 | 6/27/2023 |
0.5.2 | 160 | 6/26/2023 |
0.1.1 | 137 | 6/21/2023 |
0.1.0 | 155 | 6/21/2023 |
0.0.5 | 155 | 6/21/2023 |
0.0.4 | 136 | 6/21/2023 |
0.0.3 | 165 | 6/19/2023 |
0.0.2 | 164 | 6/18/2023 |
0.0.1 | 174 | 6/18/2023 |