dpp::entitlement
dpp::managed
dpp::json_interface< entitlement >
entitlement.h
struct friend struct json_interface< entitlement > json_interface< entitlement > dpp::entitlement::json_interface< entitlement > json_interface< entitlement >
snowflake snowflake dpp::entitlement::application_id application_id dpp::entitlement::application_id {0}

ID of the parent application.

time_t time_t dpp::entitlement::ends_at ends_at dpp::entitlement::ends_at {0}

Optional: Date at which the entitlement is no longer valid.

Not present when using test entitlements.

uint16_t uint16_t dpp::entitlement::flags flags dpp::entitlement::flags {0}

Flags bitmap from dpp::entitlement_flags.

uint8_t uint8_t dpp::entitlement::gift_code_flags gift_code_flags dpp::entitlement::gift_code_flags {0}

Gift Code Flags (undocumented).

Undocumented, but given in examples in the docs.

snowflake snowflake dpp::entitlement::guild_id guild_id dpp::entitlement::guild_id {0}

Optional: ID of the user that is granted access to the entitlement's SKU.

If a guild is provided, according to the examples the user who triggered the purchase will also be passed in the user ID. The presence of a non-zero guild id snowflake is indication it is a guild subscription.

snowflake snowflake dpp::managed::id id dpp::managed::id = {}

Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.

snowflake snowflake dpp::entitlement::promotion_id promotion_id dpp::entitlement::promotion_id {0}

Promotion id.

These are undocumented but given in examples in the docs.

snowflake snowflake dpp::entitlement::sku_id sku_id dpp::entitlement::sku_id {0}

ID of the entitlement event.

Not sure if this remains constant, it does not relate to the SKU, user, guild or subscription. Do not use it for anything except state tracking.

time_t time_t dpp::entitlement::starts_at starts_at dpp::entitlement::starts_at {0}

Optional: Start date at which the entitlement is valid.

Not present when using test entitlements.

snowflake snowflake dpp::entitlement::subscription_id subscription_id dpp::entitlement::subscription_id {0}

Subscription ID.

This is a unique identifier of the user or guilds subscription to the SKU. It won't ever change.

entitlement_type entitlement_type dpp::entitlement::type type dpp::entitlement::type = entitlement_type::APPLICATION_SUBSCRIPTION

The type of entitlement.

snowflake snowflake dpp::entitlement::user_id user_id dpp::entitlement::user_id {0}

Optional: ID of the user that is granted access to the entitlement's SKU.

entitlement & entitlement & dpp::entitlement::fill_from_json_impl (nlohmann::json *j) fill_from_json_impl dpp::entitlement::fill_from_json_impl nlohmann::json * j

Read class values from json object j

A json object to read from

A reference to self

json json dpp::entitlement::to_json_impl (bool with_id=false) const to_json_impl dpp::entitlement::to_json_impl bool with_id false

Build json for this entitlement object.

with_id

include the ID in the json

json JSON object

dpp::entitlement::entitlement
()=default
entitlement
dpp::entitlement::entitlement

Construct a new entitlement object.

dpp::entitlement::entitlement
(const snowflake sku_id, const snowflake id=0, const snowflake application_id=0, const entitlement_type type=dpp::entitlement_type::APPLICATION_SUBSCRIPTION, const uint8_t flags=0)
entitlement
dpp::entitlement::entitlement
const snowflake sku_id
const snowflake id 0
const snowflake application_id 0
const entitlement_type type dpp::entitlement_type::APPLICATION_SUBSCRIPTION
const uint8_t flags 0

Construct a new entitlement object with sku_id, ID, application_id, type, and flags.

sku_id

The ID of the SKU.

id

The ID of the entitlement.

application_id

The ID of the parent application.

type

The type of entitlement (Should only ever be APPLICATION_SUBSCRIPTION unless you going to use this object as a parameter for dpp::cluster::entitlement_test_create).

flags

The flags for the SKU from dpp::entitlement_flags.

std::string std::string dpp::json_interface< entitlement >::build_json (bool with_id=false) const build_json dpp::json_interface< entitlement >::build_json bool with_id false

