yatbcpp  0.0.1
Yet another Telegram Bot CPP Library
sendLocation.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <optional>
4 #include "methods/sendLocation.h"
5 
6 using namespace std;
7 using namespace yatbcpp;
8 
10 // Constructor Section //
12 
13 sendLocation::sendLocation(Chat C,Location location) :
14  telegram_methodJSON("sendLocation"),
15  chat_id(to_string(C.getId())), latitude(location.getLatitude()), longitude(location.getLongitude())
16 {
17 
18 }
19 
21  telegram_methodJSON("sendLocation"),
22  chat_id(to_string(chat_id)), latitude(location.getLatitude()), longitude(location.getLongitude())
23 {
24 
25 }
26 
28  telegram_methodJSON("sendLocation"),
29  chat_id(move(chat_id)), latitude(location.getLatitude()), longitude(location.getLongitude())
30 {
31 
32 }
34 // Outgoing Section //
36 
37 
38 Json::Value sendLocation::toJson() {
39  Json::Value Outgoing;
40  Outgoing["chat_id"] = getChat_id();
41  Outgoing["latitude"] = getLatitude();
42  Outgoing["longitude"] = getLongitude();
43 
44  if(getLivePeriod()){
45  Outgoing["live_period"] = getLivePeriod().value();
46  }
48  Outgoing["disable_notification"] = getDisable_notification().value();
49  }
51  Outgoing["reply_to_message_id"] = getReply_to_message_id().value();
52  }
53 
54  return Outgoing;
55 
56 }
57 
58 
60 // Setter Section //
62 
63 
64 void sendLocation::setLive_period(const optional<unsigned int> &live_period) {
66 }
67 
70 }
71 
74 }
75 
76 
83 }
84 
91 }
92 
99 }
100 
102 // Getter Section //
104 
105 const string &sendLocation::getChat_id() const {
106  return chat_id;
107 }
108 
109 const float &sendLocation::getLatitude() const {
110  return latitude;
111 }
112 
113 const float &sendLocation::getLongitude() const {
114  return longitude;
115 }
116 
117 const optional<unsigned int> &sendLocation::getLivePeriod() const {
118  return live_period;
119 }
120 
121 const optional<bool> &sendLocation::getDisable_notification() const {
122  return disable_notification;
123 }
124 
125 const optional<int32_t> &sendLocation::getReply_to_message_id() const {
126  return reply_to_message_id;
127 }
128 
129 const optional<ReplyMarkup> &sendLocation::getReply_markup() const {
130  return reply_markup;
131 }
Json::Value toJson()
Definition: sendLocation.cc:38
std::optional< int > reply_to_message_id
Definition: sendLocation.h:80
const float & getLongitude() const
void setReplyMarkup(const ReplyKeyboardMarkup RKM)
Definition: sendLocation.cc:81
std::optional< bool > disable_notification
Definition: sendLocation.h:79
std::optional< unsigned int > live_period
Definition: sendLocation.h:78
Definition: Bot.h:27
telegram_methodJSON(std::string functionname)
const std::optional< int > & getReply_to_message_id() const
float getLatitude() const
Definition: Location.cc:38
const std::optional< ReplyMarkup > & getReply_markup() const
void setDisable_notification(const std::optional< bool > &disable_notification)
Definition: sendLocation.cc:68
std::optional< ReplyMarkup > reply_markup
Definition: sendLocation.h:81
const float & getLatitude() const
void setLive_period(const std::optional< unsigned int > &live_period)
Definition: sendLocation.cc:64
float getLongitude() const
Definition: Location.cc:34
const std::optional< bool > & getDisable_notification() const
const std::string & getChat_id() const
void setReply_to_message_id(const std::optional< int > &reply_to_message_id)
Definition: sendLocation.cc:72
sendLocation(Chat C, Location location)
Definition: sendLocation.cc:13
const std::optional< unsigned int > & getLivePeriod() const