tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
UserShared.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
7 struct UserShared {
8 UserShared() = default;
9 explicit UserShared(const nl::json& json) {
10 fromJson(json);
11 }
12
14 std::int32_t requestId{};
15
21 std::int64_t userId{};
22
25 nl::json toJson() const {
26 nl::json json = nl::json::object();
27 OBJECT_SERIALIZE_FIELD(json, "request_id", requestId);
28 OBJECT_SERIALIZE_FIELD(json, "user_id", userId);
29 return json;
30 }
31
33 void fromJson(const nl::json& json) {
34 OBJECT_DESERIALIZE_FIELD(json, "request_id", requestId, 0, false);
35 OBJECT_DESERIALIZE_FIELD(json, "user_id", userId, 0, false);
36 }
37 };
38}
#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 contains information about the user whose identifier was shared with the bot using a Keyb...
Definition UserShared.hpp:7
std::int64_t userId
Identifier of the shared user. This number may have more than 32 significant bits and some programmin...
nl::json toJson() const
Serializes this object to JSON.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
UserShared(const nl::json &json)
Definition UserShared.hpp:9
std::int32_t requestId
Identifier of the request.