This repository has been archived on 2020-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon-cpp/src/easy/entities/status.hpp

289 lines
6.8 KiB
C++
Raw Normal View History

2018-03-31 04:29:55 +02:00
/* This file is part of mastodon-cpp.
2019-03-20 06:15:43 +01:00
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
*
2018-03-31 04:29:55 +02:00
* This program is free software: you can redistribute it and/or modify
2019-08-15 22:53:38 +02:00
* it under the terms of the GNU Affero General Public License as published by
2018-03-31 04:29:55 +02:00
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2019-08-15 22:53:38 +02:00
* GNU Affero General Public License for more details.
2018-03-31 04:29:55 +02:00
*
2019-08-15 22:53:38 +02:00
* You should have received a copy of the GNU Affero General Public License
2018-03-31 04:29:55 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MASTODON_CPP_EASY_STATUS_HPP
#define MASTODON_CPP_EASY_STATUS_HPP
#include <string>
#include <cstdint>
#include <vector>
2019-08-12 04:06:43 +02:00
#include "../../mastodon-cpp.hpp"
#include "../entity.hpp"
#include "account.hpp"
#include "emoji.hpp"
#include "attachment.hpp"
#include "mention.hpp"
#include "tag.hpp"
#include "application.hpp"
#include "card.hpp"
2018-03-31 04:29:55 +02:00
using std::string;
using std::uint64_t;
2018-03-31 04:29:55 +02:00
namespace Mastodon
2019-03-29 14:44:39 +01:00
{
namespace Easy
2018-03-31 04:29:55 +02:00
{
/*!
* @brief Class to hold statuses
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2019-03-29 14:44:39 +01:00
class Status : public Entity
2018-03-31 04:29:55 +02:00
{
public:
2019-03-11 20:48:54 +01:00
using Entity::Entity;
2018-03-31 04:29:55 +02:00
virtual bool valid() const override;
2018-03-31 04:29:55 +02:00
/*!
2018-06-13 23:55:19 +02:00
* @brief Returns an array of matched accounts.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const Account account() const;
/*!
2018-06-13 23:55:19 +02:00
* @brief Returns application from which the status was posted.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const Application application() const;
2018-11-17 20:38:09 +01:00
/*!
* @brief Returns card
2019-03-29 14:44:39 +01:00
*
2018-11-17 20:38:09 +01:00
* @since 0.19.0
*/
const Card card() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns time of creation
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2019-05-13 21:26:55 +02:00
const Easy::time_type created_at() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns content of status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string content() const;
2018-06-13 23:55:19 +02:00
/*!
* @brief Sets content of status
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-06-13 23:55:19 +02:00
*/
Status content(const string &content);
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns an array of emojis
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const std::vector<Emoji> emojis() const;
/*!
* @brief Returns true if the user has favourited the status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2018-12-04 11:26:28 +01:00
bool favourited() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the number of favourites
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
uint64_t favourites_count() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the ID of the status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string id() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the ID of the status it replies to
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string in_reply_to_id() const;
2018-03-31 04:29:55 +02:00
2018-06-13 23:55:19 +02:00
/*!
* @brief Sets the ID of the status it replies to
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-06-13 23:55:19 +02:00
*/
Status in_reply_to_id(const string &in_reply_to_id);
2018-06-13 23:55:19 +02:00
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the ID of the account it replies to
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string in_reply_to_account_id() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the language of the status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string language() const;
2018-06-13 23:55:19 +02:00
/*!
* @brief Overrides the language of the status (ISO 639-2)
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-06-13 23:55:19 +02:00
*/
Status language(const string &language);
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the attachments
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const std::vector<Attachment> media_attachments() const;
2018-06-13 23:55:19 +02:00
/*!
* @brief Sets the attachments
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-06-13 23:55:19 +02:00
*/
Status media_attachments
(const std::vector<Attachment> &media_attachments);
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the mentions
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const std::vector<Mention> mentions() const;
/*!
* @brief Returns true if the user muted the conversation
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2018-12-04 11:26:28 +01:00
bool muted() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns true if the status is pinned
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2018-12-04 11:26:28 +01:00
bool pinned() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the reblogged Status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const Status reblog() const;
/*!
* @brief Returns true if the user has reblogged the status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2018-12-04 11:26:28 +01:00
bool reblogged() const;
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the number of reblogs for the status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
uint64_t reblogs_count() const;
2018-03-31 04:29:55 +02:00
2018-11-17 20:32:36 +01:00
/*!
* @brief Returns the number of replies for the status
2019-03-29 14:44:39 +01:00
*
2018-11-17 20:32:36 +01:00
* @since 0.19.0
*/
uint64_t replies_count() const;
2018-11-17 20:32:36 +01:00
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns true if the attachments should be hidden by default
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2018-12-04 11:26:28 +01:00
bool sensitive() const;
2018-03-31 04:29:55 +02:00
2018-06-13 23:55:19 +02:00
/*!
* @brief Sets sensitive flag for attachments
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-06-13 23:55:19 +02:00
*/
Status sensitive(const bool &sensitive);
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the spoiler text
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string spoiler_text() const;
2018-06-13 23:55:19 +02:00
/*!
* @brief Sets the spoiler text
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-06-13 23:55:19 +02:00
*/
Status spoiler_text(const string &spoiler_text);
2018-03-31 04:29:55 +02:00
/*!
* @brief Returns the tags
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const std::vector<Tag> tags() const;
/*!
* @brief Returns the Fediverse-unique resource ID
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string uri() const;
/*!
* @brief Returns the URL to the status page
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
const string url() const;
/*!
* @brief Returns the visibility of the status
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-31 04:29:55 +02:00
*/
2018-12-04 11:26:28 +01:00
visibility_type visibility() const;
2018-03-31 04:29:55 +02:00
/*!
2018-06-13 23:55:19 +02:00
* @brief Sets the visibility of the status
2019-03-29 14:44:39 +01:00
*
2018-06-14 01:52:05 +02:00
* @since 0.17.0
2018-03-31 04:29:55 +02:00
*/
2018-06-13 23:55:19 +02:00
Status visibility(const visibility_type &visibility);
2018-03-31 04:29:55 +02:00
};
}
2019-03-29 14:44:39 +01:00
}
2018-03-31 04:29:55 +02:00
#endif // MASTODON_CPP_EASY_STATUS_HPP