As I see, your fork doesn't solve the problem with optional fields in api structures and json.
Let's see.
sendMessage(... LinkPreviewOptions::Ptr linkPreviewOptions = nullptr ...)
Ok, we can remove LinkPreviewOptions structure from output json COMPLETELY when it null.
class LinkPreviewOptions {
public:
⦙ typedef std::shared_ptr<LinkPreviewOptions> Ptr;
⦙ /**
⦙ ⦙* @brief Optional. True, if the link preview is disabled
⦙ ⦙*/
⦙ bool isDisabled;
⦙ /**
⦙ ⦙* @brief Optional. URL to use for the link preview.
⦙ ⦙*
⦙ ⦙* If empty, then the first URL found in the message text will be used
⦙ ⦙*/
⦙ std::string url;
⦙ /**
⦙ ⦙* @brief Optional. True, if the media in the link preview is supposed to be shrunk; ignored if the URL is
⦙ ⦙*/
⦙ bool preferSmallMedia;
We cannot include only a PART of LinkPreviewOptions structure in output json. Thats why I suggest wrapping fields in boost::optional.
It's possible to check optionality from pointer field, but we cannot make optional bools, ints or strings (ok, strings - disputable).
class ReplyParameters {
public:
⦙ typedef std::shared_ptr<ReplyParameters> Ptr;
⦙ /**
⦙ ⦙* @brief Identifier of the message that will be replied to in the current chat, or in the chat chatId if
⦙ ⦙*/
⦙ std::int32_t messageId;
⦙ /**
⦙ ⦙* @brief Optional. If the message to be replied to is from a different chat, unique identifier for the ch
⦙ ⦙*
⦙ ⦙* Not supported for messages sent on behalf of a business account.
⦙ ⦙*/
⦙ std::int64_t chatId;
Need to skip chatId.
DECLARE_PARSER_TO_JSON(ReplyParameters) {
⦙ JsonWrapper json;
⦙ if (object) {
⦙ ⦙ ⦙ json.put("message_id", object->messageId);
⦙ ⦙ ⦙ json.put("chat_id", object->chatId);
ChatId is always serialized as 0 if it was not assigned implicitly.
As I see, your fork doesn't solve the problem with optional fields in api structures and json.
Let's see.
Ok, we can remove LinkPreviewOptions structure from output json COMPLETELY when it null.
We cannot include only a PART of LinkPreviewOptions structure in output json. Thats why I suggest wrapping fields in boost::optional.
It's possible to check optionality from pointer field, but we cannot make optional bools, ints or strings (ok, strings - disputable).
Need to skip chatId.
ChatId is always serialized as 0 if it was not assigned implicitly.