Skip to content

Commit 3d5588b

Browse files
authored
Merge pull request #374 from Ecwid/additional_data_for_products
Add new FetchedAdditionalData for inventory report
2 parents 5d75eb1 + d373c0b commit 3d5588b

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/ApiClientHelper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ private fun createAdditionalDataPolymorphicType(): PolymorphicType<FetchedReport
530530
"utm" to FetchedReportResponse.FetchedAdditionalData.AdditionalUtmData::class.java,
531531
"orders" to FetchedReportResponse.FetchedAdditionalData.AdditionalOrdersData::class.java,
532532
"customers" to FetchedReportResponse.FetchedAdditionalData.AdditionalCustomerData::class.java,
533+
"product" to FetchedReportResponse.FetchedAdditionalData.AdditionalInventoryData::class.java
533534
)
534535
)
535536
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/report/result/FetchedReportResponse.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,19 @@ data class FetchedReportResponse(
5050
val customerData: FetchedCustomerData = FetchedCustomerData(),
5151
) : FetchedAdditionalData(AdditionalDataType.CUSTOMERS)
5252

53+
data class AdditionalInventoryData(
54+
val productId: Int = 0,
55+
val sku: String? = null,
56+
val imageUrl: String? = null,
57+
val thumbnailUrl: String? = null,
58+
val exampleOrder: String? = null,
59+
) : FetchedAdditionalData(AdditionalDataType.PRODUCT)
60+
5361
enum class AdditionalDataType {
5462
UTM,
5563
ORDERS,
5664
CUSTOMERS,
65+
PRODUCT,
5766
}
5867
}
5968

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
9494
AllowNullable(FetchedReportResponse.FetchedCustomerData::customerEmail),
9595
AllowNullable(FetchedReportResponse.FetchedCustomerData::customerPhone),
9696

97+
AllowNullable(FetchedReportResponse.FetchedAdditionalData.AdditionalInventoryData::sku),
98+
AllowNullable(FetchedReportResponse.FetchedAdditionalData.AdditionalInventoryData::imageUrl),
99+
AllowNullable(FetchedReportResponse.FetchedAdditionalData.AdditionalInventoryData::thumbnailUrl),
100+
AllowNullable(FetchedReportResponse.FetchedAdditionalData.AdditionalInventoryData::exampleOrder),
101+
97102
AllowNullable(CreateBatchRequest::groupId),
98103
AllowNullable(CreateBatchRequestWithIds::groupId),
99104

0 commit comments

Comments
 (0)