tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
KeyboardButtonRequestUsers.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
11 explicit KeyboardButtonRequestUsers(const nl::json& json) {
12 fromJson(json);
13 }
14
18 std::int32_t requestId{};
19
21 bool userIsBot{};
22
25
27 std::int32_t maxQuantity{1};
28
31
34
37
38
41 nl::json toJson() const {
42 nl::json json = nl::json::object();
43 OBJECT_SERIALIZE_FIELD(json, "request_id", requestId);
44 OBJECT_SERIALIZE_FIELD(json, "user_is_bot", userIsBot);
45 OBJECT_SERIALIZE_FIELD(json, "user_is_premium", userIsPremium);
46 OBJECT_SERIALIZE_FIELD(json, "max_quantity", maxQuantity);
47 OBJECT_SERIALIZE_FIELD(json, "request_name", requestName);
48 OBJECT_SERIALIZE_FIELD(json, "request_username", requestUsername);
49 OBJECT_SERIALIZE_FIELD(json, "request_photo", requestPhoto);
50 return json;
51 }
52
54 void fromJson(const nl::json& json) {
55 OBJECT_DESERIALIZE_FIELD(json, "request_id", requestId, 0, false);
56 OBJECT_DESERIALIZE_FIELD(json, "user_is_bot", userIsBot, false, true);
57 OBJECT_DESERIALIZE_FIELD(json, "user_is_premium", userIsPremium, false, true);
58 OBJECT_DESERIALIZE_FIELD(json, "max_quantity", maxQuantity, 1, true);
59 OBJECT_DESERIALIZE_FIELD(json, "request_name", requestName, false, true);
60 OBJECT_DESERIALIZE_FIELD(json, "request_username", requestUsername, false, true);
61 OBJECT_DESERIALIZE_FIELD(json, "request_photo", requestPhoto, false, true);
62 }
63 };
64}
#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:46
TThis object defines the criteria used to request suitable users. Information about the selected user...
bool userIsPremium
Optional. Pass True to request a premium user, pass False to request a non-premium user....
bool requestUsername
Optional. Pass True to request the users' usernames.
bool userIsBot
Optional. Pass True to request a bot, pass False to request a regular user. If not specified,...
std::int32_t requestId
Signed 32-bit identifier of the request, which will be received back in the UsersShared object....
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::int32_t maxQuantity
Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
bool requestName
Optional. Pass True to request the users' first and last names.
nl::json toJson() const
Serializes this object to JSON.
bool requestPhoto
Optional. Pass True to request the users' photos.