Skip to content

Commit

Permalink
Merge pull request #323 from Ecwid/slugs-without-ids
Browse files Browse the repository at this point in the history
Add slugsWithoutIds parameter for product and category requests
  • Loading branch information
bormanEcwid authored Sep 7, 2023
2 parents 723b380 + f9f00bb commit 50610c8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -25,6 +26,7 @@ data class CategoryDetailsRequest(
return mutableMapOf<String, String>().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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -25,6 +26,7 @@ data class ProductDetailsRequest(
return mutableMapOf<String, String>().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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
Expand All @@ -92,6 +94,7 @@ sealed class ProductsSearchRequest : ApiRequest {
val productIds: List<Int> = 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,
Expand 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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
val categoriesSearchRequestNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(CategoriesSearchRequest::baseUrl),
AllowNullable(CategoriesSearchRequest::cleanUrls),
AllowNullable(CategoriesSearchRequest::slugsWithoutIds),
AllowNullable(CategoriesSearchRequest::hiddenCategories),
AllowNullable(CategoriesSearchRequest::lang),
AllowNullable(CategoriesSearchRequest::returnProductIds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
val categoryDetailsRequestNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(CategoryDetailsRequest::baseUrl),
AllowNullable(CategoryDetailsRequest::cleanUrls),
AllowNullable(CategoryDetailsRequest::slugsWithoutIds),
AllowNullable(CategoryDetailsRequest::lang)
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable
val productDetailsRequestNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(ProductDetailsRequest::baseUrl),
AllowNullable(ProductDetailsRequest::cleanUrls),
AllowNullable(ProductDetailsRequest::slugsWithoutIds),
AllowNullable(ProductDetailsRequest::lang)
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ val productsSearchRequestNullablePropertyRules: List<NullablePropertyRule<*, *>>
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),
Expand All @@ -32,6 +33,7 @@ val productsSearchRequestNullablePropertyRules: List<NullablePropertyRule<*, *>>
AllowNullable(ProductsSearchRequest.ByFilters::visibleInStorefront),
AllowNullable(ProductsSearchRequest.ByIds::baseUrl),
AllowNullable(ProductsSearchRequest.ByIds::cleanUrls),
AllowNullable(ProductsSearchRequest.ByIds::slugsWithoutIds),
AllowNullable(ProductsSearchRequest.ByIds::sortBy),
AllowNullable(ProductsSearchRequest.ByIds::lang),
)

0 comments on commit 50610c8

Please sign in to comment.