Inheritance: IBatchFactory
Example #1
0
        /// <summary>
        /// Creates a new REST client with a specified API secret and default options
        /// </summary>
        /// <param name="secret"></param>
        /// <param name="options"></param>
        public Client(string secret, Options options)
        {
            if (String.IsNullOrEmpty(secret))
                throw new InvalidOperationException("Please supply a valid secret to initialize.");

            this.Statistics = new Statistics();

            this._secret = secret;
            this._options = options;

			IRequestHandler requestHandler = new BlockingRequestHandler(this, options.Timeout);
			IBatchFactory batchFactory = new SimpleBatchFactory(this._secret);

			if (options.Async)
				_flushHandler = new AsyncFlushHandler(batchFactory, requestHandler, options.MaxQueueSize);
			else
				_flushHandler = new BlockingFlushHandler(batchFactory, requestHandler);
        }
Example #2
0
        /// <summary>
        /// Creates a new REST client with a specified API secret and default options
        /// </summary>
        /// <param name="secret"></param>
        /// <param name="options"></param>
        public Client(string secret, Options options)
        {
            if (String.IsNullOrEmpty(secret))
                throw new InvalidOperationException("Please supply a valid secret to initialize.");

            this.Statistics = new Statistics();

            this._secret = secret;
            this._options = options;

            IRequestHandler requestHandler = new WWWRequestHandler(this);
              IBatchFactory batchFactory = new SimpleBatchFactory(this._secret);
            _flushHandler = new BatchingFlushHandler(
                batchFactory,
                requestHandler,
                options.MinBatchSize,
                options.MaxQueueSize,
                options.MinSendBatchInterval
            );
        }