@@ -84,6 +84,44 @@ namespace winrt::YtFlowApp::implementation
8484 std::string type;
8585 };
8686 NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE (FfiProxyGroup, id, name, type)
87+ struct FfiProxyGroupSubscription
88+ {
89+ std::string format;
90+ std::string url;
91+ std::optional<uint64_t > upload_bytes_used;
92+ std::optional<uint64_t > download_bytes_used;
93+ std::optional<uint64_t > bytes_total;
94+ std::optional<std::string> expires_at;
95+ std::optional<std::string> retrieved_at;
96+ };
97+ inline void from_json (nlohmann::json const &json, FfiProxyGroupSubscription &r)
98+ {
99+ json.at (" format" ).get_to (r.format );
100+ json.at (" url" ).get_to (r.url );
101+ if (nlohmann::json const uploadBytesUsedDoc = json.value (" upload_bytes_used" , nlohmann::json ());
102+ uploadBytesUsedDoc != nullptr )
103+ {
104+ r.upload_bytes_used = {uploadBytesUsedDoc.get <uint64_t >()};
105+ }
106+ if (nlohmann::json const downloadBytesUsedDoc = json.value (" download_bytes_used" , nlohmann::json ());
107+ downloadBytesUsedDoc != nullptr )
108+ {
109+ r.download_bytes_used = {downloadBytesUsedDoc.get <uint64_t >()};
110+ }
111+ if (nlohmann::json const bytesTotalDoc = json.value (" bytes_total" , nlohmann::json ()); bytesTotalDoc != nullptr )
112+ {
113+ r.bytes_total = {bytesTotalDoc.get <uint64_t >()};
114+ }
115+ if (nlohmann::json const expiresAtDoc = json.value (" expires_at" , nlohmann::json ()); expiresAtDoc != nullptr )
116+ {
117+ r.expires_at = {expiresAtDoc.get <std::string>()};
118+ }
119+ if (nlohmann::json const retrievedAtDoc = json.value (" retrieved_at" , nlohmann::json ());
120+ retrievedAtDoc != nullptr )
121+ {
122+ r.retrieved_at = {retrievedAtDoc.get <std::string>()};
123+ }
124+ }
87125 struct FfiProxy
88126 {
89127 uint32_t id{};
@@ -118,16 +156,16 @@ namespace winrt::YtFlowApp::implementation
118156 {
119157 return ;
120158 }
121- if (nlohmann::json const etagDoc = json.value (" etag" , nlohmann::json{ nullptr } ); etagDoc != nullptr )
159+ if (nlohmann::json const etagDoc = json.value (" etag" , nlohmann::json () ); etagDoc != nullptr )
122160 {
123161 r.etag = {etagDoc.get <std::string>()};
124162 }
125- if (nlohmann::json const lastModifiedDoc = json.value (" last_modified" , nlohmann::json{ nullptr } );
163+ if (nlohmann::json const lastModifiedDoc = json.value (" last_modified" , nlohmann::json () );
126164 lastModifiedDoc != nullptr )
127165 {
128166 r.last_modified = {lastModifiedDoc.get <std::string>()};
129167 }
130- if (nlohmann::json const retrievedAtDoc = json.value (" retrieved_at" , nlohmann::json{ nullptr } );
168+ if (nlohmann::json const retrievedAtDoc = json.value (" retrieved_at" , nlohmann::json () );
131169 retrievedAtDoc != nullptr )
132170 {
133171 r.retrieved_at = {retrievedAtDoc.get <std::string>()};
@@ -153,16 +191,16 @@ namespace winrt::YtFlowApp::implementation
153191 {
154192 return ;
155193 }
156- if (nlohmann::json const gitTagDoc = json.value (" git_tag" , nlohmann::json{ nullptr } ); gitTagDoc != nullptr )
194+ if (nlohmann::json const gitTagDoc = json.value (" git_tag" , nlohmann::json () ); gitTagDoc != nullptr )
157195 {
158196 r.git_tag = {gitTagDoc.get <std::string>()};
159197 }
160- if (nlohmann::json const releaseTitleDoc = json.value (" release_title" , nlohmann::json{ nullptr } );
198+ if (nlohmann::json const releaseTitleDoc = json.value (" release_title" , nlohmann::json () );
161199 releaseTitleDoc != nullptr )
162200 {
163201 r.release_title = {releaseTitleDoc.get <std::string>()};
164202 }
165- if (nlohmann::json const retrievedAtDoc = json.value (" retrieved_at" , nlohmann::json{ nullptr } );
203+ if (nlohmann::json const retrievedAtDoc = json.value (" retrieved_at" , nlohmann::json () );
166204 retrievedAtDoc != nullptr )
167205 {
168206 r.retrieved_at = {retrievedAtDoc.get <std::string>()};
@@ -196,13 +234,19 @@ namespace winrt::YtFlowApp::implementation
196234 void RenameProxyGroup (uint32_t id, char const *name) &;
197235 void DeleteProxyGroup (uint32_t id) &;
198236 uint32_t CreateProxyGroup (char const *name, char const *type) &;
237+ uint32_t CreateProxySubscriptionGroup (char const *name, char const *format, char const *url) &;
199238 std::vector<FfiProxy> GetProxiesByProxyGroup (uint32_t proxyGroupId) &;
239+ FfiProxyGroupSubscription GetProxySubscriptionByProxyGroup (uint32_t proxyGroupId) &;
240+ void UpdateProxySubscriptionRetrievedByProxyGroup (uint32_t proxyGroupId, std::optional<uint64_t > uploadBytes,
241+ std::optional<uint64_t > downloadBytes,
242+ std::optional<uint64_t > totalBytes, char const *expiresAt) &;
200243 uint32_t CreateProxy (uint32_t proxyGroupId, char const *name, uint8_t const *proxy, size_t proxyLen,
201244 uint16_t proxyVersion) &;
202245 void UpdateProxy (uint32_t proxyId, char const *name, uint8_t const *proxy, size_t proxyLen,
203246 uint16_t proxyVersion) &;
204247 void DeleteProxy (uint32_t proxyId) &;
205248 void ReorderProxy (uint32_t proxyGroupId, int32_t rangeStartOrder, int32_t rangeEndOrder, int32_t moves) &;
249+ void BatchUpdateProxyInGroup (uint32_t proxyGroupId, uint8_t const *newProxyBuf, size_t newProxyBufLen) &;
206250 std::vector<FfiResource> GetResources () &;
207251 void DeleteResource (uint32_t resourceId) &;
208252 uint32_t CreateResourceWithUrl (char const *key, char const *type, char const *local_file, char const *url) &;
0 commit comments