diff --git a/include/return_types.hpp b/include/answer.hpp similarity index 92% rename from include/return_types.hpp rename to include/answer.hpp index 65b8f6e..2eb05aa 100644 --- a/include/return_types.hpp +++ b/include/answer.hpp @@ -14,8 +14,8 @@ * along with this program. If not, see . */ -#ifndef MASTODONPP_RETURN_TYPES_HPP -#define MASTODONPP_RETURN_TYPES_HPP +#ifndef MASTODONPP_ANSWER_HPP +#define MASTODONPP_ANSWER_HPP #include #include @@ -34,7 +34,7 @@ using std::string_view; * * @since 0.1.0 * - * @headerfile return_types.hpp mastodonpp/return_types.hpp + * @headerfile answer.hpp mastodonpp/answer.hpp * */ struct answer_type @@ -103,4 +103,4 @@ struct answer_type } // namespace mastodonpp -#endif // MASTODONPP_RETURN_TYPES_HPP +#endif // MASTODONPP_ANSWER_HPP diff --git a/include/connection.hpp b/include/connection.hpp index a26120c..6e43bc6 100644 --- a/include/connection.hpp +++ b/include/connection.hpp @@ -17,10 +17,10 @@ #ifndef MASTODONPP_CONNECTION_HPP #define MASTODONPP_CONNECTION_HPP +#include "answer.hpp" #include "api.hpp" #include "curl_wrapper.hpp" #include "instance.hpp" -#include "return_types.hpp" #include #include diff --git a/include/curl_wrapper.hpp b/include/curl_wrapper.hpp index 90e010a..267de96 100644 --- a/include/curl_wrapper.hpp +++ b/include/curl_wrapper.hpp @@ -17,18 +17,24 @@ #ifndef MASTODONPP_CURL_WRAPPER_HPP #define MASTODONPP_CURL_WRAPPER_HPP -#include "return_types.hpp" +#include "answer.hpp" #include "curl/curl.h" +#include #include #include +#include +#include namespace mastodonpp { +using std::map; using std::string; using std::string_view; +using std::variant; +using std::vector; /*! * @brief The HTTP method. @@ -44,6 +50,22 @@ enum class http_method DELETE }; +/*! + * @brief std::map of parameters for API calls. + * + * Example: + * @code + * parametermap parameters + * { + * {"id", "12"}, + * {"poll[options]", vector{"Yes", "No", "Maybe"}} + * }; + * @endcode + * + * @since 0.1.0 + */ +using parametermap = map>>; + /*! * @brief Handles the details of network connections. * diff --git a/include/mastodonpp.hpp b/include/mastodonpp.hpp index 70d9bdc..113ec0b 100644 --- a/include/mastodonpp.hpp +++ b/include/mastodonpp.hpp @@ -17,11 +17,11 @@ #ifndef MASTODONPP_HPP #define MASTODONPP_HPP +#include "answer.hpp" #include "api.hpp" #include "connection.hpp" #include "exceptions.hpp" #include "instance.hpp" -#include "return_types.hpp" /*! * @headerfile mastodonpp.hpp mastodonpp/mastodonpp.hpp @@ -72,6 +72,8 @@ * Any unrecoverable libcurl error will be thrown as a * mastodonpp::CURLException. Network errors will **not** be thrown, but * reported via the return value. + * + * @example example01_instance_info.cpp */ /*! diff --git a/src/return_types.cpp b/src/answer.cpp similarity index 97% rename from src/return_types.cpp rename to src/answer.cpp index 8dd25ff..8006f90 100644 --- a/src/return_types.cpp +++ b/src/answer.cpp @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -#include "return_types.hpp" +#include "answer.hpp" namespace mastodonpp { diff --git a/src/instance.cpp b/src/instance.cpp index b367f9b..683e20e 100644 --- a/src/instance.cpp +++ b/src/instance.cpp @@ -14,9 +14,9 @@ * along with this program. If not, see . */ +#include "answer.hpp" #include "instance.hpp" #include "log.hpp" -#include "return_types.hpp" namespace mastodonpp { diff --git a/src/log.hpp b/src/log.hpp index ab8c033..286cd07 100644 --- a/src/log.hpp +++ b/src/log.hpp @@ -26,6 +26,7 @@ namespace mastodonpp using std::cerr; using std::string_view; +//! @private constexpr auto shorten_filename(const string_view &filename) { for (const string_view &dir : {"/src/", "/include/"})