2025-01-29 06:28:43 +00:00
|
|
|
using System.Text.Json;
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
namespace AIStudio.Tools.ERIClient;
|
|
|
|
|
|
|
|
public abstract class ERIClientBase(string baseAddress) : IDisposable
|
|
|
|
{
|
|
|
|
protected static readonly JsonSerializerOptions JSON_OPTIONS = new()
|
|
|
|
{
|
|
|
|
WriteIndented = true,
|
|
|
|
AllowTrailingCommas = true,
|
2025-01-29 19:46:19 +00:00
|
|
|
PropertyNamingPolicy = null,
|
2025-01-29 06:28:43 +00:00
|
|
|
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
|
|
|
|
PropertyNameCaseInsensitive = true,
|
|
|
|
Converters =
|
|
|
|
{
|
|
|
|
new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseUpper),
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
protected readonly HttpClient httpClient = new()
|
|
|
|
{
|
|
|
|
BaseAddress = new Uri(baseAddress),
|
|
|
|
};
|
|
|
|
|
|
|
|
protected string securityToken = string.Empty;
|
|
|
|
|
|
|
|
#region Implementation of IDisposable
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
this.httpClient.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|