Defined a base provider to handle http client & base address

This commit is contained in:
Thorsten Sommer 2024-05-04 10:59:13 +02:00
parent 36fb450fad
commit f9c87fc72c
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -0,0 +1,22 @@
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();
/// <summary>
/// Constructor for the base provider.
/// </summary>
/// <param name="url">The base URL for the provider.</param>
protected BaseProvider(string url)
{
// Set the base URL:
this.httpClient.BaseAddress = new(url);
}
}