mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-04 05:53:07 -05:00
217e0f87fd
Port 62603508c7343f0b9ef880bcbed67c70a9e8375d to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import {
|
|
apiRequestPost,
|
|
apiRequestPut,
|
|
apiRequestGet,
|
|
apiRequestDelete,
|
|
} from 'flavours/glitch/api';
|
|
import type { ApiAccountJSON } from 'flavours/glitch/api_types/accounts';
|
|
import type { ApiListJSON } from 'flavours/glitch/api_types/lists';
|
|
|
|
export const apiCreate = (list: Partial<ApiListJSON>) =>
|
|
apiRequestPost<ApiListJSON>('v1/lists', list);
|
|
|
|
export const apiUpdate = (list: Partial<ApiListJSON>) =>
|
|
apiRequestPut<ApiListJSON>(`v1/lists/${list.id}`, list);
|
|
|
|
export const apiGetAccounts = (listId: string) =>
|
|
apiRequestGet<ApiAccountJSON[]>(`v1/lists/${listId}/accounts`, {
|
|
limit: 0,
|
|
});
|
|
|
|
export const apiGetAccountLists = (accountId: string) =>
|
|
apiRequestGet<ApiListJSON[]>(`v1/accounts/${accountId}/lists`);
|
|
|
|
export const apiAddAccountToList = (listId: string, accountId: string) =>
|
|
apiRequestPost(`v1/lists/${listId}/accounts`, {
|
|
account_ids: [accountId],
|
|
});
|
|
|
|
export const apiRemoveAccountFromList = (listId: string, accountId: string) =>
|
|
apiRequestDelete(`v1/lists/${listId}/accounts`, {
|
|
account_ids: [accountId],
|
|
});
|