Add stub API responses

master
teknomunk 10 months ago
parent d158fed722
commit 315da65af4

@ -145,6 +145,24 @@ bool http_request_write_multipart_to_FILE( struct http_request* req, FILE* f, ch
return true; 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 // route: POST /api/v1/media
bool handle_media( struct http_request* req ) 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" ) ) { if( http_request_route( req, "notifications" ) ) {
return handle_notifications(req); 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" ) ) { } else if( http_request_route( req, "filters" ) ) {
http_request_send_headers( req, 200, "application/json", true ); http_request_send_headers( req, 200, "application/json", true );
FILE* f = http_request_get_response_body( req ); FILE* f = http_request_get_response_body( req );

@ -104,6 +104,15 @@ bool route_pleroma_api2( struct http_request* req )
return false; 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 // Route: /api/v1/pleroma
bool route_pleroma_api( struct http_request* req ) bool route_pleroma_api( struct http_request* req )
{ {
@ -124,6 +133,8 @@ bool route_pleroma_api( struct http_request* req )
return result; return result;
} }
} }
} else if( http_request_route( req, "/birthdays" ) ) {
return handle_pleroma_birthdays(req);
} }
return false; return false;

Loading…
Cancel
Save