ContributionResult

The result of crate::Sponsorkit::get_financial_contribution.

On this page

The result of crate::Sponsorkit::get_financial_contribution.

Helpers filter contributions; they never sum across providers or currencies.

use sponsorkit::ContributionResult;

pub struct ContributionResult {
    pub signed_in: bool,
    pub disabled: bool,
    pub mock: bool,
    pub targets: Vec<String>,
    pub supporter: Option<Supporter>,
    pub contributions: Vec<Contribution>,
    pub fetched_at: Option<String>,
    pub stale: bool,
    pub from_cache: bool,
    pub unavailable: Option<Vec<Provider>>,
}

Fields#

signed_in#

pub signed_in: bool

JSON key: signedIn

A supporter is signed in.

disabled#

pub disabled: bool

JSON key: disabled

Sponsorkit is disabled (SPONSORKIT_DISABLE).

mock#

pub mock: bool

JSON key: mock

This is mock data.

targets#

pub targets: Vec<String>

JSON key: targets

The canonical target strings.

supporter#

pub supporter: Option<Supporter>

JSON key: supporter

The supporter, when signed in and known.

contributions#

pub contributions: Vec<Contribution>

JSON key: contributions

The contributions to the targets.

fetched_at#

pub fetched_at: Option<String>

JSON key: fetchedAt

When the data was fetched from the providers (ISO-8601).

stale#

pub stale: bool

JSON key: stale

Some data may be outdated: a provider could not be reached and its data (if any) comes from the local cache.

from_cache#

pub from_cache: bool

JSON key: fromCache

The whole result was served from the local cache.

unavailable#

pub unavailable: Option<Vec<Provider>>

JSON key: unavailable

Providers that could not be queried (API only).

Methods#

active#

pub fn active(&self) -> Vec<&Contribution>

Contributions with status active.

Returns: Vec<&Contribution> (see Contribution)

recurring#

pub fn recurring(&self) -> Vec<&Contribution>

Recurring contributions (any status).

Returns: Vec<&Contribution> (see Contribution)

one_time#

pub fn one_time(&self) -> Vec<&Contribution>

One-time contributions (any status).

Returns: Vec<&Contribution> (see Contribution)

by_provider#

pub fn by_provider(&self, provider: Provider) -> Vec<&Contribution>

Contributions through one provider.

ParameterType
providerProvider

Returns: Vec<&Contribution> (see Contribution)

direct#

pub fn direct(&self) -> Vec<&Contribution>

Contributions paid directly by the supporter (not through an organization).

Returns: Vec<&Contribution> (see Contribution)

Trait implementations#

  • impl Clone for ContributionResult
  • impl Debug for ContributionResult
  • impl Eq for ContributionResult
  • impl PartialEq for ContributionResult
  • impl Serialize for ContributionResult
  • impl<'de> Deserialize<'de> for ContributionResult