yatbcpp  0.0.1
Yet another Telegram Bot CPP Library
answerInlineQuery.cc
Go to the documentation of this file.
1 #include <jsoncpp/json/json.h>
2 #include <iostream>
4 
5 using namespace yatbcpp;
6 using namespace std;
7 
8 answerInlineQuery::answerInlineQuery(string inline_query_id,vector<shared_ptr<InlineQueryResult>> results) :
9  telegram_simplemethodJSON("answerInlineQuery"),
10  inline_query_id(move(inline_query_id)), results(move(results))
11 {
12 
13 }
14 answerInlineQuery::answerInlineQuery(string inline_query_id) :
15  telegram_simplemethodJSON("answerInlineQuery"),
16  inline_query_id(move(inline_query_id))
17 {
18 
19 }
20 
22  Json::Value Outgoing;
23  Outgoing["inline_query_id"] = getInline_query_id();
24  for(int i=0;i<results.size();i++){
25  std::cout << "DEBUG:: RESULT" << std::endl;
26  Outgoing["results"][i] = results[i]->toJson();
27  }
28  if(cache_time){
29  Outgoing["cache_time"] = cache_time.value();
30  }
31  if(is_personal){
32  Outgoing["is_personal"] = is_personal.value();
33  }
34  if(next_offset){
35  Outgoing["next_offset"] = next_offset.value();
36  }
37  if(switch_pm_text){
38  Outgoing["switch_pm_text"] = switch_pm_text.value();
39  }
41  Outgoing["switch_pm_parameter"] = switch_pm_parameter.value();
42  }
43  return Outgoing;
44 }
45 
46 
48 // Setter Section //
50 
56 void answerInlineQuery::addInlineQueryResult(shared_ptr<InlineQueryResult>IQR) {
57  this->results.push_back(move(IQR));
58 }
59 
60 void answerInlineQuery::setCache_time(const optional<std::int32_t> &cache_time) {
62 }
63 
64 void answerInlineQuery::setIs_personal(const optional<bool> &is_personal) {
66 }
67 
68 void answerInlineQuery::setNext_offset(const optional<string> &next_offset) {
70 }
71 
74 }
75 
78 }
79 
81 // Getter Section //
83 
85  return inline_query_id;
86 }
87 
88 //tood return of vector?, add?
89 
90 const optional<std::int32_t> &answerInlineQuery::getCache_time() const {
91  return cache_time;
92 }
93 
94 const optional<bool> &answerInlineQuery::getIs_personal() const {
95  return is_personal;
96 }
97 
98 const optional<string> &answerInlineQuery::getNext_offset() const {
99  return next_offset;
100 }
101 
102 const optional<string> &answerInlineQuery::getSwitch_pm_text() const {
103  return switch_pm_text;
104 }
105 
106 const optional<string> &answerInlineQuery::getSwitch_pm_parameter() const {
107  return switch_pm_parameter;
108 }
109 
110 
111 
std::optional< bool > is_personal
const std::optional< std::string > & getNext_offset() const
void setIs_personal(const std::optional< bool > &is_personal)
const std::optional< int > & getCache_time() const
std::optional< std::string > switch_pm_text
Definition: Bot.h:27
answerInlineQuery(std::string inline_query_id, std::vector< std::shared_ptr< InlineQueryResult >> results)
const std::string & getInline_query_id() const
const std::optional< std::string > & getSwitch_pm_text() const
std::optional< std::int32_t > cache_time
std::optional< std::string > next_offset
void setNext_offset(const std::optional< std::string > &next_offset)
const std::optional< std::string > & getSwitch_pm_parameter() const
std::vector< std::shared_ptr< InlineQueryResult > > results
Json::Value toJson(T Obj)
void setSwitch_pm_text(const std::optional< std::string > &switch_pm_text)
const std::optional< bool > & getIs_personal() const
void addInlineQueryResult(std::shared_ptr< InlineQueryResult > IQR)
std::optional< std::string > switch_pm_parameter
void setSwitch_pm_parameter(const std::optional< std::string > &switch_pm_parameter)
void setCache_time(const std::optional< std::int32_t > &cache_time)