Skip to content

Commit 9204cc2

Browse files
committed
Update README.md
1 parent 8e85da1 commit 9204cc2

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,58 @@
1-
## Patreon Client Api
1+
## Patreon Api
2+
[![NuGet Version](https://img.shields.io/nuget/v/Patreon.Api)](https://www.nuget.org/packages/Patreon.Api)
3+
[![Build](https://github.com/LykosAI/Patreon.Api/actions/workflows/build.yml/badge.svg)](https://github.com/LykosAI/Patreon.Api/actions/workflows/build.yml)
4+
![GitHub License](https://img.shields.io/github/license/LykosAI/Patreon.Api)
25

3-
- A .NET client for Patreon OAuth v2.0 API, using [Refit](https://github.com/reactiveui/refit)
6+
A minimal .NET Client for [Patreon API v2](https://docs.patreon.com/) using Refit and Polly. Supports automatic refresh of expired access tokens.
47

8+
## Usage
9+
### Setup with Dependency Injection
10+
```csharp
11+
using Patreon.Api.Extensions;
12+
13+
var services = new ServiceCollection();
14+
15+
services.AddPatreonApi(options =>
16+
{
17+
options.ClientId = "your-client-id";
18+
options.ClientSecret = "your-client-secret";
19+
});
20+
```
21+
22+
### Inject the IPatreonApi Polly Client to use
23+
```csharp
24+
using Patreon.Api;
25+
26+
public class MyService(IPatreonApi patreonApi)
27+
{
28+
public async Task GetTiers()
29+
{
30+
AuthorizationTokens tokens = new()
31+
{
32+
AccessToken = "your-user-access-token",
33+
RefreshToken = "your-user-refresh-token"
34+
};
35+
36+
PatreonIdentityResponse response = await patreonApi.GetIdentity(
37+
include: "memberships.campaign,memberships.currently_entitled_tiers"
38+
authorization: tokens
39+
);
40+
41+
// If automatic token refresh occured, the `tokens` object will have updated properties with the new tokens
42+
// - tokens.AccessToken
43+
// - tokens.AccessTokenExpiration
44+
// - tokens.RefreshToken
45+
46+
IReadOnlyList<string>? tiers = response.GetTierIds("your-campaign-id");
47+
}
48+
}
49+
```
50+
51+
## Contributing
52+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
53+
54+
## License
55+
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
56+
57+
## Disclaimers
58+
All trademarks, logos, and brand names are the property of their respective owners. All company, product and service names used in this document and licensed applications are for identification purposes only. Use of these names, trademarks, and brands does not imply endorsement.

0 commit comments

Comments
 (0)