Added Easy::time as time type.
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
dff3b11c00
commit
54a1fb0d3e
|
@ -25,6 +25,43 @@
|
||||||
using namespace Mastodon;
|
using namespace Mastodon;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
Easy::time::operator const system_clock::time_point()
|
||||||
|
{
|
||||||
|
return timepoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
Easy::time::operator const string()
|
||||||
|
{
|
||||||
|
return strtime("%FT%T%z", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const string Easy::time::strtime(const string &format, const bool &local) const
|
||||||
|
{
|
||||||
|
constexpr std::uint16_t bufsize = 1024;
|
||||||
|
std::time_t time = system_clock::to_time_t(timepoint);
|
||||||
|
std::tm *timeinfo;
|
||||||
|
if (local)
|
||||||
|
{
|
||||||
|
timeinfo = std::localtime(&time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timeinfo = std::gmtime(&time);
|
||||||
|
}
|
||||||
|
char buffer[bufsize];
|
||||||
|
|
||||||
|
std::strftime(buffer, bufsize, format.c_str(), timeinfo);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream &Mastodon::Easy::operator <<(std::ostream &out,
|
||||||
|
const Easy::time &t)
|
||||||
|
{
|
||||||
|
out << t.strtime("%FT%T%z", true);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
Easy::API::API(const string &instance, const string &access_token)
|
Easy::API::API(const string &instance, const string &access_token)
|
||||||
: Mastodon::API(instance, access_token)
|
: Mastodon::API(instance, access_token)
|
||||||
{}
|
{}
|
||||||
|
@ -83,39 +120,6 @@ const Easy::Link Easy::API::get_link() const
|
||||||
return Link(get_header("Link"));
|
return Link(get_header("Link"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Easy::API::strtime_utc(const system_clock::time_point &timepoint,
|
|
||||||
const string &format)
|
|
||||||
{
|
|
||||||
return strtime(timepoint, format, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
const string Easy::API::strtime_local(const system_clock::time_point &timepoint,
|
|
||||||
const string &format)
|
|
||||||
{
|
|
||||||
return strtime(timepoint, format, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
const string Easy::API::strtime(const system_clock::time_point &timepoint,
|
|
||||||
const string &format, const bool &utc)
|
|
||||||
{
|
|
||||||
constexpr std::uint16_t bufsize = 1024;
|
|
||||||
std::time_t time = system_clock::to_time_t(timepoint);
|
|
||||||
std::tm *timeinfo;
|
|
||||||
if (utc)
|
|
||||||
{
|
|
||||||
timeinfo = std::gmtime(&time);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
timeinfo = std::localtime(&time);
|
|
||||||
}
|
|
||||||
char buffer[bufsize];
|
|
||||||
|
|
||||||
std::strftime(buffer, bufsize, format.c_str(), timeinfo);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
Easy::Link::Link(const string &link_header)
|
Easy::Link::Link(const string &link_header)
|
||||||
: _next()
|
: _next()
|
||||||
, _prev()
|
, _prev()
|
||||||
|
|
|
@ -25,13 +25,14 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <jsoncpp/json/json.h>
|
#include <jsoncpp/json/json.h>
|
||||||
#include "return_types_easy.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
|
#include "easy/return_types_easy.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
|
#include <mastodon-cpp/easy/return_types_easy.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -134,6 +135,38 @@ namespace Easy
|
||||||
*/
|
*/
|
||||||
typedef std::map<Easy::notification_type, bool> alertmap;
|
typedef std::map<Easy::notification_type, bool> alertmap;
|
||||||
|
|
||||||
|
struct time
|
||||||
|
{
|
||||||
|
system_clock::time_point timepoint = system_clock::time_point();
|
||||||
|
|
||||||
|
operator const system_clock::time_point();
|
||||||
|
operator const string();
|
||||||
|
friend std::ostream &operator <<(std::ostream &out,
|
||||||
|
const Easy::time &t);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Converts time to a string.
|
||||||
|
*
|
||||||
|
* The return value can not exceed 1023 chars.
|
||||||
|
*
|
||||||
|
* @param format The format of the string, same as with
|
||||||
|
* `strftime`.
|
||||||
|
* @param local Use local time (default).
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* Mastodon::Easy::time timepoint = status.created_at();
|
||||||
|
* std::cout << timepoint.strtime("%F, %T UTC", false) << '\n';
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @return The time as string.
|
||||||
|
*
|
||||||
|
* @since 0.100.0
|
||||||
|
*/
|
||||||
|
const string strtime (const string &format,
|
||||||
|
const bool &local = true) const;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: Get rid of forward declarations.
|
// TODO: Get rid of forward declarations.
|
||||||
class Account;
|
class Account;
|
||||||
class Application;
|
class Application;
|
||||||
|
@ -253,42 +286,6 @@ namespace Easy
|
||||||
*/
|
*/
|
||||||
const Link get_link() const;
|
const Link get_link() const;
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Converts a time_point to a string
|
|
||||||
*
|
|
||||||
* The return value can not exceed 1023 chars.
|
|
||||||
*
|
|
||||||
* @param timepoint The timepoint
|
|
||||||
* @param format The format of the string, same as with
|
|
||||||
* `strftime`.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* @code
|
|
||||||
* auto timepoint = status.created_at();
|
|
||||||
* cout << Easy::strtime_utc(timepoint, "%F, %T") << '\n';
|
|
||||||
* @endcode
|
|
||||||
*
|
|
||||||
* @return The UTC time as string
|
|
||||||
*
|
|
||||||
* @since 0.11.0
|
|
||||||
*/
|
|
||||||
// TODO: Time type, convertible to time_point, str_utc and str_local.
|
|
||||||
static const string strtime_utc(const system_clock::time_point &timepoint,
|
|
||||||
const string &format);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief See strtime_utc
|
|
||||||
*
|
|
||||||
* @return The local time as string
|
|
||||||
*
|
|
||||||
* @since 0.11.0
|
|
||||||
*/
|
|
||||||
static const string strtime_local(const system_clock::time_point &timepoint,
|
|
||||||
const string &format);
|
|
||||||
|
|
||||||
// #### simple calls ####
|
|
||||||
// TODO: Own file.
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sends a post.
|
* @brief Sends a post.
|
||||||
*
|
*
|
||||||
|
@ -323,12 +320,7 @@ namespace Easy
|
||||||
const return_entity_vector<Easy::Notification> get_notifications(
|
const return_entity_vector<Easy::Notification> get_notifications(
|
||||||
const uint16_t limit = 20, const string since_id = "",
|
const uint16_t limit = 20, const string since_id = "",
|
||||||
const string max_id = "");
|
const string max_id = "");
|
||||||
|
};
|
||||||
protected:
|
|
||||||
inline static const string strtime
|
|
||||||
(const system_clock::time_point &timepoint,
|
|
||||||
const string &format, const bool &utc);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
@ -71,9 +71,9 @@ bool Account::bot() const
|
||||||
return get_bool("bot");
|
return get_bool("bot");
|
||||||
}
|
}
|
||||||
|
|
||||||
const system_clock::time_point Account::created_at() const
|
const Easy::time Account::created_at() const
|
||||||
{
|
{
|
||||||
return get_time_point("created_at");
|
return get_time("created_at");
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Account::display_name() const
|
const string Account::display_name() const
|
||||||
|
@ -296,27 +296,27 @@ Account::Source Account::Source::privacy(const Easy::visibility_type &privacy)
|
||||||
{
|
{
|
||||||
case visibility_type::Public:
|
case visibility_type::Public:
|
||||||
{
|
{
|
||||||
strprivacy = "public";
|
strprivacy = "public";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case visibility_type::Unlisted:
|
case visibility_type::Unlisted:
|
||||||
{
|
{
|
||||||
strprivacy = "unlisted";
|
strprivacy = "unlisted";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case visibility_type::Private:
|
case visibility_type::Private:
|
||||||
{
|
{
|
||||||
strprivacy = "private";
|
strprivacy = "private";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case visibility_type::Direct:
|
case visibility_type::Direct:
|
||||||
{
|
{
|
||||||
strprivacy = "direct";
|
strprivacy = "direct";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
strprivacy = "undefined";
|
strprivacy = "undefined";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,32 +19,33 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <chrono>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
using std::chrono::system_clock;
|
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold accounts.
|
* @brief Class to hold accounts.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Account : public Easy::Entity
|
class Account : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -63,137 +64,137 @@ namespace Mastodon
|
||||||
*
|
*
|
||||||
* `username` for users on the same instance, `user@hostname`
|
* `username` for users on the same instance, `user@hostname`
|
||||||
* for users on other instances.
|
* for users on other instances.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string acct() const;
|
const string acct() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns URL of avatar
|
* @brief Returns URL of avatar
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string avatar() const;
|
const string avatar() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets avatar
|
* @brief Sets avatar
|
||||||
*
|
*
|
||||||
* Filename or base64-encoded
|
* Filename or base64-encoded
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Account avatar(const string &avatar);
|
Account avatar(const string &avatar);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns URL of static avatar
|
* @brief Returns URL of static avatar
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string avatar_static() const;
|
const string avatar_static() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the account performs automated actions
|
* @brief Returns true if the account performs automated actions
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
bool bot() const;
|
bool bot() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns time of creation
|
* @brief Returns time of creation
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const system_clock::time_point created_at() const;
|
const Easy::time created_at() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns display name
|
* @brief Returns display name
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string display_name() const;
|
const string display_name() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets display name
|
* @brief Sets display name
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Account display_name(const string &display_name);
|
Account display_name(const string &display_name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns metadata fields
|
* @brief Returns metadata fields
|
||||||
*
|
*
|
||||||
* @since 0.16.1
|
* @since 0.16.1
|
||||||
*/
|
*/
|
||||||
const std::vector<fields_pair> fields() const;
|
const std::vector<fields_pair> fields() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets metadata fields
|
* @brief Sets metadata fields
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Account fields(std::vector<fields_pair> &fields);
|
Account fields(std::vector<fields_pair> &fields);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns number of followers
|
* @brief Returns number of followers
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t followers_count() const;
|
uint64_t followers_count() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns number of people this account follows
|
* @brief Returns number of people this account follows
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t following_count() const;
|
uint64_t following_count() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns URL of header image
|
* @brief Returns URL of header image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string header() const;
|
const string header() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets header image
|
* @brief Sets header image
|
||||||
*
|
*
|
||||||
* Filename or base64-encoded.
|
* Filename or base64-encoded.
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Account header(const string &header);
|
Account header(const string &header);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns URL of static header image
|
* @brief Returns URL of static header image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string header_static() const;
|
const string header_static() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns account-ID
|
* @brief Returns account-ID
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the account is locked
|
* @brief Returns true if the account is locked
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool locked() const;
|
bool locked() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets locked state
|
* @brief Sets locked state
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Account locked(const bool &locked);
|
Account locked(const bool &locked);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the account has been moved
|
* @brief Returns true if the account has been moved
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool has_moved() const;
|
bool has_moved() const;
|
||||||
|
@ -201,42 +202,42 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief If the owner decided to switch accounts, new account is in
|
* @brief If the owner decided to switch accounts, new account is in
|
||||||
* this attribute
|
* this attribute
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Account moved() const;
|
const Account moved() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns note
|
* @brief Returns note
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string note() const;
|
const string note() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets note
|
* @brief Sets note
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Account note(const string ¬e);
|
Account note(const string ¬e);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns default privacy of new toots
|
* @brief Returns default privacy of new toots
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
visibility_type privacy() const;
|
visibility_type privacy() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns if media is marked as sensitive by default
|
* @brief Returns if media is marked as sensitive by default
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool sensitive() const;
|
bool sensitive() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold source attribute
|
* @brief Class to hold source attribute
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
class Source : public Easy::Entity
|
class Source : public Easy::Entity
|
||||||
|
@ -246,14 +247,14 @@ namespace Mastodon
|
||||||
* @brief Constructs an Account::Source object from a JSON string.
|
* @brief Constructs an Account::Source object from a JSON string.
|
||||||
*
|
*
|
||||||
* @param json JSON string
|
* @param json JSON string
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
explicit Source(const string &json);
|
explicit Source(const string &json);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Constructs an empty Account::Source object.
|
* @brief Constructs an empty Account::Source object.
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Source();
|
Source();
|
||||||
|
@ -262,56 +263,56 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns metadata fields
|
* @brief Returns metadata fields
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
const std::vector<fields_pair> fields() const;
|
const std::vector<fields_pair> fields() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets metadata fields
|
* @brief Sets metadata fields
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Source fields(std::vector<fields_pair> &fields);
|
Source fields(std::vector<fields_pair> &fields);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns note in plain text
|
* @brief Returns note in plain text
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
const string note() const;
|
const string note() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets note
|
* @brief Sets note
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Source note(const string ¬e);
|
Source note(const string ¬e);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns default privacy of new toots
|
* @brief Returns default privacy of new toots
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
visibility_type privacy() const;
|
visibility_type privacy() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets default privacy of new toots
|
* @brief Sets default privacy of new toots
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Source privacy(const visibility_type &privacy);
|
Source privacy(const visibility_type &privacy);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns if media is marked as sensitive by default
|
* @brief Returns if media is marked as sensitive by default
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
bool sensitive() const;
|
bool sensitive() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets if media is marked as sensitive by default
|
* @brief Sets if media is marked as sensitive by default
|
||||||
*
|
*
|
||||||
* @since 0.18.5
|
* @since 0.18.5
|
||||||
*/
|
*/
|
||||||
Source sensitive(const bool &sensitive);
|
Source sensitive(const bool &sensitive);
|
||||||
|
@ -322,25 +323,26 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns number of statuses
|
* @brief Returns number of statuses
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t statuses_count() const;
|
uint64_t statuses_count() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns URL of the profile
|
* @brief Returns URL of the profile
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns username (without \@hostname)
|
* @brief Returns username (without \@hostname)
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string username() const;
|
const string username() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_ACCOUNT_HPP
|
#endif // MASTODON_CPP_EASY_ACCOUNT_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -18,27 +18,30 @@
|
||||||
#define MASTODON_CPP_EASY_APPLICATION_HPP
|
#define MASTODON_CPP_EASY_APPLICATION_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold applications.
|
* @brief Class to hold applications.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Application : public Easy::Entity
|
class Application : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -47,18 +50,19 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the name of the application
|
* @brief Returns the name of the application
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string name() const;
|
const string name() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the website of the application
|
* @brief Returns the website of the application
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string website() const;
|
const string website() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_APPLICATION_HPP
|
#endif // MASTODON_CPP_EASY_APPLICATION_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -21,28 +21,31 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold attachments
|
* @brief Class to hold attachments
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Attachment : public Easy::Entity
|
class Attachment : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -51,56 +54,56 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Aspect of original image
|
* @brief Aspect of original image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
double aspect() const;
|
double aspect() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Aspect of preview image
|
* @brief Aspect of preview image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
double aspect_small() const;
|
double aspect_small() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the bitrate of a video
|
* @brief Returns the bitrate of a video
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t bitrate() const;
|
uint64_t bitrate() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the image description
|
* @brief Returns the image description
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string description() const;
|
const string description() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets the image description
|
* @brief Sets the image description
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Attachment description(const string &description);
|
Attachment description(const string &description);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the duration of a video in seconds
|
* @brief Returns the duration of a video in seconds
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::chrono::duration<double> duration() const;
|
const std::chrono::duration<double> duration() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Gets file to upload
|
* @brief Gets file to upload
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
const string file() const;
|
const string file() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets file to upload
|
* @brief Sets file to upload
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*
|
*
|
||||||
* @param file Filename
|
* @param file Filename
|
||||||
|
@ -109,109 +112,109 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the focus point (x, y)
|
* @brief Returns the focus point (x, y)
|
||||||
*
|
*
|
||||||
* Values are between -1.0 and 1.0.
|
* Values are between -1.0 and 1.0.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::array<double, 2> focus() const;
|
const std::array<double, 2> focus() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets the focus point (x, y)
|
* @brief Sets the focus point (x, y)
|
||||||
*
|
*
|
||||||
* Values are between -1.0 and 1.0.
|
* Values are between -1.0 and 1.0.
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Attachment focus(const std::array<double, 2> &focus);
|
Attachment focus(const std::array<double, 2> &focus);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the framerate of a video in frames per second
|
* @brief Returns the framerate of a video in frames per second
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
double framerate() const;
|
double framerate() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the height of the original image
|
* @brief Returns the height of the original image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t height() const;
|
uint64_t height() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the height of the preview image
|
* @brief Returns the height of the preview image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t height_small() const;
|
uint64_t height_small() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the ID of the attachment
|
* @brief Returns the ID of the attachment
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL of the preview image
|
* @brief Returns the URL of the preview image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string preview_url() const;
|
const string preview_url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the remote URL of the original image
|
* @brief Returns the remote URL of the original image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string remote_url() const;
|
const string remote_url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the size of the original image
|
* @brief Returns the size of the original image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string size() const;
|
const string size() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the size of the preview image
|
* @brief Returns the size of the preview image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string size_small() const;
|
const string size_small() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns shorter URL for the image
|
* @brief Returns shorter URL for the image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string text_url() const;
|
const string text_url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns attachment type
|
* @brief Returns attachment type
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
attachment_type type() const;
|
attachment_type type() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns URL of the locally hosted version of the image
|
* @brief Returns URL of the locally hosted version of the image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the width of the original image
|
* @brief Returns the width of the original image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t width() const;
|
uint64_t width() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the width of the preview image
|
* @brief Returns the width of the preview image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t width_small() const;
|
uint64_t width_small() const;
|
||||||
|
@ -219,5 +222,6 @@ namespace Mastodon
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_ATTACHMENT_HPP
|
#endif // MASTODON_CPP_EASY_ATTACHMENT_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -19,28 +19,31 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold cards
|
* @brief Class to hold cards
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Card : public Easy::Entity
|
class Card : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -49,88 +52,89 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the name of the author
|
* @brief Returns the name of the author
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string author_name() const;
|
const string author_name() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL of the author
|
* @brief Returns the URL of the author
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string author_url() const;
|
const string author_url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the description
|
* @brief Returns the description
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string description() const;
|
const string description() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the height of the card
|
* @brief Returns the height of the card
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t height() const;
|
uint64_t height() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the HTML
|
* @brief Returns the HTML
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string html() const;
|
const string html() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL of the image associated with the card
|
* @brief Returns the URL of the image associated with the card
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string image() const;
|
const string image() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the name of the provider
|
* @brief Returns the name of the provider
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string provider_name() const;
|
const string provider_name() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL of the provider
|
* @brief Returns the URL of the provider
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string provider_url() const;
|
const string provider_url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the title
|
* @brief Returns the title
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string title() const;
|
const string title() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the type of the card
|
* @brief Returns the type of the card
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
Easy::card_type type() const;
|
Easy::card_type type() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL associated with the card
|
* @brief Returns the URL associated with the card
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the width of the card
|
* @brief Returns the width of the card
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t width() const;
|
uint64_t width() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_CARD_HPP
|
#endif // MASTODON_CPP_EASY_CARD_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -19,29 +19,32 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
#include "easy/entities/status.hpp"
|
#include "easy/entities/status.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/status.hpp>
|
#include <mastodon-cpp/easy/entities/status.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold contexts
|
* @brief Class to hold contexts
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Context : public Easy::Entity
|
class Context : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -50,18 +53,19 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the ancestors of the Status as vector of Statuses
|
* @brief Returns the ancestors of the Status as vector of Statuses
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
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
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Status> descendants() const;
|
const std::vector<Status> descendants() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_CONTEXT_HPP
|
#endif // MASTODON_CPP_EASY_CONTEXT_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -18,27 +18,30 @@
|
||||||
#define MASTODON_CPP_EASY_EMOJI_HPP
|
#define MASTODON_CPP_EASY_EMOJI_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold emojis
|
* @brief Class to hold emojis
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Emoji : public Easy::Entity
|
class Emoji : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -47,25 +50,26 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the shortcode of the emoji
|
* @brief Returns the shortcode of the emoji
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string shortcode() const;
|
const string shortcode() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL to the emoji static image
|
* @brief Returns the URL to the emoji static image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string static_url() const;
|
const string static_url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL to the emoji image
|
* @brief Returns the URL to the emoji image
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_EMOJI_HPP
|
#endif // MASTODON_CPP_EASY_EMOJI_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
|
|
||||||
|
@ -28,22 +27,26 @@ using std::uint64_t;
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
#include "easy/entities/account.hpp"
|
#include "easy/entities/account.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/account.hpp>
|
#include <mastodon-cpp/easy/entities/account.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold instances
|
* @brief Class to hold instances
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Instance : public Easy::Entity
|
class Instance : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -52,14 +55,14 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the Account of the admin or another contact person
|
* @brief Returns the Account of the admin or another contact person
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Account contact_account() const;
|
const Account contact_account() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the description of the instance
|
* @brief Returns the description of the instance
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string description() const;
|
const string description() const;
|
||||||
|
@ -67,7 +70,7 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the email address which can be used to contact the
|
* @brief Returns the email address which can be used to contact the
|
||||||
* instance administrator
|
* instance administrator
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string email() const;
|
const string email() const;
|
||||||
|
@ -75,35 +78,35 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns a vector of ISO 6391 language codes the instance has
|
* @brief Returns a vector of ISO 6391 language codes the instance has
|
||||||
* chosen to advertise
|
* chosen to advertise
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<string> languages() const;
|
const std::vector<string> languages() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the title of the instance
|
* @brief Returns the title of the instance
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string title() const;
|
const string title() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URI of the instance
|
* @brief Returns the URI of the instance
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string uri() const;
|
const string uri() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the version used by the instance
|
* @brief Returns the version used by the instance
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string version() const;
|
const string version() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL for the streaming API
|
* @brief Returns the URL for the streaming API
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string streaming_api() const;
|
const string streaming_api() const;
|
||||||
|
@ -119,5 +122,6 @@ namespace Mastodon
|
||||||
uint64_t max_toot_chars() const;
|
uint64_t max_toot_chars() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_INSTANCE_HPP
|
#endif // MASTODON_CPP_EASY_INSTANCE_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -20,28 +20,31 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold lists
|
* @brief Class to hold lists
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::List : public Easy::Entity
|
class List : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -50,18 +53,19 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns list-ID
|
* @brief Returns list-ID
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns title
|
* @brief Returns title
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string title() const;
|
const string title() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_LIST_HPP
|
#endif // MASTODON_CPP_EASY_LIST_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -19,15 +19,16 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -35,13 +36,15 @@ using std::uint64_t;
|
||||||
using std::chrono::system_clock;
|
using std::chrono::system_clock;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold mentions
|
* @brief Class to hold mentions
|
||||||
*
|
*
|
||||||
* before 0.11.0
|
* before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Mention : public Easy::Entity
|
class Mention : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -50,32 +53,33 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns acct
|
* @brief Returns acct
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string acct() const;
|
const string acct() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns account ID
|
* @brief Returns account ID
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL of user's profile
|
* @brief Returns the URL of user's profile
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the username of the account
|
* @brief Returns the username of the account
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string username() const;
|
const string username() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_MENTION_HPP
|
#endif // MASTODON_CPP_EASY_MENTION_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
@ -45,9 +45,9 @@ const Easy::Account Notification::account() const
|
||||||
return Easy::Account();
|
return Easy::Account();
|
||||||
}
|
}
|
||||||
|
|
||||||
const system_clock::time_point Notification::created_at() const
|
const Easy::time Notification::created_at() const
|
||||||
{
|
{
|
||||||
return get_time_point("created_at");
|
return get_time("created_at");
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Notification::id() const
|
const string Notification::id() const
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <chrono>
|
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
|
@ -28,25 +26,28 @@
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
#include "easy/entities/account.hpp"
|
#include "easy/entities/account.hpp"
|
||||||
#include "easy/entities/status.hpp"
|
#include "easy/entities/status.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/account.hpp>
|
#include <mastodon-cpp/easy/entities/account.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/status.hpp>
|
#include <mastodon-cpp/easy/entities/status.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
using std::chrono::system_clock;
|
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold notifications
|
* @brief Class to hold notifications
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Notification : public Easy::Entity
|
class Notification : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -55,21 +56,21 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the Account sending the notification to the user
|
* @brief Returns the Account sending the notification to the user
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Account account() const;
|
const Account account() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns time of creation
|
* @brief Returns time of creation
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const system_clock::time_point created_at() const;
|
const Easy::time created_at() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns notification ID
|
* @brief Returns notification ID
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
@ -77,18 +78,19 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the Status associated with the notification, if
|
* @brief Returns the Status associated with the notification, if
|
||||||
* applicable
|
* applicable
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Status status() const;
|
const Status status() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns notification type
|
* @brief Returns notification type
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
Easy::notification_type type() const;
|
Easy::notification_type type() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_NOTIFICATION_HPP
|
#endif // MASTODON_CPP_EASY_NOTIFICATION_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -20,27 +20,30 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold push subscriptions.
|
* @brief Class to hold push subscriptions.
|
||||||
*
|
*
|
||||||
* @since 0.14.0
|
* @since 0.14.0
|
||||||
*/
|
*/
|
||||||
class Easy::PushSubscription : public Easy::Entity
|
class PushSubscription : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -49,21 +52,21 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns push subscription ID
|
* @brief Returns push subscription ID
|
||||||
*
|
*
|
||||||
* @since 0.14.0
|
* @since 0.14.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the endpoint URL
|
* @brief Returns the endpoint URL
|
||||||
*
|
*
|
||||||
* @since 0.14.0
|
* @since 0.14.0
|
||||||
*/
|
*/
|
||||||
const string endpoint() const;
|
const string endpoint() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the server public key for signature verification
|
* @brief Returns the server public key for signature verification
|
||||||
*
|
*
|
||||||
* @since 0.14.0
|
* @since 0.14.0
|
||||||
*/
|
*/
|
||||||
const string server_key() const;
|
const string server_key() const;
|
||||||
|
@ -72,7 +75,7 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns a map of 'notification event type' and
|
* @brief Returns a map of 'notification event type' and
|
||||||
* 'push is requested or not'
|
* 'push is requested or not'
|
||||||
*
|
*
|
||||||
* @since 0.14.0
|
* @since 0.14.0
|
||||||
*/
|
*/
|
||||||
const Easy::alertmap alerts() const;
|
const Easy::alertmap alerts() const;
|
||||||
|
@ -86,5 +89,6 @@ namespace Mastodon
|
||||||
bool s_to_b(const string &str) const;
|
bool s_to_b(const string &str) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_PUSHSUBSCRIPTION_HPP
|
#endif // MASTODON_CPP_EASY_PUSHSUBSCRIPTION_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -19,28 +19,31 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold relationships
|
* @brief Class to hold relationships
|
||||||
*
|
*
|
||||||
* before 0.11.0
|
* before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Relationship : public Easy::Entity
|
class Relationship : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -49,74 +52,75 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is blocking the account
|
* @brief Returns true if the user is blocking the account
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool blocking() const;
|
bool blocking() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is blocking the account's domain
|
* @brief Returns true if the user is blocking the account's domain
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool domain_blocking() const;
|
bool domain_blocking() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the account is endorsed by the user
|
* @brief Returns true if the account is endorsed by the user
|
||||||
*
|
*
|
||||||
* @since 0.19.0
|
* @since 0.19.0
|
||||||
*/
|
*/
|
||||||
bool endorsed() const;
|
bool endorsed() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is being followed by the account
|
* @brief Returns true if the user is being followed by the account
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool followed_by() const;
|
bool followed_by() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is being following the account
|
* @brief Returns true if the user is being following the account
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool following() const;
|
bool following() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the target account ID
|
* @brief Returns the target account ID
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is muting the account
|
* @brief Returns true if the user is muting the account
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool muting() const;
|
bool muting() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is also muting notifications
|
* @brief Returns true if the user is also muting notifications
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool muting_notifications() const;
|
bool muting_notifications() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user has requested to follow the account
|
* @brief Returns true if the user has requested to follow the account
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool requested() const;
|
bool requested() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user is showing notifications
|
* @brief Returns true if the user is showing notifications
|
||||||
*
|
*
|
||||||
* @since 0.19.0
|
* @since 0.19.0
|
||||||
*/
|
*/
|
||||||
bool showing_notifications() const;
|
bool showing_notifications() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_RELATIONSHIP_HPP
|
#endif // MASTODON_CPP_EASY_RELATIONSHIP_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
@ -39,4 +39,3 @@ const string Report::id() const
|
||||||
{
|
{
|
||||||
return get_string("id");
|
return get_string("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,27 +19,30 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold reports
|
* @brief Class to hold reports
|
||||||
*
|
*
|
||||||
* before 0.11.0
|
* before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Report : public Easy::Entity
|
class Report : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -49,18 +52,19 @@ namespace Mastodon
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if an action was taken in response to the
|
* @brief Returns true if an action was taken in response to the
|
||||||
* report
|
* report
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool action_taken() const;
|
bool action_taken() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the ID of the report
|
* @brief Returns the ID of the report
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_REPORT_HPP
|
#endif // MASTODON_CPP_EASY_REPORT_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
|
@ -28,24 +27,28 @@
|
||||||
#include "easy/entities/account.hpp"
|
#include "easy/entities/account.hpp"
|
||||||
#include "easy/entities/status.hpp"
|
#include "easy/entities/status.hpp"
|
||||||
#include "easy/entities/tag.hpp"
|
#include "easy/entities/tag.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/account.hpp>
|
#include <mastodon-cpp/easy/entities/account.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/status.hpp>
|
#include <mastodon-cpp/easy/entities/status.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/tag.hpp>
|
#include <mastodon-cpp/easy/entities/tag.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold results
|
* @brief Class to hold results
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Results : public Easy::Entity
|
class Results : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -54,21 +57,21 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of matched Accounts
|
* @brief Returns an array of matched Accounts
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Account> accounts() const;
|
const std::vector<Account> accounts() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of matched Statuses
|
* @brief Returns an array of matched Statuses
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Status> statuses() const;
|
const std::vector<Status> statuses() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of matched hashtags as string
|
* @brief Returns an array of matched hashtags as string
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
const std::vector<string> hashtags_v1() const;
|
const std::vector<string> hashtags_v1() const;
|
||||||
|
@ -81,5 +84,6 @@ namespace Mastodon
|
||||||
const std::vector<Tag> hashtags_v2() const;
|
const std::vector<Tag> hashtags_v2() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_RESULTS_HPP
|
#endif // MASTODON_CPP_EASY_RESULTS_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
@ -77,9 +77,9 @@ const Easy::Card Status::card() const
|
||||||
return Easy::Card();
|
return Easy::Card();
|
||||||
}
|
}
|
||||||
|
|
||||||
const system_clock::time_point Status::created_at() const
|
const Easy::time Status::created_at() const
|
||||||
{
|
{
|
||||||
return get_time_point("created_at");
|
return get_time("created_at");
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Status::content() const
|
const string Status::content() const
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <chrono>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
|
@ -34,6 +32,7 @@
|
||||||
#include "easy/entities/tag.hpp"
|
#include "easy/entities/tag.hpp"
|
||||||
#include "easy/entities/application.hpp"
|
#include "easy/entities/application.hpp"
|
||||||
#include "easy/entities/card.hpp"
|
#include "easy/entities/card.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
@ -44,20 +43,22 @@
|
||||||
#include <mastodon-cpp/easy/entities/tag.hpp>
|
#include <mastodon-cpp/easy/entities/tag.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/application.hpp>
|
#include <mastodon-cpp/easy/entities/application.hpp>
|
||||||
#include <mastodon-cpp/easy/entities/card.hpp>
|
#include <mastodon-cpp/easy/entities/card.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
using std::chrono::system_clock;
|
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold statuses
|
* @brief Class to hold statuses
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Status : public Easy::Entity
|
class Status : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Entity::Entity;
|
using Entity::Entity;
|
||||||
|
@ -66,119 +67,119 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of matched accounts.
|
* @brief Returns an array of matched accounts.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Account account() const;
|
const Account account() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns application from which the status was posted.
|
* @brief Returns application from which the status was posted.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Application application() const;
|
const Application application() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns card
|
* @brief Returns card
|
||||||
*
|
*
|
||||||
* @since 0.19.0
|
* @since 0.19.0
|
||||||
*/
|
*/
|
||||||
const Card card() const;
|
const Card card() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns time of creation
|
* @brief Returns time of creation
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const system_clock::time_point created_at() const;
|
const Easy::time created_at() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns content of status
|
* @brief Returns content of status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string content() const;
|
const string content() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets content of status
|
* @brief Sets content of status
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status content(const string &content);
|
Status content(const string &content);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns an array of emojis
|
* @brief Returns an array of emojis
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Emoji> emojis() const;
|
const std::vector<Emoji> emojis() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user has favourited the status
|
* @brief Returns true if the user has favourited the status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool favourited() const;
|
bool favourited() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the number of favourites
|
* @brief Returns the number of favourites
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t favourites_count() const;
|
uint64_t favourites_count() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the ID of the status
|
* @brief Returns the ID of the status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string id() const;
|
const string id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the ID of the status it replies to
|
* @brief Returns the ID of the status it replies to
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string in_reply_to_id() const;
|
const string in_reply_to_id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets the ID of the status it replies to
|
* @brief Sets the ID of the status it replies to
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status in_reply_to_id(const string &in_reply_to_id);
|
Status in_reply_to_id(const string &in_reply_to_id);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the ID of the account it replies to
|
* @brief Returns the ID of the account it replies to
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string in_reply_to_account_id() const;
|
const string in_reply_to_account_id() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the language of the status
|
* @brief Returns the language of the status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string language() const;
|
const string language() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Overrides the language of the status (ISO 639-2)
|
* @brief Overrides the language of the status (ISO 639-2)
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status language(const string &language);
|
Status language(const string &language);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the attachments
|
* @brief Returns the attachments
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Attachment> media_attachments() const;
|
const std::vector<Attachment> media_attachments() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets the attachments
|
* @brief Sets the attachments
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status media_attachments
|
Status media_attachments
|
||||||
|
@ -186,116 +187,117 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the mentions
|
* @brief Returns the mentions
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Mention> mentions() const;
|
const std::vector<Mention> mentions() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user muted the conversation
|
* @brief Returns true if the user muted the conversation
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool muted() const;
|
bool muted() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the status is pinned
|
* @brief Returns true if the status is pinned
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool pinned() const;
|
bool pinned() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the reblogged Status
|
* @brief Returns the reblogged Status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const Status reblog() const;
|
const Status reblog() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the user has reblogged the status
|
* @brief Returns true if the user has reblogged the status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool reblogged() const;
|
bool reblogged() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the number of reblogs for the status
|
* @brief Returns the number of reblogs for the status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
uint64_t reblogs_count() const;
|
uint64_t reblogs_count() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the number of replies for the status
|
* @brief Returns the number of replies for the status
|
||||||
*
|
*
|
||||||
* @since 0.19.0
|
* @since 0.19.0
|
||||||
*/
|
*/
|
||||||
uint64_t replies_count() const;
|
uint64_t replies_count() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns true if the attachments should be hidden by default
|
* @brief Returns true if the attachments should be hidden by default
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
bool sensitive() const;
|
bool sensitive() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets sensitive flag for attachments
|
* @brief Sets sensitive flag for attachments
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status sensitive(const bool &sensitive);
|
Status sensitive(const bool &sensitive);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the spoiler text
|
* @brief Returns the spoiler text
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string spoiler_text() const;
|
const string spoiler_text() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets the spoiler text
|
* @brief Sets the spoiler text
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status spoiler_text(const string &spoiler_text);
|
Status spoiler_text(const string &spoiler_text);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the tags
|
* @brief Returns the tags
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const std::vector<Tag> tags() const;
|
const std::vector<Tag> tags() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the Fediverse-unique resource ID
|
* @brief Returns the Fediverse-unique resource ID
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string uri() const;
|
const string uri() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL to the status page
|
* @brief Returns the URL to the status page
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the visibility of the status
|
* @brief Returns the visibility of the status
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
visibility_type visibility() const;
|
visibility_type visibility() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sets the visibility of the status
|
* @brief Sets the visibility of the status
|
||||||
*
|
*
|
||||||
* @since 0.17.0
|
* @since 0.17.0
|
||||||
*/
|
*/
|
||||||
Status visibility(const visibility_type &visibility);
|
Status visibility(const visibility_type &visibility);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_STATUS_HPP
|
#endif // MASTODON_CPP_EASY_STATUS_HPP
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This file is part of mastodon-cpp.
|
/* This file is part of mastodon-cpp.
|
||||||
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
* Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
|
@ -77,18 +77,18 @@ uint64_t Tag::History::accounts()
|
||||||
return stouint64(get_string("accounts"));
|
return stouint64(get_string("accounts"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const system_clock::time_point Tag::History::day()
|
const Easy::time Tag::History::day()
|
||||||
{
|
{
|
||||||
const Json::Value node = get("day");
|
const Json::Value node = get("day");
|
||||||
|
|
||||||
if (node.isString())
|
if (node.isString())
|
||||||
{
|
{
|
||||||
std::chrono::seconds seconds(stouint64(node.asString()));
|
std::chrono::seconds seconds(stouint64(node.asString()));
|
||||||
return system_clock::time_point(seconds);
|
return {system_clock::time_point(seconds)};
|
||||||
}
|
}
|
||||||
|
|
||||||
ttdebug << "Could not get data: day\n";
|
ttdebug << "Could not get data: day\n";
|
||||||
return system_clock::time_point();
|
return Easy::time();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Tag::History::uses()
|
uint64_t Tag::History::uses()
|
||||||
|
|
|
@ -18,36 +18,37 @@
|
||||||
#define MASTODON_CPP_EASY_TAG_HPP
|
#define MASTODON_CPP_EASY_TAG_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "easy/entity.hpp"
|
|
||||||
|
|
||||||
// If we are compiling mastodon-cpp, use another include path
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
#ifdef MASTODON_CPP
|
#ifdef MASTODON_CPP
|
||||||
#include "mastodon-cpp.hpp"
|
#include "mastodon-cpp.hpp"
|
||||||
#include "easy/easy.hpp"
|
#include "easy/easy.hpp"
|
||||||
|
#include "easy/entity.hpp"
|
||||||
#else
|
#else
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
#include <mastodon-cpp/easy/easy.hpp>
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#include <mastodon-cpp/easy/entity.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::chrono::system_clock;
|
|
||||||
using std::uint64_t;
|
using std::uint64_t;
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
|
{
|
||||||
|
namespace Easy
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold tags.
|
* @brief Class to hold tags.
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
class Easy::Tag : public Easy::Entity
|
class Tag : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to hold Tag history
|
* @brief Class to hold Tag history
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
class History : public Easy::Entity
|
class History : public Easy::Entity
|
||||||
|
@ -59,21 +60,21 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the number of accounts using that hashtag.
|
* @brief Returns the number of accounts using that hashtag.
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
uint64_t accounts();
|
uint64_t accounts();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the day.
|
* @brief Returns the day.
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
const system_clock::time_point day();
|
const Easy::time day();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the number of accounts using that hashtag.
|
* @brief Returns the number of accounts using that hashtag.
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
uint64_t uses();
|
uint64_t uses();
|
||||||
|
@ -85,25 +86,26 @@ namespace Mastodon
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the name of the tag
|
* @brief Returns the name of the tag
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string name() const;
|
const string name() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the URL of the tag
|
* @brief Returns the URL of the tag
|
||||||
*
|
*
|
||||||
* @since before 0.11.0
|
* @since before 0.11.0
|
||||||
*/
|
*/
|
||||||
const string url() const;
|
const string url() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the history of the tag
|
* @brief Returns the history of the tag
|
||||||
*
|
*
|
||||||
* @since 0.16.0
|
* @since 0.16.0
|
||||||
*/
|
*/
|
||||||
const std::vector<History> history() const;
|
const std::vector<History> history() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MASTODON_CPP_EASY_TAG_HPP
|
#endif // MASTODON_CPP_EASY_TAG_HPP
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
// #include "easy.hpp"
|
|
||||||
#include "easy/entity.hpp"
|
#include "easy/entity.hpp"
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
|
|
||||||
|
@ -212,8 +211,7 @@ bool Easy::Entity::get_bool(const string &key) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const system_clock::time_point
|
const Easy::time Easy::Entity::get_time(const string &key) const
|
||||||
Easy::Entity::get_time_point(const string &key) const
|
|
||||||
{
|
{
|
||||||
const Json::Value node = get(key);
|
const Json::Value node = get(key);
|
||||||
|
|
||||||
|
@ -224,12 +222,12 @@ const system_clock::time_point
|
||||||
sstime >> std::get_time(&tm, "%Y-%m-%dT%T");
|
sstime >> std::get_time(&tm, "%Y-%m-%dT%T");
|
||||||
std::time_t time = timegm(&tm);
|
std::time_t time = timegm(&tm);
|
||||||
_was_set = true;
|
_was_set = true;
|
||||||
return system_clock::from_time_t(time);
|
return { system_clock::from_time_t(time) };
|
||||||
}
|
}
|
||||||
|
|
||||||
_was_set = false;
|
_was_set = false;
|
||||||
// Return clocks epoch
|
// Return clocks epoch
|
||||||
return system_clock::time_point();
|
return { system_clock::time_point() };
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<string> Easy::Entity::get_vector(const string &key) const
|
const std::vector<string> Easy::Entity::get_vector(const string &key) const
|
||||||
|
|
|
@ -18,11 +18,16 @@
|
||||||
#define ENTITY_HPP
|
#define ENTITY_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
|
||||||
#include <jsoncpp/json/json.h>
|
#include <jsoncpp/json/json.h>
|
||||||
|
|
||||||
|
// If we are compiling mastodon-cpp, use another include path
|
||||||
|
#ifdef MASTODON_CPP
|
||||||
|
#include "easy/easy.hpp"
|
||||||
|
#else
|
||||||
|
#include <mastodon-cpp/easy/easy.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::chrono::system_clock;
|
|
||||||
|
|
||||||
namespace Mastodon
|
namespace Mastodon
|
||||||
{
|
{
|
||||||
|
@ -194,11 +199,11 @@ namespace Easy
|
||||||
bool get_bool(const string &key) const;
|
bool get_bool(const string &key) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the value of key as time_point
|
* @brief Returns the value of key as Easy::time.
|
||||||
*
|
*
|
||||||
* Returns clocks epoch if the value does not exist or is null.
|
* Returns clocks epoch if the value does not exist or is null.
|
||||||
*/
|
*/
|
||||||
const system_clock::time_point get_time_point(const string &key) const;
|
const Easy::time get_time(const string &key) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the value of key as vector
|
* @brief Returns the value of key as vector
|
||||||
|
|
|
@ -38,6 +38,8 @@ namespace Easy
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Return types for calls that return a single `Easy::Entity`.
|
* @brief Return types for calls that return a single `Easy::Entity`.
|
||||||
|
*
|
||||||
|
* @since 0.100.0
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct return_entity : return_base
|
struct return_entity : return_base
|
||||||
|
|
|
@ -47,7 +47,7 @@ return_call::operator const string() const
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator <<(std::ostream &out, const return_call &ret)
|
std::ostream &Mastodon::operator <<(std::ostream &out, const return_call &ret)
|
||||||
{
|
{
|
||||||
out << ret.answer;
|
out << ret.answer;
|
||||||
return out;
|
return out;
|
||||||
|
|
Reference in New Issue