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 ContributionResult

The helper methods filter Contributions; they never sum across providers or currencies.

Constructors#

MemberDescription
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#

MemberDescription
SignedInWhether a supporter is signed in.
DisabledWhether Sponsorkit is disabled (SPONSORKIT_DISABLE).
MockWhether this is mock data.
TargetsThe canonical target strings, for example github:octocat.
SupporterThe supporter, or null when signed out (or when nothing could be fetched yet).
ContributionsAll contributions to the targets, per provider, as reported.
FetchedAtWhen the data was fetched from the providers.
StaleSome or all of the data could not be refreshed and comes from the local cache.
FromCacheThe whole result was served from the local cache.
UnavailableProviders 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#

MemberDescription
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

  • provider string: github or open-collective.

Returns IReadOnlyList<Contribution> (Contribution)

Direct()#

public IReadOnlyList<Contribution> Direct()

Contributions paid by the supporter personally (excludes organization sponsorships).

Returns IReadOnlyList<Contribution> (Contribution)