Execute API done hook

@inner
@param {Function} done the done hook
@param {boolean} sync whether is sync API, if true, it will not hook the
API done result based the call arguments
@param {Array} args the API call arguments
@param {Object} ctx the extra call context for the hook
@return {Object} return the api done hook info
function hookAPIDone(done, sync, args, ctx) {
    // API done interception
    let hasDoneHook = isFunction(done);
    let hasIntercepted = false;
    let doneHookInfo;
    if (hasDoneHook) {
        doneHookInfo = createAPIDoneHook(done, ctx);
        // intercept async API based the args: `success`/`fail`/`complete` callback
        hasIntercepted = interceptAsyncAPIDone(sync, args, doneHookInfo.hook);
    }

    return {
        hasDoneHook,
        hasIntercepted,
        doneHookInfo
    };
}