-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathGetTopicInfoQueryParams.h
More file actions
62 lines (51 loc) · 1.69 KB
/
GetTopicInfoQueryParams.h
File metadata and controls
62 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: Apache-2.0
#ifndef HIERO_TCK_CPP_GET_TOPIC_INFO_QUERY_PARAMS_H_
#define HIERO_TCK_CPP_GET_TOPIC_INFO_QUERY_PARAMS_H_
#include "nlohmann/json.hpp"
#include "json/JsonUtils.h"
#include <optional>
#include <string>
namespace Hiero::TCK::TopicService
{
/**
* Struct to hold the arguments for a `getTopicInfo` Json-RPC method call
*/
struct GetTopicInfoQueryParams
{
/**
* The ID of the topic to query.
*/
std::optional<std::string> mTopicId;
/**
* Explicit payment amount for the query in tinybars.
*/
std::optional<std::string> mQueryPayment;
/**
* Maximum payment amount for the query in tinybars.
*/
std::optional<std::string> mMaxQueryPayment;
};
} // namespace Hiero::TCK::TopicService
namespace nlohmann
{
/**
* JSON serializer template specialisation required to convert GetTopicInfoQueryParams arguments properly.
*/
template<>
struct [[maybe_unused]] adl_serializer<Hiero::TCK::TopicService::GetTopicInfoQueryParams>
{
/**
* Convert a Json Object to a GetTopicInfoQueryParams
*
* @param jsonFrom The json object which will fill the GetTopicInfoQueryParams.
* @param params The GetTopicInfoQueryParams to fill the json object.
*/
static void from_json(const json& jsonFrom, Hiero::TCK::TopicService::GetTopicInfoQueryParams& params)
{
params.mTopicId = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "topicId");
params.mQueryPayment = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "queryPayment");
params.mMaxQueryPayment = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "maxQueryPayment");
}
};
} // namespace nlohmann
#endif // HIERO_TCK_CPP_GET_TOPIC_INFO_QUERY_PARAMS_H_