Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
chosen_inline_result.hpp
1 #ifndef CPPGRAM_CHOOSEN_INLINE_RESULT_HPP
2 #define CPPGRAM_CHOOSEN_INLINE_RESULT_HPP
3 
4 #include <string>
5 
6 #include <json/json.h>
7 
8 #include "location.hpp"
9 #include "user.hpp"
10 
11 namespace cppgram
12 {
13 namespace types
14 {
23 {
26  public:
28  std::string result_id;
29 
32 
34  std::experimental::optional<Location> location;
35 
39  std::experimental::optional<std::string> inline_message_id;
40 
42  std::string query;
43 
44  ChosenInlineResult( Json::Value &json_chosen_inline_result )
45  : result_id( json_chosen_inline_result["result_id"].asString() )
46  , from( json_chosen_inline_result["from"] )
47  , query( json_chosen_inline_result["query"].asString() )
48  {
49  if ( !json_chosen_inline_result["location"].isNull() )
50  {
51  location.emplace( Location( json_chosen_inline_result["location"] ) );
52  }
53 
54  if ( !json_chosen_inline_result["inline_message_id"].isNull() )
55  {
56  inline_message_id.emplace( json_chosen_inline_result["inline_message_id"].asString() );
57  }
58  }
59 };
60 }
61 }
62 
63 #endif
std::string result_id
The unique identifier for the result that was chosen.
Definition: chosen_inline_result.hpp:28
std::experimental::optional< std::string > inline_message_id
Optional. Identifier of the sent inline message.
Definition: chosen_inline_result.hpp:39
User from
The user that chose the result.
Definition: chosen_inline_result.hpp:31
A location send by a user.
Definition: location.hpp:19
main namespace for Cppgram
std::string query
The query that was used to obtain the result.
Definition: chosen_inline_result.hpp:42
std::experimental::optional< Location > location
Optional. Sender location, only for bots that require user location
Definition: chosen_inline_result.hpp:34
User object.
Definition: user.hpp:20
A inline query choosed by the user.
Definition: chosen_inline_result.hpp:22