/// <summary> /// Initialized the default Segment.io client with your API secret. /// </summary> /// <param name="secret"></param> public static void Initialize(string secret, Options options) { lock (padlock) { if (Client == null) { Client = new Client(secret, options); } } }
/// <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); }
/// <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 ); }
/// <summary> /// Initialized the default Segment.io client with your API secret. /// </summary> /// <param name="secret"></param> public static void Initialize(string secret, Options options) { if (Client == null) { Client = new Client(secret, options); } }