#pragma once #include #include #include typedef std::function DownloadProgressHandler; void installDownloadProgressHandler(DownloadProgressHandler handler); namespace PyTools { // Downloads url to local cache, returns local file path. Reports progress via installDownloadProgressHandler. std::string download(const std::string &url, bool use_cache = true, std::atomic *abort = nullptr); // Decompresses a local log file and returns the temporary output path. std::string decompress(const std::string &path, std::atomic *abort = nullptr, size_t max_bytes = 0); // Returns JSON string of route files (same format as /v1/route/.../files API) std::string getRouteFiles(const std::string &route); // Resolves API/internal files into a JSON manifest keyed by segment number. End is inclusive. std::string resolveRouteFiles(const std::string &route, int begin, int end, const std::string &selector); // Browser sign-in; abort closes the local callback server. Returns a JSON status. std::string authenticate(const std::string &provider, std::atomic *abort); // Returns JSON string of user's devices std::string getDevices(); // Returns JSON string of device routes std::string getDeviceRoutes(const std::string &dongle_id, int64_t start_ms = 0, int64_t end_ms = 0, bool preserved = false); // Migrated bytes retain binary stdout exactly; empty on failure. std::string migrateLog(const std::string &log_path); } // namespace PyTools