Skip to content

Commit

Permalink
Merge pull request #396 from Ecwid/ECWID-134877
Browse files Browse the repository at this point in the history
ECWID-134877 - added implementation for getApplicationTokenInfo method
  • Loading branch information
Alexis2004 authored Apr 11, 2024
2 parents cf42b03 + 2768606 commit c4effd2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import com.ecwid.apiclient.v3.config.ApiServerDomain
import com.ecwid.apiclient.v3.config.ApiStoreCredentials
import com.ecwid.apiclient.v3.config.LoggingSettings
import com.ecwid.apiclient.v3.dto.application.request.ApplicationDeleteRequest
import com.ecwid.apiclient.v3.dto.application.request.ApplicationTokenRequest
import com.ecwid.apiclient.v3.dto.application.result.ApplicationDeleteResult
import com.ecwid.apiclient.v3.dto.application.result.ApplicationTokenResult
import com.ecwid.apiclient.v3.dto.batch.request.CancelBatchGroupRequest
import com.ecwid.apiclient.v3.dto.batch.request.CreateBatchRequest
import com.ecwid.apiclient.v3.dto.batch.request.CreateBatchRequestWithIds
Expand Down Expand Up @@ -252,6 +254,7 @@ interface SalesChannelsApiClient {
// https://developers.ecwid.com/api-documentation/application
interface ApplicationApiClient {
fun deleteApplication(request: ApplicationDeleteRequest): ApplicationDeleteResult
fun getApplicationToken(request: ApplicationTokenRequest): ApplicationTokenResult
}

// Application storage
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.ecwid.apiclient.v3.dto.application.request

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

class ApplicationTokenRequest : ApiRequest {
override fun toRequestInfo() = RequestInfo.createGetRequest(
pathSegments = listOf(
"application",
"token",
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.ecwid.apiclient.v3.dto.application.result

import com.ecwid.apiclient.v3.dto.common.ApiResultDTO
import java.util.*

data class ApplicationTokenResult(
val permissions: List<String> = emptyList(),
val created: Date = Date(),
val expires: Date = Date(),
) : ApiResultDTO
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ package com.ecwid.apiclient.v3.impl
import com.ecwid.apiclient.v3.ApiClientHelper
import com.ecwid.apiclient.v3.ApplicationApiClient
import com.ecwid.apiclient.v3.dto.application.request.ApplicationDeleteRequest
import com.ecwid.apiclient.v3.dto.application.request.ApplicationTokenRequest
import com.ecwid.apiclient.v3.dto.application.result.ApplicationDeleteResult
import com.ecwid.apiclient.v3.dto.application.result.ApplicationTokenResult

class ApplicationApiClientImpl(
private val apiClientHelper: ApiClientHelper
) : ApplicationApiClient {
override fun deleteApplication(request: ApplicationDeleteRequest) =
apiClientHelper.makeObjectResultRequest<ApplicationDeleteResult>(request)

override fun getApplicationToken(request: ApplicationTokenRequest) =
apiClientHelper.makeObjectResultRequest<ApplicationTokenResult>(request)
}

0 comments on commit c4effd2

Please sign in to comment.