@@ -74,7 +74,7 @@ namespace winrt::YtFlowApp::implementation
7474 std::string desc;
7575 std::string plugin;
7676 uint16_t plugin_version{0 };
77- std::vector< uint8_t > param;
77+ nlohmann::json:: binary_t param;
7878
7979 static FfiPluginVerifyResult verify (char const *plugin, uint16_t plugin_version, uint8_t const *param,
8080 size_t param_len);
@@ -130,7 +130,7 @@ namespace winrt::YtFlowApp::implementation
130130 uint32_t id{};
131131 std::string name;
132132 int32_t order_num{};
133- std::vector< uint8_t > proxy;
133+ nlohmann::json:: binary_t proxy;
134134 uint16_t proxy_version{0 };
135135 };
136136 NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE (FfiDataProxy, id, name, order_num, proxy, proxy_version)
@@ -210,6 +210,40 @@ namespace winrt::YtFlowApp::implementation
210210 }
211211 }
212212
213+ struct FfiParsedTomlPlugin
214+ {
215+ FfiPlugin plugin;
216+ bool is_entry = false ;
217+ };
218+ inline void from_json (nlohmann::json const &json, FfiParsedTomlPlugin &r)
219+ {
220+ json.get_to (r.plugin );
221+ json.at (" is_entry" ).get_to (r.is_entry );
222+ }
223+ struct FfiParsedTomlProfile
224+ {
225+ std::optional<std::string> name;
226+ std::optional<std::string> locale;
227+ std::optional<std::string> created_at;
228+ std::vector<FfiParsedTomlPlugin> plugins;
229+ };
230+ inline void from_json (nlohmann::json const &json, FfiParsedTomlProfile &r)
231+ {
232+ if (nlohmann::json const nameDoc = json.value (" name" , nlohmann::json ()); nameDoc != nullptr )
233+ {
234+ r.name = {nameDoc.get <std::string>()};
235+ }
236+ if (nlohmann::json const localeDoc = json.value (" locale" , nlohmann::json ()); localeDoc != nullptr )
237+ {
238+ r.locale = {localeDoc.get <std::string>()};
239+ }
240+ if (nlohmann::json const createdAtDoc = json.value (" created_at" , nlohmann::json ()); createdAtDoc != nullptr )
241+ {
242+ r.created_at = {createdAtDoc.get <std::string>()};
243+ }
244+ json.at (" plugins" ).get_to (r.plugins );
245+ }
246+
213247 struct FfiConn final
214248 {
215249 FfiConn (ytflow_core::ytflow_connection *conn) noexcept : conn_ptr(conn)
@@ -223,6 +257,8 @@ namespace winrt::YtFlowApp::implementation
223257 void DeleteProfile (uint32_t id) &;
224258 uint32_t CreateProfile (const char *name, const char *locale) &;
225259 void UpdateProfile (uint32_t id, const char *name, const char *locale) &;
260+ std::string ExportProfileToml (uint32_t id) &;
261+ FfiParsedTomlProfile ParseProfileToml (uint8_t const *toml, size_t tomlLen) &;
226262 std::vector<FfiPlugin> GetPluginsByProfile (uint32_t profileId) &;
227263 std::vector<FfiPlugin> GetEntryPluginsByProfile (uint32_t profileId) &;
228264 void SetPluginAsEntry (uint32_t pluginId, uint32_t profileId) &;
0 commit comments