pinafore/routes/_utils/mastodon/user.js

25 lines
792 B
JavaScript
Raw Normal View History

2018-01-28 20:51:48 +00:00
import { get, paramsString } from '../ajax'
import { basename } from './utils'
2018-01-13 22:19:51 +00:00
2018-01-22 01:18:56 +00:00
export function getVerifyCredentials(instanceName, accessToken) {
let url = `${basename(instanceName)}/api/v1/accounts/verify_credentials`
2018-01-13 22:19:51 +00:00
return get(url, {
'Authorization': `Bearer ${accessToken}`
})
2018-01-23 05:16:27 +00:00
}
export function getAccount(instanceName, accessToken, accountId) {
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}`
return get(url, {
'Authorization': `Bearer ${accessToken}`
})
2018-01-28 20:51:48 +00:00
}
export async function getRelationship(instanceName, accessToken, accountId) {
let url = `${basename(instanceName)}/api/v1/accounts/relationships`
url += '?' + paramsString({id: accountId})
let res = await get(url, {
'Authorization': `Bearer ${accessToken}`
})
return res[0]
2018-01-13 22:19:51 +00:00
}