ContributionResult
What the current user has contributed to the configured targets.
On this page
What the current user has contributed to the configured targets. Serializing it with System.Text.Json produces the protocol JSON shape.
namespace Sponsorkit;
public sealed class ContributionResultThe helper methods filter Contributions; they never sum across providers or currencies.
Constructors#
| Member | Description |
|---|---|
ContributionResult() | Creates an instance with every property at its default; set the properties with an object initializer. |
ContributionResult()#
public ContributionResult()Creates an instance with every property at its default; set the properties with an object initializer.
Properties#
| Member | Description |
|---|---|
SignedIn | Whether a supporter is signed in. |
Disabled | Whether Sponsorkit is disabled (SPONSORKIT_DISABLE). |
Mock | Whether this is mock data. |
Targets | The canonical target strings, for example github:octocat. |
Supporter | The supporter, or null when signed out (or when nothing could be fetched yet). |
Contributions | All contributions to the targets, per provider, as reported. |
FetchedAt | When the data was fetched from the providers. |
Stale | Some or all of the data could not be refreshed and comes from the local cache. |
FromCache | The whole result was served from the local cache. |
Unavailable | Providers the API could not query (their contributions are merged from the local cache). |
SignedIn#
public bool SignedIn { get; set; }Whether a supporter is signed in.
Type: bool · JSON: signedIn
Disabled#
public bool Disabled { get; set; }Whether Sponsorkit is disabled (SPONSORKIT_DISABLE).
Type: bool · JSON: disabled
Mock#
public bool Mock { get; set; }Whether this is mock data.
Type: bool · JSON: mock
Targets#
public IReadOnlyList<string> Targets { get; set; } = Array.Empty<string>();The canonical target strings, for example github:octocat.
Type: IReadOnlyList<string> · Default: Array.Empty<string>() · JSON: targets
Supporter#
public Supporter? Supporter { get; set; }The supporter, or null when signed out (or when nothing could be fetched yet).
Type: Supporter? · JSON: supporter
Contributions#
public IReadOnlyList<Contribution> Contributions { get; set; } = Array.Empty<Contribution>();All contributions to the targets, per provider, as reported.
Type: IReadOnlyList<Contribution> (Contribution) · Default: Array.Empty<Contribution>() · JSON: contributions
FetchedAt#
public DateTimeOffset? FetchedAt { get; set; }When the data was fetched from the providers.
Type: DateTimeOffset? · JSON: fetchedAt
Stale#
public bool Stale { get; set; }Some or all of the data could not be refreshed and comes from the local cache.
Type: bool · JSON: stale
FromCache#
public bool FromCache { get; set; }The whole result was served from the local cache.
Type: bool · JSON: fromCache
Unavailable#
public IReadOnlyList<string>? Unavailable { get; set; }Providers the API could not query (their contributions are merged from the local cache).
Type: IReadOnlyList<string>? · JSON: unavailable
Methods#
| Member | Description |
|---|---|
Active() | Contributions whose status is active. |
Recurring() | Recurring contributions (any status). |
OneTime() | One-time contributions (any status). |
ByProvider(string) | Contributions made through the given provider (see Providers). |
Direct() | Contributions paid by the supporter personally (excludes organization sponsorships). |
Active()#
public IReadOnlyList<Contribution> Active()Contributions whose status is active.
Returns IReadOnlyList<Contribution> (Contribution)
Recurring()#
public IReadOnlyList<Contribution> Recurring()Recurring contributions (any status).
Returns IReadOnlyList<Contribution> (Contribution)
OneTime()#
public IReadOnlyList<Contribution> OneTime()One-time contributions (any status).
Returns IReadOnlyList<Contribution> (Contribution)
ByProvider(string)#
public IReadOnlyList<Contribution> ByProvider(string provider)Contributions made through the given provider (see Providers).
Parameters
providerstring:githuboropen-collective.
Returns IReadOnlyList<Contribution> (Contribution)
Direct()#
public IReadOnlyList<Contribution> Direct()Contributions paid by the supporter personally (excludes organization sponsorships).
Returns IReadOnlyList<Contribution> (Contribution)