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/account.hpp

273 lines
6.5 KiB
C++
Raw Normal View History

2018-03-22 00:33:36 +01: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-22 00:33:36 +01:00
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MASTODON_CPP_EASY_ACCOUNT_HPP
#define MASTODON_CPP_EASY_ACCOUNT_HPP
#include <string>
#include <cstdint>
#include <vector>
#include <utility>
2018-03-22 00:33:36 +01:00
// If we are compiling mastodon-cpp, use another include path
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
2019-03-29 14:44:39 +01:00
#include "easy/entity.hpp"
#include "easy/entities/emoji.hpp"
2018-03-22 00:33:36 +01:00
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
2019-03-29 14:44:39 +01:00
#include <mastodon-cpp/easy/entity.hpp>
#include <mastodon-cpp/easy/entities/emoji.hpp>
2018-03-22 00:33:36 +01:00
#endif
using std::string;
using std::uint64_t;
2019-05-13 21:26:55 +02:00
using std::vector;
2018-03-22 00:33:36 +01:00
namespace Mastodon
2019-03-29 14:44:39 +01:00
{
namespace Easy
2018-03-22 00:33:36 +01:00
{
/*!
* @brief Class to hold accounts.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
2019-03-29 14:44:39 +01:00
class Account : public Entity
2018-03-22 00:33:36 +01:00
{
public:
2019-03-11 20:48:54 +01:00
using Entity::Entity;
virtual bool valid() const override;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns username
*
* `username` for users on the same instance, `user@hostname`
* for users on other instances.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string acct() const;
/*!
* @brief Returns URL of avatar.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string avatar() const;
/*!
* @brief Returns URL of static avatar.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string avatar_static() const;
/*!
* @brief Returns true if the account performs automated actions.
2019-03-29 14:44:39 +01:00
*
* @since 0.16.0
*/
2018-12-04 11:26:28 +01:00
bool bot() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns time of creation.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
2019-05-13 21:26:55 +02:00
const Easy::time_type created_at() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns display name.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string display_name() const;
/*!
* @brief Returns emojis.
2019-03-29 14:44:39 +01:00
*
* @since 0.106.0
*/
const std::vector<Easy::Emoji> emojis();
/*!
* @brief Returns metadata fields.
2019-03-29 14:44:39 +01:00
*
* @since 0.16.1
*/
2019-05-13 21:26:55 +02:00
const vector<Easy::account_field_type> fields() const;
/*!
* @brief Returns number of followers.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
uint64_t followers_count() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns number of people this account follows.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
uint64_t following_count() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns URL of header image.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string header() const;
/*!
* @brief Returns URL of static header image.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string header_static() const;
/*!
* @brief Returns account-ID.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string id() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns true if the account is locked.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
2018-12-04 11:26:28 +01:00
bool locked() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns true if the account has been moved. (Deprecated)
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
2018-12-04 11:26:28 +01:00
bool has_moved() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief If the owner decided to switch accounts, new account is in
* this attribute.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const Account moved() const;
/*!
* @brief Returns account description, or biography.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string note() const;
/*!
* @brief Returns default privacy of new toots.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
2018-12-04 11:26:28 +01:00
visibility_type privacy() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns if media is marked as sensitive by default.
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
2018-12-04 11:26:28 +01:00
bool sensitive() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Class to hold source attribute.
2019-03-29 14:44:39 +01:00
*
* @since 0.18.5
*/
class Source : public Entity
{
public:
using Entity::Entity;
virtual bool valid() const override;
/*!
* @brief Returns metadata fields.
2019-03-29 14:44:39 +01:00
*
* @since 0.18.5
*/
2019-05-13 21:26:55 +02:00
const vector<Easy::account_field_type> fields() const;
/*!
* @brief Returns the language as ISO 6391 string.
2019-03-29 14:44:39 +01:00
*
* @since 0.106.0
*/
const string language() const;
/*!
* @brief Returns account description in plain text.
2019-03-29 14:44:39 +01:00
*
* @since 0.18.5
*/
const string note() const;
/*!
* @brief Returns default privacy of new toots.
2019-03-29 14:44:39 +01:00
*
* @since 0.18.5
*/
2018-12-04 11:26:28 +01:00
visibility_type privacy() const;
/*!
* @brief Returns if media is marked as sensitive by default.
2019-03-29 14:44:39 +01:00
*
* @since 0.18.5
*/
2018-12-04 11:26:28 +01:00
bool sensitive() const;
};
/*!
* @brief Get source.
*
* @since before 0.100.0
*/
const Source source() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns number of statuses
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
uint64_t statuses_count() const;
2018-03-22 00:33:36 +01:00
/*!
* @brief Returns URL of the profile
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string url() const;
/*!
2019-02-19 04:41:24 +01:00
* @brief Returns username (without \@hostname)
2019-03-29 14:44:39 +01:00
*
* @since before 0.11.0
2018-03-22 00:33:36 +01:00
*/
const string username() const;
};
}
2019-03-29 14:44:39 +01:00
}
2018-03-22 00:33:36 +01:00
#endif // MASTODON_CPP_EASY_ACCOUNT_HPP