Changed ids from uint_fast64_t to const string in all relevant places.
This commit is contained in:
parent
0b47e0ec8d
commit
5a6b541de2
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.6)
|
||||
project (mastodon-cpp
|
||||
VERSION 0.21.0
|
||||
VERSION 0.30.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
|
|
@ -116,8 +116,8 @@ const string Easy::strtime(const system_clock::time_point &timepoint,
|
|||
}
|
||||
|
||||
Easy::Link::Link(const string &link_header)
|
||||
: _next(0)
|
||||
, _prev(0)
|
||||
: _next()
|
||||
, _prev()
|
||||
{
|
||||
std::regex renext("max_id=([[:digit:]]*)");
|
||||
std::regex reprev("since_id=([[:digit:]]*)");
|
||||
|
@ -125,30 +125,30 @@ Easy::Link::Link(const string &link_header)
|
|||
|
||||
if (std::regex_search(link_header, match, renext))
|
||||
{
|
||||
_next = std::stoull(match[1].str());
|
||||
_next = match[1].str();
|
||||
}
|
||||
if (std::regex_search(link_header, match, reprev))
|
||||
{
|
||||
_prev = std::stoull(match[1].str());
|
||||
_prev = match[1].str();
|
||||
}
|
||||
}
|
||||
|
||||
uint_fast64_t Easy::Link::next() const
|
||||
const string Easy::Link::next() const
|
||||
{
|
||||
return _next;
|
||||
}
|
||||
|
||||
uint_fast64_t Easy::Link::max_id() const
|
||||
const string Easy::Link::max_id() const
|
||||
{
|
||||
return _next;
|
||||
}
|
||||
|
||||
uint_fast64_t Easy::Link::prev() const
|
||||
const string Easy::Link::prev() const
|
||||
{
|
||||
return _prev;
|
||||
}
|
||||
|
||||
uint_fast64_t Easy::Link::since_id() const
|
||||
const string Easy::Link::since_id() const
|
||||
{
|
||||
return _prev;
|
||||
}
|
||||
|
|
|
@ -172,32 +172,32 @@ public:
|
|||
*
|
||||
* @since before 0.11.0
|
||||
*/
|
||||
uint_fast64_t next() const;
|
||||
const string next() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns max_id
|
||||
*
|
||||
* @since before 0.11.0
|
||||
*/
|
||||
uint_fast64_t max_id() const;
|
||||
const string max_id() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns since_id
|
||||
*
|
||||
* @since before 0.11.0
|
||||
*/
|
||||
uint_fast64_t prev() const;
|
||||
const string prev() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns since_id
|
||||
*
|
||||
* @since before 0.11.0
|
||||
*/
|
||||
uint_fast64_t since_id() const;
|
||||
const string since_id() const;
|
||||
|
||||
private:
|
||||
uint_fast64_t _next;
|
||||
uint_fast64_t _prev;
|
||||
string _next;
|
||||
string _prev;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -309,7 +309,7 @@ public:
|
|||
*/
|
||||
const vector<Notification> get_notifications(
|
||||
uint_fast16_t &error, const uint_fast16_t limit = 20,
|
||||
const uint_fast64_t since_id = 0, const uint_fast64_t max_id = 0);
|
||||
const string since_id = 0, const string max_id = 0);
|
||||
|
||||
/*!
|
||||
* @brief Base class for all entities.
|
||||
|
|
|
@ -45,10 +45,10 @@ const Easy::Status Easy::send_post(const Status &status, uint_fast16_t &error)
|
|||
return Status();
|
||||
}
|
||||
|
||||
if (status.in_reply_to_id() != 0)
|
||||
if (!status.in_reply_to_id().empty())
|
||||
{
|
||||
parameters.insert({ "in_reply_to_id",
|
||||
{ std::to_string(status.in_reply_to_id()) }});
|
||||
{ status.in_reply_to_id() }});
|
||||
}
|
||||
if (status.sensitive())
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ const Easy::Status Easy::send_post(const Status &status, uint_fast16_t &error)
|
|||
if (error == 0)
|
||||
{
|
||||
Attachment attachment(answer);
|
||||
media_ids.push_back(std::to_string(attachment.id()));
|
||||
media_ids.push_back(attachment.id());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -140,20 +140,20 @@ const Easy::Status Easy::send_post(const Status &status, uint_fast16_t &error)
|
|||
|
||||
const vector<Easy::Notification> Easy::get_notifications(
|
||||
uint_fast16_t &error, const uint_fast16_t limit,
|
||||
const uint_fast64_t since_id, const uint_fast64_t max_id)
|
||||
const string since_id, const string max_id)
|
||||
{
|
||||
API::parametermap parameters;
|
||||
string answer;
|
||||
error = 0;
|
||||
|
||||
parameters.insert({ "limit", { std::to_string(limit) } });
|
||||
if (since_id != 0)
|
||||
if (!since_id.empty())
|
||||
{
|
||||
parameters.insert({ "since_id", { std::to_string(since_id) } });
|
||||
parameters.insert({ "since_id", { since_id } });
|
||||
}
|
||||
if (max_id != 0)
|
||||
if (!max_id.empty())
|
||||
{
|
||||
parameters.insert({ "max_id", { std::to_string(max_id) } });
|
||||
parameters.insert({ "max_id", { max_id } });
|
||||
}
|
||||
|
||||
error = API::get(Mastodon::API::v1::notifications, parameters, answer);
|
||||
|
|
Reference in New Issue
Block a user