From 498589e382747a7674e9f7bb5bc507e334c48028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Thu, 23 Nov 2023 20:30:17 +0100 Subject: [PATCH 1/7] Refactor api client class --- Lombiq.OrchardCoreApiClient/ApiClient.cs | 38 +++---------------- Lombiq.OrchardCoreApiClient/ApiClientBase.cs | 39 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 33 deletions(-) create mode 100644 Lombiq.OrchardCoreApiClient/ApiClientBase.cs diff --git a/Lombiq.OrchardCoreApiClient/ApiClient.cs b/Lombiq.OrchardCoreApiClient/ApiClient.cs index c3b7f93..6b12e06 100644 --- a/Lombiq.OrchardCoreApiClient/ApiClient.cs +++ b/Lombiq.OrchardCoreApiClient/ApiClient.cs @@ -1,31 +1,18 @@ -using Lombiq.HelpfulLibraries.Refit.Helpers; using Lombiq.OrchardCoreApiClient.Constants; using Lombiq.OrchardCoreApiClient.Exceptions; using Lombiq.OrchardCoreApiClient.Interfaces; using Lombiq.OrchardCoreApiClient.Models; using Refit; -using System; -using System.Net.Http; using System.Threading.Tasks; namespace Lombiq.OrchardCoreApiClient; -public class ApiClient : IDisposable +public class ApiClient : ApiClientBase { - private readonly Lazy _lazyOrchardCoreApi; - - private HttpClient _httpClient; - - public IOrchardCoreApi OrchardCoreApi => _lazyOrchardCoreApi.Value; - - public ApiClient(ApiClientSettings apiClientSettings) => - _lazyOrchardCoreApi = new(() => - { - _httpClient = ConfigurableCertificateValidatingHttpClientHandler.CreateClient(apiClientSettings); - - // We use Newtonsoft Json.NET because Orchard Core uses it too, so the models will behave the same. - return RefitHelper.WithNewtonsoftJson(_httpClient); - }); + public ApiClient(ApiClientSettings apiClientSettings) + : base(apiClientSettings) + { + } public async Task CreateAndSetupTenantAsync( TenantApiModel createApiViewModel, @@ -57,19 +44,4 @@ public async Task CreateAndSetupTenantAsync( throw new ApiClientException("Tenant setup failed.", ex); } } - - public void Dispose() - { - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (_lazyOrchardCoreApi.IsValueCreated && _httpClient != null) - { - _httpClient.Dispose(); - _httpClient = null; - } - } } diff --git a/Lombiq.OrchardCoreApiClient/ApiClientBase.cs b/Lombiq.OrchardCoreApiClient/ApiClientBase.cs new file mode 100644 index 0000000..8b77d4c --- /dev/null +++ b/Lombiq.OrchardCoreApiClient/ApiClientBase.cs @@ -0,0 +1,39 @@ +using Lombiq.HelpfulLibraries.Refit.Helpers; +using Lombiq.OrchardCoreApiClient.Models; +using System; +using System.Net.Http; + +namespace Lombiq.OrchardCoreApiClient; + +public class ApiClientBase : IDisposable +{ + private readonly Lazy _lazyOrchardCoreApi; + + private HttpClient _httpClient; + + public T OrchardCoreApi => _lazyOrchardCoreApi.Value; + + protected ApiClientBase(ApiClientSettings apiClientSettings) => + _lazyOrchardCoreApi = new(() => + { + _httpClient = ConfigurableCertificateValidatingHttpClientHandler.CreateClient(apiClientSettings); + + // We use Newtonsoft Json.NET because Orchard Core uses it too, so the models will behave the same. + return RefitHelper.WithNewtonsoftJson(_httpClient); + }); + + public void Dispose() + { + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_lazyOrchardCoreApi.IsValueCreated && _httpClient != null) + { + _httpClient.Dispose(); + _httpClient = null; + } + } +} From 072c9bf2f113fddf4ab08d14c94ec798a37d573b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Thu, 23 Nov 2023 21:34:14 +0100 Subject: [PATCH 2/7] Deleting custom api endpoint --- .../Interfaces/IOrchardCoreApi.cs | 13 ------------- .../Models/TenantApiModel.cs | 1 - 2 files changed, 14 deletions(-) diff --git a/Lombiq.OrchardCoreApiClient/Interfaces/IOrchardCoreApi.cs b/Lombiq.OrchardCoreApiClient/Interfaces/IOrchardCoreApi.cs index f6094c9..67e4589 100644 --- a/Lombiq.OrchardCoreApiClient/Interfaces/IOrchardCoreApi.cs +++ b/Lombiq.OrchardCoreApiClient/Interfaces/IOrchardCoreApi.cs @@ -1,6 +1,5 @@ using Lombiq.OrchardCoreApiClient.Models; using Refit; -using System; using System.Threading.Tasks; using static Lombiq.OrchardCoreApiClient.Constants.CommonHeaders; @@ -42,18 +41,6 @@ public interface IOrchardCoreApi [Headers(AuthorizationBearer)] Task EditAsync([Body(buffered: true)] TenantApiModel editTenantParameters); - /// - /// Edit a previously created tenant in Orchard Core with additional settings inside - /// . This endpoint is not implemented, implement on your own. - /// - /// The property in the - /// is the additional property that is not processed in . - /// The response of the custom tenant edit. - [Post("/api/tenants/custom-edit")] - [Headers(AuthorizationBearer)] - [Obsolete("This shouldn't be here and will be soon removed, see https://github.com/Lombiq/Orchard-Core-API-Client/issues/30.")] - Task CustomEditAsync([Body(buffered: true)] TenantApiModel editTenantParameters); - /// /// Remove a previously created tenant in Orchard Core. /// diff --git a/Lombiq.OrchardCoreApiClient/Models/TenantApiModel.cs b/Lombiq.OrchardCoreApiClient/Models/TenantApiModel.cs index dab96eb..1f25c64 100644 --- a/Lombiq.OrchardCoreApiClient/Models/TenantApiModel.cs +++ b/Lombiq.OrchardCoreApiClient/Models/TenantApiModel.cs @@ -17,5 +17,4 @@ public class TenantApiModel public string RecipeName { get; set; } public IEnumerable FeatureProfiles { get; set; } public string Category { get; set; } - public IDictionary CustomSettings { get; } = new Dictionary(); } From 4ba5bfd4097e6b8f1f6ec8e566ad75d3c7ca7f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Mon, 27 Nov 2023 20:13:59 +0100 Subject: [PATCH 3/7] Refactoring base class --- Lombiq.OrchardCoreApiClient.Tester/Program.cs | 3 +- .../TestCaseUITestContextExtensions.cs | 13 ++++--- Lombiq.OrchardCoreApiClient/ApiClient.cs | 39 ++++++++++++++++--- Lombiq.OrchardCoreApiClient/ApiClientBase.cs | 39 ------------------- 4 files changed, 43 insertions(+), 51 deletions(-) delete mode 100644 Lombiq.OrchardCoreApiClient/ApiClientBase.cs diff --git a/Lombiq.OrchardCoreApiClient.Tester/Program.cs b/Lombiq.OrchardCoreApiClient.Tester/Program.cs index eaad95a..12249f6 100644 --- a/Lombiq.OrchardCoreApiClient.Tester/Program.cs +++ b/Lombiq.OrchardCoreApiClient.Tester/Program.cs @@ -1,3 +1,4 @@ +using Lombiq.OrchardCoreApiClient.Interfaces; using Lombiq.OrchardCoreApiClient.Models; using System; using System.Diagnostics.CodeAnalysis; @@ -18,7 +19,7 @@ public static class Program public static async Task Main(string[] arguments) { var port = int.TryParse(arguments.FirstOrDefault(), out var customPort) ? customPort : 44335; - using var apiClient = new ApiClient(new ApiClientSettings + using var apiClient = new ApiClient(new ApiClientSettings { ClientId = ClientId, ClientSecret = ClientSecret, diff --git a/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 06c44a9..4fdb622 100644 --- a/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -1,4 +1,5 @@ using Atata; +using Lombiq.OrchardCoreApiClient.Interfaces; using Lombiq.OrchardCoreApiClient.Models; using Lombiq.Tests.UI.Extensions; using Lombiq.Tests.UI.Services; @@ -73,7 +74,7 @@ public static async Task TestOrchardCoreApiClientBehaviorAsync( Category = "UI Test Tenants - Edited", }; - using var apiClient = new ApiClient(new ApiClientSettings + using var apiClient = new ApiClient(new ApiClientSettings { ClientId = clientId, ClientSecret = clientSecret, @@ -106,7 +107,7 @@ public static async Task TestOrchardCoreApiClientBehaviorAsync( private static async Task TestTenantCreateAsync( UITestContext context, - ApiClient apiClient, + ApiClient apiClient, TenantApiModel createApiModel) { using (var response = await apiClient.OrchardCoreApi.CreateAsync(createApiModel)) @@ -141,7 +142,7 @@ private static async Task TestTenantCreateAsync( private static async Task TestTenantSetupAsync( UITestContext context, - ApiClient apiClient, + ApiClient apiClient, TenantApiModel createApiModel, TenantSetupApiModel setupApiModel) { @@ -159,7 +160,7 @@ private static async Task TestTenantSetupAsync( private static async Task TestTenantEditAsync( UITestContext context, - ApiClient apiClient, + ApiClient apiClient, TenantApiModel editModel, TenantSetupApiModel setupApiModel) { @@ -186,7 +187,7 @@ private static async Task TestTenantEditAsync( private static async Task TestTenantDisableAsync( UITestContext context, - ApiClient apiClient, + ApiClient apiClient, TenantApiModel editModel) { await apiClient.OrchardCoreApi.DisableAsync(editModel.Name); @@ -199,7 +200,7 @@ private static async Task TestTenantDisableAsync( private static async Task TestTenantRemoveAsync( UITestContext context, - ApiClient apiClient, + ApiClient apiClient, TenantApiModel editModel) { await apiClient.OrchardCoreApi.RemoveAsync(editModel.Name); diff --git a/Lombiq.OrchardCoreApiClient/ApiClient.cs b/Lombiq.OrchardCoreApiClient/ApiClient.cs index 6b12e06..66694a3 100644 --- a/Lombiq.OrchardCoreApiClient/ApiClient.cs +++ b/Lombiq.OrchardCoreApiClient/ApiClient.cs @@ -1,18 +1,32 @@ +using Lombiq.HelpfulLibraries.Refit.Helpers; using Lombiq.OrchardCoreApiClient.Constants; using Lombiq.OrchardCoreApiClient.Exceptions; using Lombiq.OrchardCoreApiClient.Interfaces; using Lombiq.OrchardCoreApiClient.Models; using Refit; +using System; +using System.Net.Http; using System.Threading.Tasks; namespace Lombiq.OrchardCoreApiClient; -public class ApiClient : ApiClientBase +public class ApiClient : IDisposable + where TApi : IOrchardCoreApi { - public ApiClient(ApiClientSettings apiClientSettings) - : base(apiClientSettings) - { - } + private readonly Lazy _lazyOrchardCoreApi; + + private HttpClient _httpClient; + + public TApi OrchardCoreApi => _lazyOrchardCoreApi.Value; + + public ApiClient(ApiClientSettings apiClientSettings) => + _lazyOrchardCoreApi = new(() => + { + _httpClient = ConfigurableCertificateValidatingHttpClientHandler.CreateClient(apiClientSettings); + + // We use Newtonsoft Json.NET because Orchard Core uses it too, so the models will behave the same. + return RefitHelper.WithNewtonsoftJson(_httpClient); + }); public async Task CreateAndSetupTenantAsync( TenantApiModel createApiViewModel, @@ -44,4 +58,19 @@ public async Task CreateAndSetupTenantAsync( throw new ApiClientException("Tenant setup failed.", ex); } } + + public void Dispose() + { + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_lazyOrchardCoreApi.IsValueCreated && _httpClient != null) + { + _httpClient.Dispose(); + _httpClient = null; + } + } } diff --git a/Lombiq.OrchardCoreApiClient/ApiClientBase.cs b/Lombiq.OrchardCoreApiClient/ApiClientBase.cs deleted file mode 100644 index 8b77d4c..0000000 --- a/Lombiq.OrchardCoreApiClient/ApiClientBase.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Lombiq.HelpfulLibraries.Refit.Helpers; -using Lombiq.OrchardCoreApiClient.Models; -using System; -using System.Net.Http; - -namespace Lombiq.OrchardCoreApiClient; - -public class ApiClientBase : IDisposable -{ - private readonly Lazy _lazyOrchardCoreApi; - - private HttpClient _httpClient; - - public T OrchardCoreApi => _lazyOrchardCoreApi.Value; - - protected ApiClientBase(ApiClientSettings apiClientSettings) => - _lazyOrchardCoreApi = new(() => - { - _httpClient = ConfigurableCertificateValidatingHttpClientHandler.CreateClient(apiClientSettings); - - // We use Newtonsoft Json.NET because Orchard Core uses it too, so the models will behave the same. - return RefitHelper.WithNewtonsoftJson(_httpClient); - }); - - public void Dispose() - { - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (_lazyOrchardCoreApi.IsValueCreated && _httpClient != null) - { - _httpClient.Dispose(); - _httpClient = null; - } - } -} From 8d9c42a32c14c337a7821708d375879e6a3441a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Mon, 27 Nov 2023 21:22:44 +0100 Subject: [PATCH 4/7] Adding docs --- Readme.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Readme.md b/Readme.md index 12fb5c4..8ea109c 100644 --- a/Readme.md +++ b/Readme.md @@ -25,6 +25,19 @@ If you want to set up the OpenId features without the recipe, you need to enable For testing, run your Orchard Core app first, then `Lombiq.OrchardCoreApiClient.Tester`. You may need to edit the [_Program.cs_](Lombiq.OrchardCoreApiClient.Tester/Program.cs) according to your OpenID Application's settings (`ClientId`, `ClientSecret`, and `DefaultTenantUri`) and then run the console application. +### Use your own API endpoints + +You can add your own API endpoints by creating a new interface that's inherited from `IOrchardCoreApi` and add your own methods. For example, you can create a new interface called `IOrchardCoreApiExtended` and add a new method to it: + +```csharp +public interface IOrchardCoreApiExtended : IOrchardCoreApi +{ + [Post("/api/my-custom-endpoint")] + [Headers(AuthorizationBearer)] + Task GetMyCustomEndpointAsync(); +} +``` + ## Recipes Lombiq OrchardCore API Client OpenId - Recipe for enabling the Tenants and OpenId features and setting it up for the console tester application. To use this recipe, enable the Deployment feature and import this as a deployment package. From e34e9f79496fe3eef116f0605f5a7fcb1b000d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Tue, 28 Nov 2023 13:16:25 +0100 Subject: [PATCH 5/7] Adding default OC api client class --- Lombiq.OrchardCoreApiClient.Tester/Program.cs | 2 +- .../Extensions/TestCaseUITestContextExtensions.cs | 13 ++++++------- Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs | 12 ++++++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs diff --git a/Lombiq.OrchardCoreApiClient.Tester/Program.cs b/Lombiq.OrchardCoreApiClient.Tester/Program.cs index 12249f6..bf72072 100644 --- a/Lombiq.OrchardCoreApiClient.Tester/Program.cs +++ b/Lombiq.OrchardCoreApiClient.Tester/Program.cs @@ -19,7 +19,7 @@ public static class Program public static async Task Main(string[] arguments) { var port = int.TryParse(arguments.FirstOrDefault(), out var customPort) ? customPort : 44335; - using var apiClient = new ApiClient(new ApiClientSettings + using var apiClient = new OrchardCoreApiClient(new ApiClientSettings { ClientId = ClientId, ClientSecret = ClientSecret, diff --git a/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 4fdb622..d5e6ea8 100644 --- a/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -1,5 +1,4 @@ using Atata; -using Lombiq.OrchardCoreApiClient.Interfaces; using Lombiq.OrchardCoreApiClient.Models; using Lombiq.Tests.UI.Extensions; using Lombiq.Tests.UI.Services; @@ -74,7 +73,7 @@ public static async Task TestOrchardCoreApiClientBehaviorAsync( Category = "UI Test Tenants - Edited", }; - using var apiClient = new ApiClient(new ApiClientSettings + using var apiClient = new OrchardCoreApiClient(new ApiClientSettings { ClientId = clientId, ClientSecret = clientSecret, @@ -107,7 +106,7 @@ public static async Task TestOrchardCoreApiClientBehaviorAsync( private static async Task TestTenantCreateAsync( UITestContext context, - ApiClient apiClient, + OrchardCoreApiClient apiClient, TenantApiModel createApiModel) { using (var response = await apiClient.OrchardCoreApi.CreateAsync(createApiModel)) @@ -142,7 +141,7 @@ private static async Task TestTenantCreateAsync( private static async Task TestTenantSetupAsync( UITestContext context, - ApiClient apiClient, + OrchardCoreApiClient apiClient, TenantApiModel createApiModel, TenantSetupApiModel setupApiModel) { @@ -160,7 +159,7 @@ private static async Task TestTenantSetupAsync( private static async Task TestTenantEditAsync( UITestContext context, - ApiClient apiClient, + OrchardCoreApiClient apiClient, TenantApiModel editModel, TenantSetupApiModel setupApiModel) { @@ -187,7 +186,7 @@ private static async Task TestTenantEditAsync( private static async Task TestTenantDisableAsync( UITestContext context, - ApiClient apiClient, + OrchardCoreApiClient apiClient, TenantApiModel editModel) { await apiClient.OrchardCoreApi.DisableAsync(editModel.Name); @@ -200,7 +199,7 @@ private static async Task TestTenantDisableAsync( private static async Task TestTenantRemoveAsync( UITestContext context, - ApiClient apiClient, + OrchardCoreApiClient apiClient, TenantApiModel editModel) { await apiClient.OrchardCoreApi.RemoveAsync(editModel.Name); diff --git a/Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs b/Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs new file mode 100644 index 0000000..7627d5f --- /dev/null +++ b/Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs @@ -0,0 +1,12 @@ +using Lombiq.OrchardCoreApiClient.Interfaces; +using Lombiq.OrchardCoreApiClient.Models; + +namespace Lombiq.OrchardCoreApiClient; + +public class OrchardCoreApiClient : ApiClient +{ + public OrchardCoreApiClient(ApiClientSettings apiClientSettings) + : base(apiClientSettings) + { + } +} From 2c977ba033c20f66088d375bb71506352a29f742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Wed, 29 Nov 2023 12:34:07 +0100 Subject: [PATCH 6/7] fix --- Lombiq.OrchardCoreApiClient.Tester/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Lombiq.OrchardCoreApiClient.Tester/Program.cs b/Lombiq.OrchardCoreApiClient.Tester/Program.cs index bf72072..238c3fd 100644 --- a/Lombiq.OrchardCoreApiClient.Tester/Program.cs +++ b/Lombiq.OrchardCoreApiClient.Tester/Program.cs @@ -1,4 +1,3 @@ -using Lombiq.OrchardCoreApiClient.Interfaces; using Lombiq.OrchardCoreApiClient.Models; using System; using System.Diagnostics.CodeAnalysis; From 9dc4ed222054527d43e7d287b30b021def715a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20N=C3=A9meth?= Date: Wed, 29 Nov 2023 15:50:25 +0100 Subject: [PATCH 7/7] Using same name --- Lombiq.OrchardCoreApiClient.Tester/Program.cs | 2 +- .../Extensions/TestCaseUITestContextExtensions.cs | 12 ++++++------ Lombiq.OrchardCoreApiClient/ApiClient.cs | 8 ++++++++ Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs | 12 ------------ 4 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs diff --git a/Lombiq.OrchardCoreApiClient.Tester/Program.cs b/Lombiq.OrchardCoreApiClient.Tester/Program.cs index 238c3fd..eaad95a 100644 --- a/Lombiq.OrchardCoreApiClient.Tester/Program.cs +++ b/Lombiq.OrchardCoreApiClient.Tester/Program.cs @@ -18,7 +18,7 @@ public static class Program public static async Task Main(string[] arguments) { var port = int.TryParse(arguments.FirstOrDefault(), out var customPort) ? customPort : 44335; - using var apiClient = new OrchardCoreApiClient(new ApiClientSettings + using var apiClient = new ApiClient(new ApiClientSettings { ClientId = ClientId, ClientSecret = ClientSecret, diff --git a/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index d5e6ea8..06c44a9 100644 --- a/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.OrchardCoreApiClient.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -73,7 +73,7 @@ public static async Task TestOrchardCoreApiClientBehaviorAsync( Category = "UI Test Tenants - Edited", }; - using var apiClient = new OrchardCoreApiClient(new ApiClientSettings + using var apiClient = new ApiClient(new ApiClientSettings { ClientId = clientId, ClientSecret = clientSecret, @@ -106,7 +106,7 @@ public static async Task TestOrchardCoreApiClientBehaviorAsync( private static async Task TestTenantCreateAsync( UITestContext context, - OrchardCoreApiClient apiClient, + ApiClient apiClient, TenantApiModel createApiModel) { using (var response = await apiClient.OrchardCoreApi.CreateAsync(createApiModel)) @@ -141,7 +141,7 @@ private static async Task TestTenantCreateAsync( private static async Task TestTenantSetupAsync( UITestContext context, - OrchardCoreApiClient apiClient, + ApiClient apiClient, TenantApiModel createApiModel, TenantSetupApiModel setupApiModel) { @@ -159,7 +159,7 @@ private static async Task TestTenantSetupAsync( private static async Task TestTenantEditAsync( UITestContext context, - OrchardCoreApiClient apiClient, + ApiClient apiClient, TenantApiModel editModel, TenantSetupApiModel setupApiModel) { @@ -186,7 +186,7 @@ private static async Task TestTenantEditAsync( private static async Task TestTenantDisableAsync( UITestContext context, - OrchardCoreApiClient apiClient, + ApiClient apiClient, TenantApiModel editModel) { await apiClient.OrchardCoreApi.DisableAsync(editModel.Name); @@ -199,7 +199,7 @@ private static async Task TestTenantDisableAsync( private static async Task TestTenantRemoveAsync( UITestContext context, - OrchardCoreApiClient apiClient, + ApiClient apiClient, TenantApiModel editModel) { await apiClient.OrchardCoreApi.RemoveAsync(editModel.Name); diff --git a/Lombiq.OrchardCoreApiClient/ApiClient.cs b/Lombiq.OrchardCoreApiClient/ApiClient.cs index 66694a3..b24f238 100644 --- a/Lombiq.OrchardCoreApiClient/ApiClient.cs +++ b/Lombiq.OrchardCoreApiClient/ApiClient.cs @@ -10,6 +10,14 @@ namespace Lombiq.OrchardCoreApiClient; +public class ApiClient : ApiClient +{ + public ApiClient(ApiClientSettings apiClientSettings) + : base(apiClientSettings) + { + } +} + public class ApiClient : IDisposable where TApi : IOrchardCoreApi { diff --git a/Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs b/Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs deleted file mode 100644 index 7627d5f..0000000 --- a/Lombiq.OrchardCoreApiClient/OrchardCoreApiClient.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Lombiq.OrchardCoreApiClient.Interfaces; -using Lombiq.OrchardCoreApiClient.Models; - -namespace Lombiq.OrchardCoreApiClient; - -public class OrchardCoreApiClient : ApiClient -{ - public OrchardCoreApiClient(ApiClientSettings apiClientSettings) - : base(apiClientSettings) - { - } -}