SDKs
Offizielle Client-Bibliotheken kapseln die REST-API mit typisierten Request-/Response-Modellen, einem asynchronen Polling-Helper und abgebildeten Fehlertypen — keine mühsame Eigenimplementierung von Multipart-Uploads und Status-Polling .
Java
Jetzt auf Maven Central verfügbar. Erfordert Java 11+; basiert auf java.net.http.HttpClient, mit Jackson als einziger Dependency.
Installation
Gradle (Kotlin DSL)
dependencies {
implementation("de.xingen:xingen-sdk:0.1.0")
} Maven
<dependency>
<groupId>de.xingen</groupId>
<artifactId>xingen-sdk</artifactId>
<version>0.1.0</version>
</dependency> Verwendung
XingenClient client = XingenClient.builder()
.apiKey(System.getenv("XINGEN_API_KEY"))
.build();
InvoiceRecord result = client.invoices().validateFileAndWait(
Path.of("invoice.xml"),
ValidationProfile.XRECHNUNG,
PollOptions.defaults());
if (result.getValidationResult().isValid()) {
System.out.println("Valid!");
} else {
result.getValidationResult().getErrors().forEach(error ->
System.out.println(error.getSeverity() + ": " + error.getMessage()));
} Maven Central ↗ · Quellcode & vollständiges README ↗
Python
Jetzt auf PyPI ↗ verfügbar. Erfordert Python 3.10+; basiert auf requests und pydantic v2.
Installation
pip install xingen-sdk Verwendung
from xingen import XingenClient
from xingen.models.enums import InvoiceStatus, ValidationProfile
client = XingenClient(api_key=os.environ["XINGEN_API_KEY"])
result = client.invoices.validate_file_and_wait("invoice.xml", ValidationProfile.XRECHNUNG)
if result.status is InvoiceStatus.VALIDATED and result.validation_result.valid:
print("Valid!")
else:
for error in result.validation_result.errors:
print(f"{error.severity}: {error.message}") PyPI ↗ · Quellcode & vollständiges README ↗
TypeScript
Jetzt auf npm ↗ verfügbar. Erfordert Node 22+; basiert auf nativen fetch/FormData-APIs, mit lossless-json ↗ als einziger Dependency. Enthält sowohl ESM- als auch CommonJS-Builds.
Installation
npm install xingen-sdk Verwendung
import { InvoiceStatus, ValidationProfile, XingenClient } from "xingen-sdk";
const client = new XingenClient({ apiKey: process.env.XINGEN_API_KEY! });
const result = await client.invoices.validateFileAndWait("invoice.xml", ValidationProfile.XRECHNUNG);
if (result.status === InvoiceStatus.VALIDATED && result.validationResult?.valid) {
console.log("Valid!");
} else {
for (const error of result.validationResult?.errors ?? []) {
console.log(`${error.severity}: ${error.message}`);
}
} npm ↗ · Quellcode & vollständiges README ↗
C#
Jetzt auf NuGet ↗ verfügbar. Zielplattform .NET 8+; basiert auf System.Net.Http.HttpClient und System.Text.Json, ohne Dependencies von Drittanbietern.
Installation
dotnet add package Xingen.Sdk Verwendung
using var client = new XingenClient(Environment.GetEnvironmentVariable("XINGEN_API_KEY")!);
var result = await client.Invoices.ValidateFileAndWaitAsync(
"invoice.xml", ValidationProfile.XRECHNUNG);
if (result.Status == InvoiceStatus.Validated && result.ValidationResult!.Valid)
{
Console.WriteLine("Valid!");
}
else
{
foreach (var error in result.ValidationResult!.Errors)
{
Console.WriteLine($"{error.Severity}: {error.Message} ({error.Field})");
}
} NuGet ↗ · Quellcode & vollständiges README ↗
PHP
Jetzt auf Packagist ↗ verfügbar. Erfordert PHP 8.1+ mit den Erweiterungen curl und json (beide standardmäßig enthalten). Keine Dependencies von Drittanbietern zur Laufzeit.
Installation
composer require xingen/xingen-sdk Verwendung
use Xingen\Sdk\XingenClient;
use Xingen\Sdk\Models\InvoiceStatus;
use Xingen\Sdk\Models\ValidationProfile;
$client = new XingenClient(apiKey: getenv('XINGEN_API_KEY'));
$result = $client->invoices->validateFileAndWait('invoice.xml', ValidationProfile::XRECHNUNG);
if ($result->status === InvoiceStatus::VALIDATED && $result->validationResult->valid) {
echo "Valid!\n";
} else {
foreach ($result->validationResult->errors as $error) {
echo "{$error->severity->value}: {$error->message} ({$error->field})\n";
}
} Packagist ↗ · Quellcode & vollständiges README ↗
Go
Jetzt auf pkg.go.dev ↗ verfügbar. Erfordert Go 1.23+; keine Dependencies von Drittanbietern, vollständig auf Basis der Standardbibliothek.
Installation
go get github.com/nko-technologies/xingen-go-sdk Verwendung
record, err := client.Invoices.ValidateFileAndWait(ctx, "invoice.xml", xingen.ProfileXRechnung, xingen.DefaultPollOptions())
if err != nil {
log.Fatal(err)
}
if record.Status == xingen.StatusValidated && record.ValidationResult.Valid {
fmt.Println("Valid!")
} else {
for _, e := range record.ValidationResult.Errors {
fmt.Printf("%s: %s (%s)\n", *e.Severity, *e.Message, *e.Field)
}
}