client/splunk.js
function(http, params) {
            if (!(http instanceof Http) && !params) {
                // Move over the params
                params = http;
                http = null;
            }

            params = params || {};

            this.scheme        = params.scheme || "https";
            this.host          = params.host || "localhost";
            this.port          = params.port || 8089;
            this.username      = params.username || null;
            this.password      = params.password || null;
            this.owner         = params.owner;
            this.app           = params.app;
            this.sessionKey    = params.sessionKey || "";
            this.authorization = params.authorization || "Splunk";
            this.paths         = params.paths || Paths;
            this.version       = params.version || "default";
            this.timeout       = params.timeout || 0;
            this.autologin     = true;

            // Initialize autologin
            // The reason we explicitly check to see if 'autologin'
            // is actually set is because we need to distinguish the
            // case of it being set to 'false', and it not being set.
            // Unfortunately, in JavaScript, these are both false-y
            if (params.hasOwnProperty("autologin")) {
                this.autologin = params.autologin;
            }

            if (!http) {
                // If there is no HTTP implementation set, we check what platform
                // we're running on. If we're running in the browser, then complain,
                // else, we instantiate NodeHttp.
                if (typeof(window) !== 'undefined') {
                    throw new Error("Http instance required when creating a Context within a browser.");
                }
                else {
                    var NodeHttp = require('./platform/node/node_http').NodeHttp;
                    http = new NodeHttp();
                }
            }

            // Store the HTTP implementation
            this.http = http;
            this.http._setSplunkVersion(this.version);

            // Store our full prefix, which is just combining together
            // the scheme with the host
            var versionPrefix = utils.getWithVersion(this.version, prefixMap);
            this.prefix = this.scheme + "://" + this.host + ":" + this.port + versionPrefix;

            // We perform the bindings so that every function works
            // properly when it is passed as a callback.
            this._headers         = utils.bind(this, this._headers);
            this.fullpath         = utils.bind(this, this.fullpath);
            this.urlify           = utils.bind(this, this.urlify);
            this.get              = utils.bind(this, this.get);
            this.del              = utils.bind(this, this.del);
            this.post             = utils.bind(this, this.post);
            this.login            = utils.bind(this, this.login);
            this._shouldAutoLogin = utils.bind(this, this._shouldAutoLogin);
            this._requestWrapper  = utils.bind(this, this._requestWrapper);
        }
function(http, params) {
            if (!(http instanceof Http) && !params) {
                // Move over the params
                params = http;
                http = null;
            }

            params = params || {};

            this.scheme        = params.scheme || "https";
            this.host          = params.host || "localhost";
            this.port          = params.port || 8089;
            this.username      = params.username || null;
            this.password      = params.password || null;
            this.owner         = params.owner;
            this.app           = params.app;
            this.sessionKey    = params.sessionKey || "";
            this.authorization = params.authorization || "Splunk";
            this.paths         = params.paths || Paths;
            this.version       = params.version || "default";
            this.timeout       = params.timeout || 0;
            this.autologin     = true;

            // Initialize autologin
            // The reason we explicitly check to see if 'autologin'
            // is actually set is because we need to distinguish the
            // case of it being set to 'false', and it not being set.
            // Unfortunately, in JavaScript, these are both false-y
            if (params.hasOwnProperty("autologin")) {
                this.autologin = params.autologin;
            }

            if (!http) {
                // If there is no HTTP implementation set, we check what platform
                // we're running on. If we're running in the browser, then complain,
                // else, we instantiate NodeHttp.
                if (typeof(window) !== 'undefined') {
                    throw new Error("Http instance required when creating a Context within a browser.");
                }
                else {
                    var NodeHttp = require('./platform/node/node_http').NodeHttp;
                    http = new NodeHttp();
                }
            }

            // Store the HTTP implementation
            this.http = http;
            this.http._setSplunkVersion(this.version);

            // Store our full prefix, which is just combining together
            // the scheme with the host
            var versionPrefix = utils.getWithVersion(this.version, prefixMap);
            this.prefix = this.scheme + "://" + this.host + ":" + this.port + versionPrefix;

            // We perform the bindings so that every function works
            // properly when it is passed as a callback.
            this._headers         = utils.bind(this, this._headers);
            this.fullpath         = utils.bind(this, this.fullpath);
            this.urlify           = utils.bind(this, this.urlify);
            this.get              = utils.bind(this, this.get);
            this.del              = utils.bind(this, this.del);
            this.post             = utils.bind(this, this.post);
            this.login            = utils.bind(this, this.login);
            this._shouldAutoLogin = utils.bind(this, this._shouldAutoLogin);
            this._requestWrapper  = utils.bind(this, this._requestWrapper);
        }
