Last active
June 23, 2016 16:50
-
-
Save aaronmcadam/9b5372a9b849a3fbb934a4c1b46ad3eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { curry } from 'ramda'; | |
const makeRequest = curry((endpoint, tokenResponse) => { | |
const token = bizApi.accessToken.create(tokenResponse); | |
const accessToken = token.token.access_token; | |
return bizApi.api('GET', endpoint, { access_token: accessToken }); | |
}); | |
/** | |
* Makes a GET request to the Business API | |
* @param {string} endpoint The endpoint we wish to call | |
* @returns {Promise} A promise containing the requested data | |
*/ | |
const callBizApi = (endpoint: string): Promise<any> => { | |
return requestToken(credentials).then(makeRequest(endpoint)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment