Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
inline_query.hpp
1 #ifndef CPPGRAM_INLINE_QUERY_HPP
2 #define CPPGRAM_INLINE_QUERY_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 id;
29 
32 
34  std::experimental::optional<Location> location;
35 
37  std::string query,
38 
40  offset;
41 
42  InlineQuery( Json::Value &json_inline_query )
43  : id( json_inline_query["id"].asString() )
44  , from( User( json_inline_query["from"] ) )
45  , query( json_inline_query["query"].asString() )
46  , offset( json_inline_query["offset"].asString() )
47 
48  {
49  if ( !json_inline_query["localtion"].isNull() )
50  {
51  location.emplace( Location( json_inline_query["location"] ) );
52  }
53  }
54 };
55 }
56 }
57 
58 #endif
User from
Sender.
Definition: inline_query.hpp:31
Incoming inline query.
Definition: inline_query.hpp:22
std::string offset
Offset of the results to be returned, can be controlled by the bot.
Definition: inline_query.hpp:37
std::string query
Text of the query, up to 512 characters.
Definition: inline_query.hpp:37
A location send by a user.
Definition: location.hpp:19
main namespace for Cppgram
std::experimental::optional< Location > location
Optional. Sender location, only for bots that request user location
Definition: inline_query.hpp:34
std::string id
Unique identifier for this query.
Definition: inline_query.hpp:28
User object.
Definition: user.hpp:20