LegoSharp 5.2.0
See the version list below for details.
dotnet add package LegoSharp --version 5.2.0
NuGet\Install-Package LegoSharp -Version 5.2.0
<PackageReference Include="LegoSharp" Version="5.2.0" />
paket add LegoSharp --version 5.2.0
#r "nuget: LegoSharp, 5.2.0"
// Install LegoSharp as a Cake Addin
#addin nuget:?package=LegoSharp&version=5.2.0
// Install LegoSharp as a Cake Tool
#tool nuget:?package=LegoSharp&version=5.2.0
LegoSharp
LegoSharp is an unofficial C# library for interacting with Lego's web APIs.
Usage
Searching the Lego graph is currently the only supported action.
To search the graph, you first make a graph client.
LegoGraphClient graphClient = new LegoGraphClient();
You then authenticate the client (no Lego account is required).
await graphClient.authenticateAsync();
Once you authenticate, you can query different graph APIs.
Pick a Brick
You can query Pick a Brick.
LegoGraphClient graphClient = new LegoGraphClient();
await graphClient.authenticateAsync();
PickABrickQuery query = new PickABrickQuery();
query.addFilter(new BrickColorFilter()
.addValue(BrickColor.Black)
);
query.query = "wheel";
PickABrickResult result = await graphClient.pickABrick(query);
foreach (Brick brick in result.elements)
{
// do something with each brick
}
Product Search
You can query for Lego Products.
LegoGraphClient graphClient = new LegoGraphClient();
await graphClient.authenticateAsync();
ProductSearchQuery query = new ProductSearchQuery();
query.addFilter(new ProductTypeFilter()
.addValue(ProductType.Sets)
);
query.addFilter(new ProductPriceFilter()
.fromTo(1000, 2500)
);
query.query = "train";
ProductSearchResult result = await graphClient.productSearch(query);
foreach (Product product in result.products)
{
// do something with each product
}
Contributing
Contributions are welcome. I'd reccomend first opening an issue for what you want to add so we can talk about implementation details. When you're ready to code, simply fork, make your changes, and then open a pull request. I will ask you to add tests for most code changes, and tests are required to pass before merging.
Why does this exist?
This library exists for a few reasons:
- I wanted to see what it is like to reverse engineer an API.
- I like Legos (though I don't buy them that often, they're pretty expensive...).
- I work in TS for my day job, so I wanted to do a project in another language. Since C# is used a lot where I work, I chose it. Not only am I keeping myself familiar in C#, it's also fun to see how my TS brain handles having to work in C#.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.