File tree Expand file tree Collapse file tree
src/main/kotlin/com/ecwid/apiclient/v3/dto Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com.ecwid.apiclient.v3.dto.common
2+
3+ import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueAlias
4+
5+ interface UpdatedAttributeValue {
6+ val id: Int?
7+ val alias: AttributeValueAlias ?
8+ val name: String?
9+ val value: String?
10+ }
Original file line number Diff line number Diff line change 11package com.ecwid.apiclient.v3.dto.product.request
22
3- import com.ecwid.apiclient.v3.dto.common.NullableUpdatedValue
4- import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO
3+ import com.ecwid.apiclient.v3.dto.common.*
54import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind
6- import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
7- import com.ecwid.apiclient.v3.dto.common.ProductCondition
85import com.ecwid.apiclient.v3.dto.product.enums.*
96import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
107
@@ -276,11 +273,21 @@ data class UpdatedProduct(
276273 )
277274
278275 data class AttributeValue internal constructor(
279- val id : Int? = null ,
280- val alias : AttributeValueAlias ? = null ,
281- val name : String? = null ,
282- val value : String? = null
283- ) {
276+ override val id : Int? = null ,
277+ override val alias : AttributeValueAlias ? = null ,
278+ override val name : String? = null ,
279+ override val value : String? = null
280+ ): UpdatedAttributeValue {
281+
282+ fun UpdatedAttributeValue.ofProduct () =
283+ AttributeValue (
284+ id = id,
285+ alias = alias,
286+ name = name,
287+ value = value
288+ )
289+
290+ fun Collection<UpdatedAttributeValue>.ofProduct () = this .map { it.ofProduct() }
284291
285292 companion object {
286293
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package com.ecwid.apiclient.v3.dto.variation.request
22
33import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO
44import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind
5+ import com.ecwid.apiclient.v3.dto.common.UpdatedAttributeValue
56import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueAlias
67import com.ecwid.apiclient.v3.dto.product.enums.OutOfStockVisibilityBehaviour
78import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation
@@ -34,11 +35,23 @@ data class UpdatedVariation(
3435) : ApiUpdatedDTO {
3536
3637 data class AttributeValue (
37- val id : Int? = null ,
38- val alias : AttributeValueAlias ? = null ,
39- val name : String? = null ,
40- val value : String? = null
41- )
38+ override val id : Int? = null ,
39+ override val alias : AttributeValueAlias ? = null ,
40+ override val name : String? = null ,
41+ override val value : String? = null
42+ ) : UpdatedAttributeValue {
43+
44+ fun UpdatedAttributeValue.ofVariation () =
45+ AttributeValue (
46+ id = id,
47+ alias = alias,
48+ name = name,
49+ value = value
50+ )
51+
52+ fun Collection<UpdatedAttributeValue>.ofVariation () = this .map { it.ofVariation() }
53+
54+ }
4255
4356 data class WholesalePrice (
4457 val quantity : Int = 0 ,
You can’t perform that action at this time.
0 commit comments