cpSpatial.Client
1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package cpSpatial.Client --version 1.0.1
NuGet\Install-Package cpSpatial.Client -Version 1.0.1
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.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cpSpatial.Client" Version="1.0.1" />
<PackageReference Include="cpSpatial.Client" />
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.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: cpSpatial.Client, 1.0.1"
#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.1
#: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.1
#tool nuget:?package=cpSpatial.Client&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 incpSpatial.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 identifierSecretKey(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 noexpires_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 | Versions 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.
-
net10.0
- cpSpatial.Contracts (>= 1.0.7)
- Microsoft.Extensions.DependencyInjection (>= 10.0.2)
- Microsoft.Extensions.Http (>= 10.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.2)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.