public DataSiftClient(string username, string apikey, GetAPIRequestDelegate requestCreator = null, GetStreamConnectionDelegate connectionCreator = null, GetIngestRequestDelegate ingestRequestCreator = null,
            string baseUrl = null, string apiVersion = null, string baseIngestUrl = null)
        {
            Contract.Requires<ArgumentNullException>(username != null);
            Contract.Requires<ArgumentException>(username.Trim().Length > 0);
            Contract.Requires<ArgumentNullException>(apikey != null);
            Contract.Requires<ArgumentException>(apikey.Trim().Length > 0);
            Contract.Requires<ArgumentException>(Constants.APIKEY_FORMAT.IsMatch(apikey), Messages.INVALID_APIKEY);

            _username = username;
            _apikey = apikey;

            if(!String.IsNullOrEmpty(baseUrl))
                _baseUrl = baseUrl;

            if (!String.IsNullOrEmpty(baseIngestUrl))
                _baseIngestUrl = baseIngestUrl;

            if (!String.IsNullOrEmpty(apiVersion))
                _apiVersion = apiVersion;

            if (requestCreator == null)
                _getRequest = GetRequestDefault;
            else
                _getRequest = requestCreator;

            if (ingestRequestCreator == null)
                _getIngestRequest = GetIngestRequestDefault;
            else
                _getIngestRequest = ingestRequestCreator;

            _getConnection = connectionCreator;
        }
        public DataSiftClient(string username, string apikey, GetAPIRequestDelegate requestCreator = null, GetStreamConnectionDelegate connectionCreator = null, GetIngestRequestDelegate ingestRequestCreator = null,
                              string baseUrl = null, string apiVersion = null, string baseIngestUrl = null)
        {
            Contract.Requires <ArgumentNullException>(username != null);
            Contract.Requires <ArgumentException>(username.Trim().Length > 0);
            Contract.Requires <ArgumentNullException>(apikey != null);
            Contract.Requires <ArgumentException>(apikey.Trim().Length > 0);
            Contract.Requires <ArgumentException>(Constants.APIKEY_FORMAT.IsMatch(apikey), Messages.INVALID_APIKEY);

            _username = username;
            _apikey   = apikey;

            if (!String.IsNullOrEmpty(baseUrl))
            {
                _baseUrl = baseUrl;
            }

            if (!String.IsNullOrEmpty(baseIngestUrl))
            {
                _baseIngestUrl = baseIngestUrl;
            }

            if (!String.IsNullOrEmpty(apiVersion))
            {
                _apiVersion = apiVersion;
            }

            if (requestCreator == null)
            {
                _getRequest = GetRequestDefault;
            }
            else
            {
                _getRequest = requestCreator;
            }

            if (ingestRequestCreator == null)
            {
                _getIngestRequest = GetIngestRequestDefault;
            }
            else
            {
                _getIngestRequest = ingestRequestCreator;
            }

            _getConnection = connectionCreator;
        }