#pragma once #include "constants.hpp" #include "error.hpp" #include "package.hpp" #include "types.hpp" #include "result.hpp" #include "config.hpp" #include #include #include #include #include namespace gdpm::package { struct info { size_t asset_id; string type; string title; string author; size_t author_id; string version; string godot_version; string cost; string description; string modify_date; string support_level; string category; string remote_source; string download_url; string download_hash; bool is_installed; string install_path; std::vector dependencies; }; struct params { enum install_method_e{ GLOBAL_LINK_LOCAL, GLOBAL_CLONE_LOCAL, GLOBAL_ONLY, LOCAL_ONLY }; bool parallel_jobs = 1; bool use_cache = true; bool use_remote = true; bool skip_prompt = false; std::string remote_source = ""; install_method_e install_method = GLOBAL_LINK_LOCAL; }; using info_list = std::vector; using title_list = std::vector; using id_list = std::vector; using path = std::string; using path_list = std::vector; /*! @brief Install a Godot package from the Asset Library in the current project. By default, packages are stored in a global directory and linked to the project where the tool is executed. Use the `--jobs` option to install packages in parallel. Specify which remote source to use by passing the `--remote` option. By default, the first remote source will by used. Alternatively, if the `--use-remote=false` option is passed, then the tool will only attempt to fetch the package from cache. Use the `--use-cache=false` option to fetch package only from remote source. `gdpm install "super cool example package" To only install a package global without linking to the project, use the `--global-only` option. `gdpm install --global-only "super cool example package" To install a package to a local project only, use the `--local-only` option. This will extract the package contents to the project location instead of the global install location. Use the `--path` option to specify an alternative path. `gdpm install --local-only "super cool example package" --path addons/example To copy the package to a project instead of linking, use the `--clone` option. `gdpm install --clone "super cool examle package" */ GDPM_DLL_EXPORT error install(const config::context& config, const title_list& package_titles, const params& params = package::params()); /*! @brief Remove's package and contents from local database. */ GDPM_DLL_EXPORT error remove(const config::context& config, const title_list& package_titles, const params& params = package::params()); GDPM_DLL_EXPORT error remove_all(const config::context& config, const params& params = package::params()); GDPM_DLL_EXPORT error update(const config::context& config, const title_list& package_titles, const params& params = package::params()); GDPM_DLL_EXPORT error search(const config::context& config, const title_list& package_titles, const params& params = package::params()); GDPM_DLL_EXPORT error list(const config::context& config, const args_t& args, const opts_t& opts); GDPM_DLL_EXPORT error export_to(const path_list& paths); GDPM_DLL_EXPORT error link(const config::context& config, const title_list& package_titles, const opts_t& opts); GDPM_DLL_EXPORT error clone(const config::context& config, const title_list& package_titles, const opts_t& opts); GDPM_DLL_EXPORT void print_list(const rapidjson::Document& json); GDPM_DLL_EXPORT void print_list(const info_list& packages); GDPM_DLL_EXPORT result_t get_package_info(const opts_t& opts); GDPM_DLL_EXPORT result_t get_package_titles(const info_list& packages); GDPM_DLL_EXPORT void clean_temporary(const config::context& config, const title_list& package_titles); /* Dependency Management API */ GDPM_DLL_EXPORT result_t synchronize_database(const config::context& config, const title_list& package_titles); GDPM_DLL_EXPORT result_t resolve_dependencies(const config::context& config, const title_list& package_titles); }