Skip to content

Commit 858a0f6

Browse files
author
Vasily Karyaev
authored
Merge pull request #218 from Ecwid/latest_stats_counts
Added productCount and categoryCount fields to FetchedLatestStats
2 parents bdcee57 + 8e37572 commit 858a0f6

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/LatestStatsRequest.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ package com.ecwid.apiclient.v3.dto.profile.request
33
import com.ecwid.apiclient.v3.dto.ApiRequest
44
import com.ecwid.apiclient.v3.impl.RequestInfo
55

6-
class LatestStatsRequest : ApiRequest {
6+
data class LatestStatsRequest @JvmOverloads constructor(
7+
val productCountRequired: Boolean = false,
8+
val categoryCountRequired: Boolean = false,
9+
) : ApiRequest {
710

811
override fun toRequestInfo() = RequestInfo.createGetRequest(
912
pathSegments = listOf(
1013
"latest-stats"
14+
),
15+
params = mapOf(
16+
"productCountRequired" to productCountRequired.toString(),
17+
"categoryCountRequired" to categoryCountRequired.toString(),
1118
)
1219
)
1320
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedLatestStats.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ data class FetchedLatestStats(
1111
val categoriesUpdated: Date = Date(),
1212
val discountCouponsUpdated: Date = Date(),
1313
val abandonedSalesUpdated: Date = Date(),
14-
val customersUpdated: Date = Date()
14+
val customersUpdated: Date = Date(),
15+
val productCount: Int? = null,
16+
val categoryCount: Int? = null,
1517
) : ApiFetchedDTO {
1618

1719
override fun getModifyKind() = ModifyKind.ReadOnly

src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
1515
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.IgnoreNullable
1616
import com.ecwid.apiclient.v3.rule.nullablepropertyrules.*
1717
import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
18+
import com.ecwid.apiclient.v3.dto.profile.result.FetchedLatestStats
1819
import com.ecwid.apiclient.v3.dto.storage.result.FetchedStorageData
1920
import kotlin.reflect.KProperty1
2021

@@ -44,6 +45,9 @@ val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
4445
AllowNullable(FetchedProduct.ProductOption.ChoiceBased::defaultChoice),
4546
AllowNullable(FetchedProduct.ProductOption.CheckboxOption::defaultChoice),
4647

48+
AllowNullable(FetchedLatestStats::productCount),
49+
AllowNullable(FetchedLatestStats::categoryCount),
50+
4751
IgnoreNullable(ConvertCartToOrderResult::id),
4852
IgnoreNullable(ConvertCartToOrderResult::orderNumber),
4953
IgnoreNullable(ConvertCartToOrderResult::vendorOrderNumber),

0 commit comments

Comments
 (0)