lib/Api.js
function (token, option) {
  if (arguments.length < 1) {
    throw paramError;
  }
  check(option);

  this.token = token;
  this.host = (option && option.host) || config.apiHost;
  // 存取请求数的回调函数
  this.getRequestCount = option && option.getRequestCount || getReqCountHandle;
  this.saveRequestCount = option && option.saveRequestCount || saveReqCountHandle;
  // 请求实例
  this._request = new Request({
    protocol: (option && option.protocol) || config.httpProtocol,
    getRequestCount: reqCountWrap(this.token, this.getRequestCount),
    saveRequestCount: reqCountWrap(this.token, this.saveRequestCount),
  });
}
function (token, option) {
  if (arguments.length < 1) {
    throw paramError;
  }
  check(option);

  this.token = token;
  this.host = (option && option.host) || config.apiHost;
  // 存取请求数的回调函数
  this.getRequestCount = option && option.getRequestCount || getReqCountHandle;
  this.saveRequestCount = option && option.saveRequestCount || saveReqCountHandle;
  // 请求实例
  this._request = new Request({
    protocol: (option && option.protocol) || config.httpProtocol,
    getRequestCount: reqCountWrap(this.token, this.getRequestCount),
    saveRequestCount: reqCountWrap(this.token, this.saveRequestCount),
  });
}
初始化
@param {string} token
@param {object} option
@param {string} option.protocol 可选，'http'或者'https',默认'https'
@param {string} option.host 可选，开发 API 接口域名,默认'api.youhaosuda.com'
@param {function} option.getRequestCount 获取请求数函数
@param {function} option.saveRequestCount 存储请求数函数
@constructor