aboutsummaryrefslogtreecommitdiff
path: root/src/services/api/api.service.js
diff options
context:
space:
mode:
authordave <starpumadev@gmail.com>2019-04-04 11:27:02 -0400
committertaehoon <th.dev91@gmail.com>2019-05-15 12:04:24 -0400
commitaffbe8700ec85cf39afd4c4cdf978a9a579e57c7 (patch)
treed1ae607935019e0b9c7c678f3f8b099ea76f4c78 /src/services/api/api.service.js
parent9eac355851b40aa5df9e6b23eca8c0ff1698e670 (diff)
#468 - integrate endpoints
Diffstat (limited to 'src/services/api/api.service.js')
-rw-r--r--src/services/api/api.service.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index b7a602b8..65cebe78 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -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_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials'
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 { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js'
@@ -210,6 +212,22 @@ const unfollowUser = ({id, credentials}) => {
}).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}) => {
return fetch(MASTODON_BLOCK_USER_URL(id), {
headers: authHeaders(credentials),
@@ -715,6 +733,8 @@ const apiService = {
fetchFollowers,
followUser,
unfollowUser,
+ pinOwnStatus,
+ unpinOwnStatus,
blockUser,
unblockUser,
fetchUser,