2018-06-13 16:38:36 +02:00
|
|
|
import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax'
|
2018-02-24 23:49:28 +01:00
|
|
|
import { auth, basename } from './utils'
|
2018-01-13 23:19:51 +01:00
|
|
|
|
2018-02-09 07:29:29 +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-06-13 16:38:36 +02:00
|
|
|
return get(url, auth(accessToken), {timeout: DEFAULT_TIMEOUT})
|
2018-01-23 06:16:27 +01:00
|
|
|
}
|
|
|
|
|
2018-02-09 07:29:29 +01:00
|
|
|
export function getAccount (instanceName, accessToken, accountId) {
|
2018-01-23 06:16:27 +01:00
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/${accountId}`
|
2018-06-13 16:38:36 +02:00
|
|
|
return get(url, auth(accessToken), {timeout: DEFAULT_TIMEOUT})
|
2018-01-28 21:51:48 +01:00
|
|
|
}
|
|
|
|
|
2018-02-09 07:29:29 +01:00
|
|
|
export async function getRelationship (instanceName, accessToken, accountId) {
|
2018-01-28 21:51:48 +01:00
|
|
|
let url = `${basename(instanceName)}/api/v1/accounts/relationships`
|
|
|
|
url += '?' + paramsString({id: accountId})
|
2018-06-13 16:38:36 +02:00
|
|
|
let res = await get(url, auth(accessToken), {timeout: DEFAULT_TIMEOUT})
|
2018-01-28 21:51:48 +01:00
|
|
|
return res[0]
|
2018-02-09 07:29:29 +01:00
|
|
|
}
|