D++ (DPP)
C++ Discord API Bot Library
|
Represents an interface for an object that can optionally implement functions for converting to and from nlohmann::json. In the event either parse_from_json() or build_json() are not implemented and are called, they will throw at runtime. More...
#include <json_interface.h>
Public Member Functions | |
T & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
virtual std::string | build_json (bool with_id=false) const |
Build JSON string from the object. More... | |
Protected Member Functions | |
~json_interface ()=default | |
Represents an interface for an object that can optionally implement functions for converting to and from nlohmann::json. In the event either parse_from_json() or build_json() are not implemented and are called, they will throw at runtime.
T | Type of class that implements the interface |
|
protecteddefault |
|
inlinevirtual |
Build JSON string from the object.
with_id | Include the ID in the JSON |
Reimplemented in dpp::interaction_response, dpp::interaction_modal_response, dpp::interaction, dpp::slashcommand, dpp::ban, dpp::channel, dpp::thread, dpp::dtemplate, dpp::emoji, dpp::guild, dpp::integration, dpp::invite, dpp::presence, dpp::role, dpp::scheduled_event, dpp::stage_instance, dpp::voiceregion, dpp::voicestate, dpp::webhook, dpp::sticker, dpp::sticker_pack, dpp::user, dpp::user_identified, and dpp::prune.
|
inline |
Convert object from nlohmann::json.
j | nlohmann::json object |