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>
|
2019-03-28 15:30:56 +01:00
|
|
|
*
|
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>
|
2018-06-12 03:05:12 +02:00
|
|
|
#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"
|
2019-05-01 00:57:00 +02:00
|
|
|
#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>
|
2019-05-01 00:57:00 +02:00
|
|
|
#include <mastodon-cpp/easy/entities/emoji.hpp>
|
2018-03-22 00:33:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
using std::string;
|
2019-02-22 08:29:54 +01:00
|
|
|
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
|
|
|
*
|
2018-06-14 11:17:26 +02: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;
|
|
|
|
|
2019-03-31 21:43:57 +02:00
|
|
|
virtual bool valid() const override;
|
2018-07-14 11:44:30 +02:00
|
|
|
|
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
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string acct() const;
|
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns URL of avatar.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string avatar() const;
|
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns URL of static avatar.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string avatar_static() const;
|
|
|
|
|
2018-06-11 01:44:41 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns true if the account performs automated actions.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since 0.16.0
|
2018-06-11 01:44:41 +02:00
|
|
|
*/
|
2018-12-04 11:26:28 +01:00
|
|
|
bool bot() const;
|
2018-06-11 01:44:41 +02:00
|
|
|
|
2018-03-22 00:33:36 +01:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns time of creation.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns display name.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string display_name() const;
|
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns emojis.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2019-05-01 00:57:00 +02:00
|
|
|
* @since 0.106.0
|
2018-09-16 02:45:24 +02:00
|
|
|
*/
|
2019-05-01 00:57:00 +02:00
|
|
|
const std::vector<Easy::Emoji> emojis();
|
2018-09-16 02:45:24 +02:00
|
|
|
|
2018-06-12 03:05:12 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns metadata fields.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-12 03:05:12 +02:00
|
|
|
* @since 0.16.1
|
|
|
|
*/
|
2019-05-13 21:26:55 +02:00
|
|
|
const vector<Easy::account_field_type> fields() const;
|
2018-06-12 03:05:12 +02:00
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns number of followers.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
2019-02-22 08:29:54 +01:00
|
|
|
uint64_t followers_count() const;
|
2018-03-22 00:33:36 +01:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns number of people this account follows.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
2019-02-22 08:29:54 +01:00
|
|
|
uint64_t following_count() const;
|
2018-03-22 00:33:36 +01:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns URL of header image.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string header() const;
|
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns URL of static header image.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string header_static() const;
|
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns account-ID.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
2019-01-27 03:44:08 +01:00
|
|
|
const string id() const;
|
2018-03-22 00:33:36 +01:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns true if the account is locked.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns true if the account has been moved. (Deprecated)
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|
2019-05-01 00:57:00 +02:00
|
|
|
* this attribute.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const Account moved() const;
|
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns account description, or biography.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
|
|
|
const string note() const;
|
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns default privacy of new toots.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns if media is marked as sensitive by default.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|
|
|
|
2018-09-16 02:45:24 +02:00
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Class to hold source attribute.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-09-16 02:45:24 +02:00
|
|
|
* @since 0.18.5
|
|
|
|
*/
|
2019-04-05 14:39:35 +02:00
|
|
|
class Source : public Entity
|
2018-09-16 02:45:24 +02:00
|
|
|
{
|
|
|
|
public:
|
2019-04-05 14:39:35 +02:00
|
|
|
using Entity::Entity;
|
2018-09-16 02:45:24 +02:00
|
|
|
|
2019-03-31 21:43:57 +02:00
|
|
|
virtual bool valid() const override;
|
2018-09-16 02:45:24 +02:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns metadata fields.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-09-16 02:45:24 +02:00
|
|
|
* @since 0.18.5
|
|
|
|
*/
|
2019-05-13 21:26:55 +02:00
|
|
|
const vector<Easy::account_field_type> fields() const;
|
2018-09-16 02:45:24 +02:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns the language as ISO 6391 string.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2019-05-01 00:57:00 +02:00
|
|
|
* @since 0.106.0
|
2018-09-16 02:45:24 +02:00
|
|
|
*/
|
2019-05-01 00:57:00 +02:00
|
|
|
const string language() const;
|
2018-09-16 02:45:24 +02:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns account description in plain text.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-09-16 02:45:24 +02:00
|
|
|
* @since 0.18.5
|
|
|
|
*/
|
|
|
|
const string note() const;
|
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns default privacy of new toots.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-09-16 02:45:24 +02:00
|
|
|
* @since 0.18.5
|
|
|
|
*/
|
2018-12-04 11:26:28 +01:00
|
|
|
visibility_type privacy() const;
|
2018-09-16 02:45:24 +02:00
|
|
|
|
|
|
|
/*!
|
2019-05-01 00:57:00 +02:00
|
|
|
* @brief Returns if media is marked as sensitive by default.
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-09-16 02:45:24 +02:00
|
|
|
* @since 0.18.5
|
|
|
|
*/
|
2018-12-04 11:26:28 +01:00
|
|
|
bool sensitive() const;
|
2018-09-16 02:45:24 +02:00
|
|
|
};
|
|
|
|
|
2019-04-05 14:39:35 +02:00
|
|
|
/*!
|
|
|
|
* @brief Get source.
|
|
|
|
*
|
|
|
|
* @since before 0.100.0
|
|
|
|
*/
|
2018-09-16 02:45:24 +02:00
|
|
|
const Source source() const;
|
2019-04-05 14:39:35 +02:00
|
|
|
|
2018-03-22 00:33:36 +01:00
|
|
|
/*!
|
|
|
|
* @brief Returns number of statuses
|
2019-03-29 14:44:39 +01:00
|
|
|
*
|
2018-06-14 11:17:26 +02:00
|
|
|
* @since before 0.11.0
|
2018-03-22 00:33:36 +01:00
|
|
|
*/
|
2019-02-22 08:29:54 +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
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|
|
|
*
|
2018-06-14 11:17:26 +02: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
|