mastodon-cpp  0.18.8
status.hpp
1 /* This file is part of mastodon-cpp.
2  * Copyright © 2018 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_STATUS_HPP
18 #define MASTODON_CPP_EASY_STATUS_HPP
19 
20 #include <string>
21 #include <cstdint>
22 #include <chrono>
23 #include <vector>
24 
25 // If we are compiling mastodon-cpp, use another include path
26 #ifdef MASTODON_CPP
27  #include "mastodon-cpp.hpp"
28  #include "easy/easy.hpp"
29  #include "easy/entities/account.hpp"
30  #include "easy/entities/emoji.hpp"
31  #include "easy/entities/attachment.hpp"
32  #include "easy/entities/mention.hpp"
33  #include "easy/entities/tag.hpp"
34  #include "easy/entities/application.hpp"
35 #else
36  #include <mastodon-cpp/mastodon-cpp.hpp>
37  #include <mastodon-cpp/easy/easy.hpp>
38  #include <mastodon-cpp/easy/entities/account.hpp>
39  #include <mastodon-cpp/easy/entities/emoji.hpp>
40  #include <mastodon-cpp/easy/entities/attachment.hpp>
41  #include <mastodon-cpp/easy/entities/mention.hpp>
42  #include <mastodon-cpp/easy/entities/tag.hpp>
43  #include <mastodon-cpp/easy/entities/application.hpp>
44 #endif
45 
46 using std::string;
47 using std::uint_fast64_t;
48 using std::chrono::system_clock;
49 
50 namespace Mastodon
51 {
57  class Easy::Status : public Easy::Entity
58  {
59  public:
67  explicit Status(const string &json);
68 
74  Status();
75 
76  virtual const bool valid() const;
77 
83  const Account account() const;
84 
90  const Application application() const;
91 
97  const system_clock::time_point created_at() const;
98 
104  const string content() const;
105 
111  Status content(const string &content);
112 
118  const std::vector<Emoji> emojis() const;
119 
125  const bool favourited() const;
126 
132  const uint_fast64_t favourites_count() const;
133 
139  const uint_fast64_t id() const;
140 
146  const uint_fast64_t in_reply_to_id() const;
147 
153  Status in_reply_to_id(const uint_fast64_t &in_reply_to_id);
154 
160  const uint_fast64_t in_reply_to_account_id() const;
161 
167  const string language() const;
168 
174  Status language(const string &language);
175 
181  const std::vector<Attachment> media_attachments() const;
182 
189  (const std::vector<Attachment> &media_attachments);
190 
196  const std::vector<Mention> mentions() const;
197 
203  const bool muted() const;
204 
210  const bool pinned() const;
211 
217  const Status reblog() const;
218 
224  const bool reblogged() const;
225 
231  const uint_fast64_t reblogs_count() const;
232 
238  const bool sensitive() const;
239 
245  Status sensitive(const bool &sensitive);
246 
252  const string spoiler_text() const;
253 
259  Status spoiler_text(const string &spoiler_text);
260 
266  const std::vector<Tag> tags() const;
267 
273  const string uri() const;
274 
280  const string url() const;
281 
287  const visibility_type visibility() const;
288 
295  };
296 }
297 
298 #endif // MASTODON_CPP_EASY_STATUS_HPP
const bool muted() const
Returns true if the user muted the conversation.
Definition: status.cpp:197
const uint_fast64_t in_reply_to_id() const
Returns the ID of the status it replies to.
Definition: status.cpp:124
const bool reblogged() const
Returns true if the user has reblogged the status.
Definition: status.cpp:218
const bool pinned() const
Returns true if the status is pinned.
Definition: status.cpp:202
const string url() const
Returns the URL to the status page.
Definition: status.cpp:271
const visibility_type visibility() const
Returns the visibility of the status.
Definition: status.cpp:276
const uint_fast64_t id() const
Returns the ID of the status.
Definition: status.cpp:119
visibility_type
Describes visibility of toots.
Definition: easy.hpp:68
const std::vector< Emoji > emojis() const
Returns an array of emojis.
Definition: status.cpp:93
const uint_fast64_t reblogs_count() const
Returns the number of reblogs for the status.
Definition: status.cpp:223
const bool sensitive() const
Returns true if the attachments should be hidden by default.
Definition: status.cpp:228
const uint_fast64_t favourites_count() const
Returns the number of favourites.
Definition: status.cpp:114
virtual const bool valid() const
Returns true if the Entity holds valid data.
Definition: status.cpp:32
const std::vector< Attachment > media_attachments() const
Returns the attachments.
Definition: status.cpp:151
const string language() const
Returns the language of the status.
Definition: status.cpp:140
Status()
Constructs an empty Status object.
Definition: status.cpp:28
Class to hold accounts.
Definition: account.hpp:46
Class to hold statuses.
Definition: status.hpp:57
const string content() const
Returns content of status.
Definition: status.cpp:82
Definition: mastodon-cpp.hpp:52
Base class for all entities.
Definition: easy.hpp:304
const std::vector< Tag > tags() const
Returns the tags.
Definition: status.cpp:250
const system_clock::time_point created_at() const
Returns time of creation.
Definition: status.cpp:77
const Account account() const
Returns an array of matched accounts.
Definition: status.cpp:55
const uint_fast64_t in_reply_to_account_id() const
Returns the ID of the account it replies to.
Definition: status.cpp:135
const string uri() const
Returns the Fediverse-unique resource ID.
Definition: status.cpp:266
const Application application() const
Returns application from which the status was posted.
Definition: status.cpp:66
const string spoiler_text() const
Returns the spoiler text.
Definition: status.cpp:239
const std::vector< Mention > mentions() const
Returns the mentions.
Definition: status.cpp:181
const bool favourited() const
Returns true if the user has favourited the status.
Definition: status.cpp:109
Class to hold applications.
Definition: application.hpp:40
const Status reblog() const
Returns the reblogged Status.
Definition: status.cpp:207