Merge remote-tracking branch 'parent/main' into upstream-20241126
This commit is contained in:
commit
8a075ba4c6
303 changed files with 7495 additions and 4498 deletions
49
app/javascript/mastodon/api/bookmark_categories.ts
Normal file
49
app/javascript/mastodon/api/bookmark_categories.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import {
|
||||
apiRequestPost,
|
||||
apiRequestPut,
|
||||
apiRequestGet,
|
||||
apiRequestDelete,
|
||||
} from 'mastodon/api';
|
||||
import type { ApiAccountJSON } from 'mastodon/api_types/accounts';
|
||||
import type { ApiBookmarkCategoryJSON } from 'mastodon/api_types/bookmark_categories';
|
||||
|
||||
export const apiCreate = (bookmarkCategory: Partial<ApiBookmarkCategoryJSON>) =>
|
||||
apiRequestPost<ApiBookmarkCategoryJSON>(
|
||||
'v1/bookmark_categories',
|
||||
bookmarkCategory,
|
||||
);
|
||||
|
||||
export const apiUpdate = (bookmarkCategory: Partial<ApiBookmarkCategoryJSON>) =>
|
||||
apiRequestPut<ApiBookmarkCategoryJSON>(
|
||||
`v1/bookmark_categories/${bookmarkCategory.id}`,
|
||||
bookmarkCategory,
|
||||
);
|
||||
|
||||
export const apiGetAccounts = (bookmarkCategoryId: string) =>
|
||||
apiRequestGet<ApiAccountJSON[]>(
|
||||
`v1/bookmark_categories/${bookmarkCategoryId}/statuses`,
|
||||
{
|
||||
limit: 0,
|
||||
},
|
||||
);
|
||||
|
||||
export const apiGetAccountBookmarkCategories = (accountId: string) =>
|
||||
apiRequestGet<ApiBookmarkCategoryJSON[]>(
|
||||
`v1/statuses/${accountId}/bookmark_categories`,
|
||||
);
|
||||
|
||||
export const apiAddAccountToBookmarkCategory = (
|
||||
bookmarkCategoryId: string,
|
||||
accountId: string,
|
||||
) =>
|
||||
apiRequestPost(`v1/bookmark_categories/${bookmarkCategoryId}/statuses`, {
|
||||
account_ids: [accountId],
|
||||
});
|
||||
|
||||
export const apiRemoveAccountFromBookmarkCategory = (
|
||||
bookmarkCategoryId: string,
|
||||
accountId: string,
|
||||
) =>
|
||||
apiRequestDelete(`v1/bookmark_categories/${bookmarkCategoryId}/statuses`, {
|
||||
account_ids: [accountId],
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue