Devreon.MtSuite.Client
1.0.1
dotnet add package Devreon.MtSuite.Client --version 1.0.1
NuGet\Install-Package Devreon.MtSuite.Client -Version 1.0.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="Devreon.MtSuite.Client" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Devreon.MtSuite.Client" Version="1.0.1" />
<PackageReference Include="Devreon.MtSuite.Client" />
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 Devreon.MtSuite.Client --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Devreon.MtSuite.Client, 1.0.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.
#:package Devreon.MtSuite.Client@1.0.1
#: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=Devreon.MtSuite.Client&version=1.0.1
#tool nuget:?package=Devreon.MtSuite.Client&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Devreon.MtSuite.Client
Typed HttpClient for accessing Devreon MtSuite Meta Manager REST endpoints from .NET applications.
Installation
Use any of the following:
dotnet add package Devreon.MtSuite.Client
Install-Package Devreon.MtSuite.Client
Requirements
- .NET 8.0 or .NET 9.0
- Base URL of a running MtSuite Host (e.g.,
https://localhost:7287/api) - An API key with access to the Meta Manager endpoints
Quick start
using Devreon.MtSuite.Client;
using Devreon.MtSuite.Client.Extensions;
using Devreon.MtSuite.Client.Options;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddMtSuiteRestClient(new MtSuiteMetaManagerRestClientOptions
{
BaseAddress = "https://localhost:7287/api",
ApiKey = "/ivpbQiEcRQzKJyVEAY4TkyjIHYjZqhamgPH5bqrfkA="
});
var provider = services.BuildServiceProvider();
var client = provider.GetRequiredService<IMtSuiteMetaManagerRestClient>();
var now = DateTime.UtcNow;
var prices = await client.GetPriceHistoryAsync(
metaId: Guid.Parse("32ac7f16-1621-4118-9264-7cfe45e8ca7f"),
symbol: "EURUSD",
from: now.AddMinutes(-1),
to: now);
ASP.NET Core integration
Register the client in Program.cs or your composition root and inject IMtSuiteMetaManagerRestClient where needed:
builder.Services.AddMtSuiteRestClient(new MtSuiteMetaManagerRestClientOptions
{
BaseAddress = builder.Configuration["MtSuite:BaseAddress"]!,
ApiKey = builder.Configuration["MtSuite:ApiKey"]!
});
// Usage in a service/endpoint/controller
public class PricesService(IMtSuiteMetaManagerRestClient client)
{
public Task<IList<DtoMtSuiteBidAsk>> GetAsync(Guid metaId, string symbol, DateTime from, DateTime to) =>
client.GetPriceHistoryAsync(metaId, symbol, from, to);
}
Configuration example:
{
"MtSuite": {
"BaseAddress": "https://localhost:7287/api",
"ApiKey": "<your-api-key>"
}
}
Configuration options
public sealed class MtSuiteMetaManagerRestClientOptions
{
public required string BaseAddress { get; init; } // Absolute base URL to MtSuite Host (e.g., https://host:port/api)
public required string ApiKey { get; init; } // API key sent as X-Api-Key header
}
- The client sends
X-Api-Key: {ApiKey}on each request. BaseAddressmust be an absolute URI and typically includes the API base path.
API surface
public interface IMtSuiteMetaManagerRestClient
{
Task<IList<DtoMtSuiteBidAsk>> GetPriceHistoryAsync(
Guid metaId,
string symbol,
DateTime from,
DateTime to,
CancellationToken cancellationToken = default);
}
DTO returned by GetPriceHistoryAsync:
public class DtoMtSuiteBidAsk
{
public DateTime Timestamp { get; set; }
public double Bid { get; set; }
public double Ask { get; set; }
}
Error handling and behaviors
- If
symbolis null/empty, the client throwsArgumentException. - If the server returns 400 or 500, the client throws
HttpRequestExceptionincluding the response body. - If the server returns 404, the client returns an empty list.
- For other non-success statuses, the client uses
EnsureSuccessStatusCode()and will throw accordingly. - JSON is deserialized using
JsonSerializerDefaults.Webwith case-insensitive property names.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.Http (>= 9.0.8)
-
net9.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.Http (>= 9.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.