mastodonpp  0.0.0
api.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_API_HPP
18 #define MASTODONPP_API_HPP
19 
20 #include <map>
21 #include <string>
22 #include <variant>
23 
24 namespace mastodonpp
25 {
26 
27 using std::string;
28 using std::variant;
29 
35 class API
36 {
37 public:
45  enum class v1
46  {
47  instance
48  };
49 
57  enum class v2
58  {
59  search
60  };
61 
67  using endpoint_type = variant<v1,v2>;
68 
77  explicit API(endpoint_type &endpoint);
78 
84  string to_string() const;
85 
86 private:
87  const endpoint_type _endpoint;
88 };
89 
90 } // namespace mastodonpp
91 
92 #endif // MASTODONPP_API_HPP
mastodonpp::API::v2
v2
An enumeration of all v2 API endpoints.
Definition: api.hpp:57
mastodonpp::API::to_string
string to_string() const
Convert endpoint_type to string.
Definition: api.cpp:34
mastodonpp
C++ wrapper for the Mastodon API.
Definition: api.cpp:23
mastodonpp::API::API
API(endpoint_type &endpoint)
Constructs an API object. You should never need this.
Definition: api.cpp:30
mastodonpp::API
Holds API endpoints.
Definition: api.hpp:35
mastodonpp::API::v1
v1
An enumeration of all v1 API endpoints.
Definition: api.hpp:45
mastodonpp::API::endpoint_type
variant< v1, v2 > endpoint_type
Type for endpoints. Either API::v1 or API::v2.
Definition: api.hpp:67