From f9c87fc72c07c5e95066364d2b71e1ee14648390 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 4 May 2024 10:59:13 +0200 Subject: [PATCH] Defined a base provider to handle http client & base address --- .../Provider/BaseProvider.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/MindWork AI Studio/Provider/BaseProvider.cs diff --git a/app/MindWork AI Studio/Provider/BaseProvider.cs b/app/MindWork AI Studio/Provider/BaseProvider.cs new file mode 100644 index 0000000..d6ce8a5 --- /dev/null +++ b/app/MindWork AI Studio/Provider/BaseProvider.cs @@ -0,0 +1,22 @@ +namespace AIStudio.Provider; + +/// +/// The base class for all providers. +/// +public abstract class BaseProvider +{ + /// + /// The HTTP client to use for all requests. + /// + protected readonly HttpClient httpClient = new(); + + /// + /// Constructor for the base provider. + /// + /// The base URL for the provider. + protected BaseProvider(string url) + { + // Set the base URL: + this.httpClient.BaseAddress = new(url); + } +} \ No newline at end of file