sentry_protos 0.22.1

Rust bindings for sentry-protos
Documentation
// This file is @generated by prost-build.
/// How a Grant was created.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GrantSource {
    Unspecified = 0,
    /// Derived from a Trial row.
    TrialProduct = 1,
    TrialSubscription = 2,
    TrialPlan = 3,
    TrialEnterprise = 4,
    /// Promo-code redemption.
    Promo = 5,
    /// Recurring quota credit (e.g. monthly free errors).
    Recurring = 6,
    /// One-off admin/support gift.
    Gift = 7,
}
impl GrantSource {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "GRANT_SOURCE_UNSPECIFIED",
            Self::TrialProduct => "GRANT_SOURCE_TRIAL_PRODUCT",
            Self::TrialSubscription => "GRANT_SOURCE_TRIAL_SUBSCRIPTION",
            Self::TrialPlan => "GRANT_SOURCE_TRIAL_PLAN",
            Self::TrialEnterprise => "GRANT_SOURCE_TRIAL_ENTERPRISE",
            Self::Promo => "GRANT_SOURCE_PROMO",
            Self::Recurring => "GRANT_SOURCE_RECURRING",
            Self::Gift => "GRANT_SOURCE_GIFT",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "GRANT_SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
            "GRANT_SOURCE_TRIAL_PRODUCT" => Some(Self::TrialProduct),
            "GRANT_SOURCE_TRIAL_SUBSCRIPTION" => Some(Self::TrialSubscription),
            "GRANT_SOURCE_TRIAL_PLAN" => Some(Self::TrialPlan),
            "GRANT_SOURCE_TRIAL_ENTERPRISE" => Some(Self::TrialEnterprise),
            "GRANT_SOURCE_PROMO" => Some(Self::Promo),
            "GRANT_SOURCE_RECURRING" => Some(Self::Recurring),
            "GRANT_SOURCE_GIFT" => Some(Self::Gift),
            _ => None,
        }
    }
}
/// A non-billable quota allowance for an organization within a time window.
///
/// Grants can be offset by counter-grants: separate Grant rows with a negative
/// amount. The effective amount is the original amount plus the sum of all
/// counter-grant amounts, netted server-side and returned via
/// GetEffectiveGrants.
///
/// UNITS grants have exactly one entry in line_item_uids. CENTS grants may
/// have several.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Grant {
    #[prost(uint64, tag = "1")]
    pub id: u64,
    #[prost(uint64, tag = "2")]
    pub organization_id: u64,
    #[prost(enumeration = "GrantType", tag = "3")]
    pub r#type: i32,
    /// The line items this grant applies to.
    #[prost(string, repeated, tag = "4")]
    pub line_item_uids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// The original amount. May be negative for counter-grants.
    #[prost(int64, tag = "5")]
    pub amount: i64,
    #[prost(message, optional, tag = "6")]
    pub start_date: ::core::option::Option<super::super::super::Date>,
    #[prost(message, optional, tag = "7")]
    pub end_date: ::core::option::Option<super::super::super::Date>,
    #[prost(enumeration = "GrantStatus", tag = "8")]
    pub status: i32,
    #[prost(enumeration = "GrantSource", tag = "9")]
    pub source: i32,
}
/// Denomination of a Grant.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GrantType {
    Unspecified = 0,
    /// A quantity of units for specific line items.
    Units = 1,
    /// A monetary allowance measured in cents.
    Cents = 2,
}
impl GrantType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "GRANT_TYPE_UNSPECIFIED",
            Self::Units => "GRANT_TYPE_UNITS",
            Self::Cents => "GRANT_TYPE_CENTS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "GRANT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "GRANT_TYPE_UNITS" => Some(Self::Units),
            "GRANT_TYPE_CENTS" => Some(Self::Cents),
            _ => None,
        }
    }
}
/// Lifecycle state of a Grant.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GrantStatus {
    Unspecified = 0,
    /// Consumable now; within \[start_date, end_date\].
    Active = 1,
    /// Manually deactivated (admin revoke, customer opt-out, etc.).
    Inactive = 2,
    /// Past end_date.
    Expired = 3,
}
impl GrantStatus {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "GRANT_STATUS_UNSPECIFIED",
            Self::Active => "GRANT_STATUS_ACTIVE",
            Self::Inactive => "GRANT_STATUS_INACTIVE",
            Self::Expired => "GRANT_STATUS_EXPIRED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "GRANT_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "GRANT_STATUS_ACTIVE" => Some(Self::Active),
            "GRANT_STATUS_INACTIVE" => Some(Self::Inactive),
            "GRANT_STATUS_EXPIRED" => Some(Self::Expired),
            _ => None,
        }
    }
}
/// A grant with counter-grant chains collapsed into a single effective amount.
/// Returned in drain priority order (end_date ASC, effective_amount ASC, grant_id ASC).
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EffectiveGrant {
    #[prost(uint64, tag = "1")]
    pub grant_id: u64,
    #[prost(enumeration = "GrantType", tag = "2")]
    pub r#type: i32,
    #[prost(string, repeated, tag = "3")]
    pub line_item_uids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Usable amount after counter-grant collapse; always > 0.
    #[prost(int64, tag = "4")]
    pub effective_amount: i64,
    /// The grant's own active window, inclusive on both ends. These are the
    /// grant's stored dates, not clipped to the query window: the grant applies
    /// only to usage on days within \[start_date, end_date\], so a grant ending
    /// mid-window stops covering usage after end_date.
    #[prost(message, optional, tag = "5")]
    pub start_date: ::core::option::Option<super::super::super::Date>,
    #[prost(message, optional, tag = "6")]
    pub end_date: ::core::option::Option<super::super::super::Date>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetEffectiveGrantsRequest {
    #[prost(uint64, tag = "1")]
    pub organization_id: u64,
    /// When set, returns only grants whose line_item_uids contain this value.
    #[prost(string, optional, tag = "2")]
    pub line_item_uid: ::core::option::Option<::prost::alloc::string::String>,
    /// start_date / end_date define the query window. A grant is returned if its
    /// own \[start_date, end_date\] overlaps this window (grant.start_date \<=
    /// end_date AND grant.end_date >= start_date), inclusive on both ends. A grant
    /// that begins before the window or ends inside it is therefore included.
    /// Returned grants apply only to usage on the days each grant is itself active
    /// — a grant ending mid-window does not cover usage after its end_date.
    #[prost(message, optional, tag = "3")]
    pub start_date: ::core::option::Option<super::super::super::Date>,
    #[prost(message, optional, tag = "4")]
    pub end_date: ::core::option::Option<super::super::super::Date>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEffectiveGrantsResponse {
    /// Grants with counter-chains collapsed, sorted by drain priority.
    #[prost(message, repeated, tag = "1")]
    pub effective_grants: ::prost::alloc::vec::Vec<EffectiveGrant>,
}