From a7635318300a7fe2ee5560a26ad16e960271acbc Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 11:44:21 -0400 Subject: [PATCH] (fix): generate Environments.cs to populate base url --- src/SchematicHQ.Client.sln | 20 +++++++++---------- src/SchematicHQ.Client/Core/ClientOptions.cs | 4 +++- src/SchematicHQ.Client/Core/Environments.cs | 6 ++++++ src/SchematicHQ.Client/Core/RawClient.cs | 2 +- src/SchematicHQ.Client/Schematic.cs | 2 +- .../SchematicHQ.Client.csproj | 11 ++++++++-- 6 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 src/SchematicHQ.Client/Core/Environments.cs diff --git a/src/SchematicHQ.Client.sln b/src/SchematicHQ.Client.sln index 9577a39..18d9741 100644 --- a/src/SchematicHQ.Client.sln +++ b/src/SchematicHQ.Client.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{EE8E0485-C844-4D5A-A5CB-F2805679CCFD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client", "SchematicHQ.Client\SchematicHQ.Client.csproj", "{73411664-7CAE-4BBC-850D-C9034D971A09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{3F0DC5BA-F8CF-4D81-85F8-284C421A69DC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicHQ.Client.Test", "SchematicHQ.Client.Test\SchematicHQ.Client.Test.csproj", "{B827DD04-2419-47AF-B5BB-AF9BB3225EB5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,13 +16,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EE8E0485-C844-4D5A-A5CB-F2805679CCFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE8E0485-C844-4D5A-A5CB-F2805679CCFD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE8E0485-C844-4D5A-A5CB-F2805679CCFD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE8E0485-C844-4D5A-A5CB-F2805679CCFD}.Release|Any CPU.Build.0 = Release|Any CPU - {3F0DC5BA-F8CF-4D81-85F8-284C421A69DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F0DC5BA-F8CF-4D81-85F8-284C421A69DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F0DC5BA-F8CF-4D81-85F8-284C421A69DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F0DC5BA-F8CF-4D81-85F8-284C421A69DC}.Release|Any CPU.Build.0 = Release|Any CPU + {73411664-7CAE-4BBC-850D-C9034D971A09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73411664-7CAE-4BBC-850D-C9034D971A09}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73411664-7CAE-4BBC-850D-C9034D971A09}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73411664-7CAE-4BBC-850D-C9034D971A09}.Release|Any CPU.Build.0 = Release|Any CPU + {B827DD04-2419-47AF-B5BB-AF9BB3225EB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B827DD04-2419-47AF-B5BB-AF9BB3225EB5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B827DD04-2419-47AF-B5BB-AF9BB3225EB5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B827DD04-2419-47AF-B5BB-AF9BB3225EB5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/SchematicHQ.Client/Core/ClientOptions.cs b/src/SchematicHQ.Client/Core/ClientOptions.cs index 32c9f5b..7a22645 100644 --- a/src/SchematicHQ.Client/Core/ClientOptions.cs +++ b/src/SchematicHQ.Client/Core/ClientOptions.cs @@ -1,3 +1,5 @@ +using SchematicHQ.Client.Core; + namespace SchematicHQ.Client; public partial class ClientOptions @@ -5,7 +7,7 @@ public partial class ClientOptions /// /// The Base URL for the API. /// - public string? BaseUrl { get; init; } + public string BaseUrl { get; init; } = Environments.DEFAULT; /// /// The http client used to make requests. diff --git a/src/SchematicHQ.Client/Core/Environments.cs b/src/SchematicHQ.Client/Core/Environments.cs new file mode 100644 index 0000000..699b9ac --- /dev/null +++ b/src/SchematicHQ.Client/Core/Environments.cs @@ -0,0 +1,6 @@ +namespace SchematicHQ.Client.Core; + +public class Environments +{ + public static string DEFAULT = "https://api.schematichq.com"; +} diff --git a/src/SchematicHQ.Client/Core/RawClient.cs b/src/SchematicHQ.Client/Core/RawClient.cs index bef61eb..2c83b17 100644 --- a/src/SchematicHQ.Client/Core/RawClient.cs +++ b/src/SchematicHQ.Client/Core/RawClient.cs @@ -106,7 +106,7 @@ private Dictionary GetHeaders(ApiRequest request) private string BuildUrl(string path, Dictionary query) { - var url = $"{_clientOptions.BaseUrl}/{path}"; + var url = $"{_clientOptions.BaseUrl}{path}"; if (query.Count > 0) { url += "?"; diff --git a/src/SchematicHQ.Client/Schematic.cs b/src/SchematicHQ.Client/Schematic.cs index 37fb18f..9e22b3d 100644 --- a/src/SchematicHQ.Client/Schematic.cs +++ b/src/SchematicHQ.Client/Schematic.cs @@ -14,7 +14,7 @@ public Schematic(string apiKey = null, ClientOptions clientOptions = null) { "X-Schematic-Api-Key", apiKey }, { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "schematic_fern_api_sdk" }, - { "X-Fern-SDK-Version", "0.0.10" }, + { "X-Fern-SDK-Version", "0.0.11" }, }, clientOptions ?? new ClientOptions() ); diff --git a/src/SchematicHQ.Client/SchematicHQ.Client.csproj b/src/SchematicHQ.Client/SchematicHQ.Client.csproj index 8204165..16aec77 100644 --- a/src/SchematicHQ.Client/SchematicHQ.Client.csproj +++ b/src/SchematicHQ.Client/SchematicHQ.Client.csproj @@ -1,15 +1,22 @@ + net7.0 enable false - 0.0.10 + 0.0.11 + README.md + https://github.com/schematichq/schematic-csharp + + + + - \ No newline at end of file +