#pragma once // Files API: upload (multipart), list, metadata, download, delete. // GA at /v1/files; `with_betas({Beta::kFilesApi20250414})` keeps sending the // legacy header, and scope_id (beta) filters by scope. #include #include #include "anthropic/core/page.h" #include "anthropic/core/session.h" namespace molo::anthropic::core { struct FileMeta { std::string id, filename, mime_type, created_at, expires_at; long size_bytes = 0; bool downloadable = false; Json raw; static FileMeta parse(const Json& j); }; struct FileContent { std::string bytes; std::string content_type; }; class Files : public CoreService { public: explicit Files(std::shared_ptr session) : CoreService(std::move(session)) {} // expires_in_seconds 0: no expiry; else 3600..7776000. FileMeta upload(const std::string& filename, const std::string& data, const std::string& mime_type, long expires_in_seconds = 0); Page list(int limit = 0, const std::string& page = "", const std::vector& ids = {}, const std::string& scope_id = ""); FileMeta metadata(const std::string& file_id); FileContent download(const std::string& file_id); Json destroy(const std::string& file_id); // explicit delete }; } // namespace molo::anthropic::core