Merge branch 'develop' into main
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
tastytea 2020-01-06 14:45:19 +01:00
commit 7917d94248
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
7 changed files with 34 additions and 9 deletions

View File

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef MASTODONPP_RETURN_TYPES_HPP #ifndef MASTODONPP_ANSWER_HPP
#define MASTODONPP_RETURN_TYPES_HPP #define MASTODONPP_ANSWER_HPP
#include <cstdint> #include <cstdint>
#include <string> #include <string>
@ -34,7 +34,7 @@ using std::string_view;
* *
* @since 0.1.0 * @since 0.1.0
* *
* @headerfile return_types.hpp mastodonpp/return_types.hpp * @headerfile answer.hpp mastodonpp/answer.hpp
* *
*/ */
struct answer_type struct answer_type
@ -103,4 +103,4 @@ struct answer_type
} // namespace mastodonpp } // namespace mastodonpp
#endif // MASTODONPP_RETURN_TYPES_HPP #endif // MASTODONPP_ANSWER_HPP

View File

@ -17,10 +17,10 @@
#ifndef MASTODONPP_CONNECTION_HPP #ifndef MASTODONPP_CONNECTION_HPP
#define MASTODONPP_CONNECTION_HPP #define MASTODONPP_CONNECTION_HPP
#include "answer.hpp"
#include "api.hpp" #include "api.hpp"
#include "curl_wrapper.hpp" #include "curl_wrapper.hpp"
#include "instance.hpp" #include "instance.hpp"
#include "return_types.hpp"
#include <string> #include <string>
#include <string_view> #include <string_view>

View File

@ -17,18 +17,24 @@
#ifndef MASTODONPP_CURL_WRAPPER_HPP #ifndef MASTODONPP_CURL_WRAPPER_HPP
#define MASTODONPP_CURL_WRAPPER_HPP #define MASTODONPP_CURL_WRAPPER_HPP
#include "return_types.hpp" #include "answer.hpp"
#include "curl/curl.h" #include "curl/curl.h"
#include <map>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <variant>
#include <vector>
namespace mastodonpp namespace mastodonpp
{ {
using std::map;
using std::string; using std::string;
using std::string_view; using std::string_view;
using std::variant;
using std::vector;
/*! /*!
* @brief The HTTP method. * @brief The HTTP method.
@ -44,6 +50,22 @@ enum class http_method
DELETE DELETE
}; };
/*!
* @brief std::map of parameters for API calls.
*
* Example:
* @code
* parametermap parameters
* {
* {"id", "12"},
* {"poll[options]", vector<string>{"Yes", "No", "Maybe"}}
* };
* @endcode
*
* @since 0.1.0
*/
using parametermap = map<string, variant<string, vector<string>>>;
/*! /*!
* @brief Handles the details of network connections. * @brief Handles the details of network connections.
* *

View File

@ -17,11 +17,11 @@
#ifndef MASTODONPP_HPP #ifndef MASTODONPP_HPP
#define MASTODONPP_HPP #define MASTODONPP_HPP
#include "answer.hpp"
#include "api.hpp" #include "api.hpp"
#include "connection.hpp" #include "connection.hpp"
#include "exceptions.hpp" #include "exceptions.hpp"
#include "instance.hpp" #include "instance.hpp"
#include "return_types.hpp"
/*! /*!
* @headerfile mastodonpp.hpp mastodonpp/mastodonpp.hpp * @headerfile mastodonpp.hpp mastodonpp/mastodonpp.hpp
@ -72,6 +72,8 @@
* Any unrecoverable libcurl error will be thrown as a * Any unrecoverable libcurl error will be thrown as a
* mastodonpp::CURLException. Network errors will **not** be thrown, but * mastodonpp::CURLException. Network errors will **not** be thrown, but
* reported via the return value. * reported via the return value.
*
* @example example01_instance_info.cpp
*/ */
/*! /*!

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "return_types.hpp" #include "answer.hpp"
namespace mastodonpp namespace mastodonpp
{ {

View File

@ -14,9 +14,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "answer.hpp"
#include "instance.hpp" #include "instance.hpp"
#include "log.hpp" #include "log.hpp"
#include "return_types.hpp"
namespace mastodonpp namespace mastodonpp
{ {

View File

@ -26,6 +26,7 @@ namespace mastodonpp
using std::cerr; using std::cerr;
using std::string_view; using std::string_view;
//! @private
constexpr auto shorten_filename(const string_view &filename) constexpr auto shorten_filename(const string_view &filename)
{ {
for (const string_view &dir : {"/src/", "/include/"}) for (const string_view &dir : {"/src/", "/include/"})