-
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
292 additions
and
37 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
16 changes: 16 additions & 0 deletions
16
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,16 @@ | ||
package com.ecwid.apiclient.v3 | ||
|
||
import com.ecwid.apiclient.v3.dto.extrafield.request.* | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.CustomersConfigCreateResult | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.CustomersConfigUpdateResult | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.CustomersConfigsSearchResult | ||
import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig | ||
|
||
|
||
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): CustomersConfigUpdateResult | ||
} |
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
20 changes: 20 additions & 0 deletions
20
...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,20 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.dto.profile.request.UpdatedExtrafieldConfig | ||
import com.ecwid.apiclient.v3.httptransport.HttpBody | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
|
||
data class CustomersConfigCreateRequest( | ||
val newConfig: UpdatedExtrafieldConfig = UpdatedExtrafieldConfig() | ||
) : 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, | ||
) | ||
} |
22 changes: 22 additions & 0 deletions
22
...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,22 @@ | ||
package com.ecwid.apiclient.v3.dto.extrafield.request | ||
|
||
import com.ecwid.apiclient.v3.dto.ApiRequest | ||
import com.ecwid.apiclient.v3.dto.profile.request.UpdatedExtrafieldConfig | ||
import com.ecwid.apiclient.v3.httptransport.HttpBody | ||
import com.ecwid.apiclient.v3.impl.RequestInfo | ||
|
||
data class CustomersConfigUpdateRequest( | ||
val extrafieldKey: String = "", | ||
val updatedConfig: UpdatedExtrafieldConfig = UpdatedExtrafieldConfig() | ||
) : 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
Oops, something went wrong.