Skip to content

Commit 4ef783d

Browse files
authored
Merge pull request #223 from Ecwid/additional-product-search-parameters
Add baseUrl, cleanUrls and lang parameters to ProductsSearchRequest.ByIds
2 parents 6af0e7d + 52574bc commit 4ef783d

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313
id("nebula.release") version "15.2.0"
1414
id("maven-publish")
1515
id("io.gitlab.arturbosch.detekt") version "1.17.1"
16+
id("org.gradle.test-retry") version "1.4.1"
1617
}
1718

1819
repositories {
@@ -57,6 +58,9 @@ tasks.withType<Test> {
5758
slowThreshold = Consts.SLOW_TESTS_LOGGING_THRESHOLD_MS
5859
theme = ThemeType.STANDARD
5960
}
61+
retry {
62+
maxRetries.set(Consts.MAX_TEST_RETRIES_COUNT)
63+
}
6064
}
6165

6266
tasks.withType<Detekt>().configureEach {
@@ -66,7 +70,6 @@ tasks.withType<Detekt>().configureEach {
6670
val settingsProvider = SettingsProvider()
6771

6872
tasks {
69-
7073
// All checks were already made by workflow "On pull request" => no checks here
7174
if (gradle.startParameter.taskNames.contains("final")) {
7275
named("build").get().apply {
@@ -324,6 +327,6 @@ object PublicationSettings {
324327
}
325328

326329
object Consts {
327-
328330
const val SLOW_TESTS_LOGGING_THRESHOLD_MS = 30_000L
331+
const val MAX_TEST_RETRIES_COUNT = 3
329332
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductsSearchRequest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ sealed class ProductsSearchRequest : ApiRequest {
8787

8888
data class ByIds(
8989
val productIds: List<Int> = listOf(),
90+
val baseUrl: String? = null,
91+
val cleanUrls: Boolean? = null,
9092
val sortBy: SortOrder? = null,
93+
val lang: String? = null,
9194
) : ProductsSearchRequest() {
9295
override fun toRequestInfo() = RequestInfo.createGetRequest(
9396
pathSegments = listOf(
@@ -103,7 +106,10 @@ sealed class ProductsSearchRequest : ApiRequest {
103106
val request = this
104107
return mutableMapOf<String, String>().apply {
105108
put("productId", request.productIds.joinToString(","))
109+
request.baseUrl?.let { put("baseUrl", it) }
110+
request.cleanUrls?.let { put("cleanUrls", it.toString()) }
106111
request.sortBy?.let { put("sortBy", it.name) }
112+
request.lang?.let { put("lang", it) }
107113
}.toMap()
108114
}
109115
}

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductsSearchRequestRules.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule
55
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
66

77
val productsSearchRequestNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
8-
AllowNullable(ProductsSearchRequest.ByFilters::attributes),
8+
AllowNullable(ProductsSearchRequest.ByFilters::attributes),
99
AllowNullable(ProductsSearchRequest.ByFilters::baseUrl),
1010
AllowNullable(ProductsSearchRequest.ByFilters::categories),
1111
AllowNullable(ProductsSearchRequest.ByFilters::cleanUrls),
@@ -30,5 +30,8 @@ val productsSearchRequestNullablePropertyRules: List<NullablePropertyRule<*, *>>
3030
AllowNullable(ProductsSearchRequest.ByFilters::discountsAllowed),
3131
AllowNullable(ProductsSearchRequest.ByFilters::isCustomerSetPrice),
3232
AllowNullable(ProductsSearchRequest.ByFilters::visibleInStorefront),
33+
AllowNullable(ProductsSearchRequest.ByIds::baseUrl),
34+
AllowNullable(ProductsSearchRequest.ByIds::cleanUrls),
3335
AllowNullable(ProductsSearchRequest.ByIds::sortBy),
36+
AllowNullable(ProductsSearchRequest.ByIds::lang),
3437
)

0 commit comments

Comments
 (0)