Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 1. Add your API key | ||
| - Create `BrickOwlSharp.Demos/apikey.txt` with your BrickOwl API key. | ||
| 2. Pick a demo in `BrickOwlSharp.Demos/Program.cs` |
There was a problem hiding this comment.
Fix apikey.txt location in quickstart
The quickstart tells users to create BrickOwlSharp.Demos/apikey.txt and then run dotnet run --project BrickOwlSharp.Demos. The demo app reads apikey.txt relative to the current working directory (see BrickOwlSharp.Demos/Program.cs), so if they execute the command from the repo root as shown, the file won’t be found and the demo fails at startup. Consider instructing users to place apikey.txt in the working directory where they run the command (e.g., repo root) or update the demo code/readme to reference the project-relative path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR enhances the README documentation to improve discoverability and usability of the BrickOwlSharp client library by adding comprehensive feature descriptions, a quickstart guide, and enriched code examples.
- Expanded feature descriptions for new API capabilities (user details, invoice transactions, order management, advanced catalog endpoints, and color list)
- Added demo project quickstart instructions with clear steps for API key setup and running demos
- Provided inline-commented code examples for five key demo scenarios to support copy-paste integration
| // Replace with a real order ID from your shop. | ||
| const int sampleOrderId = 0; | ||
| OrderDetails orderDetails = await client.GetOrderAsync(sampleOrderId); | ||
| Console.WriteLine($"Order {orderDetails.Id} has {orderDetails.OrderItems.Count} items."); | ||
|
|
||
| // Tax schemes are useful for reporting or custom invoice generation. | ||
| OrderTaxSchemesResponse taxSchemes = await client.GetOrderTaxSchemesAsync(); | ||
| Console.WriteLine($"Tax scheme payload has properties: {taxSchemes.AdditionalData.Count}"); | ||
|
|
||
| // Enable only when you want to mutate live order data. | ||
| bool runOrderUpdates = false; | ||
| if (runOrderUpdates) | ||
| { | ||
| // Add or update a public order note. | ||
| await client.UpdateOrderNoteAsync(sampleOrderId, "Packed and ready to ship."); | ||
| // Advance the order status (e.g., Processed, Shipped). | ||
| await client.UpdateOrderStatusAsync(sampleOrderId, OrderStatus.Processed); | ||
| // Provide carrier tracking for the buyer. | ||
| await client.UpdateOrderTrackingAsync(sampleOrderId, "TRACKING-123"); | ||
| // Register the IP for order notifications/webhooks. | ||
| await client.SetOrderNotifyAsync("203.0.113.10"); | ||
| } | ||
| ``` |
There was a problem hiding this comment.
The README code snippet is missing the IBrickOwlClient client variable declaration that appears at the beginning of the actual demo file. The code example should start with IBrickOwlClient client = BrickOwlClientFactory.Build(); to ensure users can copy and run this snippet standalone.
| // Bulk metadata for catalog sync jobs (downloads files, not items themselves). | ||
| CatalogBulkResponse bulkCatalog = await client.CatalogBulkAsync("catalog"); | ||
| // Lookup multiple BOIDs at once to reduce round trips. | ||
| CatalogBulkLookupResponse bulkLookup = await client.CatalogBulkLookupAsync(new[] { "737117-39", "1067768" }); | ||
| // Text search for items (supports pagination). | ||
| CatalogSearchResponse searchResults = await client.CatalogSearchAsync("Brick", page: 1); | ||
| // Condition list helps map new/used terminology for filters. | ||
| CatalogConditionListResponse conditions = await client.GetCatalogConditionListAsync(); | ||
| // Field options supply valid values for attributes such as category. | ||
| CatalogFieldOptionListResponse fieldOptions = await client.GetCatalogFieldOptionListAsync("category_0", "en"); | ||
|
|
||
| // Build a basic cart to estimate pricing or availability. | ||
| CatalogCartBasicResponse cart = await client.CreateCatalogCartBasicAsync( | ||
| new[] { ("3034", 21, (string?)null, 1) }, | ||
| "N", | ||
| "US"); | ||
|
|
||
| // Batch multiple endpoints into one API call. | ||
| var batchRequests = new (string Endpoint, string RequestMethod, IEnumerable<Dictionary<string, string>> Parameters)[] | ||
| { | ||
| ("catalog/search", | ||
| "GET", | ||
| new List<Dictionary<string, string>> | ||
| { | ||
| // Per-request parameter dictionary. | ||
| new() { { "query", "Vendor" } } | ||
| }) | ||
| }; | ||
| BulkBatchResponse batchResponse = await client.BulkBatchAsync(batchRequests); | ||
| ``` |
There was a problem hiding this comment.
The README code snippet is missing the IBrickOwlClient client variable declaration. The code example should start with IBrickOwlClient client = BrickOwlClientFactory.Build(); to match the actual demo file and ensure users can copy and run this snippet standalone.
| // Bulk metadata for catalog sync jobs (downloads files, not items themselves). | ||
| CatalogBulkResponse bulkCatalog = await client.CatalogBulkAsync("catalog"); | ||
| // Lookup multiple BOIDs at once to reduce round trips. | ||
| CatalogBulkLookupResponse bulkLookup = await client.CatalogBulkLookupAsync(new[] { "737117-39", "1067768" }); |
There was a problem hiding this comment.
The array initialization syntax differs from the actual demo code. In the actual CatalogAdvancedDemo.cs file (line 47), the code uses collection expression syntax ["737117-39", "1067768"], but here the README uses explicit array syntax new[] { "737117-39", "1067768" }. While both are valid, consider matching the demo code for consistency.
| CatalogBulkLookupResponse bulkLookup = await client.CatalogBulkLookupAsync(new[] { "737117-39", "1067768" }); | |
| CatalogBulkLookupResponse bulkLookup = await client.CatalogBulkLookupAsync(["737117-39", "1067768"]); |
| CatalogCartBasicResponse cart = await client.CreateCatalogCartBasicAsync( | ||
| new[] { ("3034", 21, (string?)null, 1) }, |
There was a problem hiding this comment.
The inline array initialization syntax for cartItems differs from the actual demo code. In the actual CatalogAdvancedDemo.cs file (lines 63-66), the code first declares a named variable var cartItems = new (string DesignId, int? ColorId, string? Boid, int Quantity)[] { ("3034", 21, null, 1) }; and then passes it to the method. The README uses an inline array initialization instead. Consider matching the demo code for consistency, especially since it makes the tuple field names explicit and more self-documenting.
| CatalogCartBasicResponse cart = await client.CreateCatalogCartBasicAsync( | |
| new[] { ("3034", 21, (string?)null, 1) }, | |
| var cartItems = new (string DesignId, int? ColorId, string? Boid, int Quantity)[] | |
| { | |
| ("3034", 21, null, 1) | |
| }; | |
| CatalogCartBasicResponse cart = await client.CreateCatalogCartBasicAsync( | |
| cartItems, |
Motivation
batchRequestsexample and explicit parameter construction.Description
README.md"New in this update" section with richer descriptions for user/token details, invoice transactions, order management, advanced catalog tooling, and color list endpoints.BrickOwlSharp.Demos/apikey.txt, pick a demo inBrickOwlSharp.Demos/Program.cs, and rundotnet run --project BrickOwlSharp.Demos.UserDemo,InvoiceDemo,OrderManagementDemo,CatalogAdvancedDemo, andColorDemo.BulkBatchAsynccalls.Testing
README.mdwas staged and committed to the branch successfully.Codex Task