mastodonpp  0.0.0
request.hpp
1 /* This file is part of mastodonpp.
2  * Copyright © 2020 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Affero General Public License for more details.
12  *
13  * You should have received a copy of the GNU Affero General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef MASTODONPP_REQUEST_HPP
18 #define MASTODONPP_REQUEST_HPP
19 
20 #include "api.hpp"
21 #include "curl_wrapper.hpp"
22 #include "instance.hpp"
23 #include "return_types.hpp"
24 
25 #include <string>
26 
27 namespace mastodonpp
28 {
29 
30 using std::string;
31 
39 class Request : public CURLWrapper
40 {
41 public:
49  explicit Request(Instance &instance);
50 
59  [[nodiscard]]
60  answer_type get(API::endpoint_type endpoint) const;
61 
69  [[nodiscard]]
70  answer_type get(string endpoint) const;
71 
72 private:
73  Instance &_instance;
74 };
75 
76 } // namespace mastodonpp
77 
78 #endif // MASTODONPP_REQUEST_HPP
mastodonpp
C++ wrapper for the Mastodon API.
Definition: api.cpp:23
mastodonpp::Request
Used to make a request to the Mastodon API.
Definition: request.hpp:39
mastodonpp::Request::Request
Request(Instance &instance)
Construct a new Request object.
Definition: request.cpp:22
mastodonpp::Request::get
answer_type get(API::endpoint_type endpoint) const
Make a HTTP GET call.
Definition: request.cpp:26
mastodonpp::answer_type
Return type for Requests.
Definition: return_types.hpp:44
mastodonpp::Instance
Holds the access data of an instance.
Definition: instance.hpp:36
mastodonpp::CURLWrapper
Handles the details of network connections.
Definition: curl_wrapper.hpp:36
mastodonpp::API::endpoint_type
variant< v1, v2 > endpoint_type
Type for endpoints. Either API::v1 or API::v2.
Definition: api.hpp:69