Gitkit client constructor.

@param {object} options Options to be passed in
@constructor
195167
function GitkitClient(options) {
  this.widgetUrl = options.widgetUrl;
  this.maxTokenExpiration = 86400 * 30; // 30 days
  this.audiences = [];
  if (options.projectId !== undefined) {
    this.audiences.push(options.projectId);
  }
  if (options.clientId !== undefined) {
    this.audiences.push(options.clientId);
  }
  if (this.audiences.length == 0) {
    throw new Error("Missing projectId or clientId in server configuration.");
  }
  this.authClient = new google.auth.JWT(
      options.serviceAccountEmail,
      options.serviceAccountPrivateKeyFile,
      options.serviceAccountPrivateKey,
      [GitkitClient.GITKIT_SCOPE],
      '');
  this.certificateCache = null;
  this.certificateExpiry = null;
}
1118088
function Client(config = {}) {
  this.config = config;
  this.logger = new Logger(config);

  //Client is a required field, so throw error if it's not supplied.
  //If 'this.dialect' is set, then this is a 'super()' call, in which case
  //'client' does not have to be set as it's already assigned on the client prototype.

  if (this.dialect && !this.config.client) {
    this.logger.warn(
      `Using 'this.dialect' to identify the client is deprecated and support for it will be removed in the future. Please use configuration option 'client' instead.`
    );
  }
  const dbClient = this.config.client || this.dialect;
  if (!dbClient) {
    throw new Error(`knex: Required configuration option 'client' is missing.`);
  }

  if (config.version) {
    this.version = config.version;
  }

  this.connectionSettings = cloneDeep(config.connection || {});
  if (this.driverName && config.connection) {
    this.initializeDriver();
    if (!config.pool || (config.pool && config.pool.max !== 0)) {
      this.initializePool(config);
    }
  }
  this.valueForUndefined = this.raw('DEFAULT');
  if (config.useNullAsDefault) {
    this.valueForUndefined = null;
  }
}
717323
function GithubBot(options) {
  if (!(this instanceof GithubBot)) {
    return new GithubBot(options);
  }
  BaseBot.call(this, options);

  this.handlers(events);
  this.define('events', events);
}
820485
function createMiddleware(options, archiveFormat) {
  /**
   * Express middleware handling GitHub 'codeload' archive requests
   *
   * @param {Request} req Request object
   * @param {Response} res Response object
   * @param {callback} next next middleware in chain
   *
   * @see https://developer.github.com/v3/repos/contents/#get-archive-link
   */
  return async (req, res, next) => {
    // GET /:owner/:repo/:archive_format/:ref
    const { owner } = req.params;
    const repoName = req.params.repo;
    const refName = req.params.ref;

    const repPath = resolveRepositoryPath(options, owner, repoName);

    // project-helix/#187: serve modified content only if the requested ref is currently checked out
    const serveUncommitted = await isCheckedOut(repPath, refName);

    let commitSha;
    let archiveFileName;
    let archiveFilePath;

    resolveCommit(repPath, refName)
      .then((oid) => {
        commitSha = oid;
        return getObject(repPath, commitSha);
      })
      .then(({ object: commit }) => getObject(repPath, commit.tree))
      .then(async ({ object: tree }) => {
        archiveFileName = `${owner}-${repoName}-${serveUncommitted ? 'SNAPSHOT' : commitSha}${archiveFormat === 'zip' ? '.zip' : '.tgz'}`;
        archiveFilePath = joinPaths(CACHE_DIR, archiveFileName);
        await fse.ensureDir(CACHE_DIR);

        // check cache
        if (!serveUncommitted && await fse.pathExists(archiveFilePath)) {
          // no need to build archive, use cached archive file
          return fse.createReadStream(archiveFilePath); // lgtm [js/path-injection]
        }

        // build archive
        let archive;
        if (archiveFormat === 'zip') {
          // zip
          archive = new Archiver('zip', {
            zlib: { level: 9 }, // compression level
          });
        } else {
          // tar.gz
          archive = new Archiver('tar', {
            gzip: true,
            gzipOptions: {
              level: 9, // compression level
            },
          });
        }
        if (serveUncommitted) {
          // don't cache
          archive = await archiveWorkingDir(repPath, archive);
        } else {
          archive = await archiveGitTree(repPath, tree, archive);
        }

        return new Promise((resolve, reject) => {
          if (serveUncommitted) {
            // don't cache
            archive.finalize();
            resolve(archive);
          } else {
            // cache archive file
            archive.pipe(fse.createWriteStream(archiveFilePath)) // lgtm [js/path-injection]
              .on('finish', () => resolve(fse.createReadStream(archiveFilePath))) // lgtm [js/path-injection]
              .on('error', err => reject(err));
            archive.finalize();
          }
        });
      })
      .then((archiveStream) => {
        const mimeType = archiveFormat === 'zip' ? 'application/zip' : 'application/x-gzip';
        res.writeHead(200, {
          'Content-Type': mimeType,
          'Content-Disposition': `attachment; filename=${archiveFileName}`,
        });
        archiveStream.pipe(res);
      })
      .catch((err) => {
        options.logger.debug(`[archiveHandler] code: ${err.code} message: ${err.message} stack: ${err.stack}`);
        next(err);
      });
  };
}
436628
function SCP(options) {
	this.options = options || {};

	console.assert(this.options.hostname, "Hostname required!");

	this.debug = !!options.debug;
	this.listener = new Listener({
		debug: options.debug
	});
}
730760
public static GitkitClient createFromJson(String configPath)
      throws GitkitClientException, JSONException, IOException {
    return createFromJson(configPath, null);
  }
