1+ // SPDX-License-Identifier: Apache-2.0
2+ #ifndef HIERO_TCK_CPP_UPDATE_FILE_PARAMS_H_
3+ #define HIERO_TCK_CPP_UPDATE_FILE_PARAMS_H_
4+
5+ #include " common/CommonTransactionParams.h"
6+ #include " json/JsonUtils.h"
7+
8+ #include < nlohmann/json.hpp>
9+ #include < optional>
10+ #include < string>
11+ #include < vector>
12+
13+ namespace Hiero ::TCK::FileService
14+ {
15+ /* *
16+ * Struct to hold the arguments for an `updateFile` JSON-RPC method call.
17+ */
18+ struct UpdateFileParams
19+ {
20+ /* *
21+ * The ID of the file to update.
22+ */
23+ std::optional<std::string> mFileId ;
24+
25+ /* *
26+ * The keys that must sign when mutating the file.
27+ */
28+ std::optional<std::vector<std::string>> mKeys ;
29+
30+ /* *
31+ * The new contents of the file.
32+ */
33+ std::optional<std::string> mContents ;
34+
35+ /* *
36+ * The new memo for the file.
37+ */
38+ std::optional<std::string> mFileMemo ;
39+
40+ /* *
41+ * The new time at which the file will expire.
42+ */
43+ std::optional<std::string> mExpirationTime ;
44+
45+ /* *
46+ * Any parameters common to all transaction types.
47+ */
48+ std::optional<CommonTransactionParams> mCommonTxParams ;
49+ };
50+
51+ } // namespace Hiero::TCK::FileService
52+
53+ namespace nlohmann
54+ {
55+ /* *
56+ * JSON serializer template specialization required to convert UpdateFileParams arguments properly.
57+ */
58+ template <>
59+ struct [[maybe_unused]] adl_serializer<Hiero::TCK::FileService::UpdateFileParams>
60+ {
61+ static void from_json (const json& jsonFrom, Hiero::TCK::FileService::UpdateFileParams& params)
62+ {
63+ params.mFileId = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, " fileId" );
64+ params.mKeys = Hiero::TCK::getOptionalJsonParameter<std::vector<std::string>>(jsonFrom, " keys" );
65+ params.mContents = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, " contents" );
66+ params.mFileMemo = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, " fileMemo" );
67+ params.mExpirationTime = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, " expirationTime" );
68+ params.mCommonTxParams =
69+ Hiero::TCK::getOptionalJsonParameter<Hiero::TCK::CommonTransactionParams>(jsonFrom, " commonTransactionParams" );
70+ }
71+ };
72+
73+ } // namespace nlohmann
74+
75+ #endif // HIERO_TCK_CPP_UPDATE_FILE_PARAMS_H_
0 commit comments