-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ECWID-144507 new endpoint for store extrafields customers config
- Loading branch information
Showing
27 changed files
with
284 additions
and
38 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/com/ecwid/apiclient/v3/StoreExtrafieldsApiClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.ecwid.apiclient.v3 | ||
|
||
import com.ecwid.apiclient.v3.dto.extrafield.request.* | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.* | ||
|
||
|
||
interface StoreExtrafieldsApiClient { | ||
fun searchCustomersConfigs(request: CustomersConfigsSearchRequest): CustomersConfigsSearchResult | ||
fun getCustomersConfig(request: CustomersConfigDetailsRequest): FetchedCustomersConfig | ||
fun createCustomersConfig(request: CustomersConfigCreateRequest): CustomersConfigCreateResult | ||
fun updateCustomersConfig(request: CustomersConfigUpdateRequest): CustomersConfigUpdateResult | ||
fun deleteCustomersConfig(request: CustomersConfigDeleteRequest): CustomersConfigDeleteResult | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomersConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.ecwid.apiclient.v3.converter | ||
|
||
import com.ecwid.apiclient.v3.dto.extrafield.request.UpdatedCustomersConfig | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig | ||
|
||
|
||
fun FetchedCustomersConfig.toUpdated(): UpdatedCustomersConfig { | ||
return UpdatedCustomersConfig( | ||
key = key, | ||
title = title, | ||
type = type, | ||
shownOnOrderDetails = shownOnOrderDetails, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldEntityType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.enums | ||
|
||
enum class ExtrafieldEntityType { | ||
CHECKOUT, | ||
CUSTOMERS, | ||
} |
2 changes: 1 addition & 1 deletion
2
...nt/v3/dto/profile/enums/ExtrafieldType.kt → ...v3/dto/extrafield/enums/ExtrafieldType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigCreateRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.httptransport.HttpBody | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
|
||
data class CustomersConfigCreateRequest( | ||
val newConfig: UpdatedCustomersConfig = UpdatedCustomersConfig() | ||
) : ApiRequest { | ||
override fun toRequestInfo() = RequestInfo.createPostRequest( | ||
pathSegments = listOf( | ||
"store_extrafields", | ||
"customers" | ||
), | ||
httpBody = HttpBody.JsonBody( | ||
obj = newConfig | ||
) | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
...main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDeleteRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
|
||
data class CustomersConfigDeleteRequest( | ||
val extrafieldKey: String = "" | ||
) : ApiRequest { | ||
override fun toRequestInfo() = RequestInfo.createDeleteRequest( | ||
pathSegments = listOf( | ||
"store_extrafields", | ||
"customers", | ||
extrafieldKey | ||
), | ||
params = mapOf() | ||
) | ||
} |
20 changes: 20 additions & 0 deletions
20
...ain/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDetailsRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
import com.ecwid.apiclient.v3.responsefields.ResponseFields | ||
|
||
data class CustomersConfigDetailsRequest( | ||
val extrafieldKey: String = "", | ||
val responseFields: ResponseFields = ResponseFields.All, | ||
) : ApiRequest { | ||
override fun toRequestInfo() = RequestInfo.createGetRequest( | ||
pathSegments = listOf( | ||
"store_extrafields", | ||
"customers", | ||
extrafieldKey | ||
), | ||
params = mapOf(), | ||
responseFields = responseFields, | ||
) | ||
} |
21 changes: 21 additions & 0 deletions
21
...main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigUpdateRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.httptransport.HttpBody | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
|
||
data class CustomersConfigUpdateRequest( | ||
val extrafieldKey: String = "", | ||
val updatedConfig: UpdatedCustomersConfig = UpdatedCustomersConfig() | ||
) : ApiRequest { | ||
override fun toRequestInfo() = RequestInfo.createPutRequest( | ||
pathSegments = listOf( | ||
"store_extrafields", | ||
"customers", | ||
extrafieldKey | ||
), | ||
httpBody = HttpBody.JsonBody( | ||
obj = updatedConfig | ||
) | ||
) | ||
} |
19 changes: 19 additions & 0 deletions
19
...ain/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigsSearchRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
import com.ecwid.apiclient.v3.responsefields.ResponseFields | ||
|
||
|
||
data class CustomersConfigsSearchRequest( | ||
val responseFields: ResponseFields = ResponseFields.All, | ||
) : ApiRequest { | ||
override fun toRequestInfo() = RequestInfo.createGetRequest( | ||
pathSegments = listOf( | ||
"store_extrafields", | ||
"customers" | ||
), | ||
params = mapOf(), | ||
responseFields = responseFields, | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/UpdatedCustomersConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO | ||
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind | ||
import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig | ||
|
||
data class UpdatedCustomersConfig( | ||
val key: String? = null, | ||
val title: String? = null, | ||
val type: ExtrafieldType? = null, | ||
val shownOnOrderDetails: Boolean? = null, | ||
) : ApiUpdatedDTO { | ||
|
||
override fun getModifyKind() = ModifyKind.ReadWrite(FetchedCustomersConfig::class) | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigCreateResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.result | ||
|
||
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO | ||
|
||
data class CustomersConfigCreateResult( | ||
val createCount: Int = 0, | ||
val key: String = "" | ||
) : ApiResultDTO |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigDeleteResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.result | ||
|
||
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO | ||
|
||
data class CustomersConfigDeleteResult( | ||
val deleteCount: Int = 0 | ||
) : ApiResultDTO |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigUpdateResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.result | ||
|
||
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO | ||
|
||
data class CustomersConfigUpdateResult( | ||
val updateCount: Int = 0 | ||
) : ApiResultDTO |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigsSearchResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.result | ||
|
||
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO | ||
|
||
data class CustomersConfigsSearchResult( | ||
val items: List<FetchedCustomersConfig> = listOf(), | ||
) : ApiResultDTO |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/FetchedCustomersConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.result | ||
|
||
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO | ||
import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldEntityType | ||
import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType | ||
import com.ecwid.apiclient.v3.dto.extrafield.request.UpdatedCustomersConfig | ||
import java.util.* | ||
|
||
data class FetchedCustomersConfig( | ||
val key: String? = null, | ||
val title: String? = null, | ||
val entityTypes: ExtrafieldEntityType? = null, | ||
val type: ExtrafieldType? = null, | ||
val shownOnOrderDetails: Boolean? = null, | ||
val createdDate: Date? = null, | ||
val lastModifiedDate: Date? = null, | ||
) : ApiFetchedDTO { | ||
|
||
override fun getModifyKind() = ApiFetchedDTO.ModifyKind.ReadWrite(UpdatedCustomersConfig::class) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreExtrafieldsApiClientImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.ecwid.apiclient.v3.impl | ||
|
||
import com.ecwid.apiclient.v3.ApiClientHelper | ||
import com.ecwid.apiclient.v3.StoreExtrafieldsApiClient | ||
import com.ecwid.apiclient.v3.dto.extrafield.request.* | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.* | ||
|
||
internal class StoreExtrafieldsApiClientImpl( | ||
private val apiClientHelper: ApiClientHelper | ||
) : StoreExtrafieldsApiClient { | ||
|
||
override fun searchCustomersConfigs(request: CustomersConfigsSearchRequest): CustomersConfigsSearchResult = | ||
apiClientHelper.makeObjectResultRequest(request) | ||
|
||
override fun getCustomersConfig(request: CustomersConfigDetailsRequest): FetchedCustomersConfig = | ||
apiClientHelper.makeObjectResultRequest(request) | ||
|
||
override fun createCustomersConfig(request: CustomersConfigCreateRequest): CustomersConfigCreateResult = | ||
apiClientHelper.makeObjectResultRequest(request) | ||
|
||
override fun updateCustomersConfig(request: CustomersConfigUpdateRequest): CustomersConfigUpdateResult = | ||
apiClientHelper.makeObjectResultRequest(request) | ||
|
||
override fun deleteCustomersConfig(request: CustomersConfigDeleteRequest): CustomersConfigDeleteResult = | ||
apiClientHelper.makeObjectResultRequest(request) | ||
} |
Oops, something went wrong.