Bookmark folders
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
a8092de638
commit
9e45228823
28 changed files with 464 additions and 31 deletions
|
|
@ -110,6 +110,8 @@ const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcemen
|
|||
const PLEROMA_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles`
|
||||
const PLEROMA_STATUS_QUOTES_URL = id => `/api/v1/pleroma/statuses/${id}/quotes`
|
||||
const PLEROMA_USER_FAVORITES_TIMELINE_URL = id => `/api/v1/pleroma/accounts/${id}/favourites`
|
||||
const PLEROMA_BOOKMARK_FOLDERS_URL = '/api/v1/pleroma/bookmark_folders'
|
||||
const PLEROMA_BOOKMARK_FOLDER_URL = id => `/api/v1/pleroma/bookmark_folders/${id}`
|
||||
|
||||
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
|
||||
const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
|
||||
|
|
@ -690,7 +692,8 @@ const fetchTimeline = ({
|
|||
tag = false,
|
||||
withMuted = false,
|
||||
replyVisibility = 'all',
|
||||
includeTypes = []
|
||||
includeTypes = [],
|
||||
bookmarkFolderId = false
|
||||
}) => {
|
||||
const timelineUrls = {
|
||||
public: MASTODON_PUBLIC_TIMELINE,
|
||||
|
|
@ -760,6 +763,9 @@ const fetchTimeline = ({
|
|||
params.push(['include_types[]', type])
|
||||
})
|
||||
}
|
||||
if (timeline === 'bookmarks' && bookmarkFolderId) {
|
||||
params.push(['folder_id', bookmarkFolderId])
|
||||
}
|
||||
|
||||
params.push(['limit', 20])
|
||||
|
||||
|
|
@ -1893,6 +1899,44 @@ const deleteEmojiFile = ({ packName, shortcode }) => {
|
|||
return fetch(`${PLEROMA_EMOJI_UPDATE_FILE_URL(packName)}&shortcode=${shortcode}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
const fetchBookmarkFolders = ({ credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDERS_URL
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => data.json())
|
||||
}
|
||||
|
||||
const createBookmarkFolder = ({ name, emoji, credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDERS_URL
|
||||
const headers = authHeaders(credentials)
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
return fetch(url, {
|
||||
headers,
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name, emoji })
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const updateBookmarkFolder = ({ folderId, name, emoji, credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDER_URL(folderId)
|
||||
const headers = authHeaders(credentials)
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
return fetch(url, {
|
||||
headers,
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ name, emoji })
|
||||
})
|
||||
}
|
||||
|
||||
const deleteBookmarkFolder = ({ folderId, credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDER_URL(folderId)
|
||||
return fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: authHeaders(credentials)
|
||||
})
|
||||
}
|
||||
|
||||
const apiService = {
|
||||
verifyCredentials,
|
||||
fetchTimeline,
|
||||
|
|
@ -2023,7 +2067,11 @@ const apiService = {
|
|||
updateEmojiFile,
|
||||
deleteEmojiFile,
|
||||
listRemoteEmojiPacks,
|
||||
downloadRemoteEmojiPack
|
||||
downloadRemoteEmojiPack,
|
||||
fetchBookmarkFolders,
|
||||
createBookmarkFolder,
|
||||
updateBookmarkFolder,
|
||||
deleteBookmarkFolder
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue