mastodon-cpp  0.106.0
types_easy.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 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef MASTODON_CPP_EASY_TYPES_EASY_HPP
18 #define MASTODON_CPP_EASY_TYPES_EASY_HPP
19 
20 #include <string>
21 #include <utility>
22 #include <chrono>
23 #include <cstdint>
24 
25 using std::string;
26 using std::chrono::system_clock;
27 using std::uint64_t;
28 
29 namespace Mastodon
30 {
31 namespace Easy
32 {
38  enum class event_type
39  {
40  Update,
42  Delete,
43  Error,
44  Undefined
45  };
46 
52  // TODO: What about instance-only?
53  enum class visibility_type
54  {
55  Direct,
56  Private,
57  Unlisted,
58  Public,
59  Undefined
60  };
61 
67  // TODO: Look up what Pleroma returns.
68  enum class attachment_type
69  {
70  Image,
71  Video,
72  Gifv,
73  Unknown,
74  Undefined
75  };
76 
82  enum class card_type
83  {
84  Link,
85  Photo,
86  Video,
87  Rich,
88  Undefined
89  };
90 
96  enum class notification_type
97  {
98  Mention,
99  Reblog,
100  Favourite,
101  Follow,
102  Undefined
103  };
104 
110  enum class context_type
111  {
112  Home,
113  Notifications,
114  Public,
115  Thread,
116  Undefined
117  };
118 
124  typedef struct stream_event_type
125  {
126  event_type type = event_type::Undefined;
127  string data;
129 
130  [[deprecated("Replaced by Mastodon::Easy::stream_event_type")]]
132 
138  typedef struct alert_type
139  {
140  Easy::notification_type type = Easy::notification_type::Undefined;
141  bool pushreq = false;
142  } alert_type;
143 
149  struct time_type
150  {
151  system_clock::time_point timepoint = system_clock::time_point();
152 
153  operator const system_clock::time_point() const;
154 
160  operator const string() const;
161 
167  friend std::ostream &operator <<(std::ostream &out,
168  const Easy::time_type &t);
169 
189  const string strtime(const string &format,
190  const bool &local = true) const;
191  };
192 
193  [[deprecated("Replaced by Mastodon::Easy::time_type")]]
194  typedef time_type time;
195 
201  typedef struct account_field_type
202  {
203  const string name;
204  const string value;
205  Easy::time_type verified_at;
207 
213  typedef struct urls_type
214  {
215  string streaming_api;
216  } urls_type;
217 
221  typedef struct stats_type
222  {
223  uint64_t user_count = 0;
224  uint64_t status_count = 0;
225  uint64_t domain_count = 0;
226  } stats_type;
227 }
228 }
229 #endif // MASTODON_CPP_EASY_TYPES_EASY_HPP
Class to hold notifications.
Definition: notification.hpp:40
Type for time. Converts to time_point and string.
Definition: types_easy.hpp:149
Class to hold mentions.
Definition: mention.hpp:39
Statistics returned by Instance::stats().
Definition: types_easy.hpp:221
Used for stream events.
Definition: types_easy.hpp:124
struct Mastodon::Easy::urls_type urls_type
URLs returned by Instance::urls().
Describes an account-field.
Definition: types_easy.hpp:201
struct Mastodon::Easy::alert_type alert_type
Type of notification and &#39;push is requested or not&#39;.
std::ostream & operator<<(std::ostream &out, const time_type &t)
Definition: types_easy.cpp:53
Collection of things to interface with server software that implements the Mastodon API...
Definition: mastodon-cpp.hpp:46
context_type
Describes the context.
Definition: types_easy.hpp:110
struct Mastodon::Easy::account_field_type account_field_type
Describes an account-field.
notification_type
Describes the notification type.
Definition: types_easy.hpp:96
URLs returned by Instance::urls().
Definition: types_easy.hpp:213
struct Mastodon::Easy::stats_type stats_type
Statistics returned by Instance::stats().
struct Mastodon::Easy::stream_event_type stream_event_type
Used for stream events.
card_type
Describes the card type.
Definition: types_easy.hpp:82
Type of notification and &#39;push is requested or not&#39;.
Definition: types_easy.hpp:138
event_type
Describes the event type returned in streams.
Definition: types_easy.hpp:38
visibility_type
Describes visibility of posts.
Definition: types_easy.hpp:53
attachment_type
Describes the attachment type.
Definition: types_easy.hpp:68