2018-02-24 02:23:36 +00:00
|
|
|
import { getWithTimeout, paramsString } from '../_utils/ajax'
|
2018-02-24 22:49:28 +00:00
|
|
|
import { auth, basename } from './utils'
|
2018-01-13 22:19:51 +00:00
|
|
|
|
2018-02-09 06:29:29 +00:00
|
|
|
export function getVerifyCredentials (instanceName, accessToken) {
|
2018-01-19 05:52:58 +00:00
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/verify_credentials`
|
2018-02-24 22:49:28 +00:00
|
|
|
return getWithTimeout(url, auth(accessToken))
|
2018-01-23 05:16:27 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 06:29:29 +00:00
|
|
|
export function getAccount (instanceName, accessToken, accountId) {
|
2018-01-23 05:16:27 +00:00
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}`
|
2018-02-24 22:49:28 +00:00
|
|
|
return getWithTimeout(url, auth(accessToken))
|
2018-01-28 20:51:48 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 06:29:29 +00:00
|
|
|
export async function getRelationship (instanceName, accessToken, accountId) {
|
2018-01-28 20:51:48 +00:00
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/relationships`
|
|
|
|
url += '?' + paramsString({id: accountId})
|
2018-02-24 22:49:28 +00:00
|
|
|
let res = await getWithTimeout(url, auth(accessToken))
|
2018-01-28 20:51:48 +00:00
|
|
|
return res[0]
|
2018-02-09 06:29:29 +00:00
|
|
|
}
|