From 048d158209e8387173899e80ea1118afcac3c1c4 Mon Sep 17 00:00:00 2001 From: ari melody Date: Fri, 5 Jul 2024 15:41:11 +0100 Subject: [PATCH] add stream health api endpoint (#24, #19) --- src/lib/api.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/api.js b/src/lib/api.js index a13b6d5..c9a70b6 100644 --- a/src/lib/api.js +++ b/src/lib/api.js @@ -131,6 +131,19 @@ export async function verifyCredentials(host, token) { return data; } +/** + * GET /api/v1/streaming/health + * Checks if the server's streaming service is alive + */ +export async function getStreamingHealth(host) { + let url = `https://${host}/api/v1/streaming/health`; + const res = await fetch(url, { + method: 'GET' + }); + + return res.ok; +} + /** * GET /api/v1/notifications * @param {string} host - The domain of the target server. @@ -250,7 +263,7 @@ export async function editPost(host, token, post_id, post_data) { * @param {string} token - The application token * @param {any} post_id - The ID of the post to delete. */ -export async function editPost(host, token, post_id) { +export async function deletePost(host, token, post_id) { let url = `https://${host}/api/v1/statuses/${post_id}`; const data = await fetch(url, { method: 'POST',