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
                    
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="Relativity.API.Extensions" Version="20.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Relativity.API.Extensions" Version="20.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Relativity.API.Extensions" />
                    
Project file
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 Relativity.API.Extensions --version 20.0.0
                    
#r "nuget: Relativity.API.Extensions, 20.0.0"
                    
#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 Relativity.API.Extensions@20.0.0
                    
#: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=Relativity.API.Extensions&version=20.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Relativity.API.Extensions&version=20.0.0
                    
Install as a Cake Tool

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 theRelativity.Core::RestServicesUri Instance-Setting of the tenant as a string.
  • GetHttpAuthorizationHandler
    • Returns a DelegatingHandler that automatically adds Authorization headers for HTTP calls. This method takes in Relativity.API.ExecutionIdentity as an input.

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. 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 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. 
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
20.0.0 276 7/25/2025