1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![doc(alias = "points")]
#![doc(alias = "channel.channel_points_custom_reward_redemption")]
//! A viewer has redeemed a custom channel points reward or a redemption of a channel points custom reward has been updated for the specified channel.
use super::{EventSubscription, EventType};
use crate::types;
use serde::{Deserialize, Serialize};

pub mod add;
pub mod update;

#[doc(inline)]
pub use add::{
    ChannelPointsCustomRewardRedemptionAddV1, ChannelPointsCustomRewardRedemptionAddV1Payload,
};
#[doc(inline)]
pub use update::{
    ChannelPointsCustomRewardRedemptionUpdateV1, ChannelPointsCustomRewardRedemptionUpdateV1Payload,
};

/// Basic information about the reward that was redeemed, at the time it was redeemed.
#[derive(Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Serialize, Deserialize)]
#[cfg_attr(not(feature = "allow_unknown_fields"), serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct Reward {
    /// The reward cost.
    pub cost: i64,
    /// The reward identifier.
    pub id: types::RewardId,
    /// The reward description.
    pub prompt: String,
    /// The reward name.
    pub title: String,
}

/// Custom reward redemption statuses: UNFULFILLED, FULFILLED or CANCELED
///
/// See also [`CustomRewardRedemptionStatus`](crate::helix::points::CustomRewardRedemptionStatus)
#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "lowercase")]
pub enum RedemptionStatus {
    /// Unfulfilled reward - the user has claimed it but it is still pending.
    Unfulfilled,
    /// Fulfilled reward - the user has claimed it and the reward has been granted.
    Fulfilled,
    /// Cancelled reward - the reward has been cancelled before fulfillment, and any spent points have been refunded.
    Canceled,
    /// Unknown reward status
    Unknown,
}