Added support for /api/v1/suggestions,

and /api/v1/suggestions/:account_id.
This commit is contained in:
tastytea 2019-04-20 00:39:52 +02:00
parent 8094603c0f
commit 14d0263606
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 22 additions and 7 deletions

View File

@ -280,8 +280,8 @@ Run `make package` from the build directory to generate a tar.gz archive.
* [x] GET /api/v1/follow_requests
* [x] POST /api/v1/follow_requests/:id/authorize
* [x] POST /api/v1/follow_requests/:id/reject
* [ ] GET /api/v1/suggestions
* [ ] DELETE /api/v1/suggestions/:account_id
* [x] GET /api/v1/suggestions
* [x] DELETE /api/v1/suggestions/:account_id
* [x] GET /api/v1/instance
* [x] GET /api/v1/lists
* [x] GET /api/v1/accounts/:id/lists

View File

@ -27,10 +27,15 @@ return_call API::del(const Mastodon::API::v1 &call,
string strid = "";
// The ID is part of the path
auto &it = params.find("id");
if (it != params.end())
const parameters::const_iterator &it_id = params.find("id");
const parameters::const_iterator &it_aid = params.find("accountid");
if (it_id != params.end())
{
strid = it->values[0];
strid = it_id->values[0];
}
else if (it_aid != params.end())
{
strid = it_aid->values[0];
}
switch (call)
@ -65,6 +70,11 @@ return_call API::del(const Mastodon::API::v1 &call,
strcall = "/api/v1/filters/" + strid;
break;
}
case v1::suggestions_accountid:
{
strcall = "/api/v1/suggestions/" + strid;
break;
}
default:
{
ttdebug << "ERROR: Invalid argument.\n";

View File

@ -231,6 +231,11 @@ const return_call API::get(const Mastodon::API::v1 &call,
strcall = "/api/v1/filters/" + strid;
break;
}
case v1::suggestions:
{
strcall = "/api/v1/suggestions";
break;
}
default:
{
ttdebug << "ERROR: Invalid argument.\n";

View File

@ -216,8 +216,8 @@ namespace Mastodon
follow_requests_id_authorize,
follow_requests_id_reject,
// suggestions,
// suggestions_id,
suggestions,
suggestions_accountid,
instance,