Skip to content

Commit

Permalink
proper typing of types
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
stephanstapel committed May 26, 2024
1 parent 1ae651d commit 043a695
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions BrickOwlSharp.Client/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public class Inventory
[JsonPropertyName("reserve_uid"), JsonConverter(typeof(IntStringConverter))]
public int? ReserveUid { get; set; }

[JsonPropertyName("type")]
public string Type{ get; set; }
[JsonPropertyName("type"), JsonConverter(typeof(ItemTypeStringConverter))]
public ItemType Type { get; set; }

[JsonPropertyName("tier_price"), JsonConverter(typeof(TierPriceListConverter))]
public List<TierPrice> TierPrices { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions BrickOwlSharp.Client/OrderItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class OrderItem
[JsonPropertyName("name")]
public string Name { get; set; }

[JsonPropertyName("type")]
public string Type { get; set; }
[JsonPropertyName("type"), JsonConverter(typeof(ItemTypeStringConverter))]
public ItemType Type { get; set; }

[JsonPropertyName("color_name")]
public string Color_Name { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion BrickOwlSharp.Demos/BrickOwlSharp.Demos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
10 changes: 4 additions & 6 deletions BrickOwlSharp.Demos/InventoryDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,19 @@ internal async Task RunAsync()
Quantity = 1,
Price = 1000.15m // make sure nobody will ever buy it :)
});

/*

bool updateResult = await client.UpdateInventoryAsync(new UpdateInventory()
{
LotId = 107931517,
LotId = newInventoryResult.LotId.Value,
AbsoluteQuantity = 23
});
*/

foreach (Inventory inventory in await client.GetInventoryAsync())
{
Console.WriteLine($"{inventory.Id}: quantity {inventory.Quantity}, lot id: {inventory.LotId}");
Console.WriteLine($"{inventory.Id}: quantity {inventory.Quantity}, lot id: {inventory.LotId}, type: {inventory.Type}");
}

bool result = await client.DeleteInventoryAsync(new DeleteInventory() { LotId = 107931627 });
bool result = await client.DeleteInventoryAsync(new DeleteInventory() { LotId = newInventoryResult.LotId.Value });
}
}
}

0 comments on commit 043a695

Please sign in to comment.