tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
UsersShared.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
8 struct UsersShared {
9 UsersShared() = default;
10 explicit UsersShared(const nl::json& json) {
11 fromJson(json);
12 }
13
15 std::int32_t requestId{};
16
18 std::vector<Ptr<SharedUser>> users;
19
25 std::int64_t userId{};
26
29 nl::json toJson() const {
30 nl::json json = nl::json::object();
31 OBJECT_SERIALIZE_FIELD(json, "request_id", requestId);
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_PTR_ARRAY(json, "users", users, false);
40 }
41 };
42}
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition Object.hpp:27
#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
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition Object.hpp:89
This object contains information about the users whose identifiers were shared with the bot using a K...
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::vector< Ptr< SharedUser > > users
Information about users shared with the bot.
std::int64_t userId
Identifier of the shared user. This number may have more than 32 significant bits and some programmin...
std::int32_t requestId
Identifier of the request.
nl::json toJson() const
Serializes this object to JSON.
UsersShared(const nl::json &json)