Contribution

One sponsorship (GitHub) or order (Open Collective), normalized.

On this page

One sponsorship (GitHub) or order (Open Collective), normalized.

use sponsorkit::Contribution;

pub struct Contribution {
    pub id: String,
    pub provider: Provider,
    pub target: String,
    pub sponsor: SponsorEntity,
    pub via: Via,
    pub kind: Kind,
    pub frequency: Frequency,
    pub status: Status,
    pub amount: Money,
    pub tier: Option<Tier>,
    pub flags: Vec<Flag>,
    pub private: bool,
    pub started_at: Option<String>,
    pub ended_at: Option<String>,
    pub last_charged_at: Option<String>,
    pub next_charge_at: Option<String>,
    pub total_contributed: Option<Money>,
}

Fields#

id#

pub id: String

JSON key: id

Stable id: con_<provider>_<22 chars>.

provider#

pub provider: Provider

JSON key: provider

The provider.

target#

pub target: String

JSON key: target

The target string, e.g. github:octocat.

pub sponsor: SponsorEntity

JSON key: sponsor

Who pays.

via#

pub via: Via

JSON key: via

Direct or through an organization.

kind#

pub kind: Kind

JSON key: kind

Recurring or one-time.

frequency#

pub frequency: Frequency

JSON key: frequency

Charge frequency.

status#

pub status: Status

JSON key: status

Status.

amount#

pub amount: Money

JSON key: amount

Amount per charge. GitHub hides some amounts; they are 0 USD with tier: None.

tier#

pub tier: Option<Tier>

JSON key: tier

Tier, if any.

flags#

pub flags: Vec<Flag>

JSON key: flags

Flags such as via_patreon.

private#

pub private: bool

JSON key: private

Whether the provider marks it private / incognito.

started_at#

pub started_at: Option<String>

JSON key: startedAt

ISO-8601 start time.

ended_at#

pub ended_at: Option<String>

JSON key: endedAt

ISO-8601 end time.

last_charged_at#

pub last_charged_at: Option<String>

JSON key: lastChargedAt

Last charge (Open Collective only).

next_charge_at#

pub next_charge_at: Option<String>

JSON key: nextChargeAt

Next charge (Open Collective only).

total_contributed#

pub total_contributed: Option<Money>

JSON key: totalContributed

Total contributed so far (Open Collective only).

Methods#

is_active#

pub fn is_active(&self) -> bool

status == active.

Returns: bool

Trait implementations#

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