mastodon-cpp  0.104.0
status.hpp
1 /* This file is part of mastodon-cpp.
2  * Copyright © 2018, 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_STATUS_HPP
18 #define MASTODON_CPP_EASY_STATUS_HPP
19 
20 #include <string>
21 #include <cstdint>
22 #include <vector>
23 
24 // If we are compiling mastodon-cpp, use another include path
25 #ifdef MASTODON_CPP
26  #include "mastodon-cpp.hpp"
27  #include "easy/entity.hpp"
28  #include "easy/entities/account.hpp"
29  #include "easy/entities/emoji.hpp"
30  #include "easy/entities/attachment.hpp"
31  #include "easy/entities/mention.hpp"
32  #include "easy/entities/tag.hpp"
33  #include "easy/entities/application.hpp"
34  #include "easy/entities/card.hpp"
35 #else
36  #include <mastodon-cpp/mastodon-cpp.hpp>
37  #include <mastodon-cpp/easy/entity.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  #include <mastodon-cpp/easy/entities/card.hpp>
45 #endif
46 
47 using std::string;
48 using std::uint64_t;
49 
50 namespace Mastodon
51 {
52 namespace Easy
53 {
59  class Status : public Entity
60  {
61  public:
62  using Entity::Entity;
63 
64  virtual bool valid() const override;
65 
71  const Account account() const;
72 
78  const Application application() const;
79 
85  const Card card() const;
86 
92  const Easy::time created_at() const;
93 
99  const string content() const;
100 
106  Status content(const string &content);
107 
113  const std::vector<Emoji> emojis() const;
114 
120  bool favourited() const;
121 
127  uint64_t favourites_count() const;
128 
134  const string id() const;
135 
141  const string in_reply_to_id() const;
142 
148  Status in_reply_to_id(const string &in_reply_to_id);
149 
155  const string in_reply_to_account_id() const;
156 
162  const string language() const;
163 
169  Status language(const string &language);
170 
176  const std::vector<Attachment> media_attachments() const;
177 
184  (const std::vector<Attachment> &media_attachments);
185 
191  const std::vector<Mention> mentions() const;
192 
198  bool muted() const;
199 
205  bool pinned() const;
206 
212  const Status reblog() const;
213 
219  bool reblogged() const;
220 
226  uint64_t reblogs_count() const;
227 
233  uint64_t replies_count() const;
234 
240  bool sensitive() const;
241 
247  Status sensitive(const bool &sensitive);
248 
254  const string spoiler_text() const;
255 
261  Status spoiler_text(const string &spoiler_text);
262 
268  const std::vector<Tag> tags() const;
269 
275  const string uri() const;
276 
282  const string url() const;
283 
289  visibility_type visibility() const;
290 
297  };
298 }
299 }
300 
301 #endif // MASTODON_CPP_EASY_STATUS_HPP
Entity()
Constructs an empty Entity object.
Definition: entity.cpp:42
bool sensitive() const
Returns true if the attachments should be hidden by default.
Definition: status.cpp:236
uint64_t reblogs_count() const
Returns the number of reblogs for the status.
Definition: status.cpp:226
Class to hold cards.
Definition: card.hpp:44
const string url() const
Returns the URL to the status page.
Definition: status.cpp:278
const std::vector< Emoji > emojis() const
Returns an array of emojis.
Definition: status.cpp:99
uint64_t favourites_count() const
Returns the number of favourites.
Definition: status.cpp:119
const std::vector< Attachment > media_attachments() const
Returns the attachments.
Definition: status.cpp:156
const string language() const
Returns the language of the status.
Definition: status.cpp:145
uint64_t replies_count() const
Returns the number of replies for the status.
Definition: status.cpp:231
Class to hold accounts.
Definition: account.hpp:46
Class to hold statuses.
Definition: status.hpp:59
bool pinned() const
Returns true if the status is pinned.
Definition: status.cpp:205
const Card card() const
Returns card.
Definition: status.cpp:72
visibility_type visibility() const
Returns the visibility of the status.
Definition: status.cpp:283
const string content() const
Returns content of status.
Definition: status.cpp:88
Collection of things to interface with server software that implements the Mastodon API...
Definition: mastodon-cpp.hpp:52
Base class for all entities.
Definition: entity.hpp:41
const std::vector< Tag > tags() const
Returns the tags.
Definition: status.cpp:258
const Easy::time created_at() const
Returns time of creation.
Definition: status.cpp:83
const Account account() const
Returns an array of matched accounts.
Definition: status.cpp:50
bool muted() const
Returns true if the user muted the conversation.
Definition: status.cpp:200
const string uri() const
Returns the Fediverse-unique resource ID.
Definition: status.cpp:273
bool reblogged() const
Returns true if the user has reblogged the status.
Definition: status.cpp:221
const string in_reply_to_account_id() const
Returns the ID of the account it replies to.
Definition: status.cpp:140
Type for time. Converts to time_point and string.
Definition: types_easy.hpp:155
const Application application() const
Returns application from which the status was posted.
Definition: status.cpp:61
const string spoiler_text() const
Returns the spoiler text.
Definition: status.cpp:247
visibility_type
Describes visibility of posts.
Definition: types_easy.hpp:53
const std::vector< Mention > mentions() const
Returns the mentions.
Definition: status.cpp:185
virtual bool valid() const override
Returns true if the Entity holds valid data.
Definition: status.cpp:25
Class to hold applications.
Definition: application.hpp:42
bool favourited() const
Returns true if the user has favourited the status.
Definition: status.cpp:114
const string in_reply_to_id() const
Returns the ID of the status it replies to.
Definition: status.cpp:129
const string id() const
Returns the ID of the status.
Definition: status.cpp:124
const Status reblog() const
Returns the reblogged Status.
Definition: status.cpp:210