Convert object to json string.

with_id

Whether to include the ID or not

Some fields are conditionally filled, do not rely on all fields being present

std::string Json built from the structure

entitlement & entitlement & dpp::json_interface< entitlement >::fill_from_json (nlohmann::json *j) fill_from_json dpp::json_interface< entitlement >::fill_from_json nlohmann::json * j

Convert object from nlohmann::json.

j

nlohmann::json object

T& Reference to self for fluent calling

double double dpp::managed::get_creation_time () const noexcept get_creation_time dpp::managed::get_creation_time

Get the creation time of this object according to Discord.

double creation time inferred from the snowflake ID. The minimum possible value is the first second of 2015.

entitlement_type entitlement_type dpp::entitlement::get_type () const get_type dpp::entitlement::get_type

Get the type of entitlement.

entitlement_type Entitlement type

bool bool dpp::entitlement::is_consumed () const is_consumed dpp::entitlement::is_consumed

Was the entitlement consumed?

A consumed entitlement is a one off purchase which has been claimed as used by the application. for example in-app purchases.

true if the entitlement was consumed.

bool bool dpp::entitlement::is_deleted () const is_deleted dpp::entitlement::is_deleted

Was the entitlement deleted?

true if the entitlement was deleted.

bool bool dpp::managed::operator!= (const managed &other) const noexcept operator!= dpp::managed::operator!= const managed & other

Comparison operator for comparing two managed objects by id.

other

Other object to compare against

true objects are not the same id

false objects are the same id

bool bool dpp::managed::operator== (const managed &other) const noexcept operator== dpp::managed::operator== const managed & other

Comparison operator for comparing two managed objects by id.

other

Other object to compare against

true objects are the same id

false objects are not the same id

auto auto dpp::json_interface< entitlement >::to_json (bool with_id=false) const to_json dpp::json_interface< entitlement >::to_json bool with_id false

Convert object to nlohmann::json.

with_id

Whether to include the ID or not

Some fields are conditionally filled, do not rely on all fields being present

json Json built from the structure

A definition of a discord entitlement.

An entitlement is a user's connection to an SKU, basically a subscription or a one-off purchase.

dpp::entitlement
dpp::json_interface< T >
dpp::json_interface< entitlement >
< entitlement >
dpp::managed
dpp::entitlement
application_id
guild_id
promotion_id
sku_id
subscription_id
user_id
gift_code_flags
type
ends_at
starts_at
flags
dpp::json_interface< T >
dpp::json_interface< entitlement >
< entitlement >
dpp::managed
id
dpp::snowflake
value
entitlement_type
time_t
uint16_t
uint64_t
uint8_t
- dpp::entitlement
  application_id
- dpp::entitlement
  build_json
- dpp::entitlement
  ends_at
- dpp::entitlement
  entitlement
- dpp::entitlement
  entitlement
- dpp::entitlement
  fill_from_json
- dpp::entitlement
  fill_from_json_impl
- dpp::entitlement
  flags
- dpp::entitlement
  get_creation_time
- dpp::entitlement
  get_type
- dpp::entitlement
  gift_code_flags
- dpp::entitlement
  guild_id
- dpp::entitlement
  id
- dpp::entitlement
  is_consumed
- dpp::entitlement
  is_deleted
- dpp::entitlement
  json_interface< entitlement >
- dpp::entitlement
  managed
- dpp::entitlement
  managed
- dpp::entitlement
  managed
- dpp::entitlement
  managed
- dpp::entitlement
  operator!=
- dpp::entitlement
  operator=
- dpp::entitlement
  operator=
- dpp::entitlement
  operator==
- dpp::entitlement
  promotion_id
- dpp::entitlement
  sku_id
- dpp::entitlement
  starts_at
- dpp::entitlement
  subscription_id
- dpp::entitlement
  to_json
- dpp::entitlement
  to_json_impl
- dpp::entitlement
  type
- dpp::entitlement
  user_id
- dpp::entitlement
  ~managed