Skip to content

Commit

Permalink
Fixed #3
Browse files Browse the repository at this point in the history
  • Loading branch information
gebirgslok committed Sep 19, 2021
1 parent ba44fcf commit 661716c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
9 changes: 7 additions & 2 deletions BricklinkSharp.Client/BricklinkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,15 @@ public Uri EnsureImageUrlScheme(string imageUrl, string scheme = "https")
return new Uri($"{scheme}:{imageUrl}");
}

public async Task<Superset[]> GetSupersetsAsync(ItemType type, string no, int colorId)
public async Task<Superset[]> GetSupersetsAsync(ItemType type, string no, int colorId = 0)
{
var typeString = type.GetStringValueOrDefault();
var url = new Uri(_baseUri, $"items/{typeString}/{no}/supersets/{colorId}").ToString();

var url = new Uri(_baseUri,
colorId > 0 ?
$"items/{typeString}/{no}/supersets?color_id={colorId}" :
$"items/{typeString}/{no}/supersets")
.ToString();

var method = HttpMethod.Get;
var responseBody = await ExecuteRequest(url, method);
Expand Down
9 changes: 5 additions & 4 deletions BricklinkSharp.Client/BricklinkSharp.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<TargetFrameworks>netstandard2.0;netcoreapp3.0;netcoreapp3.1;net5.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<!-- version numbers will be updated by build -->
<Version>1.1.0.0</Version>
<FileVersion>1.1.0.0</FileVersion>
<InformationalVersion>1.1.0.0</InformationalVersion>
<PackageVersion>1.1.0</PackageVersion>
<Version>1.1.1.0</Version>
<FileVersion>1.1.1.0</FileVersion>
<InformationalVersion>1.1.1.0</InformationalVersion>
<PackageVersion>1.1.1</PackageVersion>
<Authors>Jens Eisenbach</Authors>
<Product>BricklinkSharp</Product>
<Description>Strongly-typed, easy-to-use API client for the bricklink marketplace.</Description>
Expand All @@ -23,6 +23,7 @@
<RepositoryType>Git</RepositoryType>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<AssemblyTitle>BricklinkSharp .Net Standard 2.0</AssemblyTitle>
Expand Down
2 changes: 1 addition & 1 deletion BricklinkSharp.Client/IBricklinkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface IBricklinkClient : IDisposable

Uri EnsureImageUrlScheme(string imageUrl, string scheme = "https");

Task<Superset[]> GetSupersetsAsync(ItemType type, string no, int colorId);
Task<Superset[]> GetSupersetsAsync(ItemType type, string no, int colorId = 0);

Task<Subset[]> GetSubsetsAsync(ItemType type, string no, int colorId = 0, bool? includeOriginalBox = null,
bool? includeInstruction = null, bool? breakMinifigs = null, bool? breakSubsets = null);
Expand Down
11 changes: 10 additions & 1 deletion BricklinkSharp.Demos/CatalogDemos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public static async Task GetSupersetsDemo()
PrintHelper.PrintAsJson(supersets);
}

public static async Task GetSupersetsDemo2()
{
using var client = BricklinkClientFactory.Build();
var colorId = 8; //Brown
var supersets = await client.GetSupersetsAsync(ItemType.Part, "40232", colorId);

PrintHelper.PrintAsJson(supersets);
}

public static async Task GetItemDemo()
{
using var client = BricklinkClientFactory.Build();
Expand Down Expand Up @@ -153,7 +162,7 @@ public static void GetInstructionImageDemo()
}
}

public static void GetOrignalBoxImageDemo()
public static void GetOriginalBoxImageDemo()
{
using var client = BricklinkClientFactory.Build();

Expand Down
5 changes: 3 additions & 2 deletions BricklinkSharp.Demos/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ static async Task Main()
CatalogDemos.GetPartImageForColorDemo();
CatalogDemos.GetBookImageDemo();
CatalogDemos.GetGearImageDemo();
CatalogDemos.GetCatalogImageDemo();
CatalogDemos.GetCatalogImageDemo();
CatalogDemos.GetInstructionImageDemo();
CatalogDemos.GetOrignalBoxImageDemo();
CatalogDemos.GetOriginalBoxImageDemo();
CatalogDemos.EnsureImageUrlSchemeDemo();
await CatalogDemos.GetItemDemo();
await CatalogDemos.GetSupersetsDemo();
await CatalogDemos.GetSupersetsDemo2();
await CatalogDemos.GetSubsetsDemo();
await CatalogDemos.GetPriceGuideDemo();
await CatalogDemos.GetKnownColorsDemo();
Expand Down

0 comments on commit 661716c

Please sign in to comment.