Skip to content

Commit

Permalink
Merge pull request #341 from Ecwid/report-additional-data
Browse files Browse the repository at this point in the history
Add additionalData to FetchedReportResponse
  • Loading branch information
mvgreen authored Oct 20, 2023
2 parents 547162b + 5c35c41 commit 63150f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/kotlin/com/ecwid/apiclient/v3/ApiClientHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ private fun createAdditionalDataPolymorphicType(): PolymorphicType<FetchedReport
jsonFieldName = "type",
childClasses = mapOf(
"utm" to FetchedReportResponse.FetchedAdditionalData.AdditionalUtmData::class.java,
"orders" to FetchedReportResponse.FetchedAdditionalData.AdditionalOrdersData::class.java,
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data class FetchedReportResponse(
val dataset: List<FetchedDataset>? = null,
val comparePeriodAggregatedData: List<FetchedDataItem>? = null,
val comparePeriodDataset: List<FetchedDataset>? = null,
val additionalData: FetchedAdditionalData? = null,
) : ApiFetchedDTO {

data class FetchedDataset(
Expand All @@ -41,8 +42,13 @@ data class FetchedReportResponse(
val utmList: List<FetchedUtmDataItem> = emptyList(),
) : FetchedAdditionalData(AdditionalDataType.UTM)

data class AdditionalOrdersData(
val ordersCount: Int = 0,
) : FetchedAdditionalData(AdditionalDataType.ORDERS)

enum class AdditionalDataType {
UTM
UTM,
ORDERS
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(FetchedReportResponse::dataset),
AllowNullable(FetchedReportResponse::comparePeriodAggregatedData),
AllowNullable(FetchedReportResponse::comparePeriodDataset),
AllowNullable(FetchedReportResponse::additionalData),

AllowNullable(FetchedReportResponse.FetchedDataset::startTimeStamp),
AllowNullable(FetchedReportResponse.FetchedDataset::endTimeStamp),
Expand Down

0 comments on commit 63150f3

Please sign in to comment.