@@ -9,6 +9,7 @@ sealed class ProductsSearchRequest : ApiRequest {
99
1010 data class ByFilters (
1111 val keyword : String? = null ,
12+ val externalReferenceId : String? = null ,
1213 val priceFrom : Double? = null ,
1314 val priceTo : Double? = null ,
1415 val categories : List <Int >? = null ,
@@ -25,11 +26,15 @@ sealed class ProductsSearchRequest : ApiRequest {
2526 val attributes : ProductSearchAttributes ? = null ,
2627 val options : ProductSearchOptions ? = null ,
2728 val sku : String? = null ,
29+ val isGiftCard : Boolean? = null ,
30+ val discountsAllowed : Boolean? = null ,
31+ val isCustomerSetPrice : Boolean? = null ,
2832 val baseUrl : String? = null ,
2933 val cleanUrls : Boolean? = null ,
3034 val offset : Int = 0 ,
3135 val limit : Int = 100 ,
32- val lang : String? = null
36+ val lang : String? = null ,
37+ val visibleInStorefront : Boolean? = null ,
3338 ) : ProductsSearchRequest() {
3439 override fun toRequestInfo () = RequestInfo .createGetRequest(
3540 pathSegments = listOf (
@@ -42,7 +47,11 @@ sealed class ProductsSearchRequest : ApiRequest {
4247 val request = this
4348 return mutableMapOf<String , String >().apply {
4449 request.keyword?.let { put(" keyword" , it) }
50+ request.externalReferenceId?.let { put(" externalReferenceId" , it) }
4551 request.sku?.let { put(" sku" , it) }
52+ request.isGiftCard?.let { put(" isGiftCard" , it.toString()) }
53+ request.discountsAllowed?.let { put(" discountsAllowed" , it.toString()) }
54+ request.isCustomerSetPrice?.let { put(" isCustomerSetPrice" , it.toString()) }
4655 request.priceFrom?.let { put(" priceFrom" , it.toString()) }
4756 request.priceTo?.let { put(" priceTo" , it.toString()) }
4857 request.createdFrom?.let { put(" createdFrom" , TimeUnit .MILLISECONDS .toSeconds(it.time).toString()) }
@@ -71,11 +80,15 @@ sealed class ProductsSearchRequest : ApiRequest {
7180 put(" offset" , request.offset.toString())
7281 put(" limit" , request.limit.toString())
7382 request.lang?.let { put(" lang" , it) }
83+ request.visibleInStorefront?.let { put(" visibleInStorefront" , it.toString()) }
7484 }.toMap()
7585 }
7686 }
7787
78- 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() {
7992 override fun toRequestInfo () = RequestInfo .createGetRequest(
8093 pathSegments = listOf (
8194 " products"
@@ -90,6 +103,7 @@ sealed class ProductsSearchRequest : ApiRequest {
90103 val request = this
91104 return mutableMapOf<String , String >().apply {
92105 put(" productId" , request.productIds.joinToString(" ," ))
106+ request.sortBy?.let { put(" sortBy" , it.name) }
93107 }.toMap()
94108 }
95109 }
0 commit comments