879725
function UI(options) {
  if (!(this instanceof UI)) {
    var ui = Object.create(UI.prototype);
    UI.apply(ui, arguments);
    return ui;
  }
  debug('initializing from <%s>', __filename);
  this.options = utils.createOptions(options);
  this.appendedLines = 0;
  this.height = 0;
  this.initInterface();
}
772600
function _createClient (name, options, callback) {
  const log = logger.child({ redis: name })
  log.debug('Redis creating client: ' + name)
  let isReady = false

  const config = {}
  deepAssign(config, _defaults, options)
  let client = redis.createClient(config)

  callback = _once(callback)
  _clients[ name ] = client
  _clients[ name ].log = log

  log.debug({ clients: Object.keys(_clients) }, 'Redis clients')

  client.on('error', function (err) {
    log.error({ err: err }, 'Redis client error')
    callback(err)
  })

  client.on('warning', function (err) {
    log.warn({ err: err }, 'Redis client warning')
  })

  client.on('connect', function () {
    log.debug('Redis connected: ' + name)
  })

  client.on('ready', function () {
    log.debug('Redis client ready: ' + name)
    log.debug({ config: config }, 'Redis client config')
    log.debug(`Redis server version: ${safeGet(() => client.server_info.redis_version)}`)
    isReady = true
    callback(null, client)
  })

  client.on('reconnecting', function () {
    log.debug('Redis client reconnecting: ' + name)
  })

  client.on('end', function () {
    log.debug('Redis client end: ' + name)
    // Close the connection before removing reference.
    client.quit()
    client = null
    delete _clients[ name ]
    log.debug({ clients: Object.keys(_clients) }, 'Redis clients: ' + _clients.length)
    if (!isReady) {
      callback(new Error('Done - Failed to connect to Redis'))
    }
  })
}
1111974
function initClient (args) {
    // create client configuration
    this.client = {
        binds: [],
        hooks: {},
        minify: false,
        placeholders: {},
        refreshInterval: 0,
        server: {
            hasGet: defined(this.module.get),
            hasSet: defined(this.module.set),
        }
    }
    // skip if client args not set
    if (!defined(args.client)) {
        return
    }
    // add any hooks
    _.each(args.client.hooks, (hook, name) => {
        // require function
        this.assert(typeof hook === 'function', 115)
        // require valid hook
        this.assert(hookNames[name], 116, `${name} is not a valid hook name`)
        // set hook
        this.client.hooks[name] = hook
    })
    // set refresh interval if defined
    if (defined(args.client.refreshInterval)) {
        // convert to integer
        var refreshInterval = parseInt(args.client.refreshInterval)
        // require positive integer
        this.assert(refreshInterval > 0, 117)
        // set refresh interval
        this.client.refreshInterval = refreshInterval
    }
    // set binds if defined
    if (defined(args.client.binds)) {
        // require object, can be array
        this.assert(args.client.binds && typeof args.client.binds === 'object', 118)
        // store binds
        this.client.binds = args.client.binds
    }
    // set any client boolean options
    _.each(clientOptions, option => {
        if (defined(args.client[option])) {
            this.client[option] = !!args.client[option]
        }
    })
    // add any placeholders if defined
    _.each(args.client.placeholders, (value, property) => {
        this.client.placeholders[property] = value
    })
}
627995
function repo (options, callback) {
  var user = options.user
  var repo = options.repo
  var path = options.path || null
  var branch = options.branch || 'master'
  var token = options.token || null

  if (!user || !repo) {
    return callback(new Error('must specify user, repo'))
  }

  if (path) {
    var contentsUrl = '/repos/' + user + '/' + repo + '/contents/'
    return request({
      url: contentsUrl,
      qs: {
        access_token: token,
        ref: branch
      }
    }, function (err, data) {
      if (err) {
        var msg = 'Error requesting data from ' + contentsUrl + ': ' + err.message
        return callback(new Error(msg))
      }

      var isDir = false
      // assume the extension of the requested file is '.geojson', unless proven otherwise
      var extension = '.geojson'

      data.forEach(function (f) {
        // find out the extension of the file requested by the user
        var filenameArray = f.name.split('.')
        if (path === filenameArray[0]) {
          extension = '.' + filenameArray[1]
        }

        if (f.name === path && f.type === 'dir') isDir = true
      })

      if (isDir) {
        var url = '/repos/' + user + '/' + repo + '/contents/' + path

        return request({
          url: url,
          qs: {
            access_token: token,
            ref: branch
          }
        }, function (err, json) {
          if (err) return callback(err)

          var files = []

          json.forEach(function (file) {
            if (file.name.match(/geojson/)) {
              files.push(file)
            }
          })

          if (files.length) {
            return repoFiles({
              url: 'https://raw.github.com/' + user + '/' + repo + '/' + branch + '/' + path + '/',
              files: files
            }, callback)
          }

          callback(new Error('could not find any geojson files at ' + url))
        })
      }

      var urls = [
        'https://api.github.com/repos/' + user + '/' + repo + '/contents/' + path + extension,
        'https://raw.github.com/' + user + '/' + repo + '/' + branch + '/' + path + extension
      ]

      async.map(urls, function (url, cb) {
        request({
          url: url,
          qs: {
            access_token: token,
            ref: branch
          }
        }, cb)
      }, function (err, files) {
        if (err) return callback(err)

        var file = files[0]
        var json = files[1]
        var name = file.name
        var sha = file.sha
        var geojson = null

        if (json.type && json.type === 'FeatureCollection') {
          json.name = name
          json.sha = sha
          geojson = json
        }

        if (geojson) return callback(null, geojson)
        callback(new Error('could not find any geojson: ' + err.message))
      })
    })
  }

  var url = '/repos/' + user + '/' + repo + '/contents'

  request({
    url: url,
    qs: {
      access_token: token,
      ref: branch
    }
  }, function (err, json) {
    if (err) return callback(err)

    var files = []

    json.forEach(function (file) {
      if (file.name.match(/geojson/)) {
        files.push(file)
      }
    })

    if (files.length) {
      return repoFiles({
        url: 'https://raw.github.com/' + user + '/' + repo + '/' + branch + '/',
        files: files
      }, callback)
    }

    callback(new Error('could not find any geojson files at ' + url))
  })
}
219429
function MucProxy(options) {
    this.service = options.service;
    this.helpers = options.helpers;
    this.connection = options.stropheClient;
    this.Client = options.xmppClient;
    this.nodeStanzasCallbacks = options.nodeStanzasCallbacks;
    //
    this.joinedRooms = {};
}
1354544
function Client(key, options, GenericSocket) {
	var self = this,
		genericSocket = GenericSocket || undefined;
	
	self.connection = IrcSocket(options, genericSocket);
	self.options = options;
	self.supported = Helper.defaultSupported();
	self.key = key;

	self._connecting = false;
	self._queueId = QueuePool.queueLength(options.server);
	self._nick = options.nick;
	self._hostname = options.hostname;
	self._user = options.user;
	self._oper = false;
	self._requestedDisconnect = false;
	self._sendRegisteredTimer;
	self._pings = 0;
	self._retryTimer = null;
	self._retryCount = 0;
	self._capCount = 0;
	self._nickModifier = 0;
	self._timedOut = false;
	self._cap = {};
	self._data = {
		user: {},
		channel: {},
		server: {}
	};
	// setup a bunch of variables to manage the state of the connection

	self.connection.setTimeout(30000, function() {
		var seconds = Math.floor((+new Date()) / 1000);
		if ((seconds - self._lastTime) >= 5 * 60) {
			self._timedOut = true;
			self.disconnect();
		} else {
			self.raw(['PING', new Date().getTime().toString()]);
		}
	});

	self.queueConnect = _.wrap(self.connection.connect, function(fn, qid) {
		QueuePool.queueJob(self.options.server, qid, self.key, function() {
			fn.call(self.connection);
			self._connecting = true;

			Events.emit([self.key, 'connecting'], {
				nickname: self._nick,
				username: self.options.user,
				server: self.options.server,
				port: self.options.port,
				localPort: self.connection.impl.localPort
			});
			// emit a connecting event
		});
	});
	// setup queueConnect

	self.queueConnect(self._queueId);
	// connect the server

	self.connection.on('connect', self._connectEvent.bind(self));
	self.connection.on('close', self._closeEvent.bind(self));
	self.connection.on('error', function() { });
	self.connection.on('data', self._parseLine.bind(self));
	// event handlers
}
491311
function VK(options, redirectUri, code, token) {
    EventEmitter.call(self);
    self = this;
    if (options === undefined)
        throw 'No options passed to constructor';
    if (options.appID === undefined || options.appSecret === undefined)
        throw 'Wrong options';
    if (options.mode === 'undefined' || !(options.mode === 'oauth' || options.mode === 'sig'))
        options.mode = 'oauth';
    self.options = options;
    self.code = code || '';
    self.token = token || '';
    self.redirectUri = redirectUri || 'http://localhost';
    self.userId = 0;
}
1013184
function $createClient(options) {
        /*
         * Ensure we have default options.
         */
        options = extend({}, {}, options);

        const { url, transport } = options;

        if (_clients[url]) {
            return _clients[url];
        }

        const client = mqtt.connect(url, transport);

        _clients[url] = client;

        return client;
    }
1334273
function Server(options) {
  var that = this;
  that.options = options || {};
  that.stack = [];
  bind.call(that);
}
904911
function (options) {
            var key;
            for (key in this.config) {
                if (this.config.hasOwnProperty(key) && this.config[key].singleton) {
                    this._init(key, options);
                }
            }
            return this;
        }
497695
function( options ) {
  this.options = options;
  this.wpt = new WPT( this.options.wpt.server );

  this.data  = [];
  this.queue = new Queue();
}