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-150909 Added update counters method for product reviews #441

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import com.ecwid.apiclient.v3.dto.customergroup.request.*
import com.ecwid.apiclient.v3.dto.customergroup.result.*
import com.ecwid.apiclient.v3.dto.instantsite.redirects.request.*
import com.ecwid.apiclient.v3.dto.instantsite.redirects.result.*
import com.ecwid.apiclient.v3.dto.order.request.*
import com.ecwid.apiclient.v3.dto.order.result.*
import com.ecwid.apiclient.v3.dto.productreview.request.*
import com.ecwid.apiclient.v3.dto.productreview.result.*
import com.ecwid.apiclient.v3.dto.producttype.request.*
Expand Down Expand Up @@ -314,4 +312,5 @@ interface ProductReviewsApiClient {
fun deleteProductReview(request: ProductReviewDeleteRequest): ProductReviewDeleteResult
fun massUpdateProductReview(request: ProductReviewMassUpdateRequest): ProductReviewMassUpdateResult
fun getProductReviewsFiltersData(request: ProductReviewFiltersDataRequest): ProductReviewFiltersDataResult
fun updateProductReviewCounters(request: ProductReviewCountersUpdateRequest): ProductReviewUpdateCountersResult
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ecwid.apiclient.v3.dto.productreview.request

import com.ecwid.apiclient.v3.dto.common.ApiRequestDTO
import com.ecwid.apiclient.v3.dto.productreview.enums.ProductReviewStatus

data class ProductReviewCountersUpdate(
val productIds: List<Long> = listOf(),
val status: ProductReviewStatus? = null,
) : ApiRequestDTO
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ecwid.apiclient.v3.dto.productreview.request

import com.ecwid.apiclient.v3.dto.ApiRequest
import com.ecwid.apiclient.v3.httptransport.HttpBody
import com.ecwid.apiclient.v3.impl.RequestInfo

data class ProductReviewCountersUpdateRequest(
val updateInfo: ProductReviewCountersUpdate = ProductReviewCountersUpdate(),
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createPostRequest(
pathSegments = listOf(
"reviews",
"update_counters",
),
params = mapOf(),
httpBody = HttpBody.JsonBody(
obj = updateInfo
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ecwid.apiclient.v3.dto.productreview.result

import com.ecwid.apiclient.v3.dto.common.ApiResultDTO

data class ProductReviewUpdateCountersResult(
val updateCount: Int = 0
) : ApiResultDTO
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ class ProductReviewsApiClientImpl(
override fun getProductReviewsFiltersData(request: ProductReviewFiltersDataRequest) =
apiClientHelper.makeObjectResultRequest<ProductReviewFiltersDataResult>(request)

override fun updateProductReviewCounters(request: ProductReviewCountersUpdateRequest) =
apiClientHelper.makeObjectResultRequest<ProductReviewUpdateCountersResult>(request)

}
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ val nullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
fetchedProductReviewNullablePropertyRules,
productReviewMassUpdateRequestNullablePropertyRules,
productReviewSearchRequestNullablePropertyRules,
productReviewCountersUpdateRequestNullablePropertyRules,
fetchedCustomersConfigNullablePropertyRules,
).flatten()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.ecwid.apiclient.v3.rule.nullablepropertyrules

import com.ecwid.apiclient.v3.dto.productreview.request.ProductReviewCountersUpdate
import com.ecwid.apiclient.v3.rule.NullablePropertyRule
import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable

val productReviewCountersUpdateRequestNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(ProductReviewCountersUpdate::productIds),
AllowNullable(ProductReviewCountersUpdate::status),
)
Loading