Ebitex.Commerce.Delivery
0.2.22
Prefix Reserved
dotnet add package Ebitex.Commerce.Delivery --version 0.2.22
NuGet\Install-Package Ebitex.Commerce.Delivery -Version 0.2.22
<PackageReference Include="Ebitex.Commerce.Delivery" Version="0.2.22" />
<PackageVersion Include="Ebitex.Commerce.Delivery" Version="0.2.22" />
<PackageReference Include="Ebitex.Commerce.Delivery" />
paket add Ebitex.Commerce.Delivery --version 0.2.22
#r "nuget: Ebitex.Commerce.Delivery, 0.2.22"
#:package Ebitex.Commerce.Delivery@0.2.22
#addin nuget:?package=Ebitex.Commerce.Delivery&version=0.2.22
#tool nuget:?package=Ebitex.Commerce.Delivery&version=0.2.22
Ebitex.Commerce.Delivery
A server-side .NET client for the ebitex Commerce Delivery API. It reads a store's catalogue (products, prices, availability and categories) and live stock with a delivery key.
It is read-only and holds no cache: the API sends private, no-cache responses with an ETag, so you decide what to cache.
Install
dotnet add package Ebitex.Commerce.Delivery
Use
using Ebitex.Commerce.Delivery;
builder.Services.AddEbitexCommerceDelivery(options =>
{
options.ApiKey = builder.Configuration["Ebitex:CommerceDeliveryKey"];
});
// …then take a CommerceDeliveryClient from dependency injection.
var store = await commerce.GetStoreAsync();
var page = await commerce.ListProductsAsync(new ProductsQuery { Search = "trail", Limit = 12 });
await foreach (var product in commerce.ListAllProductsAsync(new ProductsQuery { Sort = ProductSort.CreatedUtc }))
{
var cheapest = product.Variants.Where(v => v.Price is not null).MinBy(v => v.Price!.AmountMinor);
Console.WriteLine($"{product.Name}: {cheapest?.Price?.Amount} {cheapest?.Price?.Currency}");
}
Use a server key here. A browser-safe key, one restricted to origins or addresses, is refused from a server, because a server sends no Origin.
Prices
A price is whole minor units beside a currency (AmountMinor, Currency) and the same amount as the store's own decimal string (Amount). Show Amount; do arithmetic on AmountMinor. A variant with no price in the store has Price == null: unpriced, which is not zero.
Availability and stock
Product reads carry each variant's availability as a status (Availability.InStock, Backorder or OutOfStock), up to a few minutes old, for display. GetStockAsync is never cached and is the authority to confirm against before you take an order. A server key is told counts (StockItem.Available); it is a tighter budget than the other reads, so call it when you need it rather than on every render.
Errors
A non-success response throws CommerceDeliveryException with StatusCode, ErrorCode (invalid_cursor, rate_limited, …), RequestId (quote it to support) and, on a 429, RetryAfter. A product that is not available is null from GetProductAsync, not an exception, unless you ask for one with ProductOptions.ThrowIfMissing. A request the client refuses to send (a limit of zero, more than 50 keys) throws the same exception with IsLocal set and the server's own code.
Paging
ListPagesAsync and ListAllProductsAsync capture the query once and replay it unchanged with each cursor, because a cursor belongs to the query that produced it.
Licence
Apache-2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.