Example #1
0
        public RetrieveProductsCommand(SkubanaConfig config, IEnumerable <string> skus) : base(config, SkubanaEndpoint.RetrieveProductsUrl)
        {
            Condition.Requires(skus, "skus").IsNotNull().IsNotEmpty();

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "sku", string.Join(",", skus.Select(s => $"\"{ s }\"")) }
            };
            this.Throttler = new Throttling.Throttler(5, 1);
        }
Example #2
0
        protected SkubanaCommand(SkubanaConfig config, string relativeUrl, Dictionary <string, string> requestParameters, object payload, bool isApiCommand = true)
        {
            Condition.Requires(config, "config").IsNotNull();
            Condition.Requires(relativeUrl, "relativeUrl").IsNotNullOrEmpty();

            this.Config            = config;
            this.RelativeUrl       = relativeUrl;
            this.RequestParameters = requestParameters;
            this.Payload           = payload;
            this._isApiCommand     = isApiCommand;
        }
Example #3
0
        public GetProductStockCommand(SkubanaConfig config, string sku, long warehouseId) : base(config, SkubanaEndpoint.RetrieveProductStockUrl)
        {
            Condition.Requires(sku, "sku").IsNotNullOrEmpty();
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "sku", sku },
                { "warehouseId", warehouseId.ToString() }
            };
        }
        public RetrieveProductsUpdatedAfterCommand(SkubanaConfig config, DateTime updatedAfterUtc, int page, int limit) : base(config, SkubanaEndpoint.RetrieveProductsUrl)
        {
            Condition.Requires(page, "page").IsGreaterOrEqual(1);
            Condition.Requires(limit, "limit").IsGreaterOrEqual(1);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "modifiedDateFrom", updatedAfterUtc.ConvertDateTimeToStr() },
                { "page", page.ToString() },
                { "limit", limit.ToString() }
            };
        }
        public GetAccessTokenCommand(SkubanaConfig config, string redirectUrl, string code) : base(config, SkubanaEndpoint.GetAccessTokenUrl, null, null, isApiCommand: false)
        {
            Condition.Requires(redirectUrl, "redirectUrl").IsNotNullOrEmpty();
            Condition.Requires(code, "code").IsNotNullOrEmpty();

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "grant_type", "authorization_code" },
                { "redirect_uri", redirectUrl },
                { "code", code }
            };
        }
Example #6
0
        public RetrieveProductsStocksTotalCommand(SkubanaConfig config, long warehouseId, int page, int limit) : base(config, SkubanaEndpoint.GetProductsStocksTotalUrl)
        {
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);
            Condition.Requires(page, "page").IsGreaterOrEqual(1);
            Condition.Requires(limit, "limit").IsGreaterOrEqual(1);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "warehouseId", warehouseId.ToString() },
                { "page", page.ToString() },
                { "limit", limit.ToString() }
            };
        }
Example #7
0
        public RetrieveOrdersCommand(SkubanaConfig config, DateTime startDateUtc, DateTime endDateUtc, long warehouseId, int page, int limit) : base(config, SkubanaEndpoint.RetrieveOrdersUrl)
        {
            Condition.Requires(endDateUtc, "endDateUtc").IsGreaterThan(startDateUtc);
            Condition.Requires(warehouseId, "warehouseId").IsNotEqualTo(0);
            Condition.Requires(page, "page").IsGreaterOrEqual(1);
            Condition.Requires(limit, "limit").IsGreaterOrEqual(1);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "modifiedDateFrom", startDateUtc.ConvertDateTimeToStr() },
                { "modifiedDateTo", endDateUtc.ConvertDateTimeToStr() },
                { "warehouseId", warehouseId.ToString() },
                { "page", page.ToString() },
                { "limit", limit.ToString() }
            };
        }
Example #8
0
        public AdjustProductsStockCommand(SkubanaConfig config, IEnumerable <SkubanaProductStock> skusQuantities, long warehouseId) : base(config, SkubanaEndpoint.AdjustProductStockUrl)
        {
            Condition.Requires(skusQuantities, "skusQuantities").IsNotNull().IsNotEmpty();
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);

            var body = new List <AdjustProductStockRequestBodyItem>();

            foreach (var skuQuantity in skusQuantities)
            {
                body.Add(new AdjustProductStockRequestBodyItem()
                {
                    MasterSku         = skuQuantity.ProductSku,
                    OnHandQuantity    = skuQuantity.OnHandQuantity > maxQuantity ? maxQuantity : skuQuantity.OnHandQuantity,
                    WarehouseId       = warehouseId,
                    StockLocationName = skuQuantity.LocationName
                });
            }

            this.Payload = body;
        }
Example #9
0
        public CreateProductsStockCommand(SkubanaConfig config, IEnumerable <SkubanaProductStock> productsStock, long warehouseId) : base(config, SkubanaEndpoint.CreateProductStockUrl)
        {
            Condition.Requires(productsStock, "productsStock").IsNotNull().IsNotEmpty();
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);

            var body = new List <CreateProductStockRequestBodyItem>();

            foreach (var productStock in productsStock)
            {
                body.Add(new CreateProductStockRequestBodyItem()
                {
                    ProductId         = productStock.ProductId,
                    Quantity          = productStock.OnHandQuantity > maxQuantity ? maxQuantity : productStock.OnHandQuantity,
                    WarehouseId       = warehouseId,
                    StockLocationName = productStock.LocationName,
                    Pickable          = true,
                    Receivable        = true
                });
            }
            ;

            this.Payload = body;
        }
Example #10
0
 public OrdersService(SkubanaConfig config) : base(config)
 {
 }
 public ListWarehousesCommand(SkubanaConfig config) : base(config, SkubanaEndpoint.ListWarehousesUrl)
 {
     this.Throttler = new Throttling.Throttler(5, 1);
 }
Example #12
0
 public IGlobalService CreateGlobalService(SkubanaConfig config)
 {
     return(new GlobalService(config));
 }
Example #13
0
 public IInventoryService CreateInventoryService(SkubanaConfig config)
 {
     return(new InventoryService(config));
 }
Example #14
0
 public IAuthenticationService CreateAuthenticationService(SkubanaConfig config, SkubanaAppCredentials appCredentials)
 {
     return(new AuthenticationService(config, appCredentials));
 }
Example #15
0
 protected SkubanaCommand(SkubanaConfig config, string relativeUrl, object payload) : this(config, relativeUrl, null, payload)
 {
 }
Example #16
0
 public IProductsService CreateProductsService(SkubanaConfig config)
 {
     return(new ProductsService(config));
 }
Example #17
0
 public ServiceBaseWithTokenAuth(SkubanaConfig config) : base(config)
 {
 }
Example #18
0
        public ServiceBaseWithBasicAuth(SkubanaConfig config, SkubanaAppCredentials appCredentials) : base(config)
        {
            Condition.Requires(appCredentials, "appCredentials").IsNotNull();

            this.AppCredentials = appCredentials;
        }
Example #19
0
 public IOrdersService CreateOrdersService(SkubanaConfig config)
 {
     return(new OrdersService(config));
 }
Example #20
0
 protected SkubanaCommand(SkubanaConfig config, string relativeUrl) : this(config, relativeUrl, null, null)
 {
 }
Example #21
0
 public ProductsService(SkubanaConfig config) : base(config)
 {
 }
Example #22
0
 public InventoryService(SkubanaConfig config) : base(config)
 {
 }
Example #23
0
 public GlobalService(SkubanaConfig config) : base(config)
 {
 }