function Client(options) {
  options = options || {};

  this.isClient = true;
  this.subdomain = options.subdomain;
  this.endpoint = options.endpoint;
  if (!this.subdomain && !this.endpoint) throw new Error('No subdomain was specified.');

  // Determine if we construct a URL from the subdomain or use a custom one
  if(this.endpoint && typeof this.endpoint !== 'undefined') {
    this.baseUrl = this.endpoint;
  } else {
    this.baseUrl = 'https://' + this.subdomain + '.desk.com';
  }

  if (options.username && options.password) {
    this.auth = { username: options.username, password: options.password, sendImmediately: true };
  } else if (options.consumerKey && options.consumerSecret && options.token && options.tokenSecret) {
    this.auth = {
      consumer_key: options.consumerKey,
      consumer_secret: options.consumerSecret,
      token: options.token,
      token_secret: options.tokenSecret
    };
  } else {
    throw new Error('No authentication specified, use either Basic Authentication or OAuth.');
  }

  this.retry = options.retry || false;
  this.maxRetry = options.maxRetry || 3;
  this.timeout = options.timeout;
  this.logger = options.logger || null;
  this.queue = async.queue(this.request.bind(this), 60);

  linkMixin.call(this, JSON.parse(fs.readFileSync(__dirname + '/resources.json', 'utf-8')));
}
function Client(options) {
  options = options || {};

  this.isClient = true;
  this.subdomain = options.subdomain;
  this.endpoint = options.endpoint;
  if (!this.subdomain && !this.endpoint) throw new Error('No subdomain was specified.');

  
  if(this.endpoint && typeof this.endpoint !== 'undefined') {
    this.baseUrl = this.endpoint;
  } else {
    this.baseUrl = 'https:
  }

  if (options.username && options.password) {
    this.auth = { username: options.username, password: options.password, sendImmediately: true };
  } else if (options.consumerKey && options.consumerSecret && options.token && options.tokenSecret) {
    this.auth = {
      consumer_key: options.consumerKey,
      consumer_secret: options.consumerSecret,
      token: options.token,
      token_secret: options.tokenSecret
    };
  } else {
    throw new Error('No authentication specified, use either Basic Authentication or OAuth.');
  }

  this.retry = options.retry || false;
  this.maxRetry = options.maxRetry || 3;
  this.timeout = options.timeout;
  this.logger = options.logger || null;
  this.queue = async.queue(this.request.bind(this), 60);

  linkMixin.call(this, JSON.parse(fs.readFileSync(__dirname + '/resources.json', 'utf-8')));
}
function Client ( options ) { options = options || { } ; this . isClient = true ; this . subdomain = options . subdomain ; this . endpoint = options . endpoint ; if ( ! this . subdomain && ! this . endpoint ) throw new Error ( 'No subdomain was specified.' ) ; // Determine if we construct a URL from the subdomain or use a custom one if ( this . endpoint && typeof this . endpoint !== 'undefined' ) { this . baseUrl = this . endpoint ; } else { this . baseUrl = 'https://' + this . subdomain + '.desk.com' ; } if ( options . username && options . password ) { this . auth = { username : options . username , password : options . password , sendImmediately : true } ; } else if ( options . consumerKey && options . consumerSecret && options . token && options . tokenSecret ) { this . auth = { consumer_key : options . consumerKey , consumer_secret : options . consumerSecret , token : options . token , token_secret : options . tokenSecret } ; } else { throw new Error ( 'No authentication specified, use either Basic Authentication or OAuth.' ) ; } this . retry = options . retry || false ; this . maxRetry = options . maxRetry || 3 ; this . timeout = options . timeout ; this . logger = options . logger || null ; this . queue = async . queue ( this . request . bind ( this ) , 60 ) ; linkMixin . call ( this , JSON . parse ( fs . readFileSync ( __dirname + '/resources.json' , 'utf-8' ) ) ) ; }
Initialize a new `Client` with the given `options`.

Options:

- `subdomain` the desk.com subdomain to use
- `endpoint` the desk.com custom domain to use - if you use your own domain
- `username` username for basic authentication
- `password` password for basic authentication
- `consumerKey` consumer key for the oauth application
- `consumerSecret` secret for the oauth application
- `token` the token for the oauth authentication
- `tokenSecret` secret for the oauth authentication
- `retry` retry request on 429 and 503
- `logger` logging function to use for request logging

@param {Object} options
@api private
Initialize a new Client with the given options .