Location
GET
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Wdcs.Wip.Api;
using Wdcs.Wip.Client;
using Wdcs.Wip.Model;
namespace wip_project.Api
{
public partial class LocationService : IGetApi
{
public async Task GetAsync(string apiUrl, string username, string password)
{
var config = new Wdcs.Wip.Client.Configuration()
{
BasePath = apiUrl
};
var tokenRequest = new TokenApi(config);
// Get the Token
var response = tokenRequest.Create(new TokenUser(username, password));
var authorization = "Bearer " + response.AuthToken;
// Instantiate API
var api = new LocationApi(config);
//Get list of locations
await api.GetAsync(authorization: authorization);
}
}
}
PUT
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Wdcs.Wip.Api;
using Wdcs.Wip.Client;
using Wdcs.Wip.Model;
namespace wip_project.Api
{
public partial class LocationService : IPutApi
{
public async Task PutAsync(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;
// Create a new Entity for Location
var regularLocation = new Location(
locationId: "L001",
warehouseId: "01",
locationType: Location.LocationTypeEnum.REGULAR,
description: "My first regular location",
pickFromLocation: true
);
// Put to database
var api = new LocationApi(config);
await api.PutAsync(authorization, regularLocation);
}
}
}