From b4f0a62cf8902313899459f7ed0766f8778af1ae Mon Sep 17 00:00:00 2001 From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:51:44 +0000 Subject: [PATCH 1/3] build(codegen): updating SDK --- .../ServiceProviderFixture.cs | 2 +- .../ServiceProviderFixture.cs | 2 +- .../Serialization/IStreamSerializerService.cs | 3 +-- references.txt | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commercetools.Sdk/IntegrationTests/commercetools.GraphQL.Api.IntegrationTests/ServiceProviderFixture.cs b/commercetools.Sdk/IntegrationTests/commercetools.GraphQL.Api.IntegrationTests/ServiceProviderFixture.cs index da55e093edd..968da45207a 100644 --- a/commercetools.Sdk/IntegrationTests/commercetools.GraphQL.Api.IntegrationTests/ServiceProviderFixture.cs +++ b/commercetools.Sdk/IntegrationTests/commercetools.GraphQL.Api.IntegrationTests/ServiceProviderFixture.cs @@ -26,7 +26,7 @@ public ServiceProviderFixture() Build(); var useStreamClient = Enum.Parse(configuration.GetValue("ClientType", "String")) == ClientType.Stream; - services.UseCommercetoolsApi(configuration, "Client", options: new ClientOptions { ReadResponseAsStream = useStreamClient}); + services.UseCommercetoolsApi(configuration, "Client", options: new ClientOptions { ReadResponseAsStream = useStreamClient }); services.AddLogging(c => c.AddProvider(new InMemoryLoggerProvider())); services.SetupClient( "MeClient", diff --git a/commercetools.Sdk/IntegrationTests/commercetools.ImportApi.IntegrationTests/ServiceProviderFixture.cs b/commercetools.Sdk/IntegrationTests/commercetools.ImportApi.IntegrationTests/ServiceProviderFixture.cs index 9c8767fb035..804dcbe858d 100644 --- a/commercetools.Sdk/IntegrationTests/commercetools.ImportApi.IntegrationTests/ServiceProviderFixture.cs +++ b/commercetools.Sdk/IntegrationTests/commercetools.ImportApi.IntegrationTests/ServiceProviderFixture.cs @@ -23,7 +23,7 @@ public ServiceProviderFixture() Build(); var useStreamClient = Enum.Parse(configuration.GetValue("ClientType", "String")) == ClientType.Stream; - services.UseCommercetoolsImportApi(configuration, "ImportClient", options: new ClientOptions { ReadResponseAsStream = useStreamClient}); + services.UseCommercetoolsImportApi(configuration, "ImportClient", options: new ClientOptions { ReadResponseAsStream = useStreamClient }); this.serviceProvider = services.BuildServiceProvider(); //set default ProjectKey diff --git a/commercetools.Sdk/commercetools.Base.Abstractions/Serialization/IStreamSerializerService.cs b/commercetools.Sdk/commercetools.Base.Abstractions/Serialization/IStreamSerializerService.cs index 7fd5b99ce6c..87cfdafee43 100644 --- a/commercetools.Sdk/commercetools.Base.Abstractions/Serialization/IStreamSerializerService.cs +++ b/commercetools.Sdk/commercetools.Base.Abstractions/Serialization/IStreamSerializerService.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; namespace commercetools.Base.Serialization { diff --git a/references.txt b/references.txt index cc2b06f0929..1b72395a7ed 100644 --- a/references.txt +++ b/references.txt @@ -218,3 +218,4 @@ d10443de67d8c8e684b4e63415b5720fc3bcf169 5b5166eedb28e48364c82c3fcf2d795983fe9fa8 941e8656001becbc52907ad541f2c61e461d865d be578831c2178be70f96067afc7f51dc08a513e3 +3ac46e79b1cfbcb5f09ff4306b26075dd60d14e0 From a709affc4d852b93d7957527560bf8e38ab6b05a Mon Sep 17 00:00:00 2001 From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:15:44 +0000 Subject: [PATCH 2/3] build(codegen): updating SDK --- changes.md | 28 +++++++++----- .../Carts/DiscountedLineItemPortionDraft.cs | 13 +++++++ .../Carts/IDiscountedLineItemPortionDraft.cs | 15 ++++++++ .../Orders/DiscountedLineItemPriceDraft.cs | 4 +- .../Orders/IDiscountedLineItemPriceDraft.cs | 4 +- ...ntedLineItemPortionDraftQueryBuilderDsl.cs | 38 +++++++++++++++++++ ...ountedLineItemPriceDraftQueryBuilderDsl.cs | 4 +- references.txt | 1 + 8 files changed, 91 insertions(+), 16 deletions(-) create mode 100644 commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/DiscountedLineItemPortionDraft.cs create mode 100644 commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/IDiscountedLineItemPortionDraft.cs create mode 100644 commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Carts/DiscountedLineItemPortionDraftQueryBuilderDsl.cs diff --git a/changes.md b/changes.md index 5a93ea4eee2..e475995171d 100644 --- a/changes.md +++ b/changes.md @@ -3,6 +3,7 @@
Added Type(s) +- added type `DiscountedLineItemPortionDraft` - added type `DiscountCodeSetKeyAction` - added type `CartDiscountCreatedMessage` - added type `CartDiscountDeletedMessage` @@ -23,6 +24,23 @@
+
+Changed Property(s) + +- :warning: changed property `includedDiscounts` of type `DiscountedLineItemPriceDraft` from type `DiscountedLineItemPortion[]` to `DiscountedLineItemPortionDraft[]` +
+ + +
+Added Property(s) + +- added property `perMethodExternalTaxRate` to type `CartAddLineItemAction` +- added property `key` to type `DiscountCode` +- added property `key` to type `DiscountCodeDraft` +- added property `shippingMode` to type `MyCartDraft` +
+ +
Added Method(s) @@ -39,13 +57,3 @@ - added resource `/{projectKey}/discount-codes/key={key}`
- -
-Added Property(s) - -- added property `perMethodExternalTaxRate` to type `CartAddLineItemAction` -- added property `key` to type `DiscountCode` -- added property `key` to type `DiscountCodeDraft` -- added property `shippingMode` to type `MyCartDraft` -
- diff --git a/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/DiscountedLineItemPortionDraft.cs b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/DiscountedLineItemPortionDraft.cs new file mode 100644 index 00000000000..139c2bc398c --- /dev/null +++ b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/DiscountedLineItemPortionDraft.cs @@ -0,0 +1,13 @@ +using commercetools.Sdk.Api.Models.Common; + + +namespace commercetools.Sdk.Api.Models.Carts +{ + + public partial class DiscountedLineItemPortionDraft : IDiscountedLineItemPortionDraft + { + public IReference Discount { get; set; } + + public ITypedMoneyDraft DiscountedAmount { get; set; } + } +} diff --git a/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/IDiscountedLineItemPortionDraft.cs b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/IDiscountedLineItemPortionDraft.cs new file mode 100644 index 00000000000..f06d1d24e2a --- /dev/null +++ b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Carts/IDiscountedLineItemPortionDraft.cs @@ -0,0 +1,15 @@ +using commercetools.Sdk.Api.Models.Common; +using commercetools.Base.CustomAttributes; + +// ReSharper disable CheckNamespace +namespace commercetools.Sdk.Api.Models.Carts +{ + [DeserializeAs(typeof(commercetools.Sdk.Api.Models.Carts.DiscountedLineItemPortionDraft))] + public partial interface IDiscountedLineItemPortionDraft + { + IReference Discount { get; set; } + + ITypedMoneyDraft DiscountedAmount { get; set; } + + } +} diff --git a/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/DiscountedLineItemPriceDraft.cs b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/DiscountedLineItemPriceDraft.cs index 9d5341aec4e..70789f2e327 100644 --- a/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/DiscountedLineItemPriceDraft.cs +++ b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/DiscountedLineItemPriceDraft.cs @@ -11,8 +11,8 @@ public partial class DiscountedLineItemPriceDraft : IDiscountedLineItemPriceDraf { public IMoney Value { get; set; } - public IList IncludedDiscounts { get; set; } - public IEnumerable IncludedDiscountsEnumerable { set => IncludedDiscounts = value.ToList(); } + public IList IncludedDiscounts { get; set; } + public IEnumerable IncludedDiscountsEnumerable { set => IncludedDiscounts = value.ToList(); } } } diff --git a/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/IDiscountedLineItemPriceDraft.cs b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/IDiscountedLineItemPriceDraft.cs index ba1af5c3472..77e3ef88259 100644 --- a/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/IDiscountedLineItemPriceDraft.cs +++ b/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Orders/IDiscountedLineItemPriceDraft.cs @@ -12,8 +12,8 @@ public partial interface IDiscountedLineItemPriceDraft { IMoney Value { get; set; } - IList IncludedDiscounts { get; set; } - IEnumerable IncludedDiscountsEnumerable { set => IncludedDiscounts = value.ToList(); } + IList IncludedDiscounts { get; set; } + IEnumerable IncludedDiscountsEnumerable { set => IncludedDiscounts = value.ToList(); } } diff --git a/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Carts/DiscountedLineItemPortionDraftQueryBuilderDsl.cs b/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Carts/DiscountedLineItemPortionDraftQueryBuilderDsl.cs new file mode 100644 index 00000000000..a031f1fe68e --- /dev/null +++ b/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Carts/DiscountedLineItemPortionDraftQueryBuilderDsl.cs @@ -0,0 +1,38 @@ +using System; + +// ReSharper disable CheckNamespace +namespace commercetools.Sdk.Api.Predicates.Query.Carts +{ + + public partial class DiscountedLineItemPortionDraftQueryBuilderDsl + { + public DiscountedLineItemPortionDraftQueryBuilderDsl() + { + } + + public static DiscountedLineItemPortionDraftQueryBuilderDsl Of() + { + return new DiscountedLineItemPortionDraftQueryBuilderDsl(); + } + + public CombinationQueryPredicate Discount( + Func> fn) + { + return new CombinationQueryPredicate(ContainerQueryPredicate.Of() + .Parent(ConstantQueryPredicate.Of().Constant("discount")) + .Inner(fn.Invoke(commercetools.Sdk.Api.Predicates.Query.Common.ReferenceQueryBuilderDsl.Of())), + DiscountedLineItemPortionDraftQueryBuilderDsl.Of); + } + + public CombinationQueryPredicate DiscountedAmount( + Func> fn) + { + return new CombinationQueryPredicate(ContainerQueryPredicate.Of() + .Parent(ConstantQueryPredicate.Of().Constant("discountedAmount")) + .Inner(fn.Invoke(commercetools.Sdk.Api.Predicates.Query.Common.TypedMoneyDraftQueryBuilderDsl.Of())), + DiscountedLineItemPortionDraftQueryBuilderDsl.Of); + } + + + } +} diff --git a/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Orders/DiscountedLineItemPriceDraftQueryBuilderDsl.cs b/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Orders/DiscountedLineItemPriceDraftQueryBuilderDsl.cs index 7ac863df068..f930cdcd147 100644 --- a/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Orders/DiscountedLineItemPriceDraftQueryBuilderDsl.cs +++ b/commercetools.Sdk/commercetools.Sdk.Api/Predicates/Query/Generated/Orders/DiscountedLineItemPriceDraftQueryBuilderDsl.cs @@ -25,11 +25,11 @@ public CombinationQueryPredicate Va } public CombinationQueryPredicate IncludedDiscounts( - Func> fn) + Func> fn) { return new CombinationQueryPredicate(ContainerQueryPredicate.Of() .Parent(ConstantQueryPredicate.Of().Constant("includedDiscounts")) - .Inner(fn.Invoke(commercetools.Sdk.Api.Predicates.Query.Carts.DiscountedLineItemPortionQueryBuilderDsl.Of())), + .Inner(fn.Invoke(commercetools.Sdk.Api.Predicates.Query.Carts.DiscountedLineItemPortionDraftQueryBuilderDsl.Of())), DiscountedLineItemPriceDraftQueryBuilderDsl.Of); } public ICollectionPredicateBuilder IncludedDiscounts() diff --git a/references.txt b/references.txt index 1b72395a7ed..a496b854a3a 100644 --- a/references.txt +++ b/references.txt @@ -219,3 +219,4 @@ d10443de67d8c8e684b4e63415b5720fc3bcf169 941e8656001becbc52907ad541f2c61e461d865d be578831c2178be70f96067afc7f51dc08a513e3 3ac46e79b1cfbcb5f09ff4306b26075dd60d14e0 +ffed231e91d01608e1bb08ecc1883cf00d9d9293 From 66235041cc3ceee223a6ca6bb6dfbda345954059 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Fri, 16 Feb 2024 14:06:10 +0100 Subject: [PATCH 3/3] add response body to exception message --- .../commercetools.Base.Client/ExceptionFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commercetools.Sdk/commercetools.Base.Client/ExceptionFactory.cs b/commercetools.Sdk/commercetools.Base.Client/ExceptionFactory.cs index 8f224e9c97f..b2f23c95d09 100644 --- a/commercetools.Sdk/commercetools.Base.Client/ExceptionFactory.cs +++ b/commercetools.Sdk/commercetools.Base.Client/ExceptionFactory.cs @@ -33,7 +33,7 @@ private static ApiHttpException CreateServerException(HttpRequestMessage request { var statusCode = (int)response.StatusCode; var body = response.ExtractResponseBody(); - var message = $"Server error response {request.RequestUri} {statusCode} {response.ReasonPhrase}"; + var message = $"Server error response {request.RequestUri} {statusCode} {response.ReasonPhrase} {body}"; List> t = new List>(); var headers = new ApiHttpHeaders(response.Headers.SelectMany(pair => pair.Value.Select(v => new KeyValuePair(pair.Key, v))).ToList()); switch (statusCode) @@ -60,7 +60,7 @@ private static ApiHttpException CreateClientException(HttpRequestMessage request { var statusCode = (int)response.StatusCode; var body = response.ExtractResponseBody(); - var message = $"Client error response {request.RequestUri} {statusCode} {response.ReasonPhrase}"; + var message = $"Client error response {request.RequestUri} {statusCode} {response.ReasonPhrase} {body}"; var headers = new ApiHttpHeaders(response.Headers.SelectMany(pair => pair.Value.Select(v => new KeyValuePair(pair.Key, v))).ToList()); switch (statusCode) {