add stream health api endpoint (#24, #19)

This commit is contained in:
ari melody 2024-07-05 15:41:11 +01:00
parent 0d9c7b1761
commit 048d158209
Signed by: ari
GPG key ID: CF99829C92678188

View file

@ -131,6 +131,19 @@ export async function verifyCredentials(host, token) {
return data; 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 * GET /api/v1/notifications
* @param {string} host - The domain of the target server. * @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 {string} token - The application token
* @param {any} post_id - The ID of the post to delete. * @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}`; let url = `https://${host}/api/v1/statuses/${post_id}`;
const data = await fetch(url, { const data = await fetch(url, {
method: 'POST', method: 'POST',