https://github.com/fawaztakahji/partydotnet
A .NET client for the Party API made with Refit.
https://github.com/fawaztakahji/partydotnet
coomer coomer-party coomer-su kemono kemono-party kemono-su
Last synced: 3 months ago
JSON representation
A .NET client for the Party API made with Refit.
- Host: GitHub
- URL: https://github.com/fawaztakahji/partydotnet
- Owner: FawazTakahji
- License: gpl-3.0
- Created: 2024-05-21T02:34:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-23T19:21:39.000Z (about 1 year ago)
- Last Synced: 2025-01-27T09:29:50.321Z (5 months ago)
- Topics: coomer, coomer-party, coomer-su, kemono, kemono-party, kemono-su
- Language: C#
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PartyDotNet
A .NET client for the Party API made with Refit.
Report Bug
.
Request Feature
[](https://github.com/FawazTakahji/PartyDotNet/releases)
[](https://www.nuget.org/packages/PartyDotNet)
[](https://github.com/FawazTakahji/PartyDotNet/graphs/contributors)
[](https://github.com/FawazTakahji/PartyDotNet/issues)## Installation
The latest release can be download from [NuGet](https://www.nuget.org/packages/PartyDotNet) or from the GitHub [packages](https://github.com/FawazTakahji/PartyDotNet/packages) and [releases](https://github.com/FawazTakahji/PartyDotNet/releases) pages.## Usage
### Without a session cookie
```csharp
IPartyClient apiClient = RestService.For("https://kemono.su/api/v1");
List posts = await apiClient.GetRecentPosts();
```### With a session cookie
```csharp
CookieContainer container = new();
container.Add(new Cookie("session", "", string.Empty, "coomer.su"));HttpClientHandler handler = new() { CookieContainer = container };
HttpClient httpClient = new(handler) { BaseAddress = new Uri("https://coomer.su/api/v1") };IPartyClient apiClient = RestService.For(httpClient);
List creators = await apiClient.GetFavoriteCreators();
```### With IHttpClientFactory
Configuring services
```csharp
ServiceCollection collection = new();CookieContainer container = new();
container.Add(new Cookie("session", "", string.Empty, "kemono.su"));collection.AddHttpClient("KemonoClient", client =>
{
client.BaseAddress = new Uri("https://kemono.su/api/v1");
})
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
CookieContainer = container
});_serviceProvider = collection.BuildServiceProvider();
```
Getting a client from IHttpClientFactory
```csharp
IPartyClient apiClient = _serviceProvider.GetRequiredService().CreatePartyClient("KemonoClient");
HttpResponseMessage response = await apiClient.AddFavoriteCreator(Service.Patreon, "2448989");
```