-
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-141762 merge remote-tracking branch 'origin/master' into ECWID-…
…141762
- Loading branch information
Showing
48 changed files
with
443 additions
and
56 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
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,30 @@ | ||
package com.ecwid.apiclient.v3 | ||
|
||
import com.ecwid.apiclient.v3.dto.common.PartialResult | ||
import com.ecwid.apiclient.v3.dto.order.request.* | ||
import com.ecwid.apiclient.v3.dto.order.result.* | ||
import kotlin.reflect.KClass | ||
|
||
// Orders | ||
// https://developers.ecwid.com/api-documentation/orders | ||
interface OrdersApiClient { | ||
fun searchOrders(request: OrdersSearchRequest): OrdersSearchResult | ||
fun <Result> searchOrders(request: OrdersSearchRequest, resultClass: KClass<Result>): Result | ||
where Result : PartialResult<OrdersSearchResult> | ||
fun searchOrdersAsSequence(request: OrdersSearchRequest): Sequence<FetchedOrder> | ||
fun getOrderDetails(request: OrderDetailsRequest): FetchedOrder | ||
fun getOrderInvoice(request: OrderInvoiceRequest): String | ||
fun createOrder(request: OrderCreateRequest): OrderCreateResult | ||
fun updateOrder(request: OrderUpdateRequest): OrderUpdateResult | ||
fun deleteOrder(request: OrderDeleteRequest): OrderDeleteResult | ||
fun uploadOrderItemOptionFile(request: OrderItemOptionFileUploadRequest): OrderItemOptionFileUploadResult | ||
fun deleteOrderItemOptionFile(request: OrderItemOptionFileDeleteRequest): OrderItemOptionFileDeleteResult | ||
fun deleteOrderItemOptionFiles(request: OrderItemOptionFilesDeleteRequest): OrderItemOptionFileDeleteResult | ||
fun searchDeletedOrders(request: DeletedOrdersSearchRequest): DeletedOrdersSearchResult | ||
fun searchDeletedOrdersAsSequence(request: DeletedOrdersSearchRequest): Sequence<DeletedOrder> | ||
} | ||
|
||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER") | ||
inline fun <reified Result : PartialResult<OrdersSearchResult>> OrdersApiClient.searchOrders(request: OrdersSearchRequest): Result { | ||
return searchOrders(request, Result::class) | ||
} |
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 | ||
} |
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
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
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) | ||
} |
Oops, something went wrong.