Added support for push subscriptions

This commit is contained in:
tastytea 2018-05-22 23:49:31 +02:00
parent 9b81c53810
commit a0435e37d3
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
7 changed files with 23 additions and 4 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (mastodon-cpp
VERSION 0.13.1
VERSION 0.13.2
LANGUAGES CXX
)

View File

@ -270,6 +270,10 @@ Feature complete as of Mastodon 2.4.0
* [x] GET /api/v1/streaming/public/local
* [x] GET /api/v1/streaming/hashtag
* [x] GET /api/v1/streaming/list
* [x] POST /api/v1/push/subscription
* [x] GET /api/v1/push/subscription
* [x] PUT /api/v1/push/subscription
* [x] DELETE /api/v1/push/subscription
# Copyright

View File

@ -47,6 +47,9 @@ const uint_fast16_t API::del(const Mastodon::API::v1 &call,
case v1::statuses_id:
strcall = "/api/v1/statuses/" + strid;
break;
case v1::push_subscription:
strcall = "/api/v1/push/subscription";
break;
default:
ttdebug << "ERROR: Invalid call.\n";
return 11;

View File

@ -141,6 +141,9 @@ const uint_fast16_t API::get(const Mastodon::API::v1 &call,
case v1::timelines_list_list_id:
strcall = "/api/v1/timelines/list/" + strid;
break;
case v1::push_subscription:
strcall = "/api/v1/push/subscription";
break;
default:
ttdebug << "ERROR: Invalid call.\n";
return 11;

View File

@ -113,6 +113,9 @@ const uint_fast16_t API::post(const Mastodon::API::v1 &call,
case v1::statuses_id_unmute:
strcall = "/api/v1/statuses/" + strid + "/unmute";
break;
case v1::push_subscription:
strcall = "/api/v1/push/subscription";
break;
default:
ttdebug << "ERROR: Invalid call.\n";
return 11;

View File

@ -41,6 +41,9 @@ const uint_fast16_t API::put(const Mastodon::API::v1 &call,
case v1::media_id:
strcall = "/api/v1/media/" + strid;
break;
case v1::push_subscription:
strcall = "/api/v1/push/subscription";
break;
default:
ttdebug << "ERROR: Invalid call.\n";
return 11;

View File

@ -246,7 +246,9 @@ public:
streaming_public,
streaming_public_local,
streaming_hashtag,
streaming_list
streaming_list,
// Push
push_subscription
};
/*!
@ -303,14 +305,15 @@ public:
*
* @param client_name The name of the application
* @param redirect_uri urn:ietf:wg:oauth:2.0:oob for none
* @param scopes Scopes (read, write, follow, space separated)
* @param scopes Scopes (`read`, `write`, `follow`, `push`; space
* separated)
* @param website The website of the application
* @param client_id Returned
* @param client_secret Returned
* @param url Returned, used to generate code for register_app2
*
* @return @ref error "Error code". If the URL has permanently changed, 13
* is returned and url is set to the new URL.
* is returned and url is set to the new URL.
*/
const uint_fast16_t register_app1(const string &client_name,
const string &redirect_uri,