Skip to content

Commit

Permalink
ECWID-116234 Implement alt-text support for all category images | Add…
Browse files Browse the repository at this point in the history
… alt text proprety in ecwid-java-api-client for category
  • Loading branch information
ZimuZhengLightspeed committed Dec 4, 2023
1 parent 118d216 commit 06fcd83
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ fun FetchedCategory.toUpdated(): UpdatedCategory {
seoTitle = seoTitle,
seoTitleTranslated = seoTitleTranslated,
seoDescription = seoDescription,
seoDescriptionTranslated = seoDescriptionTranslated
seoDescriptionTranslated = seoDescriptionTranslated,
imageAlt = imageAlt?.toUpdated()
)
}

fun FetchedCategory.Alt.toUpdated() = UpdatedCategory.Alt(
main = main,
translated = translated
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ data class UpdatedCategory(
val seoTitle: String? = null,
val seoTitleTranslated: LocalizedValueMap? = null,
val seoDescription: String? = null,
val seoDescriptionTranslated: LocalizedValueMap? = null
val seoDescriptionTranslated: LocalizedValueMap? = null,
val imageAlt: Alt? = null
) : ApiUpdatedDTO {

override fun getModifyKind() = ModifyKind.ReadWrite(FetchedCategory::class)

data class Alt(
val main: String? = null,
val translated: LocalizedValueMap? = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ data class FetchedCategory(
val seoTitle: String? = null,
val seoTitleTranslated: LocalizedValueMap? = null,
val seoDescription: String? = null,
val seoDescriptionTranslated: LocalizedValueMap? = null
val seoDescriptionTranslated: LocalizedValueMap? = null,
val imageAlt: Alt? = null
) : ApiFetchedDTO, ApiResultDTO {

override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedCategory::class)

data class Alt(
val main: String? = null,
val translated: LocalizedValueMap? = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ val fetchedCategoryNullablePropertyRules: List<NullablePropertyRule<*, *>> = lis
AllowNullable(FetchedCategory::seoTitle),
AllowNullable(FetchedCategory::seoTitleTranslated),
AllowNullable(FetchedCategory::seoDescription),
AllowNullable(FetchedCategory::seoDescriptionTranslated)
AllowNullable(FetchedCategory::seoDescriptionTranslated),
AllowNullable(FetchedCategory::imageAlt),
AllowNullable(FetchedCategory.Alt::main),
AllowNullable(FetchedCategory.Alt::translated)
)

0 comments on commit 06fcd83

Please sign in to comment.