tgbotxx  1.1.6.9
Telegram Bot C++ Library
WebAppInfo.hpp
Go to the documentation of this file.
1 #pragma once
3 
4 namespace tgbotxx {
7  struct WebAppInfo {
8  WebAppInfo() = default;
9  explicit WebAppInfo(const nl::json& json) {
10  fromJson(json);
11  }
12 
15  std::string url;
16 
17 
20  nl::json toJson() const {
21  nl::json json = nl::json::object();
22  OBJECT_SERIALIZE_FIELD(json, "url", url);
23  return json;
24  }
25 
27  void fromJson(const nl::json& json) {
28  OBJECT_DESERIALIZE_FIELD(json, "url", url, "", false);
29  }
30  };
31 }
#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
Describes a Web App. https://core.telegram.org/bots/api#webappinfo.
Definition: WebAppInfo.hpp:7
WebAppInfo(const nl::json &json)
Definition: WebAppInfo.hpp:9
nl::json toJson() const
Serializes this object to JSON.
Definition: WebAppInfo.hpp:20
std::string url
An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps Web...
Definition: WebAppInfo.hpp:15
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition: WebAppInfo.hpp:27