tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
KeyboardButtonRequestUser.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
11 explicit KeyboardButtonRequestUser(const nl::json& json) {
12 fromJson(json);
13 }
14
17 std::int32_t requestId{};
18
20 bool userIsBot{};
21
24
25
28 nl::json toJson() const {
29 nl::json json = nl::json::object();
30 OBJECT_SERIALIZE_FIELD(json, "request_id", requestId);
31 OBJECT_SERIALIZE_FIELD(json, "user_is_bot", userIsBot);
32 OBJECT_SERIALIZE_FIELD(json, "user_is_premium", userIsPremium);
33 return json;
34 }
35
37 void fromJson(const nl::json& json) {
38 OBJECT_DESERIALIZE_FIELD(json, "request_id", requestId, 0, false);
39 OBJECT_DESERIALIZE_FIELD(json, "user_is_bot", userIsBot, false, true);
40 OBJECT_DESERIALIZE_FIELD(json, "user_is_premium", userIsPremium, false, true);
41 }
42 };
43}
#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 defines the criteria used to request a suitable user. The identifier of the selected user...
bool userIsPremium
Optional. Pass True to request a premium user, pass False to request a non-premium user....
std::int32_t requestId
Signed 32-bit identifier of the request, which will be received back in the UserShared object.
bool userIsBot
Optional. Pass True to request a bot, pass False to request a regular user. If not specified,...
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.