Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecwid 116234 api client change #362

Merged
merged 7 commits into from
Jan 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fun FetchedCategory.toUpdated(): UpdatedCategory {
seoTitle = seoTitle,
seoTitleTranslated = seoTitleTranslated,
seoDescription = seoDescription,
seoDescriptionTranslated = seoDescriptionTranslated
seoDescriptionTranslated = seoDescriptionTranslated,
alt = alt?.toUpdated(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ fun FetchedProduct.ProductImage.toUpdated() = UpdatedProduct.ProductImage(
alt = alt?.toUpdated()
)

fun FetchedProduct.ProductImage.Alt.toUpdated() = UpdatedProduct.ProductImage.Alt(
main = main,
translated = translated
)

fun FetchedProduct.TaxInfo.toUpdated() = UpdatedProduct.TaxInfo(
taxable = taxable,
enabledManualTaxes = enabledManualTaxes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.ecwid.apiclient.v3.dto.category.result.FetchedCategory
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

data class UpdatedCategory(
val parentId: Int? = null,
Expand All @@ -18,8 +19,10 @@ data class UpdatedCategory(
val seoTitle: String? = null,
val seoTitleTranslated: LocalizedValueMap? = null,
val seoDescription: String? = null,
val seoDescriptionTranslated: LocalizedValueMap? = null
val seoDescriptionTranslated: LocalizedValueMap? = null,
val alt: UpdatedAlt? = null
) : ApiUpdatedDTO {

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.ecwid.apiclient.v3.dto.category.request.UpdatedCategory
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO
import com.ecwid.apiclient.v3.dto.common.FetchedAlt
import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
import com.ecwid.apiclient.v3.dto.common.PictureInfo

Expand Down Expand Up @@ -32,8 +33,10 @@ data class FetchedCategory(
val seoTitle: String? = null,
val seoTitleTranslated: LocalizedValueMap? = null,
val seoDescription: String? = null,
val seoDescriptionTranslated: LocalizedValueMap? = null
val seoDescriptionTranslated: LocalizedValueMap? = null,
val alt: FetchedAlt? = null
) : ApiFetchedDTO, ApiResultDTO {

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

}
18 changes: 18 additions & 0 deletions src/main/kotlin/com/ecwid/apiclient/v3/dto/common/Alt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.ecwid.apiclient.v3.dto.common

data class FetchedAlt(
val main: String? = null,
val translated: LocalizedValueMap? = null,
) {
fun toUpdated(): UpdatedAlt {
return UpdatedAlt(
main = main,
translated = translated
)
}
}

data class UpdatedAlt(
val main: String? = null,
val translated: LocalizedValueMap? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,8 @@ data class UpdatedProduct(
data class ProductImage(
val id: String = "0",
val orderBy: Int = 0,
val alt: Alt? = null
) {
data class Alt(
val main: String? = null,
val translated: LocalizedValueMap? = null
)
}
val alt: UpdatedAlt? = null
)

override fun getModifyKind() = ModifyKind.ReadWrite(FetchedProduct::class)
}
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,8 @@ data class FetchedProduct(
val image800pxUrl: String? = null,
val image1500pxUrl: String? = null,
val imageOriginalUrl: String? = null,
val alt: Alt? = null
) {
data class Alt(
val main: String? = null,
val translated: LocalizedValueMap? = null
)
}
val alt: FetchedAlt? = null
)

data class ProductVideo(
val id: String = "0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ecwid.apiclient.v3.rule.nullablepropertyrules

import com.ecwid.apiclient.v3.dto.category.result.FetchedCategory
import com.ecwid.apiclient.v3.dto.common.FetchedAlt
import com.ecwid.apiclient.v3.rule.NullablePropertyRule
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.IgnoreNullable
Expand All @@ -25,5 +26,8 @@ val fetchedCategoryNullablePropertyRules: List<NullablePropertyRule<*, *>> = lis
AllowNullable(FetchedCategory::seoTitle),
AllowNullable(FetchedCategory::seoTitleTranslated),
AllowNullable(FetchedCategory::seoDescription),
AllowNullable(FetchedCategory::seoDescriptionTranslated)
AllowNullable(FetchedCategory::seoDescriptionTranslated),
AllowNullable(FetchedCategory::alt),
ZimuZhengLightspeed marked this conversation as resolved.
Show resolved Hide resolved
AllowNullable(FetchedAlt::main),
AllowNullable(FetchedAlt::translated),
)
Original file line number Diff line number Diff line change
@@ -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.product.result.FetchedProduct
import com.ecwid.apiclient.v3.rule.NullablePropertyRule
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
Expand Down Expand Up @@ -99,8 +100,8 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
IgnoreNullable(FetchedProduct.ProductImage::image800pxUrl),
IgnoreNullable(FetchedProduct.ProductImage::imageOriginalUrl),
AllowNullable(FetchedProduct.ProductImage::alt),
AllowNullable(FetchedProduct.ProductImage.Alt::main),
ZimuZhengLightspeed marked this conversation as resolved.
Show resolved Hide resolved
AllowNullable(FetchedProduct.ProductImage.Alt::translated),
AllowNullable(FetchedAlt::main),
AllowNullable(FetchedAlt::translated),
AllowNullable(FetchedProduct.ProductVideo::videoCoverId),
AllowNullable(FetchedProduct.ProductVideo::image160pxUrl),
AllowNullable(FetchedProduct.ProductVideo::image400pxUrl),
Expand Down