Entitlement
Represent that a user or guild has access to a premium offer.
Attributes
int
The entitlement's owner application's identifier.
bool
Whether the entitlement is already consumed. Not applicable for subscriptions.
bool
Whether the entitlement is deleted.
None | DateTime
When the entitlement ends.
int
The guild's identifier that was granted access to the stock keeping unit.
int
The unique identifier number of the entitlement.
int
The stock keeping unit's identifier the this entitlement grants access to.
None | DateTime
When the entitlement starts.
int
The subscription's identifier the entitlement is part of.
The entitlement's type.
int
The user's identifier that was granted access to the stock keeping unit.
Notes
Entitlement instances are weakreferable.
Properties
created_at
When the entity was created.
Returns
created_at : datetime
owner_id
Returns the entitlement's owner's identifier. It is either its .guild_id
or .user_id
.
Returns
owner_id : int
owner_type
partial
Returns whether the entity is partial.
Returns
partial : bool
Methods
(...)
__new__Creates a new partial entitlement.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
guild_id |
| The guild's identifier that was granted access to the stock keeping unit. | ||
sku_id |
| The stock keeping unit's identifier the this entitlement grants access to. | ||
user_id |
| The user's identifier that was granted access to the stock keeping unit. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
()
copyCopies the entitlement.
Returns
new : instance<type<self>>
(...)
copy_withCopies the entitlement with the given fields.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
guild_id |
| The guild's identifier that was granted access to the stock keeping unit. | ||
sku_id |
| The stock keeping unit's identifier the this entitlement grants access to. | ||
user_id |
| The user's identifier that was granted access to the stock keeping unit. |
Returns
new : instance<type<self>>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
(data)
from_dataCreates a new entitlement.
Parameter | Type | Description |
---|---|---|
data |
| Entitlement data. |
Returns
new : instance<cls>
(data)
from_data_is_createdCreates a new entitlement
Parameter | Type | Description |
---|---|---|
data |
| Entitlement data. |
Returns
new : instance<cls>
is_created : bool
(entitlement_id, ...)
precreateCreates an entitlement instance.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
entitlement_id |
| The entitlement's identifier. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters. | ||
application |
| Alternative for | ||
application_id |
| The entitlement's owner application's identifier. | ||
consumed |
| Whether the entitlement is already consumed. | ||
deleted |
| Whether the entitlement is deleted. | ||
ends_at |
| When the entitlement ends. | ||
entitlement_type |
| The entitlement's type. | ||
guild |
| Alternative for | ||
guild_id |
| The guild's identifier that was granted access to the stock keeping unit. | ||
sku |
| Alternative for | ||
sku_id |
| The stock keeping unit's identifier the this entitlement grants access to. | ||
starts_at |
| When the entitlement starts. | ||
subscription |
| Alternative for | ||
subscription_id |
| The subscription's identifier the entitlement is part of. | ||
user |
| Alternative for | ||
user_id |
| The user's identifier that was granted access to the stock keeping unit. |
Returns
self : instance<cls>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
(...)
to_dataConverts the entitlement into a json serializable object.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
defaults |
|
| Whether default field values should be included. | ||
include_internals |
|
| Whether internal fields should be included. |
Returns
data : dict
of (str
, object
) items
(entitlement_id)
_create_emptyCreates a new entitlement instance with it's attribute set to their default values.
Parameter | Type | Description |
---|---|---|
entitlement_id |
| The entitlement's identifier. |
Returns
self : instance<cls>
(data)
_difference_update_attributesUpdates the attributes of the entitlement and returns the changed ones within an attribute-name
- old-value
relation.
Parameter | Type | Description |
---|---|---|
data |
| Entitlement data. |
Returns
old_attributes : dict
of (str
, object
) items
The updated attributes.
The returned dictionary might contain the following items:
Key | Value |
---|---|
consumed | bool |
deleted | bool |
ends_at | None , DateTime |
starts_at | None , DateTime |
()
_get_hash_partialCalculates the entitlement's hash based on their fields.
This method is called by .__hash__
if the channel has no .id
set.
Returns
hash_value : int
(other)
_is_equal_same_typeReturns whether self is equal to other. Other must be same type as self.
Parameter | Type | Description |
---|---|---|
other |
| The other instance. |
Returns
is_equal : bool
(data)
_set_attributesSets the entitlement's attributes from the given data. (Except .id
.)
Parameter | Type | Description |
---|---|---|
data |
| Entitlement data. |
(data)
_update_attributesUpdates the entitlement by overwriting it's old attributes.
Parameter | Type | Description |
---|---|---|
data |
| Entitlement data. |
()
__eq__Returns whether the two entitlements are equal.
()
__ge__Whether this entity's id is greater or equal than the other's.
()
__getattr__Drops a rich attribute error.
()
__gt__Whether this entity's id is greater than the other's.
()
__hash__Returns the hash value of the entitlement.
()
__le__Whether this entity's id is less or equal than the other's.
()
__lt__Whether this entity's id is less than the other's.
()
__ne__Returns whether the two entitlements are not equal.
()
__repr__Returns the entitlement's representation.