Entitlements¶
discord_http.entitlements module¶
- class discord_http.entitlements.SKU(*, state, data)¶
Bases:
PartialSKURepresents a SKU (Stock Keeping Unit) object.
- Parameters:
state (DiscordAPI)
data (dict)
- property application: PartialUser¶
The application that owns the SKU.
- async create_test_entitlement(*, owner_id, owner_type) PartialEntitlements¶
Create an entitlement for testing purposes.
- Parameters:
owner_id (
Snowflake|int) – The ID of the owner, can be GuildID or UserID.owner_type (
EntitlementOwnerType|int) – The type of the owner.
- Return type:
- Returns:
The created entitlement.
- async fetch_subscription(subscription_id) Subscription¶
Fetch a specific subscription for this SKU.
- async fetch_subscriptions(user_id, *, before=None, after=None, limit=50) list[Subscription]¶
Fetch the subscriptions for this SKU.
- Parameters:
user_id (
Snowflake|int) – The user ID to fetch subscriptions for. Required for bot-token requests (only optional when using an OAuth2 access token, which this library does not support).before (
Snowflake|int|None) – Consider only subscriptions before given IDafter (
Snowflake|int|None) – Consider only subscriptions after given IDlimit (
int) – The maximum amount of subscriptions to fetch (1-100)
- Return type:
- Returns:
The subscriptions for this SKU
- get_partial_subscription(subscription_id) PartialSubscription¶
Creates a partial subscription object under this SKU, without fetching it.
- class discord_http.entitlements.Entitlements(*, state, data)¶
Bases:
PartialEntitlementsRepresents an entitlement object.
- Parameters:
state (DiscordAPI)
data (dict)
- type: EntitlementType¶
The type of the entitlement.
- property application: PartialUser¶
The application that owns the entitlement.
- property sku: PartialSKU¶
The SKU that the entitlement belongs to.
- property user: PartialUser | None¶
The user that owns the entitlement, if the owner type is user.
- property guild: Guild | PartialGuild | None¶
The guild the entitlement is in.
- property subscription: PartialSubscription | None¶
The partial subscription this entitlement belongs to, if any.
- async fetch() Entitlements¶
Fetches the entitlement.
- Return type:
- class discord_http.entitlements.PartialEntitlements(*, state, id)¶
Bases:
PartialBaseRepresents a partial entitlement object.
- Parameters:
state (DiscordAPI)
id (int)
- async fetch() Entitlements¶
Fetches the entitlement.
- Return type:
- class discord_http.entitlements.PartialSKU(*, state, id)¶
Bases:
PartialBaseRepresents a partial SKU object.
- Parameters:
state (DiscordAPI)
id (int)
- async create_test_entitlement(*, owner_id, owner_type) PartialEntitlements¶
Create an entitlement for testing purposes.
- Parameters:
owner_id (
Snowflake|int) – The ID of the owner, can be GuildID or UserID.owner_type (
EntitlementOwnerType|int) – The type of the owner.
- Return type:
- Returns:
The created entitlement.
- async fetch_subscriptions(user_id, *, before=None, after=None, limit=50) list[Subscription]¶
Fetch the subscriptions for this SKU.
- Parameters:
user_id (
Snowflake|int) – The user ID to fetch subscriptions for. Required for bot-token requests (only optional when using an OAuth2 access token, which this library does not support).before (
Snowflake|int|None) – Consider only subscriptions before given IDafter (
Snowflake|int|None) – Consider only subscriptions after given IDlimit (
int) – The maximum amount of subscriptions to fetch (1-100)
- Return type:
- Returns:
The subscriptions for this SKU
- async fetch_subscription(subscription_id) Subscription¶
Fetch a specific subscription for this SKU.
- get_partial_subscription(subscription_id) PartialSubscription¶
Creates a partial subscription object under this SKU, without fetching it.
- class discord_http.entitlements.PartialSubscription(*, state, sku_id, id)¶
Bases:
PartialBaseRepresents a partial subscription object.
- Parameters:
state (DiscordAPI)
sku_id (int)
id (int)
- property sku: PartialSKU¶
The SKU this subscription is being looked up through.
- async fetch() Subscription¶
Fetches the subscription.
- Return type:
- class discord_http.entitlements.Subscription(*, state, data, sku_id=None)¶
Bases:
PartialBaseRepresents a subscription object.
- Parameters:
state (DiscordAPI)
data (dict)
sku_id (int | None)
- property skus: list[PartialSKU]¶
The partial SKU objects this subscription applies to.
- property renewal_skus: list[PartialSKU]¶
The partial SKU objects the user will be subscribed to at renewal, if any.
- property entitlements: list[PartialEntitlements]¶
The partial entitlement objects granted for this subscription.
- property status: SubscriptionStatus¶
The status of the subscription.
- property user: PartialUser¶
The user subscribed to the SKU(s).
- async fetch() Subscription¶
Fetches the latest version of this subscription.
- Raises:
ValueError – If no SKU is known to route the request through (should not happen for a subscription that came from the API, which always includes sku_ids)
- Return type: