FinancialContribution

A ContributionResult with filter helpers.

On this page

A ContributionResult with filter helpers.

Helpers only filter; they never sum across providers or currencies. JSON.stringify() yields exactly the protocol shape.

import { FinancialContribution } from "@sponsorkit/sdk";

class FinancialContribution implements ContributionResult { … }

Class, exported from @sponsorkit/sdk, @sponsorkit/sdk/node, @sponsorkit/sdk/server.

Extends ContributionResult.

Constructors#

new FinancialContribution()#

new FinancialContribution(result: ContributionResult)

Parameters

ParameterTypeDefaultDescription
resultContributionResultrequiredSee ContributionResult.

Properties#

signedIn#

signedIn: boolean

disabled#

disabled: boolean

mock#

mock: boolean

targets#

targets: string[]

Canonical target strings, e.g. ["github:octocat"].

supporter#

supporter: Supporter | null

Type: Supporter

contributions#

contributions: Contribution[]

Type: Contribution

fetchedAt#

fetchedAt: string | null

stale#

stale: boolean

Some provider could not be reached; its data (if any) comes from the local cache.

fromCache#

fromCache: boolean

The whole result was served from the local cache.

unavailable#

unavailable?: Provider[]

Providers the API could not query (API results only).

Type: Provider

Methods#

active()#

active(): Contribution[]

Contributions with status active.

Returns Contribution[] (Contribution)

recurring()#

recurring(): Contribution[]

Recurring contributions (any status).

Returns Contribution[] (Contribution)

oneTime()#

oneTime(): Contribution[]

One-time contributions (any status).

Returns Contribution[] (Contribution)

byProvider()#

byProvider(provider: Provider): Contribution[]

Contributions on one provider.

Parameters

ParameterTypeDefaultDescription
providerProviderrequiredSee Provider.

Returns Contribution[] (Contribution)

direct()#

direct(): Contribution[]

Contributions made by the user themselves (excludes via: "organization").

Returns Contribution[] (Contribution)

toJSON()#

toJSON(): ContributionResult

The plain protocol object.

Returns ContributionResult (ContributionResult)