pl-api: wip bookmark folders on kmyblue
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@@ -2352,6 +2352,10 @@ class PlApiClient {
|
||||
bookmarkStatus: async (statusId: string, folderId?: string) => {
|
||||
const response = await this.request(`/api/v1/statuses/${statusId}/bookmark`, { method: 'POST', body: { folder_id: folderId } });
|
||||
|
||||
if (folderId && this.features.bookmarkFoldersMultiple) {
|
||||
await this.request(`/api/v1/bookmark_categories/${folderId}/statuses`, { method: 'POST', params: { status_ids: [statusId] } });
|
||||
}
|
||||
|
||||
return v.parse(statusSchema, response.json);
|
||||
},
|
||||
|
||||
@@ -2571,13 +2575,22 @@ class PlApiClient {
|
||||
/**
|
||||
* Load conversation from a remote server.
|
||||
*
|
||||
* Requires features{@link Features['loadConversation']}.
|
||||
* Requires features{@link Features.loadConversation}.
|
||||
*/
|
||||
loadConversation: async (statusId: string) => {
|
||||
const response = await this.request <{}>(`/api/v1/statuses/${statusId}/load_conversation`, { method: 'POST' });
|
||||
|
||||
return response.json;
|
||||
},
|
||||
|
||||
/**
|
||||
* Requires features{@link Features.bookmarkFoldersMultiple}.
|
||||
*/
|
||||
getStatusBookmarkFolders: async (statusId: string) => {
|
||||
const response = await this.request(`/api/v1/statuses/${statusId}/categories`, { method: 'GET' });
|
||||
|
||||
return v.parse(filteredArray(bookmarkFolderSchema), response.json);
|
||||
},
|
||||
};
|
||||
|
||||
public readonly media = {
|
||||
|
||||
@@ -366,6 +366,8 @@ const getFeatures = (instance: Instance) => {
|
||||
/** Whether people who blocked you are visible through the API. */
|
||||
blockersVisible: instance.api_versions['blockers_visible.pleroma.pl-api'] >= 1,
|
||||
|
||||
bookmarkFolderEmojis: instance.api_versions['bookmark_folders.pleroma.pl-api'] >= 1,
|
||||
|
||||
/**
|
||||
* Can group bookmarks in folders.
|
||||
* @see GET /api/v1/pleroma/bookmark_folders
|
||||
@@ -378,7 +380,7 @@ const getFeatures = (instance: Instance) => {
|
||||
instance.api_versions['kmyblue_bookmark_category.fedibird.pl-api'] >= 1,
|
||||
]),
|
||||
|
||||
bookmarkFolderEmojis: instance.api_versions['bookmark_folders.pleroma.pl-api'] >= 1,
|
||||
bookmarkFoldersMultiple: instance.api_versions['kmyblue_bookmark_category.fedibird.pl-api'] >= 1,
|
||||
|
||||
/**
|
||||
* Can bookmark statuses.
|
||||
|
||||
Reference in New Issue
Block a user