Added Easy::Mention, small fixes
This commit is contained in:
parent
4a1b454ba1
commit
fa03cb7ed2
|
@ -33,6 +33,7 @@
|
|||
|
||||
using std::string;
|
||||
using std::uint64_t;
|
||||
using std::chrono::system_clock;
|
||||
|
||||
namespace Mastodon
|
||||
{
|
||||
|
@ -75,7 +76,7 @@ namespace Mastodon
|
|||
/*!
|
||||
* @brief Returns time of creation
|
||||
*/
|
||||
const std::chrono::system_clock::time_point created_at() const;
|
||||
const system_clock::time_point created_at() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns display name
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "easy/emoji.hpp"
|
||||
#include "easy/instance.hpp"
|
||||
#include "easy/list.hpp"
|
||||
#include "easy/mention.hpp"
|
||||
//#include "easy/notification.hpp"
|
||||
#else
|
||||
#include <mastodon-cpp/easy.hpp>
|
||||
#include <mastodon-cpp/easy/account.hpp>
|
||||
|
@ -34,7 +36,9 @@
|
|||
#include <mastodon-cpp/easy/card.hpp>
|
||||
//#include <mastodon-cpp/easy/context.hpp>
|
||||
#include <mastodon-cpp/easy/emoji.hpp>
|
||||
#include "easy/list.hpp"
|
||||
#include <mastodon-cpp/easy/list.hpp>
|
||||
#include <mastodon-cpp/easy/mention.hpp>
|
||||
//#include <mastodon-cpp/easy/notification.hpp>
|
||||
#endif
|
||||
|
||||
#endif // MASTODON_CPP_EASY_ALL_HPP
|
||||
|
|
|
@ -80,6 +80,18 @@ public:
|
|||
unknown
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Describes the notification type
|
||||
*/
|
||||
enum class notification_type
|
||||
{
|
||||
mention,
|
||||
reblog,
|
||||
favourite,
|
||||
follow,
|
||||
unknown
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Constructs a new Easy object.
|
||||
*
|
||||
|
@ -181,6 +193,8 @@ public:
|
|||
class Emoji;
|
||||
class Instance;
|
||||
class List;
|
||||
class Mention;
|
||||
class Notification;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
// If we are compiling mastodon-cpp, use another include path
|
||||
#ifdef MASTODON_CPP
|
||||
|
@ -30,6 +31,7 @@
|
|||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::uint64_t;
|
||||
|
||||
namespace Mastodon
|
||||
{
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include "mention.hpp"
|
||||
#include "macros.hpp"
|
||||
|
||||
using namespace Mastodon;
|
||||
using Mention = Easy::Mention;
|
||||
using std::string;
|
||||
using std::uint64_t;
|
||||
|
||||
Mention::Mention(const string &json)
|
||||
: Entity(json)
|
||||
{}
|
||||
|
||||
Mention::Mention()
|
||||
: Entity()
|
||||
{}
|
||||
|
||||
const string Mention::acct() const
|
||||
{
|
||||
return get_string("acct");
|
||||
}
|
||||
|
||||
const uint64_t Mention::id() const
|
||||
{
|
||||
return get_uint64("id");
|
||||
}
|
||||
|
||||
const string Mention::url() const
|
||||
{
|
||||
return get_string("url");
|
||||
}
|
||||
|
||||
const string Mention::username() const
|
||||
{
|
||||
return get_string("username");
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* 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_MENTION_HPP
|
||||
#define MASTODON_CPP_EASY_MENTION_HPP
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
// If we are compiling mastodon-cpp, use another include path
|
||||
#ifdef MASTODON_CPP
|
||||
#include "mastodon-cpp.hpp"
|
||||
#include "easy.hpp"
|
||||
#else
|
||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||
#include <mastodon-cpp/easy.hpp>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::uint64_t;
|
||||
using std::chrono::system_clock;
|
||||
|
||||
namespace Mastodon
|
||||
{
|
||||
/*!
|
||||
* @brief Class to hold mentions
|
||||
*/
|
||||
class Easy::Mention : public Easy::Entity
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructs a Mention object from a JSON string.
|
||||
*
|
||||
* @param json JSON string
|
||||
*/
|
||||
explicit Mention(const string &json);
|
||||
|
||||
/*!
|
||||
* @brief Constructs an empty Mention object.
|
||||
*/
|
||||
Mention();
|
||||
|
||||
/*!
|
||||
* @brief Returns acct
|
||||
*/
|
||||
const string acct() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns account ID
|
||||
*/
|
||||
const uint64_t id() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the URL of user's profile
|
||||
*/
|
||||
const string url() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the username of the account
|
||||
*/
|
||||
const string username() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MASTODON_CPP_EASY_MENTION_HPP
|
Reference in New Issue