import { queryEncode } from '../util' ; import BaseAPI from './BaseAPI' ; export default class OAuth extends BaseAPI { public access ( client_id , client_secret , code , redirect_uri = null , single_channel = false , extraArgs = { } ) { const args = { client_id , client_secret , code , redirect_uri , single_channel , ... extraArgs } ; const encodedParams = queryEncode ( args ) ; const url = `${ BaseAPI . API_ENDPOINT }oauth.access?${ encodedParams }` ; return this . _fetch ( url , { method : 'POST' } ) ; } public token ( client_id , client_secret , code , redirect_uri = null , single_channel = false , extraArgs = { } ) { const args = { client_id , client_secret , code , redirect_uri , single_channel , ... extraArgs } ; return this . _get ( 'oauth.token' , args ) ; } }