mirror of
https://github.com/NicolasConstant/sengi
synced 2024-12-22 21:58:59 +01:00
commit
63175d1e60
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sengi",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"main": "main-electron.js",
|
||||
"description": "A multi-account desktop client for Mastodon and Pleroma",
|
||||
|
@ -357,7 +357,11 @@ export class MastodonService {
|
||||
createList(account: AccountInfo, title: string): Promise<StreamElement> {
|
||||
let route = `https://${account.instance}${this.apiRoutes.postList}?title=${title}`;
|
||||
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
|
||||
return this.httpClient.post<List>(route, null, { headers: headers }).toPromise()
|
||||
|
||||
let data = new ListData();
|
||||
data.title = title;
|
||||
|
||||
return this.httpClient.post<List>(route, data, { headers: headers }).toPromise()
|
||||
.then((list: List) => {
|
||||
return new StreamElement(StreamTypeEnum.list, list.title, account.id, null, list.title, list.id, account.instance);
|
||||
});
|
||||
@ -378,8 +382,12 @@ export class MastodonService {
|
||||
addAccountToList(account: AccountInfo, listId: string, accountId: number): Promise<any> {
|
||||
let route = `https://${account.instance}${this.apiRoutes.addAccountToList}`.replace('{0}', listId);
|
||||
route += `?account_ids[]=${accountId}`;
|
||||
|
||||
let data = new ListAccountData();
|
||||
data.account_ids.push(accountId.toString());
|
||||
|
||||
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
|
||||
return this.httpClient.post(route, null, { headers: headers }).toPromise();
|
||||
return this.httpClient.post(route, data, { headers: headers }).toPromise();
|
||||
}
|
||||
|
||||
removeAccountFromList(account: AccountInfo, listId: string, accountId: number): Promise<any> {
|
||||
@ -543,6 +551,15 @@ class PollData {
|
||||
choices: number[];
|
||||
}
|
||||
|
||||
class ListData {
|
||||
title: string;
|
||||
replies_policy: string = 'list'; //TODO
|
||||
}
|
||||
|
||||
class ListAccountData {
|
||||
account_ids: string[] = [];
|
||||
}
|
||||
|
||||
class StatusData {
|
||||
status: string;
|
||||
in_reply_to_id: string;
|
||||
|
Loading…
Reference in New Issue
Block a user