Patreon.Api 1.0.0-pre.2

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

// Install Patreon.Api as a Cake Tool
#tool nuget:?package=Patreon.Api&version=1.0.0-pre.2&prerelease                

Patreon Api

NuGet Version Build GitHub License

A minimal .NET Client for Patreon API v2 using Refit and Polly. Supports automatic refresh of expired access tokens.

Usage

Setup with Dependency Injection

using Patreon.Api.Extensions;

var services = new ServiceCollection();

services.AddPatreonApi(options =>
{
    options.ClientId = "your-client-id";
    options.ClientSecret = "your-client-secret";
});

Inject the IPatreonApi Polly Client to use

using Patreon.Api;

public class MyService(IPatreonApi patreonApi)
{
    public async Task GetTiers()
    {
        AuthorizationTokens tokens = new()
        {
            AccessToken = "your-user-access-token",
            RefreshToken = "your-user-refresh-token"
        };
        
        PatreonIdentityResponse response = await patreonApi.GetIdentity(
            include: "memberships.campaign,memberships.currently_entitled_tiers"
            authorization: tokens
        );
        
        // If automatic token refresh occured, the `tokens` object will have updated properties with the new tokens
        // - tokens.AccessToken
        // - tokens.AccessTokenExpiration
        // - tokens.RefreshToken
        
        IReadOnlyList<string>? tiers = response.GetTierIds("your-campaign-id");
    }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Disclaimers

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.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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
1.2.1 96 11/3/2024
1.2.0 149 10/12/2024
1.1.1 112 10/10/2024
1.1.0 103 10/10/2024
1.0.0 104 10/8/2024
1.0.0-pre.2 44 10/8/2024
1.0.0-pre.1 44 10/8/2024