version 0.3.0 #1

Merged
ari merged 22 commits from dev into main 2024-07-02 19:39:03 +00:00
2 changed files with 24 additions and 1 deletions
Showing only changes of commit bc6d02d974 - Show all commits

View file

@ -91,8 +91,27 @@ export async function verifyCredentials() {
return data;
}
export async function getNotifications(since_id, limit, types) {
if (!get(client).user) return false;
let url = `https://${get(client).instance.host}/api/v1/notifications`;
let params = new URLSearchParams();
if (since_id) params.append("max_id", last_post_id);
if (limit) params.append("limit", limit);
if (types) params.append("types", types.join(','));
const params_string = params.toString();
if (params_string) url += '?' + params_string;
const data = await fetch(url, {
method: 'GET',
headers: { "Authorization": "Bearer " + get(client).app.token }
}).then(res => res.json());
return data;
}
export async function getTimeline(last_post_id) {
if (!get(client).instance || !get(client).app) return false;
let url = `https://${get(client).instance.host}/api/v1/timelines/home`;
if (last_post_id) url += "?max_id=" + last_post_id;
const data = await fetch(url, {

View file

@ -93,6 +93,10 @@ export class Client {
return user;
}
async getNotifications(since_id, limit, types) {
return await api.getNotifications(since_id, limit, types);
}
async getTimeline(last_post_id) {
return await api.getTimeline(last_post_id);
}