|
@@ -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])
|
|
|
|
|
@@ -829,11 +835,14 @@ const unretweet = ({ id, credentials }) => {
|
|
|
.then((data) => parseStatus(data))
|
|
|
}
|
|
|
|
|
|
-const bookmarkStatus = ({ id, credentials }) => {
|
|
|
+const bookmarkStatus = ({ id, credentials, ...options }) => {
|
|
|
return promisedRequest({
|
|
|
url: MASTODON_BOOKMARK_STATUS_URL(id),
|
|
|
headers: authHeaders(credentials),
|
|
|
- method: 'POST'
|
|
|
+ method: 'POST',
|
|
|
+ payload: {
|
|
|
+ folder_id: options.folder_id
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -1893,6 +1902,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: 'PATCH',
|
|
|
+ body: JSON.stringify({ name, emoji })
|
|
|
+ }).then((data) => data.json())
|
|
|
+}
|
|
|
+
|
|
|
+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 +2070,11 @@ const apiService = {
|
|
|
updateEmojiFile,
|
|
|
deleteEmojiFile,
|
|
|
listRemoteEmojiPacks,
|
|
|
- downloadRemoteEmojiPack
|
|
|
+ downloadRemoteEmojiPack,
|
|
|
+ fetchBookmarkFolders,
|
|
|
+ createBookmarkFolder,
|
|
|
+ updateBookmarkFolder,
|
|
|
+ deleteBookmarkFolder
|
|
|
}
|
|
|
|
|
|
export default apiService
|