/// <summary> /// Returns service to work with Etsy's receipts /// </summary> /// <returns></returns> public IEtsyOrdersService CreateOrdersService(EtsyConfig config, Throttler throttler) { Condition.Requires(config).IsNotNull(); Condition.Requires(throttler).IsNotNull(); return(new EtsyOrdersService(this._applicationKey, this._sharedSecret, config, throttler)); }
/// <summary> /// Returns service to work with credentials /// </summary> /// <returns></returns> public IEtsyAuthenticationService CreateAuthenticationService(EtsyConfig config) { Condition.Requires(config).IsNotNull(); var throttler = new Throttler(config.ThrottlingMaxRequestsPerRestoreInterval, config.ThrottlingRestorePeriodInSeconds, config.ThrottlingMaxRetryAttempts); return(new EtsyAuthenticationService(this._applicationKey, this._sharedSecret, config, throttler)); }
public void Init() { var credentials = LoadCredentials(); ShopName = credentials.ShopName; var config = new EtsyConfig(credentials.ShopName, credentials.Token, credentials.TokenSecret); var factory = new EtsyServicesFactory(credentials.ApplicationKey, credentials.SharedSecret); var throttler = new Throttler(config.ThrottlingMaxRequestsPerRestoreInterval, config.ThrottlingRestorePeriodInSeconds, config.ThrottlingMaxRetryAttempts); EtsyOrdersService = factory.CreateOrdersService(config, throttler); EtsyItemsService = factory.CreateItemsService(config, throttler); EtsyAuthenticationService = factory.CreateAuthenticationService(config); EtsyAdminService = factory.CreateAdminService(config, throttler); CancellationTokenSource = new CancellationTokenSource(); }
public void RequestTimesOut() { var requestTimeout = 1; const string message = "TaskCanceledException"; var credentials = LoadCredentials(); var config = new EtsyConfig(credentials.ShopName, credentials.Token, credentials.TokenSecret, requestTimeout); var factory = new EtsyServicesFactory(credentials.ApplicationKey, credentials.SharedSecret); var throttler = new Throttler(config.ThrottlingMaxRequestsPerRestoreInterval, config.ThrottlingRestorePeriodInSeconds, config.ThrottlingMaxRetryAttempts); EtsyOrdersService = factory.CreateOrdersService(config, throttler); var cancellationTokenSource = new CancellationTokenSource(); var etsyException = Assert.Throws <EtsyException>(() => { base.EtsyOrdersService.GetOrders(DateTime.Now.AddMonths(-3), DateTime.Now, cancellationTokenSource.Token); }); Assert.IsNotNull(etsyException); Assert.That(etsyException.ToString().Contains(message)); }
public EtsyOrdersService(string applicationKey, string sharedSecret, EtsyConfig config, Throttler throttler) : base(applicationKey, sharedSecret, config, throttler) { }
public EtsyClient(IOptions <EtsyConfig> etsyConfig, ICacheService cacheService, IBaseClient baseClient) : base(baseClient) { _etsyConfig = etsyConfig.Value; _cacheService = cacheService; }