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: boolJSON key: signedIn
A supporter is signed in.
disabled#
pub disabled: boolJSON key: disabled
Sponsorkit is disabled (SPONSORKIT_DISABLE).
mock#
pub mock: boolJSON 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: boolJSON 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: boolJSON 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.
| Parameter | Type |
|---|---|
provider | Provider |
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 ContributionResultimpl Debug for ContributionResultimpl Eq for ContributionResultimpl PartialEq for ContributionResultimpl Serialize for ContributionResultimpl<'de> Deserialize<'de> for ContributionResult