Execute api

@inner
@param {Object} hookInfo the api done hook info
@param {Function} rawApi the raw api definition
@param {Array} args the API call arguments
@return {*}
function executeAPI(hookInfo, rawApi, args) {
    // call API
    let {hasDoneHook, hasIntercepted, doneHookInfo} = hookInfo;
    let result = rawApi.apply(this, args);
    if (hasDoneHook) {
        // intercept the API call result
        if (isPromise(result)) {
            result = interceptPromiseResponse(hasIntercepted, result, doneHookInfo);
        }
        else if (!hasIntercepted) {
            result = doneHookInfo.hook(null, result);
        }
    }

    return result;
}