DNV.Veracity.Services.Api.This 1.4.2

dotnet add package DNV.Veracity.Services.Api.This --version 1.4.2
NuGet\Install-Package DNV.Veracity.Services.Api.This -Version 1.4.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="DNV.Veracity.Services.Api.This" Version="1.4.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DNV.Veracity.Services.Api.This --version 1.4.2
#r "nuget: DNV.Veracity.Services.Api.This, 1.4.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.
// Install DNV.Veracity.Services.Api.This as a Cake Addin
#addin nuget:?package=DNV.Veracity.Services.Api.This&version=1.4.2

// Install DNV.Veracity.Services.Api.This as a Cake Tool
#tool nuget:?package=DNV.Veracity.Services.Api.This&version=1.4.2

Veracity - My Services API v3 - This Client

Provides an async .NET client for the This view point in Veracity My Services API v3. Allows manipulation and retrival of information related to a service.

Resources

  • Administrators
  • Services
  • Subscribers
  • Users

Example

With the nuget package installed, services for each resource may be individually configured, injected and requested inside your solution.

1. Configuration

To configure a resource service, introduce configuration in the form of OAuthHttpClientOptions:

appsettings.json

The This view point only supports Client Credential Flow.

{
	"OAuthHttpClients": [
		...
		{
			"Name": "this-subscribers",
			"Flow": "ClientCredentials",
			"BaseUri": <BaseUri>,
			"SubscriptionKey": <SubscriptionKey>,
			"OAuthClientOptions": {
				"Authority": <Authority>,
				"ClientId": <ClientId>,
				"ClientSecret": <ClientSecret>,
				"Scopes": [ <Scope> ],
			}
		}
		...
	]
}

2. Registration

Register the service or services using extensions methods available from the DNV.Veracity.Services.Api.This.Extensions namespace.

startup.cs

Packages from DNV.Veracity.Service.Api are dependent on the DNV.OAuth.Api.HttpClient package, therefore the HttpClientFactory should also be injected.

public void ConfigureServices(IServiceCollection services)
{
	...
	services.AddOAuthHttpClientFactory(Congiuration.GetSection("OAuthHttpClients").Get<IEnumerable<OAuthHttpClientOptions>>());
	...
	services.AddThisSubscribers("this-subscribers")
	...
}

3. Request service

Request the service from the constructor by its interface:

ExampleController.cs

public class ExampleController : Controller
{
	...
	private readonly IThisSubscribers _thisSubscribers;
	...
	public ExampleController(IThisSubscribers thisSubscribers)
	{
		...
		_thisSubscribers = thisSubscribers ?? throw new ArgumentNullException(nameof(thisSubscribers));
		...
	}
	...
	public async Task<IActionResult> FetchSubscribers(int page, int pageSize)
	{
		return Json(await _thisSubscribers.List(page, pageSize));
	}
	...
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
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.4.2 6,589 12/6/2023
1.4.1 105 11/9/2023
1.4.0 134 10/24/2023
1.3.3 140 6/20/2023
1.3.2 127 6/20/2023
1.3.1 127 6/20/2023
1.3.0 141 6/8/2023