tgbotxx  1.1.6.9
Telegram Bot C++ Library
SwitchInlineQueryChosenChat.hpp
Go to the documentation of this file.
1 #pragma once
4 
5 namespace tgbotxx {
11  explicit SwitchInlineQueryChosenChat(const nl::json& json) {
12  fromJson(json);
13  }
14 
16  std::string query;
17 
20 
22  bool allowBotChats{};
23 
26 
29 
30 
33  nl::json toJson() const {
34  nl::json json = nl::json::object();
35  OBJECT_SERIALIZE_FIELD(json, "query", query);
36  OBJECT_SERIALIZE_FIELD(json, "allow_user_chats", allowUserChats);
37  OBJECT_SERIALIZE_FIELD(json, "allow_bot_chats", allowBotChats);
38  OBJECT_SERIALIZE_FIELD(json, "allow_group_chats", allowGroupChats);
39  OBJECT_SERIALIZE_FIELD(json, "allow_channel_chats", allowChannelChats);
40  return json;
41  }
42 
44  void fromJson(const nl::json& json) {
45  OBJECT_DESERIALIZE_FIELD(json, "query", query, "", true);
46  OBJECT_DESERIALIZE_FIELD(json, "allow_user_chats", allowUserChats, false, true);
47  OBJECT_DESERIALIZE_FIELD(json, "allow_bot_chats", allowBotChats, false, true);
48  OBJECT_DESERIALIZE_FIELD(json, "allow_group_chats", allowGroupChats, false, true);
49  OBJECT_DESERIALIZE_FIELD(json, "allow_channel_chats", allowChannelChats, false, true);
50  }
51  };
52 }
#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
This object represents an inline button that switches the current user to inline mode in a chosen cha...
bool allowGroupChats
Optional. True, if group and supergroup chats can be chosen.
bool allowUserChats
Optional. True, if private chats with users can be chosen.
std::string query
Optional. The default inline query to be inserted in the input field. If left empty,...
bool allowChannelChats
Optional. True, if channel chats can be chosen.
bool allowBotChats
Optional. True, if private chats with bots can be chosen.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.