Zyker.Core.ApiClient
1.0.3
dotnet add package Zyker.Core.ApiClient --version 1.0.3
NuGet\Install-Package Zyker.Core.ApiClient -Version 1.0.3
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="Zyker.Core.ApiClient" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zyker.Core.ApiClient" Version="1.0.3" />
<PackageReference Include="Zyker.Core.ApiClient" />
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 Zyker.Core.ApiClient --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zyker.Core.ApiClient, 1.0.3"
#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 Zyker.Core.ApiClient@1.0.3
#: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=Zyker.Core.ApiClient&version=1.0.3
#tool nuget:?package=Zyker.Core.ApiClient&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Generic HTTP client
A reusable .NET base library for building HTTP API integrations. Features include typed request/response handling, JSON processing, file downloads, centralized error handling, configurable timeouts, and Microsoft.Extensions.Logging support.
Usage
- Install NuGet package into your project →
Install-Package Zyker.Core.ApiClient -version [PKG_VERSION] - Inherit from →
ApiClientbase class
public class MyApiClient
: ApiClient, IMyApiClient
{
[CODE], etc. ...
}
- Instantiate the HTTP client with one of the constructors, passing HTTP client factory and/or JSON parsing options
public MyApiClient(
IHttpClientFactory httpClientFactory,
ILogger<MyApiClient> logger,
IConfiguration configuration)
: base(httpClientFactory, logger)
{
_logger = logger;
IConfigurationSection finnhubConfiguration = configuration.GetRequiredSection(CONFIG_SECTION);
_baseUri = finnhubConfiguration.GetSection(CONFIG_BASE_URI).Value;
_authorisation = finnhubConfiguration.GetSection(CONFIG_AUTH).Value;
}
- Compose HTTP message with the inherited compose massage, additional headers, query string and body object parameters can be supplied however optional
...
string requestUri = $"{_baseUri}/[ENDPOINT_ROUTE]";
Dictionary<string, string> headers = new() { ["authorization"] = _authorisation };
Dictionary<string, string> queryString = new()
{
["mic"] = MIC,
["localcode"] = LOCAL_CODE,
["isin"] = ISIN,
["format"] = FORMAT
};
HttpRequestMessage httpRequestMessage = ApiClient
.CreateHttpRequestMessage(HttpMethod.Get, requestUri, headers, queryString);
...
- Send the request to the specified Uri
public async Task<EndOfDayPricesDto> GetEndOfDayPricesAsync(string MIC,
string localCode, string ISIN, CancellationToken cancellationToken)
{
_logger.LogInformation("{LOGGER_PREFIX} Request to get the EOD security prices for : "
+ "MIC - {MIC}, LocalCode - {LocalCode}, ISIN - {ISIN}",
LOGGER_PREFIX, MIC, localCode, ISIN);
// Construct request message with access token header
string requestUri = $"{_baseUri}/[ENDPOINT_ROUTE]";
Dictionary<string, string> headers = new() { ["authorization"] = _authorisation };
Dictionary<string, string> queryString = new()
{
["mic"] = MIC,
["localcode"] = LOCAL_CODE,
["isin"] = ISIN,
["format"] = FORMAT
};
HttpRequestMessage httpRequestMessage = ApiClient
.CreateHttpRequestMessage(HttpMethod.Get, requestUri, headers, queryString);
byte[] bytes = await base.SendRequestAsync(httpRequestMessage, cancellationToken);
// Parse JSON metadata and get attached files
Utf8JsonReader jsonReader = new(new ReadOnlySpan<byte>(bytes));
JsonDocument jsonResponse = null;
if (!JsonDocument.TryParseValue(ref jsonReader, out jsonResponse))
throw new HttpRequestException("Bad request, invalid JSON.", null,
HttpStatusCode.BadRequest);
JsonElement data = jsonResponse.RootElement.GetProperty("jsondata");
EndOfDayPricesDto response = JsonSerializer
.Deserialize<EndOfDayPricesDto>(data[0].GetRawText(), base.JsonSerializerOptions);
_logger.LogInformation("{LOGGER_PREFIX} Retrieved prices : JSON response - {ResponseJson}",
LOGGER_PREFIX, JsonSerializer.Serialize(response, base.JsonSerializerOptions));
return response;
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.13)
- Microsoft.Extensions.Http (>= 10.0.14)
- Microsoft.Extensions.Http.Diagnostics (>= 10.11.0)
- Microsoft.Extensions.Http.Polly (>= 10.0.14)
- Microsoft.Extensions.Http.Resilience (>= 10.11.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
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 |
|---|---|---|
| 1.0.3 | 0 | 11/5/2026 |
| 1.0.3-prerelease.14 | 0 | 11/5/2026 |
| 1.0.3-prerelease.13 | 0 | 11/5/2026 |
| 1.0.3-prerelease.11 | 0 | 11/5/2026 |
| 1.0.3-prerelease.8 | 0 | 11/5/2026 |
| 1.0.2 | 30 | 11/5/2026 |