From c9517612b490ef826e4ca23afffbfb0c7f9240ea Mon Sep 17 00:00:00 2001 From: Denis Fomichev Date: Wed, 6 Sep 2023 16:57:25 +0400 Subject: [PATCH 1/2] Add slugsWithoutIds parameter for product and category requests --- .../v3/dto/category/request/CategoriesSearchRequest.kt | 2 ++ .../v3/dto/category/request/CategoryDetailsRequest.kt | 2 ++ .../apiclient/v3/dto/product/request/ProductDetailsRequest.kt | 2 ++ .../apiclient/v3/dto/product/request/ProductsSearchRequest.kt | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoriesSearchRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoriesSearchRequest.kt index 55f3a98cd..1c209ea3c 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoriesSearchRequest.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoriesSearchRequest.kt @@ -10,6 +10,7 @@ data class CategoriesSearchRequest( val returnProductIds: Boolean? = null, val baseUrl: String? = null, val cleanUrls: Boolean? = null, + val slugsWithoutIds: Boolean? = null, val offset: Int = 0, val limit: Int = 100, val lang: String? = null, @@ -47,6 +48,7 @@ data class CategoriesSearchRequest( request.returnProductIds?.let { put("productIds", it.toString()) } request.baseUrl?.let { put("baseUrl", it) } request.cleanUrls?.let { put("cleanUrls", it.toString()) } + request.slugsWithoutIds?.let { put("slugsWithoutIds", it.toString()) } put("offset", request.offset.toString()) put("limit", request.limit.toString()) request.lang?.let { put("lang", it) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoryDetailsRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoryDetailsRequest.kt index b6b970902..e8cfc05f2 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoryDetailsRequest.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/category/request/CategoryDetailsRequest.kt @@ -8,6 +8,7 @@ data class CategoryDetailsRequest( val categoryId: Int = 0, val baseUrl: String? = null, val cleanUrls: Boolean? = null, + val slugsWithoutIds: Boolean? = null, val lang: String? = null, val responseFields: ResponseFields = ResponseFields.All, ) : ApiRequest { @@ -25,6 +26,7 @@ data class CategoryDetailsRequest( return mutableMapOf().apply { request.baseUrl?.let { put("baseUrl", it) } request.cleanUrls?.let { put("cleanUrls", it.toString()) } + request.slugsWithoutIds?.let { put("slugsWithoutIds", it.toString()) } request.lang?.let { put("lang", it) } }.toMap() } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductDetailsRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductDetailsRequest.kt index bc85d1291..95c302958 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductDetailsRequest.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductDetailsRequest.kt @@ -8,6 +8,7 @@ data class ProductDetailsRequest( val productId: Int = 0, val baseUrl: String? = null, val cleanUrls: Boolean? = null, + val slugsWithoutIds: Boolean? = null, val lang: String? = null, val responseFields: ResponseFields = ResponseFields.All, ) : ApiRequest { @@ -25,6 +26,7 @@ data class ProductDetailsRequest( return mutableMapOf().apply { request.baseUrl?.let { put("baseUrl", it) } request.cleanUrls?.let { put("cleanUrls", it.toString()) } + request.slugsWithoutIds?.let { put("slugsWithoutIds", it.toString()) } request.lang?.let { put("lang", it) } }.toMap() } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductsSearchRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductsSearchRequest.kt index 612cf784b..726293231 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductsSearchRequest.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/ProductsSearchRequest.kt @@ -32,6 +32,7 @@ sealed class ProductsSearchRequest : ApiRequest { val isCustomerSetPrice: Boolean? = null, val baseUrl: String? = null, val cleanUrls: Boolean? = null, + val slugsWithoutIds: Boolean? = null, val offset: Int = 0, val limit: Int = 100, val lang: String? = null, @@ -79,6 +80,7 @@ sealed class ProductsSearchRequest : ApiRequest { request.includeProductsFromSubcategories?.let { put("includeProductsFromSubcategories", it.toString()) } request.baseUrl?.let { put("baseUrl", it) } request.cleanUrls?.let { put("cleanUrls", it.toString()) } + request.slugsWithoutIds?.let { put("slugsWithoutIds", it.toString()) } request.sortBy?.let { put("sortBy", it.name) } put("offset", request.offset.toString()) put("limit", request.limit.toString()) @@ -92,6 +94,7 @@ sealed class ProductsSearchRequest : ApiRequest { val productIds: List = listOf(), val baseUrl: String? = null, val cleanUrls: Boolean? = null, + val slugsWithoutIds: Boolean? = null, val sortBy: SortOrder? = null, val lang: String? = null, val responseFields: ResponseFields = ResponseFields.All, @@ -113,6 +116,7 @@ sealed class ProductsSearchRequest : ApiRequest { put("productId", request.productIds.joinToString(",")) request.baseUrl?.let { put("baseUrl", it) } request.cleanUrls?.let { put("cleanUrls", it.toString()) } + request.slugsWithoutIds?.let { put("slugsWithoutIds", it.toString()) } request.sortBy?.let { put("sortBy", it.name) } request.lang?.let { put("lang", it) } }.toMap() From f9f00bba191e92fdcc3a2f6887a3b3f9adc0370e Mon Sep 17 00:00:00 2001 From: Denis Fomichev Date: Wed, 6 Sep 2023 18:47:44 +0400 Subject: [PATCH 2/2] fix slugsWithoutIds parameter in tests --- .../rule/nullablepropertyrules/CategoriesSearchRequestRules.kt | 1 + .../rule/nullablepropertyrules/CategoryDetailsRequestRules.kt | 1 + .../v3/rule/nullablepropertyrules/ProductDetailsRequestRules.kt | 1 + .../v3/rule/nullablepropertyrules/ProductsSearchRequestRules.kt | 2 ++ 4 files changed, 5 insertions(+) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoriesSearchRequestRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoriesSearchRequestRules.kt index 215e52391..1a645b425 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoriesSearchRequestRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoriesSearchRequestRules.kt @@ -7,6 +7,7 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable val categoriesSearchRequestNullablePropertyRules: List> = listOf( AllowNullable(CategoriesSearchRequest::baseUrl), AllowNullable(CategoriesSearchRequest::cleanUrls), + AllowNullable(CategoriesSearchRequest::slugsWithoutIds), AllowNullable(CategoriesSearchRequest::hiddenCategories), AllowNullable(CategoriesSearchRequest::lang), AllowNullable(CategoriesSearchRequest::returnProductIds) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoryDetailsRequestRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoryDetailsRequestRules.kt index 4a3757ba1..80757a767 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoryDetailsRequestRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CategoryDetailsRequestRules.kt @@ -7,5 +7,6 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable val categoryDetailsRequestNullablePropertyRules: List> = listOf( AllowNullable(CategoryDetailsRequest::baseUrl), AllowNullable(CategoryDetailsRequest::cleanUrls), + AllowNullable(CategoryDetailsRequest::slugsWithoutIds), AllowNullable(CategoryDetailsRequest::lang) ) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductDetailsRequestRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductDetailsRequestRules.kt index 4e1b434f1..dc65a4b7d 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductDetailsRequestRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductDetailsRequestRules.kt @@ -7,5 +7,6 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable val productDetailsRequestNullablePropertyRules: List> = listOf( AllowNullable(ProductDetailsRequest::baseUrl), AllowNullable(ProductDetailsRequest::cleanUrls), + AllowNullable(ProductDetailsRequest::slugsWithoutIds), AllowNullable(ProductDetailsRequest::lang) ) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductsSearchRequestRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductsSearchRequestRules.kt index 8093d3e02..4dcfff1eb 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductsSearchRequestRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/ProductsSearchRequestRules.kt @@ -9,6 +9,7 @@ val productsSearchRequestNullablePropertyRules: List> AllowNullable(ProductsSearchRequest.ByFilters::baseUrl), AllowNullable(ProductsSearchRequest.ByFilters::categories), AllowNullable(ProductsSearchRequest.ByFilters::cleanUrls), + AllowNullable(ProductsSearchRequest.ByFilters::slugsWithoutIds), AllowNullable(ProductsSearchRequest.ByFilters::createdFrom), AllowNullable(ProductsSearchRequest.ByFilters::createdTo), AllowNullable(ProductsSearchRequest.ByFilters::enabled), @@ -32,6 +33,7 @@ val productsSearchRequestNullablePropertyRules: List> AllowNullable(ProductsSearchRequest.ByFilters::visibleInStorefront), AllowNullable(ProductsSearchRequest.ByIds::baseUrl), AllowNullable(ProductsSearchRequest.ByIds::cleanUrls), + AllowNullable(ProductsSearchRequest.ByIds::slugsWithoutIds), AllowNullable(ProductsSearchRequest.ByIds::sortBy), AllowNullable(ProductsSearchRequest.ByIds::lang), )