From 2d4f9dc52fc44abdb8e38b8ab02583296382a316 Mon Sep 17 00:00:00 2001 From: Zimu Zheng Date: Tue, 13 Feb 2024 13:35:41 +0100 Subject: [PATCH 1/2] ECWID-116235 Implement alt-text support for variation images | Add alt property for variation --- .../com/ecwid/apiclient/v3/converter/FetchedCombination.kt | 1 + .../apiclient/v3/dto/variation/request/UpdatedVariation.kt | 2 ++ .../ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt index a12c2c6a2..82824119e 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt @@ -37,6 +37,7 @@ fun FetchedVariation.toUpdated(): UpdatedVariation { customsHsTariffCode = customsHsTariffCode, subscriptionSettings = subscriptionSettings?.toUpdated(), + alt = alt?.toUpdated() ) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt index f234fed7e..d7d10c7d8 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt @@ -3,6 +3,7 @@ package com.ecwid.apiclient.v3.dto.variation.request import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap +import com.ecwid.apiclient.v3.dto.common.UpdatedAlt import com.ecwid.apiclient.v3.dto.common.UpdatedAttributeValue import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueAlias import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueLocation @@ -41,6 +42,7 @@ data class UpdatedVariation( val customsHsTariffCode: String? = null, val subscriptionSettings: SubscriptionSettings? = null, + val alt: UpdatedAlt? = null, ) : ApiUpdatedDTO { data class AttributeValue( diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt index e144c6a8b..e20419b2a 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt @@ -2,6 +2,7 @@ package com.ecwid.apiclient.v3.dto.variation.result import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind +import com.ecwid.apiclient.v3.dto.common.FetchedAlt import com.ecwid.apiclient.v3.dto.common.FetchedAttributeValue import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueLocation @@ -56,6 +57,7 @@ data class FetchedVariation( val customsHsTariffCode: String? = null, val subscriptionSettings: SubscriptionSettings? = null, + val alt: FetchedAlt? = null, ) : ApiFetchedDTO { data class AttributeValue( From a185637bf25ba2731b3891e91b7a448444db7889 Mon Sep 17 00:00:00 2001 From: Zimu Zheng Date: Tue, 13 Feb 2024 13:37:40 +0100 Subject: [PATCH 2/2] ECWID-116235 Implement alt-text support for variation images | Unit test --- .../v3/rule/nullablepropertyrules/FetchedVariationRules.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt index 535500cf9..0f5457c0e 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt @@ -1,5 +1,6 @@ package com.ecwid.apiclient.v3.rule.nullablepropertyrules +import com.ecwid.apiclient.v3.dto.common.FetchedAlt import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation import com.ecwid.apiclient.v3.rule.NullablePropertyRule import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable @@ -72,4 +73,7 @@ val fetchedVariationTypeNullablePropertyRules: List> AllowNullable(FetchedVariation.SubscriptionSettings::oneTimePurchasePrice), IgnoreNullable(FetchedVariation.SubscriptionSettings::oneTimePurchasePriceFormatted), AllowNullable(FetchedVariation::locationInventory), + AllowNullable(FetchedVariation::alt), + AllowNullable(FetchedAlt::main), + AllowNullable(FetchedAlt::translated), )