Relativity.API.Extensions
20.0.0
dotnet add package Relativity.API.Extensions --version 20.0.0
NuGet\Install-Package Relativity.API.Extensions -Version 20.0.0
<PackageReference Include="Relativity.API.Extensions" Version="20.0.0" />
<PackageVersion Include="Relativity.API.Extensions" Version="20.0.0" />
<PackageReference Include="Relativity.API.Extensions" />
paket add Relativity.API.Extensions --version 20.0.0
#r "nuget: Relativity.API.Extensions, 20.0.0"
#:package Relativity.API.Extensions@20.0.0
#addin nuget:?package=Relativity.API.Extensions&version=20.0.0
#tool nuget:?package=Relativity.API.Extensions&version=20.0.0
Relativity.API.Extensions
This library provides extension methods for the IServicesMgr interface for connecting multi-tenant microservices. It includes the following methods:
- GetInstanceBaseURL
- Returns the Base Url and port if specified from the
Relativity.Core::RestServicesUri
Instance-Setting of the tenant as a string.
- Returns the Base Url and port if specified from the
- GetHttpAuthorizationHandler
- Returns a DelegatingHandler that automatically adds Authorization headers for HTTP calls. This method takes in
Relativity.API.ExecutionIdentity
as an input.
- Returns a DelegatingHandler that automatically adds Authorization headers for HTTP calls. This method takes in
Installing via the .NET SDK
dotnet add package Relativity.API.Extensions
Developer Setup
Usage
Users will need to include the Extensions assembly in their ADS applications. The GetInstanceBaseURL and GetHttpAuthorizationHandler can be called using the snippet below:
using Relativity.API.Extensions;
public class AgentBaseTest : AgentBase
{
private IServicesMgr _servicesMgr;
public AgentBaseTest()
{
}
public override string Name => "AgentBaseTest";
public override void Execute()
{
_servicesMgr = Helper.GetServicesManager();
// Get the auth handler
// See advanced usage for setting an inner handler
var authHandler = _servicesMgr.GetHttpAuthorizationHandler(ExecutionIdentity.CurrentUser);
var client = new HttpClient(authHandler);
var requestUrl = GetRequestUrl("/api/test-endpoint");
var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
var response = client.SendAsync(request).Result;
}
private Uri GetRequestUrl(string requestEndpoint)
{
var baseUrl = _servicesMgr.GetInstanceBaseURL();
if (string.IsNullOrEmpty(baseUrl))
{
throw new InvalidOperationException("Base URL is not set.");
}
var fullUri = new Uri(new Uri(baseUrl), requestEndpoint);
return fullUri;
}
}
Advanced Usage: Setting the InnerHandler
If you want to chain additional handlers or use a custom HttpClientHandler
, set the InnerHandler
property before passing the handler to HttpClient
:
var authHandler = _servicesMgr.GetHttpAuthorizationHandler(ExecutionIdentity.CurrentUser);
authHandler.InnerHandler = new MyCustomHandler(); // or new HttpClientHandler()
var client = new HttpClient(authHandler);
If you do not set InnerHandler
, a default HttpClientHandler
will be used.
Contributing
If you have a suggestion that would make this better, please fork the repo and create a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Maintainers
This repository is owned by the Automated Workflows Team in the Extensibility sub-domain. Please report any issues in the #help-kepler Slack channel.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.2
- Relativity.API (>= 20.0.0)
- Relativity.Logging (>= 3000.7.3)
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 |
---|---|---|
20.0.0 | 276 | 7/25/2025 |