function ( http , params ) { if ( ! ( http instanceof Http ) && ! params ) { // Move over the params params = http ; http = null ; } params = params || { } ; this . scheme = params . scheme || "https" ; this . host = params . host || "localhost" ; this . port = params . port || 8089 ; this . username = params . username || null ; this . password = params . password || null ; this . owner = params . owner ; this . app = params . app ; this . sessionKey = params . sessionKey || "" ; this . authorization = params . authorization || "Splunk" ; this . paths = params . paths || Paths ; this . version = params . version || "default" ; this . timeout = params . timeout || 0 ; this . autologin = true ; // Initialize autologin // The reason we explicitly check to see if 'autologin' // is actually set is because we need to distinguish the // case of it being set to 'false', and it not being set. // Unfortunately, in JavaScript, these are both false-y if ( params . hasOwnProperty ( "autologin" ) ) { this . autologin = params . autologin ; } if ( ! http ) { // If there is no HTTP implementation set, we check what platform // we're running on. If we're running in the browser, then complain, // else, we instantiate NodeHttp. if ( typeof ( window ) !== 'undefined' ) { throw new Error ( "Http instance required when creating a Context within a browser." ) ; } else { var NodeHttp = require ( './platform/node/node_http' ) . NodeHttp ; http = new NodeHttp ( ) ; } } // Store the HTTP implementation this . http = http ; this . http . _setSplunkVersion ( this . version ) ; // Store our full prefix, which is just combining together // the scheme with the host var versionPrefix = utils . getWithVersion ( this . version , prefixMap ) ; this . prefix = this . scheme + "://" + this . host + ":" + this . port + versionPrefix ; // We perform the bindings so that every function works // properly when it is passed as a callback. this . _headers = utils . bind ( this , this . _headers ) ; this . fullpath = utils . bind ( this , this . fullpath ) ; this . urlify = utils . bind ( this , this . urlify ) ; this . get = utils . bind ( this , this . get ) ; this . del = utils . bind ( this , this . del ) ; this . post = utils . bind ( this , this . post ) ; this . login = utils . bind ( this , this . login ) ; this . _shouldAutoLogin = utils . bind ( this , this . _shouldAutoLogin ) ; this . _requestWrapper = utils . bind ( this , this . _requestWrapper ) ; }
Constructor for `splunkjs.Context`.

@constructor
@param {splunkjs.Http} http An instance of a `splunkjs.Http` class.
@param {Object} params A dictionary of optional parameters:
- `scheme` (_string_): The scheme ("http" or "https") for accessing Splunk.
- `host` (_string_): The host name (the default is "localhost").
- `port` (_integer_): The port number (the default is 8089).
- `username` (_string_): The Splunk account username, which is used to authenticate the Splunk instance.
- `password` (_string_): The password, which is used to authenticate the Splunk instance.
- `owner` (_string_): The owner (username) component of the namespace.
- `app` (_string_): The app component of the namespace.
- `sessionKey` (_string_): The current session token.
- `autologin` (_boolean_): `true` to automatically try to log in again if the session terminates, `false` if not (`true` by default).
- 'timeout' (_integer): The connection timeout in milliseconds. ('0' by default).
- `version` (_string_): The version string for Splunk, for example "4.3.2" (the default is "5.0").
@return {splunkjs.Context} A new `splunkjs.Context` instance.

@method splunkjs.Context
Constructor for splunkjs . Context .