mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-13 19:26:28 -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
86 lines
2.5 KiB
TypeScript
86 lines
2.5 KiB
TypeScript
import {
|
|
apiRequestPost,
|
|
apiRequestGet,
|
|
apiRequestDelete,
|
|
apiRequestPatch,
|
|
} from 'mastodon/api';
|
|
import type {
|
|
ApiAccountJSON,
|
|
ApiFamiliarFollowersJSON,
|
|
} from 'mastodon/api_types/accounts';
|
|
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
|
|
import type {
|
|
ApiFeaturedTagJSON,
|
|
ApiHashtagJSON,
|
|
} from 'mastodon/api_types/tags';
|
|
|
|
import type {
|
|
ApiProfileJSON,
|
|
ApiProfileUpdateParams,
|
|
} from '../api_types/profile';
|
|
|
|
export const apiGetAccounts = (ids: string[]) =>
|
|
apiRequestGet<ApiAccountJSON[]>('v1/accounts', {
|
|
id: ids,
|
|
});
|
|
|
|
export const apiSubmitAccountNote = (id: string, value: string) =>
|
|
apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/note`, {
|
|
comment: value,
|
|
});
|
|
|
|
export const apiFollowAccount = (
|
|
id: string,
|
|
params?: {
|
|
reblogs: boolean;
|
|
},
|
|
) =>
|
|
apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/follow`, {
|
|
...params,
|
|
});
|
|
|
|
export const apiUnfollowAccount = (id: string) =>
|
|
apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/unfollow`);
|
|
|
|
export const apiRemoveAccountFromFollowers = (id: string) =>
|
|
apiRequestPost<ApiRelationshipJSON>(
|
|
`v1/accounts/${id}/remove_from_followers`,
|
|
);
|
|
|
|
export const apiGetFeaturedTags = (id: string) =>
|
|
apiRequestGet<ApiHashtagJSON[]>(`v1/accounts/${id}/featured_tags`);
|
|
|
|
export const apiGetCurrentFeaturedTags = () =>
|
|
apiRequestGet<ApiFeaturedTagJSON[]>(`v1/featured_tags`);
|
|
|
|
export const apiPostFeaturedTag = (name: string) =>
|
|
apiRequestPost<ApiFeaturedTagJSON>('v1/featured_tags', { name });
|
|
|
|
export const apiDeleteFeaturedTag = (id: string) =>
|
|
apiRequestDelete(`v1/featured_tags/${id}`);
|
|
|
|
export const apiGetTagSuggestions = () =>
|
|
apiRequestGet<ApiHashtagJSON[]>('v1/featured_tags/suggestions');
|
|
|
|
export const apiGetEndorsedAccounts = (id: string) =>
|
|
apiRequestGet<ApiAccountJSON>(`v1/accounts/${id}/endorsements`);
|
|
|
|
export const apiGetFamiliarFollowers = (id: string) =>
|
|
apiRequestGet<ApiFamiliarFollowersJSON>('v1/accounts/familiar_followers', {
|
|
id,
|
|
});
|
|
|
|
export const apiGetProfile = () => apiRequestGet<ApiProfileJSON>('v1/profile');
|
|
|
|
export const apiPatchProfile = (params: ApiProfileUpdateParams | FormData) =>
|
|
apiRequestPatch<ApiProfileJSON>('v1/profile', params);
|
|
|
|
export const apiDeleteProfileAvatar = () =>
|
|
apiRequestDelete('v1/profile/avatar');
|
|
|
|
export const apiDeleteProfileHeader = () =>
|
|
apiRequestDelete('v1/profile/header');
|
|
|
|
export const apiSubscribeByEmail = (id: string, email: string) =>
|
|
apiRequestPost(`v1/accounts/${id}/email_subscriptions`, { email });
|