#468 - integrate endpoints
This commit is contained in:
parent
9eac355851
commit
affbe8700e
2 changed files with 30 additions and 0 deletions
|
@ -51,6 +51,8 @@ const MASTODON_STATUS_FAVORITEDBY_URL = id => `/api/v1/statuses/${id}/favourited
|
||||||
const MASTODON_STATUS_REBLOGGEDBY_URL = id => `/api/v1/statuses/${id}/reblogged_by`
|
const MASTODON_STATUS_REBLOGGEDBY_URL = id => `/api/v1/statuses/${id}/reblogged_by`
|
||||||
const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials'
|
const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials'
|
||||||
const MASTODON_REPORT_USER_URL = '/api/v1/reports'
|
const MASTODON_REPORT_USER_URL = '/api/v1/reports'
|
||||||
|
const MASTODON_PIN_OWN_STATUS = id => `/api/v1/statuses/${id}/pin`
|
||||||
|
const MASTODON_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin`
|
||||||
|
|
||||||
import { each, map, concat, last } from 'lodash'
|
import { each, map, concat, last } from 'lodash'
|
||||||
import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js'
|
import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js'
|
||||||
|
@ -210,6 +212,22 @@ const unfollowUser = ({id, credentials}) => {
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pinOwnStatus = ({ id, credentials }) => {
|
||||||
|
let url = MASTODON_PIN_OWN_STATUS(id)
|
||||||
|
return fetch(url, {
|
||||||
|
headers: authHeaders(credentials),
|
||||||
|
method: 'POST'
|
||||||
|
}).then((data) => data.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
const unpinOwnStatus = ({ id, credentials }) => {
|
||||||
|
let url = MASTODON_UNPIN_OWN_STATUS(id)
|
||||||
|
return fetch(url, {
|
||||||
|
headers: authHeaders(credentials),
|
||||||
|
method: 'POST'
|
||||||
|
}).then((data) => data.json())
|
||||||
|
}
|
||||||
|
|
||||||
const blockUser = ({id, credentials}) => {
|
const blockUser = ({id, credentials}) => {
|
||||||
return fetch(MASTODON_BLOCK_USER_URL(id), {
|
return fetch(MASTODON_BLOCK_USER_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
|
@ -715,6 +733,8 @@ const apiService = {
|
||||||
fetchFollowers,
|
fetchFollowers,
|
||||||
followUser,
|
followUser,
|
||||||
unfollowUser,
|
unfollowUser,
|
||||||
|
pinOwnStatus,
|
||||||
|
unpinOwnStatus,
|
||||||
blockUser,
|
blockUser,
|
||||||
unblockUser,
|
unblockUser,
|
||||||
fetchUser,
|
fetchUser,
|
||||||
|
|
|
@ -43,6 +43,14 @@ const backendInteractorService = (credentials) => {
|
||||||
return apiService.unfollowUser({credentials, id})
|
return apiService.unfollowUser({credentials, id})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pinOwnStatus = (id) => {
|
||||||
|
return apiService.pinOwnStatus({credentials, id})
|
||||||
|
}
|
||||||
|
|
||||||
|
const unpinOwnStatus = (id) => {
|
||||||
|
return apiService.unpinOwnStatus({ credentials, id })
|
||||||
|
}
|
||||||
|
|
||||||
const blockUser = (id) => {
|
const blockUser = (id) => {
|
||||||
return apiService.blockUser({credentials, id})
|
return apiService.blockUser({credentials, id})
|
||||||
}
|
}
|
||||||
|
@ -130,6 +138,8 @@ const backendInteractorService = (credentials) => {
|
||||||
fetchFollowers,
|
fetchFollowers,
|
||||||
followUser,
|
followUser,
|
||||||
unfollowUser,
|
unfollowUser,
|
||||||
|
pinOwnStatus,
|
||||||
|
unpinOwnStatus,
|
||||||
blockUser,
|
blockUser,
|
||||||
unblockUser,
|
unblockUser,
|
||||||
fetchUser,
|
fetchUser,
|
||||||
|
|
Loading…
Reference in a new issue