2018-01-28 21:51:48 +01:00
|
|
|
import { get, paramsString } from '../ajax'
|
2018-01-19 06:52:58 +01:00
|
|
|
import { basename } from './utils'
|
2018-01-13 23:19:51 +01:00
|
|
|
|
2018-01-22 02:18:56 +01:00
|
|
|
export function getVerifyCredentials(instanceName, accessToken) {
|
2018-01-19 06:52:58 +01:00
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/verify_credentials`
|
2018-01-13 23:19:51 +01:00
|
|
|
return get(url, {
|
|
|
|
'Authorization': `Bearer ${accessToken}`
|
|
|
|
})
|
2018-01-23 06:16:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getAccount(instanceName, accessToken, accountId) {
|
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}`
|
|
|
|
return get(url, {
|
|
|
|
'Authorization': `Bearer ${accessToken}`
|
|
|
|
})
|
2018-01-28 21:51:48 +01: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 23:19:51 +01:00
|
|
|
}
|