mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-14 14:37:35 -05:00
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
Chromatic / Check for relevant changes (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
CSS Linting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Chromatic / Run Chromatic (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.3) (push) Has been cancelled
Ruby Testing / test (3.4) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.3) (push) Has been cancelled
Ruby Testing / End to End testing (3.4) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.4, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Has been cancelled
Crowdin / Download translations / download-translations (push) Has been cancelled
Bundler Audit / security (push) Has been cancelled
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import {
|
|
apiRequestPost,
|
|
apiRequestPut,
|
|
apiRequestGet,
|
|
apiRequestDelete,
|
|
} from 'mastodon/api';
|
|
import type { ApiAccountJSON } from 'mastodon/api_types/accounts';
|
|
import type { ApiListJSON } from 'mastodon/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 apiGetLists = () => apiRequestGet<ApiListJSON[]>('v1/lists');
|
|
|
|
export const apiGetListAccounts = (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],
|
|
});
|