1
0
mirror of https://github.com/nolanlawson/pinafore synced 2025-02-01 14:26:45 +01:00

40 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-02-24 21:27:32 -08:00
import { favoriteStatus } from '../routes/_api/favorite'
import fetch from 'node-fetch'
2018-03-10 10:54:16 -08:00
import FileApi from 'file-api'
import { users } from './users'
2018-03-10 10:54:16 -08:00
import { postStatus } from '../routes/_api/statuses'
2018-03-10 16:21:10 -08:00
import { deleteStatus } from '../routes/_api/delete'
2018-03-14 22:14:06 -07:00
import { authorizeFollowRequest, getFollowRequests } from '../routes/_actions/followRequests'
2018-03-10 10:54:16 -08:00
2018-03-05 23:56:48 -08:00
global.fetch = fetch
2018-03-10 10:54:16 -08:00
global.File = FileApi.File
global.FormData = FileApi.FormData
2018-02-24 21:27:32 -08:00
2018-03-10 16:21:10 -08:00
const instanceName = 'localhost:3000'
2018-03-16 10:06:02 -07:00
export async function favoriteStatusAs (username, statusId) {
return favoriteStatus(instanceName, users[username].accessToken, statusId)
2018-02-24 21:27:32 -08:00
}
2018-03-10 10:54:16 -08:00
2018-03-16 10:06:02 -07:00
export async function postAs (username, text) {
return postStatus(instanceName, users[username].accessToken, text,
2018-03-10 10:54:16 -08:00
null, null, false, null, 'public')
}
2018-03-10 16:21:10 -08:00
2018-03-16 10:06:02 -07:00
export async function postReplyAs (username, text, inReplyTo) {
return postStatus(instanceName, users[username].accessToken, text,
inReplyTo, null, false, null, 'public')
}
2018-03-16 10:06:02 -07:00
export async function deleteAs (username, statusId) {
return deleteStatus(instanceName, users[username].accessToken, statusId)
2018-03-10 16:21:10 -08:00
}
2018-03-14 22:14:06 -07:00
2018-03-16 10:06:02 -07:00
export async function getFollowRequestsAs (username) {
return getFollowRequests(instanceName, users[username].accessToken)
2018-03-14 22:14:06 -07:00
}
2018-03-16 10:06:02 -07:00
export async function authorizeFollowRequestAs (username, id) {
return authorizeFollowRequest(instanceName, users[username].accessToken, id)
2018-03-14 22:14:06 -07:00
}