feat: follow requests in sidebar

This commit is contained in:
mae taylor 2025-07-14 17:42:20 +01:00
parent 0dd903a4eb
commit 6f446fd871
Signed by: mae
GPG key ID: 3C80D76BA7A3B9BD
6 changed files with 117 additions and 3 deletions

View file

@ -176,6 +176,32 @@ export async function getNotifications(host, token, min_id, max_id, limit, types
return data;
}
/**
* GET /api/v1/follow_requests
* @param {string} host - The domain of the target server.
* @param {string} token - The application token.
* @param {string} min_id - If provided, only shows follow requests since this ID.
* @param {string} max_id - If provided, only shows follow requests before this ID.
* @param {string} limit - The maximum number of follow requests to retrieve (default 40, max 80).
*/
export async function getFollowRequests(host, token, since_id, max_id, limit) {
let url = `https://${host}/api/v1/follow_requests`;
let params = new URLSearchParams();
if (since_id) params.append("since_id", since_id);
if (max_id) params.append("max_id", max_id);
if (limit) params.append("limit", limit);
const params_string = params.toString();
if (params_string) url += '?' + params_string;
const data = await fetch(url, {
method: 'GET',
headers: { "Authorization": "Bearer " + token }
}).then(res => res.json());
return data;
}
/**
* GET /api/v1/timelines/{timeline}
* @param {string} host - The domain of the target server.