Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECWID-136994 Add search parameter to the customer group endpoint #391

Merged
merged 7 commits into from
Apr 8, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.ecwid.apiclient.v3.responsefields.ResponseFields
data class CustomerGroupsSearchRequest(
val offset: Int = 0,
val limit: Int = 100,
val keyword: String? = null,
val customerGroupIds: List<Int>? = null,
val responseFields: ResponseFields = ResponseFields.All,
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createGetRequest(
Expand All @@ -22,6 +24,12 @@ data class CustomerGroupsSearchRequest(
return mutableMapOf<String, String>().apply {
put("offset", request.offset.toString())
put("limit", request.limit.toString())
if (!request.keyword.isNullOrBlank()) {
put("keyword", request.keyword.toString())
}
if (!request.customerGroupIds.isNullOrEmpty()) {
put("customerGroupIds", request.customerGroupIds.joinToString(","))
}
}.toMap()
}
}
Loading