DNV.Veracity.Services.Api.Directory
1.4.0
See the version list below for details.
dotnet add package DNV.Veracity.Services.Api.Directory --version 1.4.0
NuGet\Install-Package DNV.Veracity.Services.Api.Directory -Version 1.4.0
<PackageReference Include="DNV.Veracity.Services.Api.Directory" Version="1.4.0" />
paket add DNV.Veracity.Services.Api.Directory --version 1.4.0
#r "nuget: DNV.Veracity.Services.Api.Directory, 1.4.0"
// Install DNV.Veracity.Services.Api.Directory as a Cake Addin #addin nuget:?package=DNV.Veracity.Services.Api.Directory&version=1.4.0 // Install DNV.Veracity.Services.Api.Directory as a Cake Tool #tool nuget:?package=DNV.Veracity.Services.Api.Directory&version=1.4.0
Veracity - My Services API v3 - Directory Client
Provides an async .NET client for the Directory
view point in Veracity My Services API v3.
Allows fetching and updating resources without a focus on a specifc user or service resource.
Resources
- Companies
- Services
- 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
Directory
view point only supports Client Credential Flow.
{
"OAuthHttpClients": [
...
{
"Name": "company-directory",
"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.Directory.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.AddCompanyDirectory("company-directory")
...
}
3. Request service
Request the service from the constructor by its interface:
ExampleController.cs
public class ExampleController : Controller
{
...
private readonly ICompanyDirectory _companyDirectory;
...
public ExampleController(ICompanyDirectory companyDirectory)
{
...
_companyDirectory = companyDirectory ?? throw new ArgumentNullException(nameof(companyDirectory));
...
}
...
public async Task<IActionResult> FetchCompany(string companyId)
{
return Json(await _companyDirectory.Get(companyId));
}
...
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
-
.NETStandard 2.1
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.