-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #439 from Ecwid/fix_report_advice
Have the same set of parameters for the report advises as for reports
- Loading branch information
Showing
4 changed files
with
75 additions
and
38 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/com/ecwid/apiclient/v3/dto/report/request/AbstractReportRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.ecwid.apiclient.v3.dto.report.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.dto.report.enums.* | ||
import com.ecwid.apiclient.v3.responsefields.ResponseFields | ||
|
||
abstract class AbstractReportRequest : ApiRequest { | ||
abstract val reportType: ReportType | ||
abstract val startedFrom: Long? | ||
abstract val endedAt: Long? | ||
abstract val timeScaleValue: TimeScaleValue? | ||
abstract val comparePeriod: ComparePeriod? | ||
abstract val firstDayOfWeek: FirstDayOfWeek? | ||
abstract val orderByMetric: String? | ||
abstract val orderDirection: String? | ||
abstract val limit: Int? | ||
abstract val offset: Int? | ||
abstract val responseFields: ResponseFields | ||
abstract val storefrontPlatform: StorefrontPlatform? | ||
|
||
protected fun toParams(): Map<String, String> { | ||
return mutableMapOf<String, String>().apply { | ||
startedFrom?.let { put("startedFrom", it.toString()) } | ||
endedAt?.let { put("endedAt", it.toString()) } | ||
timeScaleValue?.let { put("timeScaleValue", it.toString()) } | ||
comparePeriod?.let { put("comparePeriod", it.toString()) } | ||
firstDayOfWeek?.let { put("firstDayOfWeek", it.toString()) } | ||
orderByMetric?.let { put("orderByMetric", it) } | ||
orderDirection?.let { put("orderDirection", it) } | ||
limit?.let { put("limit", it.toString()) } | ||
offset?.let { put("offset", it.toString()) } | ||
storefrontPlatform?.let { put("storefrontPlatform", it.toString()) } | ||
}.toMap() | ||
} | ||
} |
20 changes: 15 additions & 5 deletions
20
src/main/kotlin/com/ecwid/apiclient/v3/dto/report/request/ReportAdviceRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters