![]() |
VOOZH | about |
dotnet add package Xero.Net.Wrapper --version 0.9.3
NuGet\Install-Package Xero.Net.Wrapper -Version 0.9.3
<PackageReference Include="Xero.Net.Wrapper" Version="0.9.3" />
<PackageVersion Include="Xero.Net.Wrapper" Version="0.9.3" />Directory.Packages.props
<PackageReference Include="Xero.Net.Wrapper" />Project file
paket add Xero.Net.Wrapper --version 0.9.3
#r "nuget: Xero.Net.Wrapper, 0.9.3"
#:package Xero.Net.Wrapper@0.9.3
#addin nuget:?package=Xero.Net.Wrapper&version=0.9.3Install as a Cake Addin
#tool nuget:?package=Xero.Net.Wrapper&version=0.9.3Install as a Cake Tool
Xero.Net.Wrapper is a .NET 8 library that provides a strongly-typed wrapper for the Xero API. Built on top of the official Xero.NetStandard.OAuth2 library, it simplifies integration with Xero by handling authentication, token caching, request construction, and response parsing. Currently optimized for client credentials flow with single tenant scenarios.
Install the package via NuGet Package Manager:
dotnet add package Xero.Net.Wrapper
Or via Package Manager Console:
Install-Package Xero.Net.Wrapper
Add Xero services to your dependency injection container:
using Xero.Net.Wrapper.Extensions;
// In your Program.cs or Startup.cs
services.AddXeroNetStandardWrapper(config =>
{
config.ClientId = "your-xero-client-id";
config.ClientSecret = "your-xero-client-secret";
config.TenantId = "your-tenant-id";
config.DisableTokenCaching = false; // Optional: disable caching if needed
// Standard Xero configuration options
config.CallbackUri = "https://yourapp.com/callback";
config.Scope = "openid profile email accounting.transactions";
config.State = "your-state-parameter";
});
Inject and use XeroService in your controllers or services:
public class AccountingController : ControllerBase
{
private readonly XeroService _xeroService;
public AccountingController(XeroService xeroService)
{
_xeroService = xeroService;
}
public async Task<IActionResult> GetContacts()
{
// Using client credentials flow with configured tenant ID
var contacts = await _xeroService.GetContactsAsync();
return Ok(contacts);
}
}
The library is optimized for client credentials flow, which is ideal for machine-to-machine scenarios:
// The service will automatically handle client credentials authentication
// when you call any API method
var contacts = await _xeroService.GetContactsAsync();
// Or explicitly request a token if needed
var token = await _xeroService.RequestClientCredentialsTokenAsync();
The library provides access to most Xero APIs:
Legend: ✅ Available | ❌ Not Implemented
services.AddXeroNetStandardWrapper(config =>
{
// Required OAuth2 settings
config.ClientId = "your-client-id";
config.ClientSecret = "your-client-secret";
config.TenantId = "your-tenant-id"; // Required: single tenant ID
// Optional wrapper-specific settings
config.DisableTokenCaching = false; // Disable automatic token caching
// Optional OAuth2 settings
config.CallbackUri = "https://yourapp.com/callback";
config.Scope = "accounting.transactions"; // Required scopes
config.State = "security-state"; // CSRF protection
});
The library automatically caches access tokens to improve performance and reduce API calls:
DisableTokenCaching = trueIMemoryCache for in-memory storageContributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.