DNV.Veracity.Services.Api.My 1.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DNV.Veracity.Services.Api.My --version 1.4.1                
NuGet\Install-Package DNV.Veracity.Services.Api.My -Version 1.4.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="DNV.Veracity.Services.Api.My" Version="1.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DNV.Veracity.Services.Api.My --version 1.4.1                
#r "nuget: DNV.Veracity.Services.Api.My, 1.4.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.
// Install DNV.Veracity.Services.Api.My as a Cake Addin
#addin nuget:?package=DNV.Veracity.Services.Api.My&version=1.4.1

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

Veracity - My Services API v3 - My Client

Provides an async .NET client for the My view point in Veracity My Services API v3. Allows fetching information and making requests for the authenticated user.

Resources

  • Companies
  • Messages
  • Policies
  • Profile
  • Services

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 My view point only supports User Credential Flow.

{
	"OAuthHttpClients": [
		...
		{
			"Name": "my-profile",
			"Flow": "UserCredentials",
			"BaseUri": <BaseUri>,
			"SubscriptionKey": <SubscriptionKey>,
			"OAuthClientOptions": {
				"Authority": <Authority>,
				"Scopes": [ <Scope> ]
			}
		}
		...
	]
}

2. Registration

Register the service or services using extensions methods available from the DNV.Veracity.Services.Api.My.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.AddMyProfile("my-profile")
	...
}

3. Request service

Request the service from the constructor by its interface:

ExampleController.cs

public class ExampleController : Controller
{
	...
	private readonly IMyProfile _myPofile;
	...
	public ExampleController(IMyProfile myProfile)
	{
		...
		_myPofile = myProfile ?? throw new ArgumentNullException(nameof(myProfile));
		...
	}
	...
	public async Task<IActionResult> FetchProfile()
	{
		return Json(await _myPofile.Get());
	}
	...
}
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 (1)

Showing the top 1 NuGet packages that depend on DNV.Veracity.Services.Api.My:

Package Downloads
DNV.OAuth.Web.Extensions

Provides various extensions for supporting OAuth in DNV web application development.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.2 116 9/27/2024
1.5.1 121 7/22/2024
1.5.0 25,320 5/13/2024
1.4.2 45,128 12/6/2023
1.4.1 160 11/9/2023
1.4.0 166 10/24/2023
1.3.3 1,674 6/20/2023
1.3.2 157 6/20/2023
1.3.1 178 6/20/2023
1.3.0 884 6/8/2023