diff --git a/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/AbstractGraphQLExecutor.kt b/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/AbstractGraphQLExecutor.kt new file mode 100644 index 00000000..3a3c15fc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/AbstractGraphQLExecutor.kt @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2024 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.graphql.common + +import com.apollographql.apollo.api.Mutation +import com.apollographql.apollo.api.Query +import com.apollographql.java.client.ApolloClient +import com.expediagroup.sdk.core.client.Disposable +import com.expediagroup.sdk.core.client.AbstractRequestExecutor +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException +import com.expediagroup.sdk.graphql.model.exception.NoDataException +import com.expediagroup.sdk.graphql.model.response.RawResponse +import java.util.concurrent.CompletableFuture + +/** + * Abstract base class for executing GraphQL operations, providing a structure for executing queries and mutations + * and returning the full response data along with any errors. + * + * This class is designed to handle the execution of GraphQL operations and return a [RawResponse] containing + * the complete, unprocessed data and error details. Subclasses should implement specific behaviors for how + * requests are sent and processed. + */ +abstract class AbstractGraphQLExecutor( + private val requestExecutor: AbstractRequestExecutor +) : Disposable { + + /** + * The Apollo Client instance used to perform GraphQL requests. + * Subclasses must initialize this property with a configured [ApolloClient] instance. + */ + protected abstract val apolloClient: ApolloClient + + /** + * Executes a GraphQL query and returns the complete raw response. + * + * @param query The GraphQL query to be executed. + * @return A [RawResponse] containing the full data and any errors from the query response. + * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the query. + * @throws [NoDataException] If the query completes without data but includes errors. + */ + abstract fun execute(query: Query): RawResponse + + /** + * Executes a GraphQL mutation and returns the complete raw response. + * + * @param mutation The GraphQL mutation to be executed. + * @return A [RawResponse] containing the full data and any errors from the mutation response. + * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the mutation. + * @throws [NoDataException] If the mutation completes without data but includes errors. + */ + abstract fun execute(mutation: Mutation): RawResponse + + /** + * Asynchronously executes a GraphQL query and returns the complete raw response in a [CompletableFuture]. + * + * @param query The GraphQL query to be executed. + * @return A [CompletableFuture] containing the full data and any errors from the query response wrapped in [RawResponse]. + * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the query. + * @throws [NoDataException] If the query completes without data but includes errors. + */ + abstract fun executeAsync(query: Query): CompletableFuture> + + /** + * Asynchronously executes a GraphQL mutation and returns the complete raw response in a [CompletableFuture]. + * + * @param mutation The GraphQL mutation to be executed. + * @return A [CompletableFuture] containing the full data and any errors from the mutation response wrapped in [RawResponse]. + * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the mutation. + * @throws [NoDataException] If the mutation completes without data but includes errors. + */ + abstract fun executeAsync(mutation: Mutation): CompletableFuture> + + /** + * Closes the underlying [AbstractRequestExecutor] and [ApolloClient] + */ + override fun dispose() { + requestExecutor.dispose() + apolloClient.close() + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/DefaultGraphQLExecutor.kt b/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/DefaultGraphQLExecutor.kt deleted file mode 100644 index 8edf00c9..00000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/DefaultGraphQLExecutor.kt +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2024 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.graphql.common - -import com.apollographql.apollo.api.ApolloResponse -import com.apollographql.apollo.api.Mutation -import com.apollographql.apollo.api.Operation -import com.apollographql.apollo.api.Query -import com.apollographql.java.client.ApolloClient -import com.expediagroup.sdk.core.client.AbstractRequestExecutor -import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.model.exception.NoDataException -import com.expediagroup.sdk.graphql.model.response.Error -import com.expediagroup.sdk.graphql.model.response.RawResponse -import java.util.concurrent.CompletableFuture -import java.util.concurrent.ExecutionException - -/** - * A streamlined implementation of [GraphQLExecutor] that handles GraphQL operations with - * error handling and response processing. This executor processes both queries and mutations - * while providing detailed error information when operations fail. - * - * This executor leverages the Apollo Client to perform requests and processes responses by capturing - * the entire data structure and any errors in a [RawResponse], which can then be further processed or - * filtered by higher-level components in the SDK. - * - * By default - this implementation is used internally in all higher-level clients that extend [GraphQLClient] abstract class - * - * @param requestExecutor used for HTTP request execution within the SDK - * @param serverUrl GraphQL server URL - */ -internal class DefaultGraphQLExecutor( - requestExecutor: AbstractRequestExecutor, - serverUrl: String -) : GraphQLExecutor(requestExecutor) { - - /** - * The Apollo Client used to execute GraphQL requests, configured with a custom HTTP client. - */ - override val apolloClient: ApolloClient = ApolloClient.Builder() - .serverUrl(serverUrl) - .httpEngine(ApolloHttpEngine(requestExecutor)) - .build() - - /** - * Asynchronously executes a GraphQL query and returns a [CompletableFuture] containing the complete - * data and any errors wrapped in [RawResponse]. - * - * @param query The GraphQL query to be executed. - * @return A [CompletableFuture] with the full data structure and any errors from the server. - * @throws [ExpediaGroupServiceException] If an exception occurs during query execution. - * @throws [NoDataException] If the query completes without data but includes errors. - */ - override fun executeAsync(query: Query): CompletableFuture> { - return CompletableFuture>().also { - apolloClient.query(query).enqueue { response -> processOperationResponse(response, it) } - } - } - - /** - * Executes a GraphQL query and returns a [RawResponse] containing the complete data and any errors. - * - * @param query The GraphQL query to be executed. - * @return A [RawResponse] with the full data structure and any errors from the server. - * @throws [ExpediaGroupServiceException] If an exception occurs during query execution. - * @throws [NoDataException] If the query completes without data but includes errors. - */ - override fun execute(query: Query): RawResponse { - return executeAsync(query).getOrThrowDomainException() - } - - /** - * Asynchronously executes a GraphQL mutation and returns a [CompletableFuture] containing the complete - * data and any errors wrapped in [RawResponse]. - * - * @param mutation The GraphQL mutation to be executed. - * @return A [CompletableFuture] with the full data structure and any errors from the server. - * @throws [ExpediaGroupServiceException] If an exception occurs during mutation execution. - * @throws [NoDataException] If the mutation completes without data but includes errors. - */ - override fun executeAsync(mutation: Mutation): CompletableFuture> { - return CompletableFuture>().also { - apolloClient.mutation(mutation).enqueue { response -> processOperationResponse(response, it) } - } - } - - /** - * Executes a GraphQL mutation and returns a [RawResponse] containing the complete data and any errors. - * - * @param mutation The GraphQL mutation to be executed. - * @return A [RawResponse] with the full data structure and any errors from the server. - * @throws [ExpediaGroupServiceException] If an exception occurs during mutation execution. - * @throws [NoDataException] If the mutation completes without data but includes errors. - */ - override fun execute(mutation: Mutation): RawResponse { - return executeAsync(mutation).getOrThrowDomainException() - } - - /** - * Handles the response from a GraphQL operation, determining whether to complete the provided CompletableFuture - * with either success or an exception based on the response data and errors. - * - * @param response The ApolloResponse containing the data and errors from the GraphQL operation. - * @param future A CompletableFuture that will be completed based on the response handling logic. - */ - private fun processOperationResponse( - response: ApolloResponse, - future: CompletableFuture> - ) { - try { - when { - response.exception != null -> future.completeExceptionally( - ExpediaGroupServiceException( - cause = response.exception - ) - ) - - response.data == null && response.hasErrors() -> future.completeExceptionally( - NoDataException( - message = "No data received from the server", - errors = response.errors!!.map { Error.fromApolloError(it) } - ) - ) - - else -> future.complete( - RawResponse( - data = response.data!!, - errors = response.errors?.map { Error.fromApolloError(it) } - ) - ) - } - } catch (e: Exception) { - future.completeExceptionally( - ExpediaGroupServiceException( - message = e.message, - cause = e - ) - ) - } - } - - private fun CompletableFuture.getOrThrowDomainException(): T { - return try { - this.get() - } catch (e: ExecutionException) { - when (e.cause) { - is NoDataException -> throw e.cause as NoDataException - is ExpediaGroupServiceException -> throw e.cause as ExpediaGroupServiceException - else -> throw e - } - } catch (e: InterruptedException) { - Thread.currentThread().interrupt() - throw ExpediaGroupServiceException("Interrupted while waiting for response", e) - } - } -} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutor.kt b/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutor.kt index 77d2ebc6..71b0e60f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutor.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutor.kt @@ -16,79 +16,155 @@ package com.expediagroup.sdk.graphql.common +import com.apollographql.apollo.api.ApolloResponse import com.apollographql.apollo.api.Mutation +import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.Query import com.apollographql.java.client.ApolloClient -import com.expediagroup.sdk.core.client.Disposable import com.expediagroup.sdk.core.client.AbstractRequestExecutor import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException import com.expediagroup.sdk.graphql.model.exception.NoDataException +import com.expediagroup.sdk.graphql.model.response.Error import com.expediagroup.sdk.graphql.model.response.RawResponse import java.util.concurrent.CompletableFuture +import java.util.concurrent.ExecutionException /** - * Abstract base class for executing GraphQL operations, providing a structure for executing queries and mutations - * and returning the full response data along with any errors. + * A streamlined implementation of [AbstractGraphQLExecutor] that handles GraphQL operations with + * error handling and response processing. This executor processes both queries and mutations + * while providing detailed error information when operations fail. * - * This class is designed to handle the execution of GraphQL operations and return a [RawResponse] containing - * the complete, unprocessed data and error details. Subclasses should implement specific behaviors for how - * requests are sent and processed. + * This executor leverages the Apollo Client to perform requests and processes responses by capturing + * the entire data structure and any errors in a [RawResponse], which can then be further processed or + * filtered by higher-level components in the SDK. + * + * By default - this implementation is used internally in all higher-level clients that extend [GraphQLClient] abstract class + * + * @param requestExecutor used for HTTP request execution within the SDK + * @param serverUrl GraphQL server URL */ -abstract class GraphQLExecutor( - private val requestExecutor: AbstractRequestExecutor -) : Disposable { +internal class GraphQLExecutor( + requestExecutor: AbstractRequestExecutor, + serverUrl: String +) : AbstractGraphQLExecutor(requestExecutor) { /** - * The Apollo Client instance used to perform GraphQL requests. - * Subclasses must initialize this property with a configured [ApolloClient] instance. + * The Apollo Client used to execute GraphQL requests, configured with a custom HTTP client. */ - protected abstract val apolloClient: ApolloClient + override val apolloClient: ApolloClient = ApolloClient.Builder() + .serverUrl(serverUrl) + .httpEngine(ApolloHttpEngine(requestExecutor)) + .build() /** - * Executes a GraphQL query and returns the complete raw response. + * Asynchronously executes a GraphQL query and returns a [CompletableFuture] containing the complete + * data and any errors wrapped in [RawResponse]. * * @param query The GraphQL query to be executed. - * @return A [RawResponse] containing the full data and any errors from the query response. - * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the query. + * @return A [CompletableFuture] with the full data structure and any errors from the server. + * @throws [ExpediaGroupServiceException] If an exception occurs during query execution. * @throws [NoDataException] If the query completes without data but includes errors. */ - abstract fun execute(query: Query): RawResponse + override fun executeAsync(query: Query): CompletableFuture> { + return CompletableFuture>().also { + apolloClient.query(query).enqueue { response -> processOperationResponse(response, it) } + } + } /** - * Executes a GraphQL mutation and returns the complete raw response. + * Executes a GraphQL query and returns a [RawResponse] containing the complete data and any errors. * - * @param mutation The GraphQL mutation to be executed. - * @return A [RawResponse] containing the full data and any errors from the mutation response. - * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the mutation. - * @throws [NoDataException] If the mutation completes without data but includes errors. + * @param query The GraphQL query to be executed. + * @return A [RawResponse] with the full data structure and any errors from the server. + * @throws [ExpediaGroupServiceException] If an exception occurs during query execution. + * @throws [NoDataException] If the query completes without data but includes errors. */ - abstract fun execute(mutation: Mutation): RawResponse + override fun execute(query: Query): RawResponse { + return executeAsync(query).getOrThrowDomainException() + } /** - * Asynchronously executes a GraphQL query and returns the complete raw response in a [CompletableFuture]. + * Asynchronously executes a GraphQL mutation and returns a [CompletableFuture] containing the complete + * data and any errors wrapped in [RawResponse]. * - * @param query The GraphQL query to be executed. - * @return A [CompletableFuture] containing the full data and any errors from the query response wrapped in [RawResponse]. - * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the query. - * @throws [NoDataException] If the query completes without data but includes errors. + * @param mutation The GraphQL mutation to be executed. + * @return A [CompletableFuture] with the full data structure and any errors from the server. + * @throws [ExpediaGroupServiceException] If an exception occurs during mutation execution. + * @throws [NoDataException] If the mutation completes without data but includes errors. */ - abstract fun executeAsync(query: Query): CompletableFuture> + override fun executeAsync(mutation: Mutation): CompletableFuture> { + return CompletableFuture>().also { + apolloClient.mutation(mutation).enqueue { response -> processOperationResponse(response, it) } + } + } /** - * Asynchronously executes a GraphQL mutation and returns the complete raw response in a [CompletableFuture]. + * Executes a GraphQL mutation and returns a [RawResponse] containing the complete data and any errors. * * @param mutation The GraphQL mutation to be executed. - * @return A [CompletableFuture] containing the full data and any errors from the mutation response wrapped in [RawResponse]. - * @throws [ExpediaGroupServiceException] If an exception occurs during the execution of the mutation. + * @return A [RawResponse] with the full data structure and any errors from the server. + * @throws [ExpediaGroupServiceException] If an exception occurs during mutation execution. * @throws [NoDataException] If the mutation completes without data but includes errors. */ - abstract fun executeAsync(mutation: Mutation): CompletableFuture> + override fun execute(mutation: Mutation): RawResponse { + return executeAsync(mutation).getOrThrowDomainException() + } /** - * Closes the underlying [AbstractRequestExecutor] and [ApolloClient] + * Handles the response from a GraphQL operation, determining whether to complete the provided CompletableFuture + * with either success or an exception based on the response data and errors. + * + * @param response The ApolloResponse containing the data and errors from the GraphQL operation. + * @param future A CompletableFuture that will be completed based on the response handling logic. */ - override fun dispose() { - requestExecutor.dispose() - apolloClient.close() + private fun processOperationResponse( + response: ApolloResponse, + future: CompletableFuture> + ) { + try { + when { + response.exception != null -> future.completeExceptionally( + ExpediaGroupServiceException( + cause = response.exception + ) + ) + + response.data == null && response.hasErrors() -> future.completeExceptionally( + NoDataException( + message = "No data received from the server", + errors = response.errors!!.map { Error.fromApolloError(it) } + ) + ) + + else -> future.complete( + RawResponse( + data = response.data!!, + errors = response.errors?.map { Error.fromApolloError(it) } + ) + ) + } + } catch (e: Exception) { + future.completeExceptionally( + ExpediaGroupServiceException( + message = e.message, + cause = e + ) + ) + } + } + + private fun CompletableFuture.getOrThrowDomainException(): T { + return try { + this.get() + } catch (e: ExecutionException) { + when (e.cause) { + is NoDataException -> throw e.cause as NoDataException + is ExpediaGroupServiceException -> throw e.cause as ExpediaGroupServiceException + else -> throw e + } + } catch (e: InterruptedException) { + Thread.currentThread().interrupt() + throw ExpediaGroupServiceException("Interrupted while waiting for response", e) + } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/common/GraphQLClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/common/GraphQLClient.kt index e36b85cb..ce7ac57c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/common/GraphQLClient.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/common/GraphQLClient.kt @@ -17,12 +17,12 @@ package com.expediagroup.sdk.lodgingconnectivity.common import com.expediagroup.sdk.core.client.Disposable -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.lodgingconnectivity.configuration.ApiEndpoint /** * Abstract base class for GraphQL clients that defines the core structure for executing GraphQL operations. - * Classes extending `GraphQLClient` are expected to provide an implementation of the [GraphQLExecutor]. + * Classes extending `GraphQLClient` are expected to provide an implementation of the [AbstractGraphQLExecutor]. * * This design allows subclasses to define custom logic for executing GraphQL queries and mutations * while relying on the `graphQLExecutor` to perform the actual request handling. @@ -40,10 +40,10 @@ abstract class GraphQLClient : Disposable { * Subclasses must provide a concrete implementation of this executor to define * how queries and mutations are processed. */ - protected abstract val graphQLExecutor: GraphQLExecutor + protected abstract val graphQLExecutor: AbstractGraphQLExecutor /** - * Closes the underlying [GraphQLExecutor] by calling [GraphQLExecutor.dispose] + * Closes the underlying [AbstractGraphQLExecutor] by calling [AbstractGraphQLExecutor.dispose] */ override fun dispose() { graphQLExecutor.dispose() diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/PaymentClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/PaymentClient.kt index 1533fd9a..0f3ca702 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/PaymentClient.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/PaymentClient.kt @@ -17,9 +17,9 @@ package com.expediagroup.sdk.lodgingconnectivity.payment import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.DefaultGraphQLExecutor -import com.expediagroup.sdk.lodgingconnectivity.common.GraphQLClient import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.lodgingconnectivity.common.GraphQLClient +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.lodgingconnectivity.common.RequestExecutor import com.expediagroup.sdk.lodgingconnectivity.configuration.ClientConfiguration import com.expediagroup.sdk.lodgingconnectivity.configuration.ClientEnvironment @@ -40,7 +40,7 @@ import com.expediagroup.sdk.lodgingconnectivity.payment.operation.getPaymentInst class PaymentClient(config: ClientConfiguration) : GraphQLClient() { override val apiEndpoint = EndpointProvider.getPaymentApiEndpoint(config.environment) - override val graphQLExecutor: GraphQLExecutor = DefaultGraphQLExecutor( + override val graphQLExecutor: AbstractGraphQLExecutor = GraphQLExecutor( requestExecutor = RequestExecutor(config, apiEndpoint), serverUrl = apiEndpoint.endpoint ) @@ -49,7 +49,7 @@ class PaymentClient(config: ClientConfiguration) : GraphQLClient() { * Retrieves the payment instrument details associated with the specified token. * * This function executes a [PaymentInstrumentQuery] GraphQL operation using the client’s configured - * [GraphQLExecutor]. It returns a [GetPaymentInstrumentResponse] containing both the targeted payment + * [AbstractGraphQLExecutor]. It returns a [GetPaymentInstrumentResponse] containing both the targeted payment * instrument data and the full raw response. * * @param token The token identifying the payment instrument to be retrieved. diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/operation/GetPaymentInstrumentOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/operation/GetPaymentInstrumentOperation.kt index 6f2be55f..1866c333 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/operation/GetPaymentInstrumentOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/payment/operation/GetPaymentInstrumentOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.payment.operation import com.expediagroup.sdk.core.extension.getOrThrow import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.payment.operation.fragment.PaymentInstrumentData @@ -40,16 +40,16 @@ data class GetPaymentInstrumentResponse( /** * Executes [PaymentInstrumentQuery] GraphQL operation to retrieve details about a specific payment instrument. * - * This function uses the provided [GraphQLExecutor] to execute the operation and returns a [GetPaymentInstrumentResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the operation and returns a [GetPaymentInstrumentResponse] * containing both the targeted payment instrument data and the full raw response. If the payment instrument * data is missing or null, an [ExpediaGroupServiceException] is thrown. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL query. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL query. * @param token The token identifying the payment instrument to be retrieved. * @return A [GetPaymentInstrumentResponse] containing the requested payment instrument data and the full raw response. * @throws [ExpediaGroupServiceException] If the payment instrument data is not found in the response. */ -fun getPaymentInstrumentOperation(graphQLExecutor: GraphQLExecutor, token: String): GetPaymentInstrumentResponse { +fun getPaymentInstrumentOperation(graphQLExecutor: AbstractGraphQLExecutor, token: String): GetPaymentInstrumentResponse { val operation = PaymentInstrumentQuery(token) val response = graphQLExecutor.execute(operation) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/SandboxDataManagementClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/SandboxDataManagementClient.kt index 25bd4d6a..44ca6a68 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/SandboxDataManagementClient.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/SandboxDataManagementClient.kt @@ -17,9 +17,9 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.DefaultGraphQLExecutor -import com.expediagroup.sdk.lodgingconnectivity.common.GraphQLClient import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.lodgingconnectivity.common.GraphQLClient +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.lodgingconnectivity.common.RequestExecutor import com.expediagroup.sdk.lodgingconnectivity.configuration.ClientConfiguration import com.expediagroup.sdk.lodgingconnectivity.configuration.ClientEnvironment @@ -77,7 +77,7 @@ import com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.paginator.Sa class SandboxDataManagementClient(config: ClientConfiguration) : GraphQLClient() { override val apiEndpoint = EndpointProvider.getSandboxApiEndpoint(config.environment) - override val graphQLExecutor: GraphQLExecutor = DefaultGraphQLExecutor( + override val graphQLExecutor: AbstractGraphQLExecutor = GraphQLExecutor( requestExecutor = RequestExecutor(config, apiEndpoint), serverUrl = apiEndpoint.endpoint ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/CreateSandboxPropertyOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/CreateSandboxPropertyOperation.kt index 0e18108d..07827ed4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/CreateSandboxPropertyOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/CreateSandboxPropertyOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.property.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxCreatePropertyMutation @@ -39,16 +39,16 @@ data class CreateSandboxPropertyResponse( /** * Executes a [SandboxCreatePropertyMutation] GraphQL mutation to create a new sandbox property with the specified input data. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [CreateSandboxPropertyResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [CreateSandboxPropertyResponse] * containing both the targeted sandbox property data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [CreatePropertyInput] containing the details for the property to be created. * @return A [CreateSandboxPropertyResponse] containing the created sandbox property data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun createSandboxPropertyOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: CreatePropertyInput ): CreateSandboxPropertyResponse { val operation = SandboxCreatePropertyMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/DeleteSandboxPropertyOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/DeleteSandboxPropertyOperation.kt index b1dd87f8..08081e71 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/DeleteSandboxPropertyOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/DeleteSandboxPropertyOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.property.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxDeletePropertyMutation @@ -39,16 +39,16 @@ data class DeleteSandboxPropertyResponse( /** * Executes [SandboxDeletePropertyMutation] GraphQL mutation to delete an existing sandbox property with the specified input data. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [DeleteSandboxPropertyResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [DeleteSandboxPropertyResponse] * containing both the targeted delete property data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [DeletePropertyInput] containing the details of the property to be deleted. * @return A [DeleteSandboxPropertyResponse] containing the deleted property data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun deleteSandboxPropertyOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: DeletePropertyInput ): DeleteSandboxPropertyResponse { val operation = SandboxDeletePropertyMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertiesOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertiesOperation.kt index 3d94e1d5..55775e3c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertiesOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertiesOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.property.operation import com.expediagroup.sdk.core.extension.orNullIfBlank import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.paging.PageInfo import com.expediagroup.sdk.graphql.model.response.PaginatedResponse import com.expediagroup.sdk.graphql.model.response.RawResponse @@ -44,11 +44,11 @@ data class GetSandboxPropertiesResponse( /** * Executes a [SandboxPropertiesQuery] GraphQL query to retrieve a paginated list of sandbox properties. * - * This function uses the provided [GraphQLExecutor] to execute the query, with optional parameters for cursor and page size. + * This function uses the provided [AbstractGraphQLExecutor] to execute the query, with optional parameters for cursor and page size. * It returns a [GetSandboxPropertiesResponse] containing the sandbox properties data, pagination information, * and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL query. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL query. * @param cursor An optional cursor to specify the starting point for pagination; defaults to `null` for the first page. * @param pageSize The number of properties to retrieve per page; defaults to `null` to use the server's default page size. * @return A [GetSandboxPropertiesResponse] containing the sandbox properties data, pagination information, and the full raw response. @@ -56,7 +56,7 @@ data class GetSandboxPropertiesResponse( */ @JvmOverloads fun getSandboxPropertiesOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, cursor: String? = null, pageSize: Int? = null ): GetSandboxPropertiesResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertyOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertyOperation.kt index 6b432684..cf883768 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertyOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/GetSandboxPropertyOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.property.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxPropertyQuery @@ -40,15 +40,15 @@ data class GetSandboxPropertyResponse( /** * Executes a [SandboxPropertyQuery] GraphQL query to retrieve details about a specific sandbox property. * - * This function uses the provided [GraphQLExecutor] to execute the query and returns a [GetSandboxPropertyResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the query and returns a [GetSandboxPropertyResponse] * containing both the targeted sandbox property data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL query. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL query. * @param propertyId The unique identifier of the sandbox property to retrieve. * @return A [GetSandboxPropertyResponse] containing the requested sandbox property data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the query execution. */ -fun getSandboxPropertyOperation(graphQLExecutor: GraphQLExecutor, propertyId: String): GetSandboxPropertyResponse { +fun getSandboxPropertyOperation(graphQLExecutor: AbstractGraphQLExecutor, propertyId: String): GetSandboxPropertyResponse { val operation = SandboxPropertyQuery(propertyId) val response = graphQLExecutor.execute(operation) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/UpdateSandboxPropertyOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/UpdateSandboxPropertyOperation.kt index 37f38e30..9c807ce6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/UpdateSandboxPropertyOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/operation/UpdateSandboxPropertyOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.property.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxUpdatePropertyMutation @@ -41,16 +41,16 @@ data class UpdateSandboxPropertyResponse( /** * Executes [SandboxUpdatePropertyMutation] GraphQL mutation to modify the details of an existing sandbox property. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns an [UpdateSandboxPropertyResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns an [UpdateSandboxPropertyResponse] * containing both the updated sandbox property data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [UpdatePropertyInput] containing the details of the property update. * @return An [UpdateSandboxPropertyResponse] containing the updated sandbox property data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun updateSandboxPropertyOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: UpdatePropertyInput ): UpdateSandboxPropertyResponse { val operation = SandboxUpdatePropertyMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/paginator/SandboxPropertiesPaginator.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/paginator/SandboxPropertiesPaginator.kt index 349a3edb..977d8055 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/paginator/SandboxPropertiesPaginator.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/property/paginator/SandboxPropertiesPaginator.kt @@ -16,7 +16,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.property.paginator -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.paging.PageInfo import com.expediagroup.sdk.graphql.model.response.PaginatedResponse import com.expediagroup.sdk.graphql.model.response.RawResponse @@ -44,16 +44,16 @@ data class SandboxPropertiesPaginatedResponse( * Provides an iterator to retrieve sandbox properties in a paginated manner using the [SandboxPropertiesQuery] * GraphQL operation, allowing seamless iteration over pages of properties. * - * This paginator uses the specified [GraphQLExecutor] to fetch pages based on a cursor and optional page size, + * This paginator uses the specified [AbstractGraphQLExecutor] to fetch pages based on a cursor and optional page size, * providing automatic handling of pagination state. * - * @param graphQLExecutor The [GraphQLExecutor] used to execute GraphQL queries. + * @param graphQLExecutor The [AbstractGraphQLExecutor] used to execute GraphQL queries. * @param pageSize The number of properties to retrieve per page; defaults to `null` to use the server's default page size. * @param initialCursor An optional cursor to specify the starting point for pagination; defaults to `null` for the first page. * @constructor Creates a [SandboxPropertiesPaginator] with the specified executor, page size, and initial cursor. */ class SandboxPropertiesPaginator @JvmOverloads constructor( - private val graphQLExecutor: GraphQLExecutor, + private val graphQLExecutor: AbstractGraphQLExecutor, private val pageSize: Int? = null, initialCursor: String? = null ) : Iterator { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CancelSandboxReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CancelSandboxReservationOperation.kt index d522e513..396f88af 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CancelSandboxReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CancelSandboxReservationOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxCancelReservationMutation @@ -41,15 +41,15 @@ data class CancelSandboxReservationResponse( /** * Executes [SandboxCancelReservationMutation] GraphQL mutation to cancel an existing sandbox reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [CancelSandboxReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [CancelSandboxReservationResponse] * containing both the updated reservation data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [CancelReservationInput] containing the details of the reservation to be canceled. * @return A [CancelSandboxReservationResponse] containing the canceled reservation data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ -fun cancelSandboxReservationOperation(graphQLExecutor: GraphQLExecutor, input: CancelReservationInput): CancelSandboxReservationResponse { +fun cancelSandboxReservationOperation(graphQLExecutor: AbstractGraphQLExecutor, input: CancelReservationInput): CancelSandboxReservationResponse { val operation = SandboxCancelReservationMutation(input) val response = graphQLExecutor.execute(operation) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/ChangeSandboxReservationStayDatesOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/ChangeSandboxReservationStayDatesOperation.kt index 0c71c7e5..12024130 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/ChangeSandboxReservationStayDatesOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/ChangeSandboxReservationStayDatesOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxChangeReservationStayDatesMutation @@ -41,16 +41,16 @@ data class ChangeSandboxReservationStayDatesResponse( /** * Executes [SandboxChangeReservationStayDatesMutation] GraphQL mutation to modify the stay dates of an existing sandbox reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [ChangeSandboxReservationStayDatesResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [ChangeSandboxReservationStayDatesResponse] * containing both the updated reservation data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [ChangeReservationStayDatesInput] containing the new stay dates for the reservation. * @return A [ChangeSandboxReservationStayDatesResponse] containing the updated reservation data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun changeSandboxReservationStayDatesOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: ChangeReservationStayDatesInput ): ChangeSandboxReservationStayDatesResponse { val operation = SandboxChangeReservationStayDatesMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CreateSandboxReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CreateSandboxReservationOperation.kt index ab5da23d..f7b0e8ea 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CreateSandboxReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/CreateSandboxReservationOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxCreateReservationMutation @@ -39,15 +39,15 @@ data class CreateSandboxReservationResponse( /** * Executes [SandboxCreateReservationMutation] GraphQL mutation to create a new sandbox reservation with the specified input data. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [CreateSandboxReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [CreateSandboxReservationResponse] * containing both the created reservation data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [CreateReservationInput] containing the details for the new reservation. * @return A [CreateSandboxReservationResponse] containing the created reservation data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ -fun createSandboxReservationOperation(graphQLExecutor: GraphQLExecutor, input: CreateReservationInput): CreateSandboxReservationResponse { +fun createSandboxReservationOperation(graphQLExecutor: AbstractGraphQLExecutor, input: CreateReservationInput): CreateSandboxReservationResponse { val operation = SandboxCreateReservationMutation(input) val response = graphQLExecutor.execute(operation) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationOperation.kt index 2ce826a3..a08a3c36 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxDeleteReservationMutation @@ -39,16 +39,16 @@ data class DeleteSandboxReservationResponse( /** * Executes [SandboxDeleteReservationMutation] GraphQL mutation to remove an existing sandbox reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [DeleteSandboxReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [DeleteSandboxReservationResponse] * containing both the deleted reservation data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [DeleteReservationInput] containing the details of the reservation to be deleted. * @return A [DeleteSandboxReservationResponse] containing the deleted reservation data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun deleteSandboxReservationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: DeleteReservationInput ): DeleteSandboxReservationResponse { val operation = SandboxDeleteReservationMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationsOperation.kt index 51c49622..e4b74f09 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/DeleteSandboxReservationsOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxDeletePropertyReservationsMutation @@ -39,16 +39,16 @@ data class DeleteSandboxReservationsResponse( /** * Executes [SandboxDeletePropertyReservationsMutation] GraphQL mutation to remove multiple reservations for a specified property. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [DeleteSandboxReservationsResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [DeleteSandboxReservationsResponse] * containing both the data for the deleted reservations and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [DeletePropertyReservationsInput] containing the details of the reservations to be deleted. * @return A [DeleteSandboxReservationsResponse] containing data for the deleted reservations and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun deleteSandboxReservationsOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: DeletePropertyReservationsInput ): DeleteSandboxReservationsResponse { val operation = SandboxDeletePropertyReservationsMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationOperation.kt index 48dad697..953437a2 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxReservationQuery @@ -38,15 +38,15 @@ data class GetSandboxReservationResponse( /** * Executes [SandboxReservationQuery] GraphQL query to retrieve details about a specific sandbox reservation. * - * This function uses the provided [GraphQLExecutor] to execute the query and returns a [GetSandboxReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the query and returns a [GetSandboxReservationResponse] * containing both the targeted reservation data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL query. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL query. * @param reservationId The unique identifier of the sandbox reservation to retrieve. * @return A [GetSandboxReservationResponse] containing the requested reservation data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the query execution. */ -fun getSandboxReservationOperation(graphQLExecutor: GraphQLExecutor, reservationId: String): GetSandboxReservationResponse { +fun getSandboxReservationOperation(graphQLExecutor: AbstractGraphQLExecutor, reservationId: String): GetSandboxReservationResponse { val operation = SandboxReservationQuery(reservationId) val response = graphQLExecutor.execute(operation) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationsOperation.kt index 71b411d7..e69f15fb 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/GetSandboxReservationsOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.extension.orNullIfBlank import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.paging.PageInfo import com.expediagroup.sdk.graphql.model.response.PaginatedResponse import com.expediagroup.sdk.graphql.model.response.RawResponse @@ -43,10 +43,10 @@ data class GetSandboxReservationsResponse( /** * Executes [SandboxPropertyReservationsQuery] GraphQL query to retrieve a paginated list of reservations for a specific property. * - * This function uses the provided [GraphQLExecutor] to execute the query, with optional parameters for cursor and page size. + * This function uses the provided [AbstractGraphQLExecutor] to execute the query, with optional parameters for cursor and page size. * It returns a [GetSandboxReservationsResponse] containing the reservation data, pagination information, and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL query. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL query. * @param propertyId The unique identifier of the property for which reservations are being retrieved. * @param cursor An optional cursor to specify the starting point for pagination; defaults to `null` for the first page. * @param pageSize The number of reservations to retrieve per page; defaults to `null` to use the server's default page size. @@ -55,7 +55,7 @@ data class GetSandboxReservationsResponse( */ @JvmOverloads fun getSandboxReservationsOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, propertyId: String, cursor: String? = null, pageSize: Int? = null diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/UpdateSandboxReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/UpdateSandboxReservationOperation.kt index 2d59d860..c7e217f9 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/UpdateSandboxReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/operation/UpdateSandboxReservationOperation.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.operation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.sandbox.operation.SandboxUpdateReservationMutation @@ -40,16 +40,16 @@ data class UpdateSandboxReservationResponse( /** * Executes [SandboxUpdateReservationMutation] GraphQL mutation to modify the details of an existing sandbox reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns an [UpdateSandboxReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns an [UpdateSandboxReservationResponse] * containing both the updated reservation data and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [UpdateReservationInput] containing the new details for the reservation. * @return An [UpdateSandboxReservationResponse] containing the updated reservation data and the full raw response. * @throws [ExpediaGroupServiceException] If an error occurs during the mutation execution. */ fun updateSandboxReservationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: UpdateReservationInput ): UpdateSandboxReservationResponse { val operation = SandboxUpdateReservationMutation(input) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/paginator/SandboxReservationsPaginator.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/paginator/SandboxReservationsPaginator.kt index c48ec102..5832600e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/paginator/SandboxReservationsPaginator.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/sandbox/reservation/paginator/SandboxReservationsPaginator.kt @@ -17,7 +17,7 @@ package com.expediagroup.sdk.lodgingconnectivity.sandbox.reservation.paginator import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.paging.PageInfo import com.expediagroup.sdk.graphql.model.response.PaginatedResponse import com.expediagroup.sdk.graphql.model.response.RawResponse @@ -45,17 +45,17 @@ data class SandboxReservationsPaginatedResponse( * Provides an iterator to retrieve sandbox reservations in a paginated manner using the [SandboxPropertyReservationsQuery] * GraphQL operation, allowing seamless iteration over pages of reservations for a specified property. * - * This paginator uses the specified [GraphQLExecutor] to fetch pages based on a cursor and optional page size, + * This paginator uses the specified [AbstractGraphQLExecutor] to fetch pages based on a cursor and optional page size, * managing the pagination state automatically. * - * @param graphQLExecutor The [GraphQLExecutor] used to execute GraphQL queries. + * @param graphQLExecutor The [AbstractGraphQLExecutor] used to execute GraphQL queries. * @param propertyId The unique identifier of the property for which reservations are being retrieved. * @param pageSize The number of reservations to retrieve per page; defaults to `null` to use the server's default page size. * @param initialCursor An optional cursor to specify the starting point for pagination; defaults to `null` for the first page. * @constructor Creates a [SandboxReservationsPaginator] with the specified executor, property ID, page size, and initial cursor. */ class SandboxReservationsPaginator @JvmOverloads constructor( - private val graphQLExecutor: GraphQLExecutor, + private val graphQLExecutor: AbstractGraphQLExecutor, private val propertyId: String, private val pageSize: Int? = null, initialCursor: String? = null diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/ReservationClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/ReservationClient.kt index 733fe362..24aa880e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/ReservationClient.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/ReservationClient.kt @@ -17,9 +17,9 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.DefaultGraphQLExecutor -import com.expediagroup.sdk.lodgingconnectivity.common.GraphQLClient import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.lodgingconnectivity.common.GraphQLClient +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.lodgingconnectivity.common.RequestExecutor import com.expediagroup.sdk.lodgingconnectivity.configuration.ClientConfiguration import com.expediagroup.sdk.lodgingconnectivity.configuration.ClientEnvironment @@ -63,7 +63,7 @@ class ReservationClient(config: ClientConfiguration) : GraphQLClient() { override val apiEndpoint = EndpointProvider.getSupplyApiEndpoint(config.environment) - override val graphQLExecutor: GraphQLExecutor = DefaultGraphQLExecutor( + override val graphQLExecutor: AbstractGraphQLExecutor = GraphQLExecutor( requestExecutor = RequestExecutor(config, apiEndpoint), serverUrl = apiEndpoint.endpoint ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationOperation.kt index f431b33f..d20c467d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.operation import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.supply.operation.CancelReservationMutation @@ -42,11 +42,11 @@ data class CancelReservationResponse( /** * Executes [CancelReservationMutation] GraphQL mutation to cancel an existing reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [CancelReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [CancelReservationResponse] * containing both the canceled reservation data (if available) and the full raw response. Optional selection parameters * allow the inclusion of additional reservation details in the response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [CancelReservationInput] containing the details of the reservation to be canceled. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -55,7 +55,7 @@ data class CancelReservationResponse( */ @JvmOverloads fun cancelReservationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: CancelReservationInput, selections: ReservationSelections? = null ): CancelReservationResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationReconciliationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationReconciliationOperation.kt index e7de2b51..e54cf5e5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationReconciliationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelReservationReconciliationOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.operation import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.supply.operation.CancelReservationReconciliationMutation @@ -42,11 +42,11 @@ data class CancelReservationReconciliationResponse( /** * Executes [CancelReservationReconciliationMutation] GraphQL mutation to cancel the reconciliation of an existing reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [CancelReservationReconciliationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [CancelReservationReconciliationResponse] * containing both the canceled reconciliation data (if available) and the full raw response. Optional selection parameters * allow the inclusion of additional reservation details in the response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [CancelReservationReconciliationInput] containing the details of the reservation reconciliation to be canceled. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -55,7 +55,7 @@ data class CancelReservationReconciliationResponse( */ @JvmOverloads fun cancelReservationReconciliationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: CancelReservationReconciliationInput, selections: ReservationSelections? = null ): CancelReservationReconciliationResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelVrboReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelVrboReservationOperation.kt index 38500de2..36b54118 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelVrboReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/CancelVrboReservationOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.operation import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.supply.operation.CancelVrboReservationMutation @@ -42,11 +42,11 @@ data class CancelVrboReservationResponse( /** * Executes [CancelVrboReservationMutation] GraphQL mutation to cancel an existing VRBO reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [CancelVrboReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [CancelVrboReservationResponse] * containing both the canceled reservation data (if available) and the full raw response. Optional selection parameters * allow the inclusion of additional reservation details in the response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [CancelVrboReservationInput] containing the details of the VRBO reservation to be canceled. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -55,7 +55,7 @@ data class CancelVrboReservationResponse( */ @JvmOverloads fun cancelVrboReservationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: CancelVrboReservationInput, selections: ReservationSelections? = null ): CancelVrboReservationResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ChangeReservationReconciliationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ChangeReservationReconciliationOperation.kt index c191673d..c3ffeadd 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ChangeReservationReconciliationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ChangeReservationReconciliationOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.operation import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.supply.operation.ChangeReservationReconciliationMutation @@ -42,11 +42,11 @@ data class ChangeReservationReconciliationResponse( /** * Executes [ChangeReservationReconciliationMutation] GraphQL mutation to modify the reconciliation details of an existing reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [ChangeReservationReconciliationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [ChangeReservationReconciliationResponse] * containing both the updated reconciliation data (if available) and the full raw response. Optional selection parameters * allow the inclusion of additional reservation details in the response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [ChangeReservationReconciliationInput] containing the details of the reconciliation changes. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -55,7 +55,7 @@ data class ChangeReservationReconciliationResponse( */ @JvmOverloads fun changeReservationReconciliationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: ChangeReservationReconciliationInput, selections: ReservationSelections? = null ): ChangeReservationReconciliationResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ConfirmReservationNotificationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ConfirmReservationNotificationOperation.kt index b5d12fe7..8ebdd09b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ConfirmReservationNotificationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/ConfirmReservationNotificationOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.operation import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.supply.operation.ConfirmReservationNotificationMutation @@ -42,11 +42,11 @@ data class ConfirmReservationNotificationResponse( /** * Executes [ConfirmReservationNotificationMutation] GraphQL mutation to confirm the notification for an existing reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [ConfirmReservationNotificationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [ConfirmReservationNotificationResponse] * containing both the confirmed reservation data (if available) and the full raw response. Optional selection parameters * allow the inclusion of additional reservation details in the response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [ConfirmReservationNotificationInput] containing the details of the reservation notification to confirm. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -55,7 +55,7 @@ data class ConfirmReservationNotificationResponse( */ @JvmOverloads fun confirmReservationNotificationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: ConfirmReservationNotificationInput, selections: ReservationSelections? = null ): ConfirmReservationNotificationResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/GetReservationsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/GetReservationsOperation.kt index a25a1048..432b65a0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/GetReservationsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/GetReservationsOperation.kt @@ -20,7 +20,7 @@ import com.expediagroup.sdk.core.extension.getOrThrow import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.extension.orNullIfBlank import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.paging.PageInfo import com.expediagroup.sdk.graphql.model.response.PaginatedResponse import com.expediagroup.sdk.graphql.model.response.RawResponse @@ -48,11 +48,11 @@ data class PropertyReservationsResponse( /** * Executes [PropertyReservationsQuery] GraphQL query to retrieve a paginated list of reservations for a specific property. * - * This function uses the provided [GraphQLExecutor] to execute the query, with optional parameters for cursor, + * This function uses the provided [AbstractGraphQLExecutor] to execute the query, with optional parameters for cursor, * page size, and selection of additional reservation details. It returns a [PropertyReservationsResponse] * containing the reservation data, pagination information, and the full raw response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL query. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL query. * @param input The [PropertyReservationsInput] containing the property ID and filter criteria for the reservations. * @param cursor An optional cursor to specify the starting point for pagination; defaults to `null` for the first page. * @param pageSize The number of reservations to retrieve per page; defaults to a predefined page size if not provided. @@ -63,7 +63,7 @@ data class PropertyReservationsResponse( */ @JvmOverloads fun getReservationsOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: PropertyReservationsInput, cursor: String? = null, pageSize: Int? = null, diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/RefundReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/RefundReservationOperation.kt index b575b3d2..874c7256 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/RefundReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/operation/RefundReservationOperation.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.operation import com.expediagroup.sdk.core.extension.orFalseIfNull import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.response.RawResponse import com.expediagroup.sdk.graphql.model.response.Response import com.expediagroup.sdk.lodgingconnectivity.supply.operation.RefundReservationMutation @@ -42,11 +42,11 @@ data class RefundReservationResponse( /** * Executes [RefundReservationMutation] GraphQL mutation to initiate a refund on an existing reservation. * - * This function uses the provided [GraphQLExecutor] to execute the mutation and returns a [RefundReservationResponse] + * This function uses the provided [AbstractGraphQLExecutor] to execute the mutation and returns a [RefundReservationResponse] * containing both the refunded reservation data (if available) and the full raw response. Optional selection parameters * allow the inclusion of additional reservation details in the response. * - * @param graphQLExecutor The [GraphQLExecutor] responsible for executing the GraphQL mutation. + * @param graphQLExecutor The [AbstractGraphQLExecutor] responsible for executing the GraphQL mutation. * @param input The [RefundReservationInput] containing the details of the reservation to be refunded. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -55,7 +55,7 @@ data class RefundReservationResponse( */ @JvmOverloads fun refundReservationOperation( - graphQLExecutor: GraphQLExecutor, + graphQLExecutor: AbstractGraphQLExecutor, input: RefundReservationInput, selections: ReservationSelections? = null ): RefundReservationResponse { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/paginator/ReservationsPaginator.kt b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/paginator/ReservationsPaginator.kt index 94296cc4..b3745d98 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/paginator/ReservationsPaginator.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/lodgingconnectivity/supply/reservation/paginator/ReservationsPaginator.kt @@ -18,7 +18,7 @@ package com.expediagroup.sdk.lodgingconnectivity.supply.reservation.paginator import com.expediagroup.sdk.core.extension.getOrThrow import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException -import com.expediagroup.sdk.graphql.common.GraphQLExecutor +import com.expediagroup.sdk.graphql.common.AbstractGraphQLExecutor import com.expediagroup.sdk.graphql.model.paging.PageInfo import com.expediagroup.sdk.graphql.model.response.PaginatedResponse import com.expediagroup.sdk.graphql.model.response.RawResponse @@ -50,10 +50,10 @@ data class ReservationsPaginatedResponse( * Provides an iterator to retrieve property reservations in a paginated manner using [PropertyReservationsQuery] * GraphQL operation, allowing seamless iteration over pages of reservations for a specified property. * - * This paginator uses the specified [GraphQLExecutor] to fetch pages based on cursor, page size, and optional reservation + * This paginator uses the specified [AbstractGraphQLExecutor] to fetch pages based on cursor, page size, and optional reservation * field selections, managing the pagination state automatically. * - * @param graphQLExecutor The [GraphQLExecutor] used to execute GraphQL queries. + * @param graphQLExecutor The [AbstractGraphQLExecutor] used to execute GraphQL queries. * @param input The [PropertyReservationsInput] specifying the property ID and filter criteria for retrieving reservations. * @param selections An optional [ReservationSelections] specifying additional fields to include in the response, such as * supplier amount and payment instrument token; defaults to `null`. @@ -62,7 +62,7 @@ data class ReservationsPaginatedResponse( * @constructor Creates a [ReservationsPaginator] with the specified executor, input parameters, and initial cursor. */ class ReservationsPaginator @JvmOverloads constructor( - private val graphQLExecutor: GraphQLExecutor, + private val graphQLExecutor: AbstractGraphQLExecutor, private val input: PropertyReservationsInput, private val selections: ReservationSelections? = null, private val pageSize: Int? = null, diff --git a/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutorTest.kt b/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/AbstractGraphQLExecutorTest.kt similarity index 91% rename from code/src/test/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutorTest.kt rename to code/src/test/kotlin/com/expediagroup/sdk/graphql/common/AbstractGraphQLExecutorTest.kt index 4c4f2104..6dbb39f0 100644 --- a/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/GraphQLExecutorTest.kt +++ b/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/AbstractGraphQLExecutorTest.kt @@ -11,14 +11,14 @@ import java.util.concurrent.CompletableFuture import org.junit.jupiter.api.Test -class GraphQLExecutorTest { +class AbstractGraphQLExecutorTest { @Test fun `should close the underlying resources on dispose call`() { val mockRequestExecutor = mockk(relaxed = true) val mockApolloClient = mockk(relaxed = true) - val testGraphQLExecutor = object : GraphQLExecutor(mockRequestExecutor) { + val testGraphQLExecutor = object : AbstractGraphQLExecutor(mockRequestExecutor) { override val apolloClient = mockApolloClient override fun execute(query: Query) = mockk>() override fun execute(mutation: Mutation) = mockk>() diff --git a/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/DefaultGraphQLExecutorTest.kt b/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/DefaultAbstractGraphQLExecutorTest.kt similarity index 95% rename from code/src/test/kotlin/com/expediagroup/sdk/graphql/common/DefaultGraphQLExecutorTest.kt rename to code/src/test/kotlin/com/expediagroup/sdk/graphql/common/DefaultAbstractGraphQLExecutorTest.kt index dec45909..8da10d49 100644 --- a/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/DefaultGraphQLExecutorTest.kt +++ b/code/src/test/kotlin/com/expediagroup/sdk/graphql/common/DefaultAbstractGraphQLExecutorTest.kt @@ -31,9 +31,9 @@ import testservice.TestMutation import testservice.TestQuery import testservice.type.buildTestData -class DefaultGraphQLExecutorTest { +class DefaultAbstractGraphQLExecutorTest { private lateinit var mockWebServer: MockWebServer - private lateinit var executor: DefaultGraphQLExecutor + private lateinit var executor: GraphQLExecutor @BeforeEach fun setUp() { @@ -46,7 +46,7 @@ class DefaultGraphQLExecutorTest { override fun execute(request: Request): Response = transport.execute(request) } - executor = DefaultGraphQLExecutor(requestExecutor, serverUrl) + executor = GraphQLExecutor(requestExecutor, serverUrl) } @AfterEach @@ -240,9 +240,9 @@ class DefaultGraphQLExecutorTest { val underlyingCause = RuntimeException("something went wrong") future.completeExceptionally(ExecutionException(underlyingCause)) - val mockExecutor = DefaultGraphQLExecutor(mockk(), "https://example.com/graphql") + val mockExecutor = GraphQLExecutor(mockk(), "https://example.com/graphql") - val extensionFunction = DefaultGraphQLExecutor::class.declaredFunctions + val extensionFunction = GraphQLExecutor::class.declaredFunctions .first { it.name == "getOrThrowDomainException" } .apply { isAccessible = true } @@ -259,9 +259,9 @@ class DefaultGraphQLExecutorTest { @Test fun `getOrThrowDomainException wraps InterruptedException with ExpediaGroupServiceException when thread interruption occurs`() { val future = CompletableFuture() - val mockExecutor = DefaultGraphQLExecutor(mockk(), "https://example.com/graphql") + val mockExecutor = GraphQLExecutor(mockk(), "https://example.com/graphql") - val extensionFunction = DefaultGraphQLExecutor::class.declaredFunctions + val extensionFunction = GraphQLExecutor::class.declaredFunctions .first { it.name == "getOrThrowDomainException" } .apply { isAccessible = true }