Skip to content

Commit c52b115

Browse files
author
mvgreen
committed
Add sortBy parameter to ProductsSearchRequest.ByIds
1 parent d4096fa commit c52b115

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ sealed class ProductsSearchRequest : ApiRequest {
8585
}
8686
}
8787

88-
data class ByIds(val productIds: List<Int> = listOf()) : ProductsSearchRequest() {
88+
data class ByIds(
89+
val productIds: List<Int> = listOf(),
90+
val sortBy: SortOrder? = null,
91+
) : ProductsSearchRequest() {
8992
override fun toRequestInfo() = RequestInfo.createGetRequest(
9093
pathSegments = listOf(
9194
"products"
@@ -100,6 +103,7 @@ sealed class ProductsSearchRequest : ApiRequest {
100103
val request = this
101104
return mutableMapOf<String, String>().apply {
102105
put("productId", request.productIds.joinToString(","))
106+
request.sortBy?.let { put("sortBy", it.name) }
103107
}.toMap()
104108
}
105109
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ val productsSearchRequestNullablePropertyRules: List<NullablePropertyRule<*, *>>
3030
AllowNullable(ProductsSearchRequest.ByFilters::discountsAllowed),
3131
AllowNullable(ProductsSearchRequest.ByFilters::isCustomerSetPrice),
3232
AllowNullable(ProductsSearchRequest.ByFilters::visibleInStorefront),
33+
AllowNullable(ProductsSearchRequest.ByIds::sortBy),
3334
)

0 commit comments

Comments
 (0)