Skip to content

Commit da3f652

Browse files
author
mvgreen
committed
Remove redundant utility extensions
1 parent eb7756f commit da3f652

5 files changed

Lines changed: 12 additions & 55 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/dto/custom/CustomAppRequest.kt

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -274,23 +274,14 @@ data class CustomAppRequest(
274274
)
275275

276276
data class AttributeValue(
277-
val id: Int? = null,
278-
val name: String? = null,
279-
val type: AttributeType? = null,
280-
val value: String? = null,
281-
val show: AttributeValueLocation? = null
282-
) {
283-
284-
fun FetchedAttributeValue.ofOrder() =
285-
AttributeValue(
286-
id = id,
287-
name = name,
288-
type = type,
289-
value = value,
290-
show = show
291-
)
292-
293-
fun Collection<FetchedAttributeValue>.ofOrder() = this.map { it.ofOrder() }
277+
override val id: Int? = null,
278+
override val name: String? = null,
279+
override val type: AttributeType? = null,
280+
override val value: String? = null,
281+
override val show: AttributeValueLocation? = null
282+
): FetchedAttributeValue {
283+
284+
fun Collection<FetchedAttributeValue>.otOrderAttributeList() = this.map { it as AttributeValue}
294285

295286
}
296287

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,7 @@ data class UpdatedProduct(
279279
override val value: String? = null
280280
) : UpdatedAttributeValue {
281281

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() }
282+
fun Collection<UpdatedAttributeValue>.toProductAttributeList() = this.map { it as AttributeValue }
291283

292284
companion object {
293285

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,7 @@ data class FetchedProduct(
242242
override val show: AttributeValueLocation? = null
243243
) : FetchedAttributeValue {
244244

245-
fun FetchedAttributeValue.ofProduct() =
246-
AttributeValue(
247-
id = id,
248-
name = name,
249-
type = type,
250-
value = value,
251-
show = show
252-
)
253-
254-
fun Collection<FetchedAttributeValue>.ofProduct() = this.map { it.ofProduct() }
245+
fun Collection<FetchedAttributeValue>.toProductAttributeList() = this.map { it as AttributeValue }
255246

256247
}
257248

src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@ data class UpdatedVariation(
4141
override val value: String? = null
4242
) : UpdatedAttributeValue {
4343

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() }
44+
fun Collection<UpdatedAttributeValue>.toVariationAttributeList() = this.map { it as AttributeValue }
5345

5446
}
5547

src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,7 @@ data class FetchedVariation(
5757
override val show: AttributeValueLocation? = null
5858
) : FetchedAttributeValue {
5959

60-
fun FetchedAttributeValue.ofVariation() =
61-
AttributeValue(
62-
id = id,
63-
name = name,
64-
type = type,
65-
value = value,
66-
show = show
67-
)
68-
69-
fun Collection<FetchedAttributeValue>.ofVariation() = this.map { it.ofVariation() }
60+
fun Collection<FetchedAttributeValue>.toVariationAttributeList() = this.map { it as AttributeValue }
7061

7162
}
7263

0 commit comments

Comments
 (0)