48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using System.Text.Json;
|
|
|
|
namespace Mesa_Backlog.Library.Binder;
|
|
|
|
public class Client
|
|
{
|
|
|
|
#nullable disable
|
|
|
|
public string API { get; set; }
|
|
public string BaseAddress { get; set; }
|
|
public string BasePage { get; set; }
|
|
public string PAT { get; set; }
|
|
public string Project { get; set; }
|
|
public string Query { get; set; }
|
|
|
|
#nullable restore
|
|
|
|
public override string ToString()
|
|
{
|
|
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
|
return result;
|
|
}
|
|
|
|
private static Library.Client Get(Client client)
|
|
{
|
|
Library.Client result;
|
|
result = new(
|
|
client.API,
|
|
client.BaseAddress,
|
|
client.BasePage,
|
|
client.PAT,
|
|
client.Project,
|
|
client.Query
|
|
);
|
|
return result;
|
|
}
|
|
|
|
public static Library.Client Get(IConfigurationRoot configurationRoot)
|
|
{
|
|
Library.Client result;
|
|
Client client = configurationRoot.Get<Client>();
|
|
result = Get(client);
|
|
return result;
|
|
}
|
|
|
|
} |