Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
34ef04e
chore: rename files and directories for improved structure
OmarAlJarrah Apr 20, 2025
c673e98
chore: delete old code
OmarAlJarrah Apr 20, 2025
6397e09
Revert "chore: delete old code"
OmarAlJarrah Apr 20, 2025
3ad78e6
chore: delete old code
OmarAlJarrah Apr 20, 2025
23c0239
chore: delete old code
OmarAlJarrah Apr 20, 2025
a56a07e
Merge branch 'v2-dev' into v2/delete-old-code
OmarAlJarrah Apr 20, 2025
e80a2f3
chore: initialize project gradle structure and configuration files
OmarAlJarrah Apr 21, 2025
33c6156
chore: initial generator config
OmarAlJarrah Apr 21, 2025
dd9a5e1
feat: initialize xap sdk module
OmarAlJarrah Apr 21, 2025
2e8fb9c
Revert "chore: delete old code"
OmarAlJarrah Apr 21, 2025
93c6388
Revert "chore: delete old code"
OmarAlJarrah Apr 21, 2025
32004dd
chore: undelete code
OmarAlJarrah Apr 21, 2025
be222dc
Merge branch 'v2/delete-old-code' into v2/initial-gradle-setup
OmarAlJarrah Apr 21, 2025
0249634
Merge branch 'v2/initial-gradle-setup' into v2/generator-config
OmarAlJarrah Apr 21, 2025
d0a54a0
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 21, 2025
dc2172b
chore: clean up build.gradle.kts and update mergeSpecs task
OmarAlJarrah Apr 21, 2025
3b1d370
Merge branch 'v2/initial-gradle-setup' into v2/generator-config
OmarAlJarrah Apr 21, 2025
5122213
chore: add imports for AllowedMediaTypesLambda and CodegenConstants
OmarAlJarrah Apr 22, 2025
251f90b
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 22, 2025
8bb97ea
Merge branch 'v2-dev' into v2/initial-gradle-setup
OmarAlJarrah Apr 24, 2025
7b9d080
Merge branch 'v2/initial-gradle-setup' into v2/generator-config
OmarAlJarrah Apr 24, 2025
5d66eff
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 24, 2025
8aaca0d
chore: update path for specs.gradle.kts in build.gradle.kts
OmarAlJarrah Apr 24, 2025
10a8782
chore: update OpenAPI generator plugin version to 0.0.9-alpha
OmarAlJarrah Apr 24, 2025
73b0557
chore: refactor transformSpecs task to use Exec type and streamline c…
OmarAlJarrah Apr 24, 2025
c14ebda
chore: remove obsolete POM license properties from gradle.properties
OmarAlJarrah Apr 24, 2025
fbc53af
chore: add mavenCentral repository to plugin management
OmarAlJarrah Apr 24, 2025
245448f
Merge branch 'v2/initial-gradle-setup' into v2/generator-config
OmarAlJarrah Apr 24, 2025
217d02f
chore: update openApiGenerate task to use project.providers.exec for …
OmarAlJarrah Apr 24, 2025
05b0741
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 24, 2025
3d08ce4
chore: rename XAP_OBJECT_MAPPER to OBJECT_MAPPER for consistency
OmarAlJarrah Apr 24, 2025
c8b1dd3
chore: del spec files
OmarAlJarrah Apr 27, 2025
2a88f73
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 27, 2025
2fc4bf3
chore: update command line for spec transformer to include additional…
OmarAlJarrah Apr 27, 2025
bd97e01
chore: update inputSpec path in openApiGenerate configuration to use …
OmarAlJarrah Apr 27, 2025
1b7c1b8
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 27, 2025
702c50c
chore: add license plugin and header configuration to build.gradle.kts
OmarAlJarrah Apr 27, 2025
37396cc
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 27, 2025
af8631f
chore: update license plugin ID in build.gradle.kts
OmarAlJarrah Apr 27, 2025
23d4bf9
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 27, 2025
727f06c
Merge branch 'v2-dev' into v2/generator-config
OmarAlJarrah Apr 27, 2025
3b89186
Merge branch 'v2/generator-config' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 27, 2025
584a367
Merge branch 'v2-dev' into v2/initial-xap-sdk-module
OmarAlJarrah Apr 28, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright (C) 2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.expediagroup.sdk.xap.client

import com.expediagroup.sdk.rest.AsyncRestClient
import com.expediagroup.sdk.rest.AsyncRestExecutor
import com.expediagroup.sdk.rest.model.Response
import com.expediagroup.sdk.rest.trait.operation.JacksonModelOperationResponseBodyTrait
import com.expediagroup.sdk.rest.trait.operation.OperationNoResponseBodyTrait
import com.expediagroup.sdk.xap.configuration.AsyncClientBuilder
import com.expediagroup.sdk.xap.configuration.AsyncXapClientConfiguration
import com.expediagroup.sdk.xap.configuration.Constant.ENDPOINT
import com.expediagroup.sdk.xap.configuration.OBJECT_MAPPER
import com.expediagroup.sdk.xap.core.AsyncRequestExecutor
import java.util.concurrent.CompletableFuture

/**
* Asynchronous client for XAP API.
*
* @property restExecutor The executor for handling REST operations.
*/
class AsyncXapClient private constructor(
config: AsyncXapClientConfiguration,
) : AsyncRestClient() {
override val restExecutor: AsyncRestExecutor =
AsyncRestExecutor(
mapper = OBJECT_MAPPER,
serverUrl = ENDPOINT,
requestExecutor = AsyncRequestExecutor(configuration = config),
)

/**
* Executes an operation that does not expect a response body.
*
* @param operation The operation to execute.
* @return A CompletableFuture containing the response.
*/
fun execute(operation: OperationNoResponseBodyTrait): CompletableFuture<Response<Nothing?>> = restExecutor.execute(operation)

/**
* Executes an operation that expects a response body.
*
* @param T The type of the response body.
* @param operation The operation to execute.
* @return A CompletableFuture containing the response.
*/
fun <T : Any> execute(operation: JacksonModelOperationResponseBodyTrait<T>): CompletableFuture<Response<T>> = restExecutor.execute(operation)

companion object {
/**
* Builder for creating an instance of [AsyncXapClient].
*/
class Builder : AsyncClientBuilder<AsyncXapClient>() {
override fun build(): AsyncXapClient = AsyncXapClient(buildConfig())
}

/**
* Creates a new builder for [AsyncXapClient].
*
* @return A new [Builder] instance.
*/
@JvmStatic
fun builder() = Builder()
}
}
Loading