2026-02-26 14:55:10 +01:00
|
|
|
import {
|
|
|
|
|
apiRequestPost,
|
|
|
|
|
apiRequestGet,
|
|
|
|
|
apiRequestDelete,
|
|
|
|
|
apiRequestPatch,
|
|
|
|
|
} from 'mastodon/api';
|
2025-05-13 08:38:18 +02:00
|
|
|
import type {
|
|
|
|
|
ApiAccountJSON,
|
|
|
|
|
ApiFamiliarFollowersJSON,
|
|
|
|
|
} from 'mastodon/api_types/accounts';
|
2024-05-23 11:50:13 +02:00
|
|
|
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
|
2026-02-23 16:53:49 +01:00
|
|
|
import type {
|
|
|
|
|
ApiFeaturedTagJSON,
|
|
|
|
|
ApiHashtagJSON,
|
|
|
|
|
} from 'mastodon/api_types/tags';
|
2024-05-23 11:50:13 +02:00
|
|
|
|
2026-02-26 14:55:10 +01:00
|
|
|
import type {
|
|
|
|
|
ApiProfileJSON,
|
|
|
|
|
ApiProfileUpdateParams,
|
|
|
|
|
} from '../api_types/profile';
|
|
|
|
|
|
2024-05-23 11:50:13 +02:00
|
|
|
export const apiSubmitAccountNote = (id: string, value: string) =>
|
2024-06-25 15:45:41 +02:00
|
|
|
apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/note`, {
|
2024-06-25 18:53:03 +02:00
|
|
|
comment: value,
|
2024-05-23 11:50:13 +02:00
|
|
|
});
|
2024-12-03 10:42:52 +01:00
|
|
|
|
|
|
|
|
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`);
|
2025-04-18 09:23:34 +02:00
|
|
|
|
|
|
|
|
export const apiRemoveAccountFromFollowers = (id: string) =>
|
|
|
|
|
apiRequestPost<ApiRelationshipJSON>(
|
|
|
|
|
`v1/accounts/${id}/remove_from_followers`,
|
|
|
|
|
);
|
2025-04-29 14:14:22 +02:00
|
|
|
|
|
|
|
|
export const apiGetFeaturedTags = (id: string) =>
|
2026-02-23 16:53:49 +01:00
|
|
|
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');
|
2025-04-29 14:14:22 +02:00
|
|
|
|
|
|
|
|
export const apiGetEndorsedAccounts = (id: string) =>
|
|
|
|
|
apiRequestGet<ApiAccountJSON>(`v1/accounts/${id}/endorsements`);
|
2025-05-13 08:38:18 +02:00
|
|
|
|
|
|
|
|
export const apiGetFamiliarFollowers = (id: string) =>
|
2025-05-14 10:59:08 +02:00
|
|
|
apiRequestGet<ApiFamiliarFollowersJSON>('v1/accounts/familiar_followers', {
|
2025-05-13 08:38:18 +02:00
|
|
|
id,
|
|
|
|
|
});
|
2026-02-26 14:55:10 +01:00
|
|
|
|
|
|
|
|
export const apiGetProfile = () => apiRequestGet<ApiProfileJSON>('v1/profile');
|
|
|
|
|
|
2026-03-16 12:39:52 +01:00
|
|
|
export const apiPatchProfile = (params: ApiProfileUpdateParams | FormData) =>
|
2026-02-26 14:55:10 +01:00
|
|
|
apiRequestPatch<ApiProfileJSON>('v1/profile', params);
|
2026-03-16 16:56:30 +01:00
|
|
|
|
|
|
|
|
export const apiDeleteProfileAvatar = () =>
|
|
|
|
|
apiRequestDelete('v1/profile/avatar');
|
|
|
|
|
|
|
|
|
|
export const apiDeleteProfileHeader = () =>
|
|
|
|
|
apiRequestDelete('v1/profile/header');
|