pub struct Entitlement {
pub id: EntitlementId,
pub sku_id: SkuId,
pub application_id: ApplicationId,
pub user_id: Option<UserId>,
pub kind: EntitlementKind,
pub deleted: bool,
pub starts_at: Option<Timestamp>,
pub ends_at: Option<Timestamp>,
pub guild_id: Option<GuildId>,
pub consumed: Option<bool>,
}Expand description
Represents that a user or guild has access to a premium offering in the application.
Fields§
§id: EntitlementIdThe ID of the entitlement.
sku_id: SkuIdThe ID of the corresponding SKU.
application_id: ApplicationIdThe ID of the parent application.
user_id: Option<UserId>The ID of the user that is granted access to the SKU.
kind: EntitlementKindThe type of the entitlement.
deleted: boolWhether the entitlement has been deleted or not. Entitlements are not deleted when they expire.
starts_at: Option<Timestamp>Start date after which the entitlement is valid. Not present when using test entitlements.
ends_at: Option<Timestamp>End date after which the entitlement is no longer valid. Not present when using test entitlements.
guild_id: Option<GuildId>The ID of the guild that is granted access to the SKU.
consumed: Option<bool>For consumable items, whether or not the entitlement has been consumed.
Implementations§
Source§impl Entitlement
impl Entitlement
Sourcepub fn sku_url(&self) -> String
pub fn sku_url(&self) -> String
Returns a link to the SKU corresponding to this entitlement. See Sku::url for details.
Sourcepub async fn consume(&mut self, http: &Http) -> Result<()>
Available on crate feature model only.
pub async fn consume(&mut self, http: &Http) -> Result<()>
model only.For a one-time purchase consumable SKU (of kind Consumable), marks the entitlement as
consumed. On success, the consumed field will be set to Some(true).
§Errors
Will fail if the corresponding SKU is not of kind Consumable.
Sourcepub async fn list(
cache_http: impl CacheHttp,
builder: GetEntitlements,
) -> Result<Vec<Entitlement>>
Available on crate feature model only.
pub async fn list( cache_http: impl CacheHttp, builder: GetEntitlements, ) -> Result<Vec<Entitlement>>
model only.Returns all entitlements for the current application, active and expired.
§Errors
May error due to an invalid response from discord, or network error.
Trait Implementations§
Source§impl Clone for Entitlement
impl Clone for Entitlement
Source§fn clone(&self) -> Entitlement
fn clone(&self) -> Entitlement
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Entitlement
impl Debug for Entitlement
Source§impl<'de> Deserialize<'de> for Entitlement
impl<'de> Deserialize<'de> for Entitlement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Entitlement
impl RefUnwindSafe for Entitlement
impl Send for Entitlement
impl Sync for Entitlement
impl Unpin for Entitlement
impl UnwindSafe for Entitlement
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)