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 11package com.ecwid.apiclient.v3.dto.common
22
3+ import com.ecwid.apiclient.v3.dto.custom.CustomAppRequest
34import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueLocation
5+ import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
46import com.ecwid.apiclient.v3.dto.producttype.enums.AttributeType
7+ import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation
58
6- interface FetchedAttributeValue < T : FetchedAttributeValue < T >> {
9+ interface FetchedAttributeValue {
710 val id: Int?
811 val name: String?
912 val type: AttributeType ?
1013 val value: String?
1114 val show: AttributeValueLocation ?
1215
13- fun cast (): T
16+ fun toProductAttribute () = FetchedProduct .AttributeValue (
17+ id = id,
18+ name = name,
19+ type = type,
20+ value = value,
21+ show = show,
22+ )
23+
24+ fun toVariationAttribute () = FetchedVariation .AttributeValue (
25+ id = id,
26+ name = name,
27+ type = type,
28+ value = value,
29+ show = show,
30+ )
31+
32+ fun toOrderAttribute () = CustomAppRequest .AttributeValue (
33+ id = id,
34+ name = name,
35+ type = type,
36+ value = value,
37+ show = show,
38+ )
1439
1540}
Original file line number Diff line number Diff line change 11package com.ecwid.apiclient.v3.dto.common
22
33import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueAlias
4+ import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
5+ import com.ecwid.apiclient.v3.dto.variation.request.UpdatedVariation
46
5- interface UpdatedAttributeValue < T : UpdatedAttributeValue < T >> {
7+ interface UpdatedAttributeValue {
68 val id: Int?
79 val alias: AttributeValueAlias ?
810 val name: String?
911 val value: String?
1012
11- fun cast (): T
13+ fun toProductAttribute () = UpdatedProduct .AttributeValue (
14+ id = id,
15+ alias = alias,
16+ name = name,
17+ value = value,
18+ )
19+
20+ fun toVariationAttribute () = UpdatedVariation .AttributeValue (
21+ id = id,
22+ alias = alias,
23+ name = name,
24+ value = value,
25+ )
1226
1327}
Original file line number Diff line number Diff line change @@ -282,16 +282,7 @@ data class CustomAppRequest(
282282 override val type : AttributeType ? = null ,
283283 override val value : String? = null ,
284284 override val show : AttributeValueLocation ? = null
285- ) : FetchedAttributeValue<AttributeValue> {
286-
287- override fun cast () = AttributeValue (
288- id = id,
289- name = name,
290- type = type,
291- value = value,
292- show = show
293- )
294- }
285+ ) : FetchedAttributeValue
295286
296287 data class ProductDimensions (
297288 val length : Double? = null ,
Original file line number Diff line number Diff line change @@ -277,14 +277,7 @@ data class UpdatedProduct(
277277 override val alias : AttributeValueAlias ? = null ,
278278 override val name : String? = null ,
279279 override val value : String? = null
280- ) : UpdatedAttributeValue<AttributeValue> {
281-
282- override fun cast () = AttributeValue (
283- id = id,
284- alias = alias,
285- name = name,
286- value = value,
287- )
280+ ) : UpdatedAttributeValue {
288281
289282 companion object {
290283
Original file line number Diff line number Diff line change @@ -240,16 +240,7 @@ data class FetchedProduct(
240240 override val type : AttributeType ? = null ,
241241 override val value : String? = null ,
242242 override val show : AttributeValueLocation ? = null
243- ) : FetchedAttributeValue<AttributeValue> {
244-
245- override fun cast () = AttributeValue (
246- id = id,
247- name = name,
248- type = type,
249- value = value,
250- show = show
251- )
252- }
243+ ) : FetchedAttributeValue
253244
254245 data class RelatedProducts (
255246 val productIds : List <Int >? = null ,
Original file line number Diff line number Diff line change @@ -39,15 +39,7 @@ data class UpdatedVariation(
3939 override val alias : AttributeValueAlias ? = null ,
4040 override val name : String? = null ,
4141 override val value : String? = null
42- ) : UpdatedAttributeValue<AttributeValue> {
43-
44- override fun cast () = AttributeValue (
45- id = id,
46- alias = alias,
47- name = name,
48- value = value,
49- )
50- }
42+ ) : UpdatedAttributeValue
5143
5244 data class WholesalePrice (
5345 val quantity : Int = 0 ,
Original file line number Diff line number Diff line change @@ -55,16 +55,7 @@ data class FetchedVariation(
5555 override val type : AttributeType ? = null ,
5656 override val value : String? = null ,
5757 override val show : AttributeValueLocation ? = null
58- ) : FetchedAttributeValue<AttributeValue> {
59-
60- override fun cast () = AttributeValue (
61- id = id,
62- name = name,
63- type = type,
64- value = value,
65- show = show
66- )
67- }
58+ ) : FetchedAttributeValue
6859
6960 data class WholesalePrice (
7061 val quantity : Int = 0 ,
You can’t perform that action at this time.
0 commit comments