DoliSharp 8.0.6
dotnet add package DoliSharp --version 8.0.6
NuGet\Install-Package DoliSharp -Version 8.0.6
<PackageReference Include="DoliSharp" Version="8.0.6" />
<PackageVersion Include="DoliSharp" Version="8.0.6" />
<PackageReference Include="DoliSharp" />
paket add DoliSharp --version 8.0.6
#r "nuget: DoliSharp, 8.0.6"
#:package DoliSharp@8.0.6
#addin nuget:?package=DoliSharp&version=8.0.6
#tool nuget:?package=DoliSharp&version=8.0.6
DoliSharp
.NET libraries for the Dolibarr REST API, plus an optional Shopify ↔ Dolibarr connector (orders via webhooks, stock sync).
| Package | Description |
|---|---|
| DoliSharp | Typed HTTP client / SDK for Dolibarr (products, orders, third parties) |
| DoliSharp.Shopify | MediatR webhook handlers and stock sync using ShopifySharp |
Target framework: .NET 8
Features
DoliSharp
IProductService— list products, product stockIOrderService— CRUD-ish order flow (create, validate, draft, invoice, deliver, reopen, delete)IThirdPartyService— list / get / create / update third parties- Fluent filters (
GetProductFilter, …) for Dolibarr query params and SQL filters - Newtonsoft-based serialization tuned for Dolibarr payloads
- Results as
HttpResponseResult<T>(wraps ErrorOr)
DoliSharp.Shopify
- Webhook topics:
orders/create,orders/updated,orders/cancelled - Maps Shopify customers/orders to Dolibarr third parties and orders
ISyncStockService— push Dolibarr warehouse stock to Shopify inventory levelsFulfillShopifyOrderCommand— mark a Shopify order fulfilled (fulfillment orders)
Installation
dotnet add package DoliSharp
dotnet add package DoliSharp.Shopify # optional connector
Or via PackageReference:
<ItemGroup>
<PackageReference Include="DoliSharp" Version="0.1.0" />
<PackageReference Include="DoliSharp.Shopify" Version="0.1.0" />
</ItemGroup>
Quick start — Dolibarr SDK
using DoliSharp;
using DoliSharp.Credentials;
using DoliSharp.Filters;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddDoliSharp(new DolibarrCredentials(
Url: "https://your-dolibarr.example.com",
Token: "YOUR_DOLAPIKEY"
));
var provider = services.BuildServiceProvider();
var products = provider.GetRequiredService<DoliSharp.Services.Products.IProductService>();
var result = await products.GetProducts(
new GetProductFilter().WithLimit(50).FilterOnProductRef("SKU-001", "SKU-002")
);
if (result.IsError)
{
// result.Errors / result.FirstError
return;
}
foreach (var product in result.Value)
{
Console.WriteLine($"{product.Ref} — {product.Label}");
}
You can also construct services directly:
var orders = new OrderService(new DolibarrCredentials(url, token));
var created = await orders.CreateOrderAsync(order);
Quick start — Shopify connector
Requires DoliSharp registered as well (order / product / third-party services).
services.AddDoliSharp(new DolibarrCredentials(dolibarrUrl, dolibarrToken));
services.AddShopifyConnector(shopifyUrl: "https://your-shop.myshopify.com", shopAccessToken: "shpat_...");
Process a webhook
Forward the raw body and Shopify headers to MediatR:
using DoliSharp.Shopify.Webhooks.Commands;
using DoliSharp.Shopify.Webhooks.Domain;
using MediatR;
var webhook = new WebhookRequest(
Id: someId,
Body: rawJsonBody,
Headers: headerDictionary // includes X-Shopify-Topic, etc.
);
ErrorOr<Success> outcome = await sender.Send(new ProcessShopifyWebhookCommand(webhook));
Supported topics (see ShopifyWebhookTopics):
| Topic | Behavior |
|---|---|
orders/create |
Ensure third party exists, create & validate Dolibarr order |
orders/updated |
Update matching Dolibarr order (lines / third party; status unchanged) |
orders/cancelled |
Delete / cancel matching Dolibarr order |
Sync stock Dolibarr → Shopify
using DoliSharp.Shopify.Stock;
using DoliSharp.Shopify.Stock.Abstractions;
var sync = provider.GetRequiredService<ISyncStockService>();
var request = new StockSyncRequest()
.AddStockSyncWarehouse(dolibarWarehouseId: 1, shopifyWarehouseId: 123456789);
var movement = await sync.SynchroniseDolibarrWithShopifyAsync(request);
Solution layout
src/
DoliSharp/ # Dolibarr SDK → PackageId: DoliSharp
DoliSharp.Shopify/ # Shopify connector → PackageId: DoliSharp.Shopify
DoliSharp.Tests/
DoliSharp.Shopify.Tests/
Error handling
- Prefer
ErrorOr<T>/HttpResponseResult<T>over exceptions for expected failures. - Shared codes live in
DoliSharp.Domain.DomainErrorsandDoliSharp.Shopify.Domain.DomainErrors.
if (result.IsError)
return result.FirstError.Description;
Development
dotnet restore
dotnet build
dotnet test
Format C# with CSharpier (config at repo root):
dotnet tool restore
dotnet tool run csharpier format src
License
Licensed under the Apache License 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- ErrorOr (>= 2.1.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DoliSharp:
| Package | Downloads |
|---|---|
|
DoliSharp.Shopify
Shopify ↔ Dolibarr connector for DoliSharp (webhooks, orders, stock sync). |
GitHub repositories
This package is not used by any popular GitHub repositories.