tgbotxx 1.1.6.9
Telegram Bot C++ Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoginUrl.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
11 struct LoginUrl {
12 LoginUrl() = default;
13 explicit LoginUrl(const nl::json& json) {
14 fromJson(json);
15 }
16
23 std::string url;
24
26 std::string forwardText;
27
31 std::string botUsername;
32
35
38 nl::json toJson() const {
39 nl::json json = nl::json::object();
40 OBJECT_SERIALIZE_FIELD(json, "url", url);
41 OBJECT_SERIALIZE_FIELD(json, "forward_text", forwardText);
42 OBJECT_SERIALIZE_FIELD(json, "bot_username", botUsername);
43 OBJECT_SERIALIZE_FIELD(json, "request_write_access", requestWriteAccess);
44 return json;
45 }
46
48 void fromJson(const nl::json& json) {
49 OBJECT_DESERIALIZE_FIELD(json, "url", url, "", false);
50 OBJECT_DESERIALIZE_FIELD(json, "forward_text", forwardText, "", true);
51 OBJECT_DESERIALIZE_FIELD(json, "bot_username", botUsername, "", true);
52 OBJECT_DESERIALIZE_FIELD(json, "request_write_access", requestWriteAccess, false, true);
53 }
54 };
55}
#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
This object represents a parameter of the inline keyboard button used to automatically authorize a us...
Definition LoginUrl.hpp:11
std::string botUsername
Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more...
Definition LoginUrl.hpp:31
std::string forwardText
Optional. New text of the button in forwarded messages.
Definition LoginUrl.hpp:26
bool requestWriteAccess
Optional. Pass True to request the permission for your bot to send messages to the user.
Definition LoginUrl.hpp:34
std::string url
An HTTPS URL to be opened with user authorization data added to the query string when the button is p...
Definition LoginUrl.hpp:23
nl::json toJson() const
Serializes this object to JSON.
Definition LoginUrl.hpp:38
LoginUrl()=default
LoginUrl(const nl::json &json)
Definition LoginUrl.hpp:13
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Definition LoginUrl.hpp:48