Xbim.WexServer.Client 1.0.0

dotnet add package Xbim.WexServer.Client --version 1.0.0
                    
NuGet\Install-Package Xbim.WexServer.Client -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xbim.WexServer.Client" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xbim.WexServer.Client" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Xbim.WexServer.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xbim.WexServer.Client --version 1.0.0
                    
#r "nuget: Xbim.WexServer.Client, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xbim.WexServer.Client@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xbim.WexServer.Client&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Xbim.WexServer.Client&version=1.0.0
                    
Install as a Cake Tool

Xbim.WexServer.Client

GitHub Packages License: MIT

A typed HTTP client for the Xbim Server API. Use this package to connect your BIM applications to Xbim Server for model storage, processing, and management. Auto-generated from OpenAPI/Swagger specifications using NSwag.

This package is required when using Xbim.WexBlazor in Platform mode (connected to Xbim Server). For standalone viewer applications without a backend, you only need Xbim.WexBlazor.

Features

  • Typed API Client - Full IntelliSense support for all endpoints
  • Authentication Support - Pluggable token provider for JWT authentication
  • Resilience - Built-in retry policies and circuit breakers via Microsoft.Extensions.Http.Resilience
  • HttpClientFactory - Proper HTTP client lifecycle management

Installation

# Add GitHub Packages source (one-time setup)
dotnet nuget add source https://nuget.pkg.github.com/Ibrahim5aad/index.json --name github --username YOUR_GITHUB_USERNAME --password YOUR_GITHUB_PAT

# Install the package
dotnet add package Xbim.WexServer.Client

Note: The YOUR_GITHUB_PAT needs read:packages scope. Create a PAT here.

Quick Start

Basic Setup

// Program.cs
builder.Services.AddWexServerClient(options =>
{
    options.BaseUrl = "https://your-Xbim-server.com";
});

With Authentication

Implement IAuthTokenProvider for your authentication flow:

public class MyTokenProvider : IAuthTokenProvider
{
    public Task<string?> GetTokenAsync(CancellationToken cancellationToken = default)
    {
        // Return your JWT token
        return Task.FromResult<string?>("your-jwt-token");
    }
}

Register with DI:

builder.Services.AddSingleton<IAuthTokenProvider, MyTokenProvider>();
builder.Services.AddWexServerClient(options =>
{
    options.BaseUrl = "https://your-Xbim-server.com";
});

Using the Client

@inject IXbimClient Client

// List workspaces
var workspaces = await Client.WorkspacesAllAsync();

// Create a project
var project = await Client.ProjectsPOSTAsync(new CreateProjectRequest
{
    Name = "My Project",
    WorkspaceId = workspaceId
});

// Upload a model
using var stream = File.OpenRead("model.ifc");
var file = await Client.UploadAsync(new FileParameter(stream, "model.ifc"));

// Get element properties
var properties = await Client.PropertiesAsync(modelVersionId, elementId);

API Endpoints

The client provides typed methods for all server endpoints:

Method Description
WorkspacesAllAsync() List all workspaces
WorkspacesPOSTAsync(request) Create workspace
WorkspacesGETAsync(id) Get workspace by ID
ProjectsAllAsync() List all projects
ProjectsPOSTAsync(request) Create project
ModelsAllAsync() List all models
ModelsPOSTAsync(request) Create model
VersionsAllAsync(modelId) List model versions
VersionsPOSTAsync(modelId, request) Create version
UploadAsync(file) Upload file
PropertiesAsync(versionId, elementId) Get element properties
UsageAsync(workspaceId) Get storage usage

Configuration Options

builder.Services.AddWexServerClient(options =>
{
    // Required: Server base URL
    options.BaseUrl = "https://api.example.com";

    // Optional: Request timeout (default: 30s)
    options.Timeout = TimeSpan.FromMinutes(2);
});

Manual Client Creation

For scenarios without DI:

var httpClient = new HttpClient
{
    BaseAddress = new Uri("https://your-server.com")
};

var client = new XbimClient(httpClient);
var workspaces = await client.WorkspacesAllAsync();

Regenerating the Client

If the server API changes, regenerate the client:

# Fetch latest swagger.json from running server
dotnet msbuild -t:FetchSwagger -p:ServerUrl=http://localhost:5000

# Regenerate client code
dotnet msbuild -t:RegenerateClient

# Or combined
dotnet msbuild -t:UpdateClient -p:ServerUrl=http://localhost:5000

Requirements

  • .NET 9.0+
  • Xbim Server instance

Dependencies

  • Newtonsoft.Json - JSON serialization
  • Microsoft.Extensions.Http - HttpClientFactory
  • Microsoft.Extensions.Http.Resilience - Retry policies

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Xbim.WexServer.Client:

Package Downloads
Xbim.WexBlazor

A Blazor wrapper for the xBIM Viewer, providing seamless integration of 3D BIM model visualization in Blazor WebAssembly applications. Includes model management, toolbar system, and plugin support.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 127 2/18/2026