Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.ecwid.apiclient.v3.dto.report.enums

enum class ComparePeriod(val alias: String) {
PREVIOUS_PERIOD("previousPeriod"),
SIMILAR_PERIOD_IN_PREVIOUS_WEEK("similarPeriodInPreviousWeek"),
SIMILAR_PERIOD_IN_PREVIOUS_MONTH("similarPeriodInPreviousMonth"),
SIMILAR_PERIOD_IN_PREVIOUS_YEAR("similarPeriodInPreviousYear"),
NO_COMPARE_PERIOD("noComparePeriod");
enum class ComparePeriod {
previousPeriod,
similarPeriodInPreviousWeek,
similarPeriodInPreviousMonth,
similarPeriodInPreviousYear,
noComparePeriod;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ecwid.apiclient.v3.dto.report.enums

enum class FirstDayOfWeek(val alias: String) {
MONDAY("monday"),
SUNDAY("sunday");
enum class FirstDayOfWeek {
monday,
sunday;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ecwid.apiclient.v3.dto.report.enums

enum class ReportType(val alias: String) {
ALL_TRAFFIC("allTraffic"),
NEW_VS_RETURNING_VISITORS("newVsReturningVisitors"),
enum class ReportType {
allTraffic,
newVsReturningVisitors,
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.ecwid.apiclient.v3.dto.report.enums

enum class TimeScaleValue(val alias: String) {
HOUR("hour"),
DAY("day"),
WEEK("week"),
MONTH("month"),
YEAR("year");
enum class TimeScaleValue {
hour,
day,
week,
month,
year;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.ecwid.apiclient.v3.dto.report.enums.TimeScaleValue
import com.ecwid.apiclient.v3.impl.RequestInfo

data class ReportRequest(
val reportType: ReportType = ReportType.ALL_TRAFFIC,
val reportType: ReportType = ReportType.allTraffic,
val startedFrom: Long? = null,
val endedAt: Long? = null,
val timeScaleValue: TimeScaleValue? = null,
Expand All @@ -19,7 +19,7 @@ data class ReportRequest(
override fun toRequestInfo() = RequestInfo.createGetRequest(
pathSegments = listOf(
"reports",
reportType.alias,
reportType.toString(),
),
params = toParams()
)
Expand All @@ -28,9 +28,9 @@ data class ReportRequest(
return mutableMapOf<String, String>().apply {
startedFrom?.let { put("startedFrom", it.toString()) }
endedAt?.let { put("endedAt", it.toString()) }
timeScaleValue?.let { put("timeScaleValue", it.alias) }
comparePeriod?.let { put("comparePeriod", it.alias) }
firstDayOfWeek?.let { put("firstDayOfWeek", it.alias) }
timeScaleValue?.let { put("timeScaleValue", it.toString()) }
comparePeriod?.let { put("comparePeriod", it.toString()) }
firstDayOfWeek?.let { put("firstDayOfWeek", it.toString()) }
}.toMap()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.ecwid.apiclient.v3.dto.report.enums.ReportType
import com.ecwid.apiclient.v3.dto.report.enums.TimeScaleValue

data class FetchedReportResponse(
val reportType: ReportType = ReportType.ALL_TRAFFIC,
val reportType: ReportType = ReportType.allTraffic,
val startedFrom: Long = 0,
val endedAt: Long = 0,
val timeScaleValue: TimeScaleValue? = null,
Expand Down