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... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
sku & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
constexpr double | get_creation_time () const noexcept |
Get the creation time of this object according to Discord. 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 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... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
Public Attributes | |
snowflake | application_id {0} |
ID of the parent application. More... | |
uint16_t | flags {0} |
Flags bitmap from dpp::sku_flags. More... | |
snowflake | id = {} |
Unique ID of object set by Discord. 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... | |
sku_type | type {sku_type::SUBSCRIPTION} |
The type of SKU. More... | |
Protected Member Functions | |
sku & | fill_from_json_impl (nlohmann::json *j) |
Read class values from json object. More... | |
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 | ID of the SKU. |
type | Type of SKU (sku_type). |
application_id | ID of the parent application. |
name | Customer-facing name of your premium offering. |
slug | System-generated URL slug based on the SKU's name. |
flags | Flags bitmap from dpp::sku_flags. |
References flags, and dpp::sku_user_subscription.
|
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.
Referenced by sku().
|
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.
Referenced by dpp::poll::add_answer(), dpp::cluster::create_webhook(), dpp::cluster::current_user_join_thread(), dpp::invite::fill_from_json_impl(), dpp::command_permission::fill_from_json_impl(), dpp::interaction::get_resolved_role(), dpp::interaction::get_resolved_user(), dpp::cluster::global_bulk_command_create(), dpp::cluster::global_bulk_command_delete(), dpp::cluster::global_command_delete(), dpp::cluster::global_command_edit(), dpp::cluster::guild_ban_delete(), dpp::cluster::guild_command_create(), dpp::cluster::guild_command_edit_permissions(), dpp::cluster::guild_get_integrations(), dpp::events::guild_member_update::handle(), dpp::events::guild_role_create::handle(), dpp::events::channel_create::handle(), dpp::events::voice_state_update::handle(), dpp::discord_voice_client::handle_frame(), main(), dpp::component::set_disabled(), and dpp::select_option::set_label().
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.