From eb176253d1c2d5ed92b11eb217ee5d0df6c1e236 Mon Sep 17 00:00:00 2001 From: Vladimir Romanov Date: Wed, 3 Aug 2022 14:24:16 +0400 Subject: [PATCH 1/2] Adding new field productSkus to related products --- .../kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt | 1 + .../com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt | 1 + .../com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt | 1 + .../v3/rule/nullablepropertyrules/FetchedProductRules.kt | 1 + 4 files changed, 4 insertions(+) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt index 4a363865d..9f3707c60 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt @@ -183,6 +183,7 @@ private fun FetchedProduct.AttributeValue.toUpdated() = UpdatedProduct.Attribute private fun FetchedProduct.RelatedProducts.toUpdated() = UpdatedProduct.RelatedProducts( productIds = productIds, + productSkus = productSkus, relatedCategory = relatedCategory?.toUpdated() ) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt index b4b9e4f46..937b2a179 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt @@ -314,6 +314,7 @@ data class UpdatedProduct( data class RelatedProducts( val productIds: List? = null, + val productSkus: List? = null, val relatedCategory: RelatedCategory? = null ) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt index 6ec1dfe0c..806b3452d 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt @@ -237,6 +237,7 @@ data class FetchedProduct( data class RelatedProducts( val productIds: List? = null, + val productSkus: List? = null, val relatedCategory: RelatedCategory? = null ) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt index 82ff53f3b..803c17479 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt @@ -100,6 +100,7 @@ val fetchedProductNullablePropertyRules: List> = list IgnoreNullable(FetchedProduct.RelatedCategory::productCount), IgnoreNullable(FetchedProduct.RelatedProducts::productIds), IgnoreNullable(FetchedProduct.RelatedProducts::relatedCategory), + AllowNullable(FetchedProduct.RelatedProducts::productSkus), IgnoreNullable(FetchedProduct.Ribbon::color), IgnoreNullable(FetchedProduct.Ribbon::text), IgnoreNullable(FetchedProduct.ShippingSettings::disabledMethods), From 4b754ffd6b4c44e8b9a254982aa3a05dd6ce1e6b Mon Sep 17 00:00:00 2001 From: Vladimir Romanov Date: Wed, 3 Aug 2022 16:51:33 +0400 Subject: [PATCH 2/2] Add write only property --- .../kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt | 1 - .../com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt | 1 - .../com/ecwid/apiclient/v3/rule/NonDuplicablePropertyRules.kt | 1 + .../v3/rule/nullablepropertyrules/FetchedProductRules.kt | 1 - 4 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt index 9f3707c60..4a363865d 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt @@ -183,7 +183,6 @@ private fun FetchedProduct.AttributeValue.toUpdated() = UpdatedProduct.Attribute private fun FetchedProduct.RelatedProducts.toUpdated() = UpdatedProduct.RelatedProducts( productIds = productIds, - productSkus = productSkus, relatedCategory = relatedCategory?.toUpdated() ) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt index 806b3452d..6ec1dfe0c 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt @@ -237,7 +237,6 @@ data class FetchedProduct( data class RelatedProducts( val productIds: List? = null, - val productSkus: List? = null, val relatedCategory: RelatedCategory? = null ) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonDuplicablePropertyRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonDuplicablePropertyRules.kt index 85d973a79..550ad38bb 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonDuplicablePropertyRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonDuplicablePropertyRules.kt @@ -18,6 +18,7 @@ val nonDuplicablePropertyRules: List> = listOf( WriteOnly(UpdatedProduct.AttributeValue::name), WriteOnly(UpdatedVariation.AttributeValue::alias), WriteOnly(UpdatedVariation.AttributeValue::name), + WriteOnly(UpdatedProduct.RelatedProducts::productSkus), ) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt index 803c17479..82ff53f3b 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt @@ -100,7 +100,6 @@ val fetchedProductNullablePropertyRules: List> = list IgnoreNullable(FetchedProduct.RelatedCategory::productCount), IgnoreNullable(FetchedProduct.RelatedProducts::productIds), IgnoreNullable(FetchedProduct.RelatedProducts::relatedCategory), - AllowNullable(FetchedProduct.RelatedProducts::productSkus), IgnoreNullable(FetchedProduct.Ribbon::color), IgnoreNullable(FetchedProduct.Ribbon::text), IgnoreNullable(FetchedProduct.ShippingSettings::disabledMethods),