mastodon-cpp  0.110.0
types.hpp
1 /* This file is part of mastodon-cpp.
2  * Copyright © 2019 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 MASTODON_CPP_TYPES_HPP
18 #define MASTODON_CPP_TYPES_HPP
19 
20 #include <string>
21 #include <map>
22 #include <vector>
23 
24 using std::string;
25 using std::vector;
26 
27 namespace Mastodon
28 {
37  typedef struct param
38  {
39  string key;
40  vector<string> values;
41 
43  operator const string() const;
44  } param;
45 
62  typedef struct parameters : public vector<param>
63  {
64  using vector<param>::vector;
65 
79  const std::vector<param>::const_iterator find(const string &key) const;
80  } parameters;
81 
87  enum class http_method
88  {
89  GET,
90  PATCH,
91  POST,
92  PUT,
93  DELETE,
94  GET_STREAM
95  };
96 
97  enum class error
98  {
99  OK = 0,
100  INVALID_ARGUMENT = 1,
101  URL_CHANGED = 10,
102  CONNECTION_TIMEOUT = 11,
103  CONNECTION_REFUSED = 12,
104  DNS = 13,
105  ENCRYPTION = 14,
106  UNKNOWN = 127
107  };
108 }
109 
110 #endif // MASTODON_CPP_TYPES_HPP
struct Mastodon::param param
A single parameter.
Vector of Mastodon::param, used for passing parameters in calls.
Definition: types.hpp:62
const std::vector< param >::const_iterator find(const string &key) const
Get iterator to element with key.
Definition: types.cpp:27
http_method
HTTP methods. Used in API calls.
Definition: types.hpp:87
Mastodon::parameters parameters
Vector of Mastodon::param, used for passing parameters in calls.
A single parameter.
Definition: types.hpp:37
Collection of things to interface with server software that implements the Mastodon API.
Definition: mastodon-cpp.hpp:47