Patreon 0.0.2

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

// Install Patreon as a Cake Tool
#tool nuget:?package=Patreon&version=0.0.2                

Non-Official C# Patreon Client

Quick Start

// create client for testing
var patreonClient = new Patreon(new(), new AccessTokenOnly("api-key"));

// build request - save for later
var request = PatreonRequestBuilder.Identity(b => b.SelectFields());

// execute request
var response = await patreonClient.GetAsync(request);

HttpClient for Production

Patreon doesn't allow client credentials flow and there are no API keys, so the client comes with token management in mind.

public class EFCorePatreonTokens : PatreonTokens, IPatreonTokens
{
    public EFCorePatreonTokens(
        HttpClient client,
        PatreonClientConfig config,
        MyDbContext ctx
    ) : base(client, config)
    {
        _ctx = ctx;
    }
    
    protected override Task<Tokens> GetTokens() {
        // your reading tokens logic
    }

    protected override Task SaveTokensAsync(Tokens response)
    {
        // your saving token logic
    }
}

var patreon = new Patreon(new(), new EFCorePatreonTokens(...));

Requests

// get identity
PatreonRequestBuilder.Identity(builder => ...);
// get campaign by id
PatreonRequestBuilder.Campaign(builder => ...);
// get campaigns
PatreonRequestBuilder.Campaigns(builder => ...);
// get member by id
PatreonRequestBuilder.Member(builder => ...);
// get campaign members by campaign id
PatreonRequestBuilder.CampaignMembers(builder => ...);
// get post by id
PatreonRequestBuilder.Post(builder => ...);
// get posts by campaign id
PatreonRequestBuilder.CampaignPosts(builder => ...);

Parameters

var request = PatreonRequestBuilder.CampaignMembers(b => b.SelectFields());

var response = await patreonClient.GetAsync(request.For("campaign_id"));

Selecting Specific Fields

var request = PatreonRequestBuilder.CampaignMembers(
    b => b.SelectFields(x => new
    {
        x.FullName,
        x.LastChargeDate,
        x.LifetimeSupportCents
    })
);
var campaignMembersRequest = PatreonRequestBuilder.CampaignMembers(
    b => b.SelectFields()
          .Include(x => x.Tiers)
);
var campaignMembersRequest = PatreonRequestBuilder.CampaignMembers(
    b => b.SelectFields()
          .Include(x => x.Tiers, x => new
          {
              x.Title
          })
);
var campaignMembersRequest = PatreonRequestBuilder.CampaignMembers(
    b => b.SelectFields()
          .Include(x => x.Tiers, x => new
          {
              x.Title
          })
          .ThenInclude(x => x.Benefits)
);
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  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 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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.0.3 483 5/20/2023
0.0.2 239 2/14/2023
0.0.1 308 9/11/2022