2018-02-25 05:27:32 +00:00
|
|
|
import { favoriteStatus } from '../routes/_api/favorite'
|
|
|
|
import fetch from 'node-fetch'
|
2018-03-10 18:54:16 +00:00
|
|
|
import FileApi from 'file-api'
|
2018-03-06 04:29:49 +00:00
|
|
|
import { users } from './users'
|
2018-03-10 18:54:16 +00:00
|
|
|
import { postStatus } from '../routes/_api/statuses'
|
2018-03-11 00:21:10 +00:00
|
|
|
import { deleteStatus } from '../routes/_api/delete'
|
2018-03-15 05:14:06 +00:00
|
|
|
import { authorizeFollowRequest, getFollowRequests } from '../routes/_actions/followRequests'
|
2018-03-10 18:54:16 +00:00
|
|
|
|
2018-03-06 07:56:48 +00:00
|
|
|
global.fetch = fetch
|
2018-03-10 18:54:16 +00:00
|
|
|
global.File = FileApi.File
|
|
|
|
global.FormData = FileApi.FormData
|
2018-02-25 05:27:32 +00:00
|
|
|
|
2018-03-11 00:21:10 +00:00
|
|
|
const instanceName = 'localhost:3000'
|
|
|
|
|
2018-02-25 05:27:32 +00:00
|
|
|
export async function favoriteStatusAsAdmin (statusId) {
|
2018-03-11 00:21:10 +00:00
|
|
|
return favoriteStatus(instanceName, users.admin.accessToken, statusId)
|
2018-02-25 05:27:32 +00:00
|
|
|
}
|
2018-03-10 18:54:16 +00:00
|
|
|
|
|
|
|
export async function postAsAdmin (text) {
|
2018-03-11 00:21:10 +00:00
|
|
|
return postStatus(instanceName, users.admin.accessToken, text,
|
2018-03-10 18:54:16 +00:00
|
|
|
null, null, false, null, 'public')
|
|
|
|
}
|
2018-03-11 00:21:10 +00:00
|
|
|
|
2018-03-11 04:24:07 +00:00
|
|
|
export async function postReplyAsAdmin (text, inReplyTo) {
|
|
|
|
return postStatus(instanceName, users.admin.accessToken, text,
|
|
|
|
inReplyTo, null, false, null, 'public')
|
|
|
|
}
|
|
|
|
|
2018-03-11 00:21:10 +00:00
|
|
|
export async function deleteAsAdmin (statusId) {
|
|
|
|
return deleteStatus(instanceName, users.admin.accessToken, statusId)
|
|
|
|
}
|
2018-03-15 05:14:06 +00:00
|
|
|
|
|
|
|
export async function getFollowRequestsAsLockedAccount () {
|
|
|
|
return getFollowRequests(instanceName, users.LockedAccount.accessToken)
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function authorizeFollowRequestAsLockedAccount (id) {
|
|
|
|
return authorizeFollowRequest(instanceName, users.LockedAccount.accessToken, id)
|
|
|
|
}
|