Skip to content

Inventory

GET

using System;
using System.Threading.Tasks;
using Wdcs.Wip.Api;
using Wdcs.Wip.Client;
using Wdcs.Wip.Model;

namespace wip_project.Api
{
    public partial class InventoryService : IGetApi
    {
        public async Task GetAsync(string apiUrl, string username, string password)
        {
            var config = new Configuration()
            {
                BasePath = apiUrl
            };
            var tokenRequest = new TokenApi(config);

            // Get the Token
            var response = tokenRequest.Create(new TokenUser(username, password));
            var authorization = "Bearer " + response.AuthToken;
            var api = new InventoryApi(config).GetAsync(authorization);
            foreach (var result in api.Result.Results)
            {
                Console.WriteLine($"Location {result.LocationId} - Item: {result.ItemId} - Location {result.OnHandQuantity}");
            }
        }
    }
}