D++ (DPP)
C++ Discord API Bot Library
|
A definition of a discord entitlement. More...
#include <entitlement.h>
Public Member Functions | |
entitlement ()=default | |
Construct a new entitlement object. More... | |
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. More... | |
entitlement_type | get_type () const |
Get the type of entitlement. More... | |
bool | is_deleted () const |
Was the entitlement deleted? More... | |
constexpr double | get_creation_time () const noexcept |
Get the creation time of this object according to Discord. More... | |
constexpr bool | operator== (const managed &other) const noexcept |
Comparison operator for comparing two managed objects by id. More... | |
constexpr bool | operator!= (const managed &other) const noexcept |
Comparison operator for comparing two managed objects by id. More... | |
entitlement & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
Public Attributes | |
snowflake | sku_id {0} |
ID of the SKU. More... | |
snowflake | application_id {0} |
ID of the parent application. More... | |
snowflake | owner_id {0} |
Optional: ID of the user/guild that is granted access to the entitlement's SKU. More... | |
entitlement_type | type = entitlement_type::APPLICATION_SUBSCRIPTION |
The type of entitlement. More... | |
time_t | starts_at {0} |
Optional: Start date at which the entitlement is valid. More... | |
time_t | ends_at {0} |
Optional: Date at which the entitlement is no longer valid. More... | |
uint16_t | flags {0} |
Flags bitmap from dpp::entitlement_flags. More... | |
snowflake | 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. More... | |
Protected Member Functions | |
entitlement & | fill_from_json_impl (nlohmann::json *j) |
json | to_json_impl (bool with_id=false) const |
Build json for this entitlement object. More... | |
Friends | |
struct | json_interface< entitlement > |
A definition of a discord entitlement.
|
default |
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 |
||
) |
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. |
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
|
protected |
Read class values from json object
j | A json object to read from |
|
inlineconstexprnoexceptinherited |
Get the creation time of this object according to Discord.
entitlement_type dpp::entitlement::get_type | ( | ) | const |
Get the type of entitlement.
bool dpp::entitlement::is_deleted | ( | ) | const |
Was the entitlement deleted?
|
inlineconstexprnoexceptinherited |
Comparison operator for comparing two managed objects by id.
other | Other object to compare against |
|
inlineconstexprnoexceptinherited |
Comparison operator for comparing two managed objects by id.
other | Other object to compare against |
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
|
protected |
Build json for this entitlement object.
with_id | include the ID in the json |
|
friend |
snowflake dpp::entitlement::application_id {0} |
ID of the parent application.
time_t dpp::entitlement::ends_at {0} |
Optional: Date at which the entitlement is no longer valid.
uint16_t dpp::entitlement::flags {0} |
Flags bitmap from dpp::entitlement_flags.
|
inherited |
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 dpp::entitlement::owner_id {0} |
Optional: ID of the user/guild that is granted access to the entitlement's SKU.
snowflake dpp::entitlement::sku_id {0} |
ID of the SKU.
time_t dpp::entitlement::starts_at {0} |
Optional: Start date at which the entitlement is valid.
entitlement_type dpp::entitlement::type = entitlement_type::APPLICATION_SUBSCRIPTION |
The type of entitlement.