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

add new methods for get repeat URL #230

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ interface OrdersApiClient {
fun deleteOrderItemOptionFiles(request: OrderItemOptionFilesDeleteRequest): OrderItemOptionFileDeleteResult
fun searchDeletedOrders(request: DeletedOrdersSearchRequest): DeletedOrdersSearchResult
fun searchDeletedOrdersAsSequence(request: DeletedOrdersSearchRequest): Sequence<DeletedOrder>
fun getRepeatOrderURL(request: RepeatOrderURLRequest): RepeatOrderURLResult
}

// Product types
Expand Down Expand Up @@ -269,6 +270,7 @@ interface CartsApiClient {
fun updateCart(request: CartUpdateRequest): CartUpdateResult
fun calculateOrderDetails(request: CalculateOrderDetailsRequest): CalculateOrderDetailsResult
fun convertCartToOrder(request: ConvertCartToOrderRequest): ConvertCartToOrderResult
fun getRepeatCartURL(request: RepeatCartURLRequest): RepeatCartURLResult
}

// Discount coupons
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ecwid.apiclient.v3.dto.cart.request

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

class RepeatCartURLRequest (
Fixed Show fixed Hide fixed
val orderNumber: Long = 0
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createGetRequest(
pathSegments = listOf(
"carts",
"$orderNumber",
"repeat"
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ecwid.apiclient.v3.dto.cart.result

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

data class RepeatCartURLResult (
Fixed Show fixed Hide fixed
val repeatCartUrl: String = ""
) : ApiResultDTO
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ecwid.apiclient.v3.dto.order.request

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

class RepeatOrderURLRequest (
Fixed Show fixed Hide fixed
val orderNumber: Long = 0
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createGetRequest(
pathSegments = listOf(
"orders",
"$orderNumber",
"repeat"
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ecwid.apiclient.v3.dto.order.result

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

data class RepeatOrderURLResult (
Fixed Show fixed Hide fixed
val repeatOrderUrl: String = ""
) : ApiResultDTO
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.ecwid.apiclient.v3.ApiClientHelper
import com.ecwid.apiclient.v3.CartsApiClient
import com.ecwid.apiclient.v3.dto.cart.request.*
import com.ecwid.apiclient.v3.dto.cart.result.*
import com.ecwid.apiclient.v3.dto.order.request.RepeatOrderURLRequest
Fixed Show fixed Hide fixed
import com.ecwid.apiclient.v3.dto.order.result.RepeatOrderURLResult
Fixed Show fixed Hide fixed

internal data class CartsApiClientImpl(
private val apiClientHelper: ApiClientHelper
Expand Down Expand Up @@ -33,4 +35,7 @@ internal data class CartsApiClientImpl(

override fun convertCartToOrder(request: ConvertCartToOrderRequest) =
apiClientHelper.makeObjectResultRequest<ConvertCartToOrderResult>(request)

override fun getRepeatCartURL(request: RepeatCartURLRequest) =
apiClientHelper.makeObjectResultRequest<RepeatCartURLResult>(request)
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ internal class OrdersApiClientImpl(
offsetRequest = offsetRequest.copy(offset = offsetRequest.offset + searchResult.count)
} while (searchResult.count >= searchResult.limit)
}

override fun getRepeatOrderURL(request: RepeatOrderURLRequest) =
apiClientHelper.makeObjectResultRequest<RepeatOrderURLResult>(request)
}