From 315da65af48f48d2f2833f4eb2ec0ee172f59749 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 14 Jul 2023 20:08:12 -0500 Subject: [PATCH] Add stub API responses --- src/controller/mastodon_api.c | 22 ++++++++++++++++++++++ src/controller/pleroma_api.c | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/controller/mastodon_api.c b/src/controller/mastodon_api.c index e6a1172..ccdac6e 100644 --- a/src/controller/mastodon_api.c +++ b/src/controller/mastodon_api.c @@ -145,6 +145,24 @@ bool http_request_write_multipart_to_FILE( struct http_request* req, FILE* f, ch return true; } +// route: GET /api/v1/announcements +bool handle_announcements( struct http_request* req ) +{ + http_request_send_headers( req, 200, "application/json", true ); + FILE* f = http_request_get_response_body( req ); + fprintf( f, "[]" ); + return true; +} + +// route: GET /api/v1/blocks +bool handle_blocks( struct http_request* req ) +{ + http_request_send_headers( req, 200, "application/json", true ); + FILE* f = http_request_get_response_body( req ); + fprintf( f, "[]" ); + return true; +} + // route: POST /api/v1/media bool handle_media( struct http_request* req ) { @@ -256,6 +274,10 @@ bool route_mastodon_api( struct http_request* req ) if( http_request_route( req, "notifications" ) ) { return handle_notifications(req); + } else if( http_request_route( req, "announcements" ) ) { + return handle_announcements(req); + } else if( http_request_route( req, "blocks" ) ) { + return handle_blocks(req); } else if( http_request_route( req, "filters" ) ) { http_request_send_headers( req, 200, "application/json", true ); FILE* f = http_request_get_response_body( req ); diff --git a/src/controller/pleroma_api.c b/src/controller/pleroma_api.c index f94520a..55eae60 100644 --- a/src/controller/pleroma_api.c +++ b/src/controller/pleroma_api.c @@ -104,6 +104,15 @@ bool route_pleroma_api2( struct http_request* req ) return false; } +// Route: GET /api/v1/pleroma/birthdays +bool handle_pleroma_birthdays( struct http_request* req ) +{ + http_request_send_headers( req, 200, "application/json", true ); + FILE* f = http_request_get_response_body( req ); + fprintf( f, "[]" ); + return true; +} + // Route: /api/v1/pleroma bool route_pleroma_api( struct http_request* req ) { @@ -124,6 +133,8 @@ bool route_pleroma_api( struct http_request* req ) return result; } } + } else if( http_request_route( req, "/birthdays" ) ) { + return handle_pleroma_birthdays(req); } return false;