import { RequestHeader } from '.' ; import { WebApiConfig } from '../config' ; import { OAuthCredential } from '../oauth' ; export function fillAHeader ( header , config ) { header [ 'A' ] = `${ config . agent }/${ config . version }/${ config . language }` ; } export function fillBaseHeader ( header , config ) { header [ 'Accept' ] = '*/*' ; header [ 'Accept-Language' ] = config . language ; } export function getUserAgent ( config ) { let os = '' ; if ( config . agent === 'win32' ) { os = `Wd/${ config . osVersion }` ; } else if ( config . agent === 'android' ) { os = `An/${ config . osVersion }` ; } else { os = `Wd/${ config . osVersion }` ; } return `KT/${ config . version } ${ os } ${ config . language }` ; } export function fillCredential ( header , credential ) { header [ 'Authorization' ] = `${ credential . accessToken }-${ credential . deviceUUID }` ; }