2024-05-04 08:59:13 +00:00
|
|
|
namespace AIStudio.Provider;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The base class for all providers.
|
|
|
|
/// </summary>
|
|
|
|
public abstract class BaseProvider
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The HTTP client to use for all requests.
|
|
|
|
/// </summary>
|
|
|
|
protected readonly HttpClient httpClient = new();
|
2024-08-25 19:55:34 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The logger to use.
|
|
|
|
/// </summary>
|
|
|
|
protected readonly ILogger logger;
|
2024-05-04 08:59:13 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Constructor for the base provider.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="url">The base URL for the provider.</param>
|
2024-08-25 19:55:34 +00:00
|
|
|
/// <param name="loggerService">The logger service to use.</param>
|
|
|
|
protected BaseProvider(string url, ILogger loggerService)
|
2024-05-04 08:59:13 +00:00
|
|
|
{
|
2024-08-25 19:55:34 +00:00
|
|
|
this.logger = loggerService;
|
|
|
|
|
2024-05-04 08:59:13 +00:00
|
|
|
// Set the base URL:
|
|
|
|
this.httpClient.BaseAddress = new(url);
|
|
|
|
}
|
|
|
|
}
|