tgbotxx  1.1.6.9
Telegram Bot C++ Library
InlineQueryResultsButton.hpp
Go to the documentation of this file.
1 #pragma once
4 
5 namespace tgbotxx {
11  explicit InlineQueryResultsButton(const nl::json& json) {
12  fromJson(json);
13  }
14 
16  std::string text;
17 
21 
28  std::string startParameter;
29 
32  nl::json toJson() const {
33  nl::json json = nl::json::object();
34  OBJECT_SERIALIZE_FIELD(json, "text", text);
35  OBJECT_SERIALIZE_FIELD_PTR(json, "web_app", webApp);
36  OBJECT_SERIALIZE_FIELD(json, "start_parameter", startParameter);
37  return json;
38  }
39 
41  void fromJson(const nl::json& json) {
42  OBJECT_DESERIALIZE_FIELD(json, "text", text, "", false);
43  OBJECT_DESERIALIZE_FIELD_PTR(json, "web_app", webApp, true);
44  OBJECT_DESERIALIZE_FIELD(json, "start_parameter", startParameter, "", true);
45  }
46  };
47 }
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition: Object.hpp:22
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition: Object.hpp:70
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition: Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition: Object.hpp:44
Definition: Api.hpp:14
std::shared_ptr< T > Ptr
Definition: Ptr.hpp:6
This object represents a button to be shown above inline query results. You must use exactly one of t...
std::string startParameter
Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the butto...
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.
Ptr< WebAppInfo > webApp
Optional. Description of the Web App that will be launched when the user presses the button....
std::string text
Label text on the button.