D++ (DPP)
C++ Discord API Bot Library
|
A definition of a discord SKU. More...
#include <sku.h>
Public Member Functions | |
sku ()=default | |
Construct a new SKU object. More... | |
sku (const snowflake id, const sku_type type, const snowflake application_id, const std::string name, const std::string slug, const uint16_t flags) | |
Construct a new SKU object with all data required. More... | |
sku_type | get_type () const |
Get the type of SKU. More... | |
bool | is_available () const |
Is the SKU available for purchase? More... | |
bool | is_guild_subscription () const |
Is the SKU a guild subscription? More... | |
bool | is_user_subscription () const |
Is the SKU a user subscription? 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... | |
sku & | 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 | |
sku_type | type {sku_type::SUBSCRIPTION} |
The type of SKU. More... | |
snowflake | application_id {0} |
ID of the parent application. More... | |
std::string | name {} |
Customer-facing name of your premium offering. More... | |
std::string | slug {} |
System-generated URL slug based on the SKU's name. More... | |
uint16_t | flags {0} |
Flags bitmap from dpp::sku_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 | |
sku & | fill_from_json_impl (nlohmann::json *j) |
json | to_json_impl (bool with_id=false) const |
Build json for this SKU object. More... | |
Friends | |
struct | json_interface< sku > |
A definition of a discord SKU.
|
default |
Construct a new SKU object.
dpp::sku::sku | ( | const snowflake | id, |
const sku_type | type, | ||
const snowflake | application_id, | ||
const std::string | name, | ||
const std::string | slug, | ||
const uint16_t | flags | ||
) |
Construct a new SKU object with all data required.
id | SKU id. |
|
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.
sku_type dpp::sku::get_type | ( | ) | const |
Get the type of SKU.
bool dpp::sku::is_available | ( | ) | const |
Is the SKU available for purchase?
bool dpp::sku::is_guild_subscription | ( | ) | const |
Is the SKU a guild subscription?
bool dpp::sku::is_user_subscription | ( | ) | const |
Is the SKU a user subscription?
|
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 SKU object.
with_id | include the ID in the json |
|
friend |
snowflake dpp::sku::application_id {0} |
ID of the parent application.
uint16_t dpp::sku::flags {0} |
Flags bitmap from dpp::sku_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.
std::string dpp::sku::name {} |
Customer-facing name of your premium offering.
std::string dpp::sku::slug {} |
System-generated URL slug based on the SKU's name.
sku_type dpp::sku::type {sku_type::SUBSCRIPTION} |
The type of SKU.