cpSpatial.Client 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package cpSpatial.Client --version 1.0.2
                    
NuGet\Install-Package cpSpatial.Client -Version 1.0.2
                    
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="cpSpatial.Client" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cpSpatial.Client" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="cpSpatial.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 cpSpatial.Client --version 1.0.2
                    
#r "nuget: cpSpatial.Client, 1.0.2"
                    
#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 cpSpatial.Client@1.0.2
                    
#: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=cpSpatial.Client&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=cpSpatial.Client&version=1.0.2
                    
Install as a Cake Tool

cpSpatial.Client

A lightweight .NET client library for calling the cpSpatial API (default: https://spatial.civilpro.com) using strongly-typed contracts from cpSpatial.Contracts.

This package:

  • Handles Bearer token acquisition via POST /auth/GetToken
  • Caches and refreshes tokens automatically (with a safety skew)
  • Exposes typed client methods (e.g. ListSurfacesAsync(projectGuid))

Contracts (DTOs/requests/responses) live in cpSpatial.Contracts.
Client behavior (HTTP, auth, DI registration) lives in cpSpatial.Client.


Install

dotnet add package cpSpatial.Client

You will also need:

dotnet add package Microsoft.Extensions.Http
dotnet add package Microsoft.Extensions.Options.ConfigurationExtensions

Quick start (DI)

appsettings.json

{
  "CpSpatial": {
    "BaseUrl": "https://spatial.civilpro.com",
    "TokenPath": "/auth/GetToken",
    "ClientId": "00000000-0000-0000-0000-000000000000",
    "SecretKey": "REPLACE_WITH_SECRET"
  }
}

Program.cs

using cpSpatial.Client;

builder.Services.AddCpSpatialClient(builder.Configuration, sectionName: "CpSpatial");

Call the client

using cpSpatial.Client;

public sealed class MyService
{
    private readonly ICpSpatialClient _spatial;

    public MyService(ICpSpatialClient spatial)
    {
        _spatial = spatial;
    }

    public async Task DoSomethingAsync(Guid projectGuid, CancellationToken ct)
    {
        var surfaces = await _spatial.ListSurfacesAsync(projectGuid, ct);
        // ...
    }
}

Configuration fields

  • BaseUrl (required): Base host of the Spatial API (e.g. https://spatial.civilpro.com)
  • TokenPath (required): Token endpoint path (e.g. /auth/GetToken)
  • ClientId (required): GUID client identifier
  • SecretKey (required): client secret

Optional (if you add them to the options type):

  • RefreshSkewSeconds: refresh a little before expiry (default 60)
  • TokenRequestTimeoutSeconds: token request timeout seconds (default 15)
  • DefaultTokenTtlMinutes: used if token response has no expires_in (default 10)

Notes on contracts layout

Recommended project dependency direction:

cpSpatial.Contracts
        ▲
        │
cpSpatial.Client
        ▲
        │
Host apps (CivilPro API, WinForms, workers)

DTO naming:

  • Prefer PascalCase C# properties plus [JsonPropertyName] for snake_case JSON fields.

License

Internal / proprietary

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.14 140 2/16/2026
1.0.13 120 2/13/2026
1.0.12 122 2/11/2026
1.0.11 127 2/11/2026
1.0.10 120 2/10/2026
1.0.9 123 2/10/2026
1.0.8 118 2/10/2026
1.0.7 120 2/10/2026
1.0.4 115 2/6/2026
1.0.3 124 2/6/2026
1.0.2 121 2/6/2026
1.0.1 124 2/6/2026
1.0.0 119 2/6/2026