Skip to content

Commit

Permalink
add entitlement struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoffi committed Aug 2, 2024
1 parent 41a66e5 commit f004123
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions entitlement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package discordgo

// The type of entitlement
type EntitlementType int

// Valid EntitlementType values
// https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-types
const (
EntitlementTypePurchase = 1
EntitlementTypePremiumSubscription = 2
EntitlementTypeDeveloperGift = 3
EntitlementTypeTestModePurchase = 4
EntitlementTypeFreePurchase = 5
EntitlementTypeUserGift = 6
EntitlementTypePremiumPurchase = 7
EntitlementTypeApplicationSubscription = 8
)

type Entitlement struct {
// The ID of the entitlement
ID string `json:"id"`

// The ID of the SKU
SKUID string `json:"sku_id"`

// The ID of the parent application
ApplicationID string `json:"application_id"`

// The ID of the user that is granted access to the entitlement's sku
UserID string `json:"user_id"`

// The type of entitlement
Type EntitlementType `json:"type"`

// The entitlement was deleted
Deleted bool `json:"deleted"`

// The start date at which the entitlement is valid.
// Not present when using test entitlements.
StartsAt string `json:"starts_at"`

// The date at which the entitlement is no longer valid.
// Not present when using test entitlements.
EndsAt string `json:"ends_at"`

// The ID of the guild that is granted access to the entitlement's sku.
GuildID string `json:"guild_id"`

// Whether or not the entitlement has been consumed.
// Only available for consumable items.
Consumed bool `json:"consumed"`
}

0 comments on commit f004123

Please sign in to comment.