Completed most of the incomplete Entitys (Attachment is still incomplete)
This commit is contained in:
parent
d78c699955
commit
e4d2b1759e
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (mastodon-cpp
|
project (mastodon-cpp
|
||||||
VERSION 0.7.12
|
VERSION 0.7.13
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -24,15 +24,15 @@
|
||||||
#include "easy/application.hpp"
|
#include "easy/application.hpp"
|
||||||
#include "easy/attachment.hpp"
|
#include "easy/attachment.hpp"
|
||||||
#include "easy/card.hpp"
|
#include "easy/card.hpp"
|
||||||
//#include "easy/context.hpp"
|
#include "easy/context.hpp"
|
||||||
#include "easy/emoji.hpp"
|
#include "easy/emoji.hpp"
|
||||||
#include "easy/instance.hpp"
|
#include "easy/instance.hpp"
|
||||||
#include "easy/list.hpp"
|
#include "easy/list.hpp"
|
||||||
#include "easy/mention.hpp"
|
#include "easy/mention.hpp"
|
||||||
//#include "easy/notification.hpp"
|
#include "easy/notification.hpp"
|
||||||
#include "easy/relationship.hpp"
|
#include "easy/relationship.hpp"
|
||||||
#include "easy/report.hpp"
|
#include "easy/report.hpp"
|
||||||
//#include "easy/results.hpp"
|
#include "easy/results.hpp"
|
||||||
#include "easy/status.hpp"
|
#include "easy/status.hpp"
|
||||||
#include "easy/tag.hpp"
|
#include "easy/tag.hpp"
|
||||||
#else
|
#else
|
||||||
|
@ -41,15 +41,15 @@
|
||||||
#include <mastodon-cpp/easy/application.hpp>
|
#include <mastodon-cpp/easy/application.hpp>
|
||||||
#include <mastodon-cpp/easy/attachment.hpp>
|
#include <mastodon-cpp/easy/attachment.hpp>
|
||||||
#include <mastodon-cpp/easy/card.hpp>
|
#include <mastodon-cpp/easy/card.hpp>
|
||||||
//#include <mastodon-cpp/easy/context.hpp>
|
#include <mastodon-cpp/easy/context.hpp>
|
||||||
#include <mastodon-cpp/easy/emoji.hpp>
|
#include <mastodon-cpp/easy/emoji.hpp>
|
||||||
#include <mastodon-cpp/easy/instance.hpp>
|
#include <mastodon-cpp/easy/instance.hpp>
|
||||||
#include <mastodon-cpp/easy/list.hpp>
|
#include <mastodon-cpp/easy/list.hpp>
|
||||||
#include <mastodon-cpp/easy/mention.hpp>
|
#include <mastodon-cpp/easy/mention.hpp>
|
||||||
//#include <mastodon-cpp/easy/notification.hpp>
|
#include <mastodon-cpp/easy/notification.hpp>
|
||||||
#include <mastodon-cpp/easy/relationship.hpp>
|
#include <mastodon-cpp/easy/relationship.hpp>
|
||||||
#include <mastodon-cpp/easy/report.hpp>
|
#include <mastodon-cpp/easy/report.hpp>
|
||||||
//#include <mastodon-cpp/easy/results.hpp>
|
#include <mastodon-cpp/easy/results.hpp>
|
||||||
#include <mastodon-cpp/easy/status.hpp>
|
#include <mastodon-cpp/easy/status.hpp>
|
||||||
#include <mastodon-cpp/easy/tag.hpp>
|
#include <mastodon-cpp/easy/tag.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
|
#include "macros.hpp"
|
||||||
|
|
||||||
using namespace Mastodon;
|
using namespace Mastodon;
|
||||||
using Context = Easy::Context;
|
using Context = Easy::Context;
|
||||||
|
@ -26,3 +27,37 @@ Context::Context(const string &json)
|
||||||
Context::Context()
|
Context::Context()
|
||||||
: Entity()
|
: Entity()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
const std::vector<Easy::Status> Context::ancestors() const
|
||||||
|
{
|
||||||
|
const Json::Value node = get("ancestors");
|
||||||
|
if (node.isArray())
|
||||||
|
{
|
||||||
|
std::vector<Easy::Status> vec;
|
||||||
|
for (const Json::Value &value : node)
|
||||||
|
{
|
||||||
|
vec.push_back(Easy::Status(value.toStyledString()));
|
||||||
|
}
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
ttdebug << "Could not get data: ancestors\n";
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<Easy::Status> Context::descendants() const
|
||||||
|
{
|
||||||
|
const Json::Value node = get("descendants");
|
||||||
|
if (node.isArray())
|
||||||
|
{
|
||||||
|
std::vector<Easy::Status> vec;
|
||||||
|
for (const Json::Value &value : node)
|
||||||
|
{
|
||||||
|
vec.push_back(Easy::Status(value.toStyledString()));
|
||||||
|
}
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
ttdebug << "Could not get data: descendants\n";
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy.hpp"
|
#include "easy.hpp"
|
||||||
|
#include "status.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy.hpp>
|
#include <mastodon-cpp/easy.hpp>
|
||||||
|
#include <mastodon-cpp/status.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -51,15 +53,15 @@ namespace Mastodon
|
||||||
*/
|
*/
|
||||||
Context();
|
Context();
|
||||||
|
|
||||||
// /*!
|
/*!
|
||||||
// * @brief Returns the ancestors of the Status as vector of Statuses
|
* @brief Returns the ancestors of the Status as vector of Statuses
|
||||||
// */
|
*/
|
||||||
// const std::vector<Status> ancestors() const;
|
const std::vector<Status> ancestors() const;
|
||||||
|
|
||||||
// /*!
|
/*!
|
||||||
// * @brief Returns the descendants of the Status as vector of Statuses
|
* @brief Returns the descendants of the Status as vector of Statuses
|
||||||
// */
|
*/
|
||||||
// const std::vector<Status> descendants() const;
|
const std::vector<Status> descendants() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,17 @@ const uint64_t Notification::id() const
|
||||||
return get_uint64("id");
|
return get_uint64("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
// const Status Notification::status() const
|
const Easy::Status Notification::status() const
|
||||||
// {
|
{
|
||||||
// //
|
const Json::Value node = get("restatusblog");
|
||||||
// }
|
if (node.isObject())
|
||||||
|
{
|
||||||
|
return Easy::Status(node.toStyledString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ttdebug << "Could not get data: status\n";
|
||||||
|
return Easy::Status();
|
||||||
|
}
|
||||||
|
|
||||||
const Easy::notification_type Notification::type() const
|
const Easy::notification_type Notification::type() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy.hpp"
|
#include "easy.hpp"
|
||||||
#include "account.hpp"
|
#include "account.hpp"
|
||||||
|
#include "status.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy.hpp>
|
#include <mastodon-cpp/easy.hpp>
|
||||||
#include <mastodon-cpp/easy/account.hpp>
|
#include <mastodon-cpp/easy/account.hpp>
|
||||||
|
#include <mastodon-cpp/easy/status.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -75,7 +77,7 @@ namespace Mastodon
|
||||||
* @brief Returns the Status associated with the notification, if
|
* @brief Returns the Status associated with the notification, if
|
||||||
* applicable
|
* applicable
|
||||||
*/
|
*/
|
||||||
// const Status status() const;
|
const Status status() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns notification type
|
* @brief Returns notification type
|
||||||
|
|
|
@ -46,6 +46,23 @@ const std::vector<Easy::Account> Results::accounts() const
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<Easy::Status> Results::statuses() const
|
||||||
|
{
|
||||||
|
const Json::Value node = get("statuses");
|
||||||
|
if (node.isArray())
|
||||||
|
{
|
||||||
|
std::vector<Easy::Status> vec;
|
||||||
|
for (const Json::Value &value : node)
|
||||||
|
{
|
||||||
|
vec.push_back(Easy::Status(value.toStyledString()));
|
||||||
|
}
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
ttdebug << "Could not get data: statuses\n";
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<string> Results::hashtags() const
|
const std::vector<string> Results::hashtags() const
|
||||||
{
|
{
|
||||||
return get_vector("hashtags");
|
return get_vector("hashtags");
|
||||||
|
|
|
@ -25,10 +25,12 @@
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy.hpp"
|
#include "easy.hpp"
|
||||||
#include "account.hpp"
|
#include "account.hpp"
|
||||||
|
#include "status.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy.hpp>
|
#include <mastodon-cpp/easy.hpp>
|
||||||
#include <mastodon-cpp/account.hpp>
|
#include <mastodon-cpp/account.hpp>
|
||||||
|
#include <mastodon-cpp/status.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -61,7 +63,7 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of matched Statuses
|
* @brief Returns an array of matched Statuses
|
||||||
*/
|
*/
|
||||||
// const std::vector<Status> statuses() const;
|
const std::vector<Status> statuses() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of matched hashtags
|
* @brief Returns an array of matched hashtags
|
||||||
|
|
Reference in New Issue