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-127444 Instant Site Redirects: Added new instant site redirects method for get-for-path endpoint #335

Merged
merged 3 commits into from
Oct 9, 2023
Merged
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
1 change: 1 addition & 0 deletions src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ interface SubscriptionsApiClient {

interface InstantSiteRedirectsApiClient {
fun searchInstantSiteRedirects(request: InstantSiteRedirectsSearchRequest): InstantSiteRedirectsSearchResult
fun getInstantSiteRedirectsForExactPath(request: InstantSiteRedirectsGetForExactPathRequest): InstantSiteRedirectsGetForExactPathResult
fun getInstantSiteRedirect(request: InstantSiteRedirectGetRequest): FetchedInstantSiteRedirect
fun updateInstantSiteRedirect(request: InstantSiteRedirectUpdateRequest): InstantSiteRedirectsUpdateResult
fun createInstantSiteRedirects(request: InstantSiteRedirectsCreateRequest): InstantSiteRedirectsCreateResult
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ecwid.apiclient.v3.dto.instantsite.redirects.request

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

data class InstantSiteRedirectsGetForExactPathRequest(
val exactPath: String? = null,
val responseFields: ResponseFields = ResponseFields.All,
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createGetRequest(
pathSegments = listOf(
"instant-site",
"redirects",
"get-for-path",
),
params = toParams(),
responseFields = responseFields,
)

private fun toParams(): Map<String, String> {
return mutableMapOf<String, String>().apply {
exactPath?.let { put("exactPath", it) }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.ecwid.apiclient.v3.dto.instantsite.redirects.result

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

data class InstantSiteRedirectsGetForExactPathResult(
val items: List<FetchedInstantSiteRedirect> = listOf(),
val hasAnyRedirects: Boolean = true,
) : ApiResultDTO
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class InstantSiteRedirectsApiClientImpl(
override fun searchInstantSiteRedirects(request: InstantSiteRedirectsSearchRequest) =
apiClientHelper.makeObjectResultRequest<InstantSiteRedirectsSearchResult>(request)

override fun getInstantSiteRedirectsForExactPath(request: InstantSiteRedirectsGetForExactPathRequest) =
apiClientHelper.makeObjectResultRequest<InstantSiteRedirectsGetForExactPathResult>(request)

override fun getInstantSiteRedirect(request: InstantSiteRedirectGetRequest) =
apiClientHelper.makeObjectResultRequest<FetchedInstantSiteRedirect>(request)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.ecwid.apiclient.v3.dto.batch.result.GetEscapedBatchResult
import com.ecwid.apiclient.v3.dto.batch.result.GetTypedBatchResult
import com.ecwid.apiclient.v3.dto.cart.result.CartUpdateResult
import com.ecwid.apiclient.v3.dto.cart.result.ConvertCartToOrderResult
import com.ecwid.apiclient.v3.dto.instantsite.redirects.request.InstantSiteRedirectsGetForExactPathRequest
import com.ecwid.apiclient.v3.dto.instantsite.redirects.request.InstantSiteRedirectsSearchRequest
import com.ecwid.apiclient.v3.dto.order.result.DeletedOrder
import com.ecwid.apiclient.v3.dto.payment.PaymentAppRequest
Expand Down Expand Up @@ -106,6 +107,8 @@ val otherNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
AllowNullable(InstantSiteRedirectsSearchRequest::keyword),
AllowNullable(InstantSiteRedirectsSearchRequest::limit),
AllowNullable(InstantSiteRedirectsSearchRequest::offset),

AllowNullable(InstantSiteRedirectsGetForExactPathRequest::exactPath),
)

val nullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
Expand Down