From 16ee6ea3d1ea5046d4a8002e448294250bd3b690 Mon Sep 17 00:00:00 2001
From: dtayeh <9638552+dtayeh@users.noreply.github.com>
Date: Tue, 26 Nov 2024 16:16:13 +0000
Subject: [PATCH 1/2] chore: Publish v5.2.0-SNAPSHOT
---
code/README.md | 2 +-
code/pom.xml | 32 +-
.../sdk/core/client/BaseRapidClient.kt | 22 +-
.../sdk/core/client/BaseXapClient.kt | 22 +-
.../expediagroup/sdk/core/client/Client.kt | 206 +-
.../sdk/core/client/ClientHelpers.kt | 2 +-
.../sdk/core/client/Environment.kt | 6 +-
.../sdk/core/client/ExpediaGroupClient.kt | 9 +-
.../sdk/core/client/HttpHandler.kt | 11 +-
.../sdk/core/client/OkHttpEventListener.kt | 89 +-
.../core/configuration/ClientConfiguration.kt | 3 +
.../sdk/core/configuration/Credentials.kt | 4 +-
.../ExpediaGroupClientConfiguration.kt | 5 +-
.../configuration/RapidClientConfiguration.kt | 2 +
.../configuration/XapClientConfiguration.kt | 2 +
.../collector/ConfigurationCollector.kt | 22 +-
.../collector/ConfigurationProviderQueue.kt | 3 +-
.../provider/ConfigurationProvider.kt | 5 +
.../provider/RuntimeConfigurationProvider.kt | 2 +
.../sdk/core/constant/ConfigurationName.kt | 2 +
.../sdk/core/constant/LogMaskingFields.kt | 2 +-
.../provider/ExceptionMessageProvider.kt | 2 +-
.../provider/LogMaskingRegexProvider.kt | 3 +-
.../provider/LoggingMessageProvider.kt | 10 +-
.../sdk/core/contract/Contract.kt | 2 +-
.../expediagroup/sdk/core/model/Operation.kt | 2 +-
.../expediagroup/sdk/core/model/Properties.kt | 2 +-
.../expediagroup/sdk/core/model/Response.kt | 8 +-
.../sdk/core/model/TransactionId.kt | 8 +-
.../core/model/exception/ExceptionUtils.kt | 2 +-
.../model/exception/ExpediaGroupException.kt | 2 +-
.../client/ExpediaGroupClientException.kt | 2 +-
.../ExpediaGroupConfigurationException.kt | 2 +-
.../ExpediaGroupInvalidFieldNameException.kt | 4 +-
.../PropertyConstraintViolationException.kt | 23 +-
.../service/ExpediaGroupApiException.kt | 8 +-
.../service/ExpediaGroupAuthException.kt | 4 +-
...xpediaGroupServiceDefaultErrorException.kt | 6 +-
.../service/ExpediaGroupServiceException.kt | 2 +-
.../sdk/core/model/paging/Paginator.kt | 11 +-
.../sdk/core/model/paging/ResponseState.kt | 49 +-
.../com/expediagroup/sdk/core/plugin/Hook.kt | 6 +-
.../expediagroup/sdk/core/plugin/Plugin.kt | 2 +-
.../AuthenticationConfiguration.kt | 4 +-
.../AuthenticationHookFactory.kt | 6 +-
.../authentication/AuthenticationPlugin.kt | 2 +-
.../strategy/AuthenticationStrategy.kt | 4 +-
.../strategy/BasicAuthenticationStrategy.kt | 2 +-
.../ExpediaGroupAuthenticationStrategy.kt | 22 +-
.../strategy/RapidAuthenticationStrategy.kt | 8 +-
.../plugin/encoding/EncodingConfiguration.kt | 2 +-
.../core/plugin/encoding/EncodingPlugin.kt | 2 +-
.../ExceptionHandlingConfiguration.kt | 2 +-
.../exception/ExceptionHandlingPlugin.kt | 2 +-
.../httptimeout/HttpTimeoutConfiguration.kt | 4 +-
.../plugin/httptimeout/HttpTimeoutPlugin.kt | 2 +-
.../logging/ExpediaGroupJsonFieldFilter.kt | 2 +-
.../ExpediaGroupJsonFieldPatternBuilder.kt | 2 +-
.../core/plugin/logging/ExpediaGroupLogger.kt | 5 +-
.../logging/ExpediaGroupLoggerFactory.kt | 2 +-
.../sdk/core/plugin/logging/LogMasker.kt | 2 +-
.../plugin/logging/LoggingConfiguration.kt | 4 +-
.../sdk/core/plugin/logging/LoggingPlugin.kt | 8 +-
.../core/plugin/logging/RequestBodyLogger.kt | 6 +-
.../core/plugin/logging/ResponseBodyLogger.kt | 24 +-
.../request/DefaultRequestConfiguration.kt | 4 +-
.../plugin/request/DefaultRequestPlugin.kt | 2 +-
.../SerializationConfiguration.kt | 2 +-
.../serialization/SerializationPlugin.kt | 2 +-
.../sdk/rapid/client/RapidClient.kt | 1403 +++++-------
.../expediagroup/sdk/rapid/models/Address.kt | 61 +-
.../expediagroup/sdk/rapid/models/Address1.kt | 57 +-
.../sdk/rapid/models/Adjustment.kt | 49 +-
.../sdk/rapid/models/AffiliateCollect.kt | 45 +-
.../sdk/rapid/models/AllInclusive.kt | 49 +-
.../expediagroup/sdk/rapid/models/Amenity.kt | 51 +-
.../expediagroup/sdk/rapid/models/Amount.kt | 47 +-
.../sdk/rapid/models/Ancestors.kt | 47 +-
.../com/expediagroup/sdk/rapid/models/Area.kt | 47 +-
.../sdk/rapid/models/AssociatedAirports.kt | 45 +-
.../sdk/rapid/models/Attribute.kt | 49 +-
.../sdk/rapid/models/Attributes.kt | 47 +-
.../expediagroup/sdk/rapid/models/BedGroup.kt | 49 +-
.../sdk/rapid/models/BedGroupAvailability.kt | 51 +-
.../rapid/models/BedGroupAvailabilityLinks.kt | 45 +-
.../sdk/rapid/models/BedGroupConfiguration.kt | 49 +-
.../sdk/rapid/models/BillingContact.kt | 49 +-
.../sdk/rapid/models/BillingContactRequest.kt | 61 +-
.../models/BillingContactRequestAddress.kt | 61 +-
.../models/BillingContactRequestWithPhone.kt | 63 +-
.../sdk/rapid/models/BoundingPolygon.kt | 11 +-
.../expediagroup/sdk/rapid/models/Brand.kt | 47 +-
.../sdk/rapid/models/BusinessModel.kt | 47 +-
.../sdk/rapid/models/CancelPenalty.kt | 55 +-
.../sdk/rapid/models/CancelRefund.kt | 47 +-
.../sdk/rapid/models/CardOption.kt | 47 +-
.../sdk/rapid/models/CategoryAge.kt | 47 +-
.../sdk/rapid/models/CategoryProperty.kt | 47 +-
.../sdk/rapid/models/CategoryValueAdd.kt | 4 +-
.../expediagroup/sdk/rapid/models/Chain.kt | 49 +-
.../rapid/models/ChangeRoomDetailsRequest.kt | 55 +-
.../expediagroup/sdk/rapid/models/Charge.kt | 47 +-
.../sdk/rapid/models/ChargeCalculated.kt | 47 +-
.../expediagroup/sdk/rapid/models/Checkin.kt | 55 +-
.../expediagroup/sdk/rapid/models/Checkout.kt | 45 +-
.../models/CommitChangeRoomRequestBody.kt | 47 +-
.../rapid/models/CompletePaymentSession.kt | 49 +-
.../models/CompletePaymentSessionLinks.kt | 49 +-
.../sdk/rapid/models/ConfirmationId.kt | 47 +-
.../sdk/rapid/models/Conversations.kt | 45 +-
.../sdk/rapid/models/Coordinates.kt | 47 +-
.../sdk/rapid/models/CoordinatesRegion.kt | 49 +-
.../rapid/models/CreateItineraryRequest.kt | 82 +-
.../models/CreateItineraryRequestInvoicing.kt | 51 +-
.../models/CreateItineraryRequestRoom.kt | 63 +-
.../sdk/rapid/models/CreditCard.kt | 49 +-
.../sdk/rapid/models/CreditCardMerchant.kt | 45 +-
.../expediagroup/sdk/rapid/models/Dates.kt | 47 +-
.../com/expediagroup/sdk/rapid/models/Day.kt | 53 +-
.../com/expediagroup/sdk/rapid/models/Deal.kt | 47 +-
.../expediagroup/sdk/rapid/models/Deposit.kt | 49 +-
.../sdk/rapid/models/DepositItinerary.kt | 49 +-
.../sdk/rapid/models/Descriptions.kt | 63 +-
.../sdk/rapid/models/DescriptionsRoom.kt | 45 +-
.../sdk/rapid/models/EnhancedHouseRules.kt | 52 +-
.../expediagroup/sdk/rapid/models/Error.kt | 51 +-
.../sdk/rapid/models/ErrorIndividual.kt | 49 +-
.../sdk/rapid/models/Essential.kt | 54 +-
.../sdk/rapid/models/EssentialInformation.kt | 49 +-
.../com/expediagroup/sdk/rapid/models/Fees.kt | 47 +-
.../rapid/models/FeesPricingInformation.kt | 49 +-
.../expediagroup/sdk/rapid/models/Field.kt | 49 +-
.../sdk/rapid/models/Frequency.kt | 4 +-
.../sdk/rapid/models/GuestRating.kt | 67 +-
.../sdk/rapid/models/GuestReviews.kt | 45 +-
.../sdk/rapid/models/GuestReviewsVerified.kt | 45 +-
.../expediagroup/sdk/rapid/models/Image.kt | 51 +-
.../expediagroup/sdk/rapid/models/Image1.kt | 49 +-
.../sdk/rapid/models/Itinerary.kt | 85 +-
.../sdk/rapid/models/ItineraryCreation.kt | 51 +-
.../rapid/models/ItineraryCreationLinks.kt | 56 +-
.../sdk/rapid/models/ItineraryHistoryItem.kt | 55 +-
.../sdk/rapid/models/ItineraryLinks.kt | 49 +-
.../com/expediagroup/sdk/rapid/models/Link.kt | 49 +-
.../sdk/rapid/models/Localized.kt | 45 +-
.../expediagroup/sdk/rapid/models/Location.kt | 49 +-
.../expediagroup/sdk/rapid/models/Loyalty.kt | 47 +-
.../sdk/rapid/models/ManagementResponse.kt | 47 +-
.../sdk/rapid/models/MarketingFeeIncentive.kt | 49 +-
.../sdk/rapid/models/MaxAllowed.kt | 49 +-
.../sdk/rapid/models/MerchantOfRecord.kt | 4 +-
.../sdk/rapid/models/MultiPolygon.kt | 56 +-
.../sdk/rapid/models/MultiPolygonAllOf.kt | 56 +-
.../sdk/rapid/models/NightCharge.kt | 49 +-
.../sdk/rapid/models/NightChargeType.kt | 4 +-
.../rapid/models/NonrefundableDateRange.kt | 47 +-
.../sdk/rapid/models/Notification.kt | 57 +-
.../sdk/rapid/models/Occupancy.kt | 47 +-
.../sdk/rapid/models/OfferType.kt | 4 +-
.../sdk/rapid/models/OnsitePayments.kt | 47 +-
.../sdk/rapid/models/PaymentOption.kt | 47 +-
.../sdk/rapid/models/PaymentRequest.kt | 74 +-
.../rapid/models/PaymentRequestWithPhone.kt | 74 +-
.../sdk/rapid/models/PaymentSessions.kt | 49 +-
.../sdk/rapid/models/PaymentSessionsLinks.kt | 45 +-
.../rapid/models/PaymentSessionsRequest.kt | 97 +-
...ntSessionsRequestCustomerAccountDetails.kt | 65 +-
.../sdk/rapid/models/PaymentType.kt | 47 +-
.../expediagroup/sdk/rapid/models/Phone.kt | 49 +-
.../sdk/rapid/models/PhoneRequest.kt | 57 +-
.../expediagroup/sdk/rapid/models/Policies.kt | 45 +-
.../expediagroup/sdk/rapid/models/Polygon.kt | 48 +-
.../sdk/rapid/models/PolygonAllOf.kt | 48 +-
.../sdk/rapid/models/Preferred.kt | 45 +-
.../sdk/rapid/models/PricingInformation.kt | 51 +-
.../sdk/rapid/models/Promotions.kt | 47 +-
.../sdk/rapid/models/PromotionsItinerary.kt | 45 +-
.../rapid/models/PropertiesGeoJsonRequest.kt | 62 +-
.../expediagroup/sdk/rapid/models/Property.kt | 12 +-
.../sdk/rapid/models/PropertyAvailability.kt | 51 +-
.../rapid/models/PropertyAvailabilityAllOf.kt | 47 +-
.../rapid/models/PropertyAvailabilityLinks.kt | 47 +-
.../models/PropertyCalendarAvailability.kt | 47 +-
.../sdk/rapid/models/PropertyContent.kt | 128 +-
.../sdk/rapid/models/PropertyGeography.kt | 45 +-
.../sdk/rapid/models/PropertyInactive.kt | 45 +-
.../sdk/rapid/models/PropertyManager.kt | 47 +-
.../sdk/rapid/models/PropertyManagerLinks.kt | 45 +-
.../sdk/rapid/models/PropertyRating.kt | 47 +-
.../rapid/models/PropertyUnavailability.kt | 49 +-
.../models/PropertyUnavailabilityAllOf.kt | 45 +-
.../com/expediagroup/sdk/rapid/models/Rate.kt | 94 +-
.../sdk/rapid/models/RateContent.kt | 52 +-
.../sdk/rapid/models/RateHistory.kt | 53 +-
.../sdk/rapid/models/RateItinerary.kt | 72 +-
.../sdk/rapid/models/RateLinks.kt | 45 +-
.../expediagroup/sdk/rapid/models/Ratings.kt | 47 +-
.../expediagroup/sdk/rapid/models/Region.kt | 92 +-
.../sdk/rapid/models/RentalAgreement.kt | 45 +-
.../sdk/rapid/models/RentalAgreementLinks.kt | 45 +-
.../expediagroup/sdk/rapid/models/Review.kt | 68 +-
.../sdk/rapid/models/RoomAvailability.kt | 49 +-
.../sdk/rapid/models/RoomContent.kt | 61 +-
.../sdk/rapid/models/RoomHistoryItem.kt | 111 +-
.../sdk/rapid/models/RoomItinerary.kt | 75 +-
.../sdk/rapid/models/RoomItineraryLinks.kt | 49 +-
.../sdk/rapid/models/RoomPriceCheck.kt | 68 +-
.../sdk/rapid/models/RoomPriceCheckLinks.kt | 51 +-
.../sdk/rapid/models/SaleScenario.kt | 53 +-
.../sdk/rapid/models/SpokenLanguage.kt | 47 +-
.../sdk/rapid/models/Statistic.kt | 49 +-
.../expediagroup/sdk/rapid/models/Status.kt | 4 +-
.../sdk/rapid/models/StatusItinerary.kt | 4 +-
.../sdk/rapid/models/StatusPriceCheck.kt | 4 +-
.../com/expediagroup/sdk/rapid/models/Stay.kt | 49 +-
.../sdk/rapid/models/StayConstraints.kt | 48 +-
.../expediagroup/sdk/rapid/models/StayType.kt | 4 +-
.../sdk/rapid/models/SupplyContact.kt | 51 +-
.../rapid/models/TestNotificationRequest.kt | 49 +-
.../expediagroup/sdk/rapid/models/Theme.kt | 47 +-
.../sdk/rapid/models/ThirdPartyAuthRequest.kt | 77 +-
.../expediagroup/sdk/rapid/models/Totals.kt | 68 +-
.../sdk/rapid/models/TraderAddress.kt | 57 +-
.../sdk/rapid/models/TraderDetailsInner.kt | 65 +-
.../sdk/rapid/models/TraderInformation.kt | 51 +-
.../sdk/rapid/models/TravelCompanion.kt | 4 +-
.../sdk/rapid/models/TripReason.kt | 4 +-
.../sdk/rapid/models/UnavailableReason.kt | 49 +-
.../sdk/rapid/models/UnitConfiguration.kt | 49 +-
.../sdk/rapid/models/VacationRentalDetails.kt | 83 +-
.../expediagroup/sdk/rapid/models/ValueAdd.kt | 55 +-
.../com/expediagroup/sdk/rapid/models/View.kt | 47 +-
.../rapid/models/exception/ApiException.kt | 914 +++-----
.../exception/PropertyConstraintViolation.kt | 44 -
.../operations/ChangeRoomDetailsOperation.kt | 21 +-
.../ChangeRoomDetailsOperationContext.kt | 11 +-
.../ChangeRoomDetailsOperationLink.kt | 11 +-
.../ChangeRoomDetailsOperationParams.kt | 95 +-
.../rapid/operations/CommitChangeOperation.kt | 21 +-
.../CommitChangeOperationContext.kt | 15 +-
.../operations/CommitChangeOperationLink.kt | 11 +-
.../operations/CommitChangeOperationParams.kt | 99 +-
.../operations/DeleteHeldBookingOperation.kt | 14 +-
.../DeleteHeldBookingOperationContext.kt | 11 +-
.../DeleteHeldBookingOperationLink.kt | 11 +-
.../DeleteHeldBookingOperationParams.kt | 88 +-
.../rapid/operations/DeleteRoomOperation.kt | 14 +-
.../operations/DeleteRoomOperationContext.kt | 11 +-
.../operations/DeleteRoomOperationLink.kt | 11 +-
.../operations/DeleteRoomOperationParams.kt | 95 +-
.../GetAdditionalAvailabilityOperation.kt | 14 +-
...tAdditionalAvailabilityOperationContext.kt | 11 +-
.../GetAdditionalAvailabilityOperationLink.kt | 11 +-
...etAdditionalAvailabilityOperationParams.kt | 173 +-
.../operations/GetAvailabilityOperation.kt | 18 +-
.../GetAvailabilityOperationContext.kt | 11 +-
.../GetAvailabilityOperationLink.kt | 11 +-
.../GetAvailabilityOperationParams.kt | 283 +--
.../operations/GetBookingReceiptOperation.kt | 6 +-
.../GetBookingReceiptOperationLink.kt | 1 +
.../GetBookingReceiptOperationParams.kt | 88 +-
.../GetCalendarAvailabilityOperation.kt | 6 +-
.../GetCalendarAvailabilityOperationLink.kt | 1 +
.../GetCalendarAvailabilityOperationParams.kt | 91 +-
.../operations/GetChainReferenceOperation.kt | 6 +-
.../GetChainReferenceOperationLink.kt | 1 +
.../GetChainReferenceOperationParams.kt | 67 +-
.../GetInactivePropertiesOperation.kt | 6 +-
.../GetInactivePropertiesOperationLink.kt | 1 +
.../GetInactivePropertiesOperationParams.kt | 97 +-
.../operations/GetPaymentOptionsOperation.kt | 14 +-
.../GetPaymentOptionsOperationContext.kt | 11 +-
.../GetPaymentOptionsOperationLink.kt | 11 +-
.../GetPaymentOptionsOperationParams.kt | 78 +-
.../GetPropertyCatalogFileOperation.kt | 6 +-
.../GetPropertyCatalogFileOperationLink.kt | 1 +
.../GetPropertyCatalogFileOperationParams.kt | 105 +-
.../GetPropertyContentFileOperation.kt | 6 +-
.../GetPropertyContentFileOperationLink.kt | 1 +
.../GetPropertyContentFileOperationParams.kt | 109 +-
.../operations/GetPropertyContentOperation.kt | 18 +-
.../GetPropertyContentOperationContext.kt | 11 +-
.../GetPropertyContentOperationLink.kt | 11 +-
.../GetPropertyContentOperationParams.kt | 271 ++-
.../GetPropertyGuestReviewsOperation.kt | 6 +-
.../GetPropertyGuestReviewsOperationLink.kt | 1 +
.../GetPropertyGuestReviewsOperationParams.kt | 141 +-
.../rapid/operations/GetRegionOperation.kt | 6 +-
.../operations/GetRegionOperationLink.kt | 1 +
.../operations/GetRegionOperationParams.kt | 128 +-
.../rapid/operations/GetRegionsOperation.kt | 6 +-
.../operations/GetRegionsOperationLink.kt | 1 +
.../operations/GetRegionsOperationParams.kt | 146 +-
.../GetReservationByItineraryIdOperation.kt | 14 +-
...eservationByItineraryIdOperationContext.kt | 11 +-
...etReservationByItineraryIdOperationLink.kt | 11 +-
...ReservationByItineraryIdOperationParams.kt | 107 +-
.../operations/GetReservationOperation.kt | 6 +-
.../operations/GetReservationOperationLink.kt | 1 +
.../GetReservationOperationParams.kt | 100 +-
.../sdk/rapid/operations/LinkableOperation.kt | 2 +-
.../operations/PostGeographyOperation.kt | 13 +-
.../operations/PostGeographyOperationLink.kt | 1 +
.../PostGeographyOperationParams.kt | 103 +-
.../operations/PostItineraryOperation.kt | 25 +-
.../PostItineraryOperationContext.kt | 11 +-
.../operations/PostItineraryOperationLink.kt | 11 +-
.../PostItineraryOperationParams.kt | 81 +-
.../PostPaymentSessionsOperation.kt | 25 +-
.../PostPaymentSessionsOperationContext.kt | 11 +-
.../PostPaymentSessionsOperationLink.kt | 11 +-
.../PostPaymentSessionsOperationParams.kt | 81 +-
.../rapid/operations/PriceCheckOperation.kt | 14 +-
.../operations/PriceCheckOperationContext.kt | 11 +-
.../operations/PriceCheckOperationLink.kt | 11 +-
.../operations/PriceCheckOperationParams.kt | 98 +-
.../PutCompletePaymentSessionOperation.kt | 14 +-
...tCompletePaymentSessionOperationContext.kt | 11 +-
.../PutCompletePaymentSessionOperationLink.kt | 11 +-
...utCompletePaymentSessionOperationParams.kt | 88 +-
.../operations/PutResumeBookingOperation.kt | 14 +-
.../PutResumeBookingOperationContext.kt | 11 +-
.../PutResumeBookingOperationLink.kt | 11 +-
.../PutResumeBookingOperationParams.kt | 88 +-
.../RequestTestNotificationOperation.kt | 13 +-
.../RequestTestNotificationOperationLink.kt | 1 +
.../RequestTestNotificationOperationParams.kt | 65 +-
...equestUndeliveredNotificationsOperation.kt | 6 +-
...stUndeliveredNotificationsOperationLink.kt | 1 +
...UndeliveredNotificationsOperationParams.kt | 71 +-
.../PropertyConstraintsValidator.kt | 65 -
code/transformedSpecs.yaml | 1880 +++++++++++++----
332 files changed, 10268 insertions(+), 6529 deletions(-)
rename code/src/main/kotlin/com/expediagroup/sdk/{rapid/models/exception => core/model/exception/client}/PropertyConstraintViolationException.kt (66%)
delete mode 100644 code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolation.kt
delete mode 100644 code/src/main/kotlin/com/expediagroup/sdk/rapid/validation/PropertyConstraintsValidator.kt
diff --git a/code/README.md b/code/README.md
index 947ff95e75..45d4050df9 100644
--- a/code/README.md
+++ b/code/README.md
@@ -5,7 +5,7 @@
com.expediagroup
rapid-sdk
- 5.1.0
+ 5.2.0-SNAPSHOT
```
diff --git a/code/pom.xml b/code/pom.xml
index dc3f615e57..41fcdc5e35 100644
--- a/code/pom.xml
+++ b/code/pom.xml
@@ -4,9 +4,9 @@
4.0.0
com.expediagroup
rapid-sdk
- 5.1.0
+ 5.2.0-SNAPSHOT
EG rapid-sdk for Java
- EG rapid-sdk v5.1.0
+ EG rapid-sdk v5.2.0-SNAPSHOT
https://github.com/ExpediaGroup/test-sdk
2022
jar
@@ -64,28 +64,28 @@
3.13.0
- 3.7.1
+ 3.8.1
3.5.0
3.4.2
3.3.1
3.6.0
3.3.1
- 3.3.0
+ 3.5.2
3.6.0
- 3.2.0
+ 3.4.0
0.8.12
1.9.20
1.2.1
- 4.5
+ 4.6
1.6.0
- 2.0.0
- 1.8.1
- 2.3.12
- 0.25.0
- 2.0.13
+ 2.0.21
+ 1.9.0
+ 2.3.13
+ 0.26.0
+ 2.0.16
1.7.0
- 3.2.5
+ 3.2.7
@@ -131,19 +131,19 @@
com.fasterxml.jackson
jackson-bom
- 2.17.2
+ 2.18.1
pom
import
com.squareup.okio
okio-jvm
- 3.9.0
+ 3.9.1
org.jetbrains
annotations
- 24.1.0
+ 26.0.1
org.hibernate.validator
@@ -153,7 +153,7 @@
com.fasterxml.jackson.core
jackson-annotations
- 2.17.2
+ 2.18.1
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt
index ce16ebc8f7..464730e16c 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt
@@ -22,6 +22,7 @@ import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvid
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy
import io.ktor.client.HttpClient
import io.ktor.client.engine.HttpClientEngine
+import io.ktor.client.engine.okhttp.OkHttp
/**
* The integration point between the SDK Core and the product SDKs.
@@ -32,15 +33,22 @@ import io.ktor.client.engine.HttpClientEngine
abstract class BaseRapidClient(
namespace: String,
clientConfiguration: RapidClientConfiguration,
- httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE,
+ httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE
) : Client(namespace) {
private val _configurationProvider: ConfigurationProvider =
ConfigurationCollector.create(
clientConfiguration.toProvider(),
- RapidConfigurationProvider,
+ RapidConfigurationProvider
)
- private val _httpClient: HttpClient =
- buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.SIGNATURE, httpClientEngine)
+
+ private val engine: HttpClientEngine =
+ _configurationProvider.okHttpClient?.let {
+ OkHttp.create {
+ preconfigured = it
+ }
+ } ?: httpClientEngine
+
+ private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.SIGNATURE, engine)
init {
finalize()
@@ -54,5 +62,9 @@ abstract class BaseRapidClient(
/** A [BaseRapidClient] builder. */
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
- abstract class Builder> : Client.Builder()
+ abstract class Builder> : HttpConfigurableBuilder()
+
+ /** A [BaseRapidClient] builder with ability to pass a custom okhttp client. */
+ @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
+ abstract class BuilderWithHttpClient> : Client.BuilderWithHttpClient()
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt
index f4768a2191..20dee68134 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt
@@ -22,6 +22,7 @@ import com.expediagroup.sdk.core.configuration.provider.XapConfigurationProvider
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy
import io.ktor.client.HttpClient
import io.ktor.client.engine.HttpClientEngine
+import io.ktor.client.engine.okhttp.OkHttp
/**
* The integration point between the SDK Core and the product SDKs.
@@ -32,15 +33,22 @@ import io.ktor.client.engine.HttpClientEngine
abstract class BaseXapClient(
namespace: String,
clientConfiguration: XapClientConfiguration,
- httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE,
+ httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE
) : Client(namespace) {
private val _configurationProvider: ConfigurationProvider =
ConfigurationCollector.create(
clientConfiguration.toProvider(),
- XapConfigurationProvider,
+ XapConfigurationProvider
)
- private val _httpClient: HttpClient =
- buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BASIC, httpClientEngine)
+
+ private val engine: HttpClientEngine =
+ _configurationProvider.okHttpClient?.let {
+ OkHttp.create {
+ preconfigured = it
+ }
+ } ?: httpClientEngine
+
+ private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BASIC, engine)
init {
finalize()
@@ -54,5 +62,9 @@ abstract class BaseXapClient(
/** A [BaseXapClient] builder. */
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
- abstract class Builder> : Client.Builder()
+ abstract class Builder> : HttpConfigurableBuilder()
+
+ /** A [BaseXapClient] builder with ability to pass a custom okhttp client. */
+ @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
+ abstract class BuilderWithHttpClient> : Client.BuilderWithHttpClient()
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt
index 48d6eadc1d..de2847b942 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt
@@ -51,6 +51,7 @@ import io.ktor.client.engine.okhttp.OkHttp
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.request
import okhttp3.Dispatcher
+import okhttp3.OkHttpClient
// Create a Dispatcher with limits
val dispatcher =
@@ -62,7 +63,7 @@ val dispatcher =
val DEFAULT_HTTP_CLIENT_ENGINE: HttpClientEngine =
OkHttp.create {
config {
- eventListener(OkHttpEventListener)
+ eventListenerFactory(OkHttpEventListener.FACTORY)
dispatcher(dispatcher)
}
}
@@ -72,7 +73,7 @@ val DEFAULT_HTTP_CLIENT_ENGINE: HttpClientEngine =
*/
abstract class Client(
namespace: String,
- environmentProvider: EnvironmentProvider = DefaultEnvironmentProvider(namespace),
+ environmentProvider: EnvironmentProvider = DefaultEnvironmentProvider(namespace)
) : EnvironmentProvider by environmentProvider {
private val httpHandler = DefaultHttpHandler(environmentProvider)
@@ -89,7 +90,7 @@ abstract class Client(
internal fun buildHttpClient(
configurationProvider: ConfigurationProvider,
authenticationType: AuthenticationStrategy.AuthenticationType,
- httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE,
+ httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE
): HttpClient =
HttpClient(httpClientEngine) {
val httpClientConfig = this
@@ -98,18 +99,9 @@ abstract class Client(
val secret: String = configurationProvider.secret ?: fireMissingConfigurationIssue(ConfigurationName.SECRET)
val endpoint: String = configurationProvider.endpoint ?: fireMissingConfigurationIssue(ConfigurationName.ENDPOINT)
val authEndpoint: String = configurationProvider.authEndpoint ?: fireMissingConfigurationIssue(ConfigurationName.AUTH_ENDPOINT)
- val requestTimeout: Long =
- configurationProvider.requestTimeout ?: fireMissingConfigurationIssue(
- ConfigurationName.REQUEST_TIMEOUT_MILLIS,
- )
- val connectionTimeout: Long =
- configurationProvider.connectionTimeout ?: fireMissingConfigurationIssue(
- ConfigurationName.CONNECTION_TIMEOUT_MILLIS,
- )
- val socketTimeout: Long =
- configurationProvider.socketTimeout ?: fireMissingConfigurationIssue(
- ConfigurationName.SOCKET_TIMEOUT_MILLIS,
- )
+ val requestTimeout: Long = configurationProvider.requestTimeout ?: fireMissingConfigurationIssue(ConfigurationName.REQUEST_TIMEOUT_MILLIS)
+ val connectionTimeout: Long = configurationProvider.connectionTimeout ?: fireMissingConfigurationIssue(ConfigurationName.CONNECTION_TIMEOUT_MILLIS)
+ val socketTimeout: Long = configurationProvider.socketTimeout ?: fireMissingConfigurationIssue(ConfigurationName.SOCKET_TIMEOUT_MILLIS)
val maskedLoggingHeaders: Set = configurationProvider.maskedLoggingHeaders ?: setOf()
val maskedLoggingBodyFields: Set = configurationProvider.maskedLoggingBodyFields ?: setOf()
@@ -118,7 +110,7 @@ abstract class Client(
httpClientConfig,
Credentials.from(key, secret),
authEndpoint,
- authenticationType,
+ authenticationType
)
plugins {
@@ -127,9 +119,7 @@ abstract class Client(
use(AuthenticationPlugin).with(authenticationConfiguration)
use(DefaultRequestPlugin).with(DefaultRequestConfiguration.from(httpClientConfig, endpoint))
use(EncodingPlugin).with(EncodingConfiguration.from(httpClientConfig))
- use(
- HttpTimeoutPlugin,
- ).with(HttpTimeoutConfiguration.from(httpClientConfig, requestTimeout, connectionTimeout, socketTimeout))
+ use(HttpTimeoutPlugin).with(HttpTimeoutConfiguration.from(httpClientConfig, requestTimeout, connectionTimeout, socketTimeout))
use(ExceptionHandlingPlugin).with(ExceptionHandlingConfiguration.from(httpClientConfig))
}
@@ -139,8 +129,7 @@ abstract class Client(
}
/** Throw an exception if the configuration is missing. */
- private fun fireMissingConfigurationIssue(configurationKey: String): Nothing =
- throw ExpediaGroupConfigurationException(getMissingRequiredConfigurationMessage(configurationKey))
+ private fun fireMissingConfigurationIssue(configurationKey: String): Nothing = throw ExpediaGroupConfigurationException(getMissingRequiredConfigurationMessage(configurationKey))
private fun isNotSuccessfulResponse(response: HttpResponse) = response.status.value !in Constant.SUCCESSFUL_STATUS_CODES_RANGE
@@ -154,13 +143,13 @@ abstract class Client(
abstract suspend fun throwServiceException(
response: HttpResponse,
- operationId: String,
+ operationId: String
)
suspend fun performGet(url: String): HttpResponse = httpHandler.performGet(httpClient, url)
/**
- * A [Client] builder.
+ * A [Client] base builder.
*/
abstract class Builder> {
/** Sets the API key to use for authentication. */
@@ -172,33 +161,6 @@ abstract class Client(
/** Sets the API endpoint to use for requests. */
protected var endpoint: String? = null
- /**
- * Sets the request timeout in milliseconds.
- *
- * Request timeout is the time period from the start of the request to the completion of the response.
- *
- * Default is infinite - no timeout.
- */
- protected var requestTimeout: Long? = null
-
- /**
- * Sets the connection timeout in milliseconds.
- *
- * Connection timeout is the time period from the start of the request to the establishment of the connection with the server.
- *
- * Default is 10 seconds (10000 milliseconds).
- */
- protected var connectionTimeout: Long? = null
-
- /**
- * Sets the socket timeout in milliseconds.
- *
- * Socket timeout is the maximum period of inactivity between two consecutive data packets.
- *
- * Default is 15 seconds (15000 milliseconds).
- */
- protected var socketTimeout: Long? = null
-
/** Sets tne body fields to be masked in logging. */
protected var maskedLoggingHeaders: Set? = null
@@ -236,6 +198,73 @@ abstract class Client(
return self()
}
+ /**
+ * Sets tne headers to be masked in logging.
+ *
+ * @param headers the headers to be masked in logging.
+ * @return The [Builder] instance.
+ */
+ fun maskedLoggingHeaders(vararg headers: String): SELF {
+ this.maskedLoggingHeaders = headers.toSet()
+ log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.MASKED_LOGGING_HEADERS, headers.joinToString()))
+ return self()
+ }
+
+ /**
+ * Sets tne body fields to be masked in logging.
+ *
+ * @param fields the body fields to be masked in logging.
+ * @return The [Builder] instance.
+ */
+ fun maskedLoggingBodyFields(vararg fields: String): SELF {
+ this.maskedLoggingBodyFields = fields.toSet()
+ log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.MASKED_LOGGING_BODY_FIELDS, fields.joinToString()))
+ return self()
+ }
+
+ /** Create a [Client] object. */
+ abstract fun build(): Client
+
+ @Suppress("UNCHECKED_CAST") // This is safe because of the type parameter
+ protected open fun self(): SELF = this as SELF
+ }
+
+ /**
+ * A builder class for configuring HTTP-related settings for a [Client].
+ *
+ * This builder class extends the base [Client.Builder] class and provides additional methods
+ * for configuring HTTP-specific settings such as request timeout, connection timeout, and socket timeout.
+ *
+ * @param The type of the builder itself, used for method chaining.
+ */
+ abstract class HttpConfigurableBuilder> : Builder() {
+ /**
+ * Sets the request timeout in milliseconds.
+ *
+ * Request timeout is the time period from the start of the request to the completion of the response.
+ *
+ * Default is infinite - no timeout.
+ */
+ protected var requestTimeout: Long? = null
+
+ /**
+ * Sets the connection timeout in milliseconds.
+ *
+ * Connection timeout is the time period from the start of the request to the establishment of the connection with the server.
+ *
+ * Default is 10 seconds (10000 milliseconds).
+ */
+ protected var connectionTimeout: Long? = null
+
+ /**
+ * Sets the socket timeout in milliseconds.
+ *
+ * Socket timeout is the maximum period of inactivity between two consecutive data packets.
+ *
+ * Default is 15 seconds (15000 milliseconds).
+ */
+ protected var socketTimeout: Long? = null
+
/**
* Sets the request timeout in milliseconds.
* Request timeout is the time period from the start of the request to the completion of the response.
@@ -246,12 +275,7 @@ abstract class Client(
*/
fun requestTimeout(milliseconds: Long): SELF {
this.requestTimeout = milliseconds
- log.info(
- LoggingMessageProvider.getRuntimeConfigurationProviderMessage(
- ConfigurationName.REQUEST_TIMEOUT_MILLIS,
- milliseconds.toString(),
- ),
- )
+ log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.REQUEST_TIMEOUT_MILLIS, milliseconds.toString()))
return self()
}
@@ -265,12 +289,7 @@ abstract class Client(
*/
fun connectionTimeout(milliseconds: Long): SELF {
this.connectionTimeout = milliseconds
- log.info(
- LoggingMessageProvider.getRuntimeConfigurationProviderMessage(
- ConfigurationName.CONNECTION_TIMEOUT_MILLIS,
- milliseconds.toString(),
- ),
- )
+ log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.CONNECTION_TIMEOUT_MILLIS, milliseconds.toString()))
return self()
}
@@ -284,54 +303,33 @@ abstract class Client(
*/
fun socketTimeout(milliseconds: Long): SELF {
this.socketTimeout = milliseconds
- log.info(
- LoggingMessageProvider.getRuntimeConfigurationProviderMessage(
- ConfigurationName.SOCKET_TIMEOUT_MILLIS,
- milliseconds.toString(),
- ),
- )
+ log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.SOCKET_TIMEOUT_MILLIS, milliseconds.toString()))
return self()
}
- /**
- * Sets tne headers to be masked in logging.
- *
- * @param headers the headers to be masked in logging.
- * @return The [Builder] instance.
- */
- fun maskedLoggingHeaders(vararg headers: String): SELF {
- this.maskedLoggingHeaders = headers.toSet()
- log.info(
- LoggingMessageProvider.getRuntimeConfigurationProviderMessage(
- ConfigurationName.MASKED_LOGGING_HEADERS,
- headers.joinToString(),
- ),
- )
- return self()
- }
+ /** Create a [Client] object. */
+ abstract override fun build(): Client
+ }
- /**
- * Sets tne body fields to be masked in logging.
- *
- * @param fields the body fields to be masked in logging.
- * @return The [Builder] instance.
- */
- fun maskedLoggingBodyFields(vararg fields: String): SELF {
- this.maskedLoggingBodyFields = fields.toSet()
- log.info(
- LoggingMessageProvider.getRuntimeConfigurationProviderMessage(
- ConfigurationName.MASKED_LOGGING_BODY_FIELDS,
- fields.joinToString(),
- ),
- )
- return self()
- }
+ /**
+ * A builder class for configuring HTTP-related settings for a [Client] with the ability to pass a custom [OkHttpClient].
+ *
+ * This builder class extends the base [Client.Builder] class and provides additional methods
+ * for setting a configured okhttp client.
+ *
+ * @param The type of the builder itself, used for method chaining.
+ */
+ abstract class BuilderWithHttpClient> : Builder() {
+ protected var okHttpClient: OkHttpClient? = null
- /** Create a [Client] object. */
- abstract fun build(): Client
+ @Suppress("UNCHECKED_CAST")
+ override fun self(): SELF = this as SELF
- @Suppress("UNCHECKED_CAST") // This is safe because of the type parameter
- protected open fun self(): SELF = this as SELF
+ /** Sets the [OkHttpClient] to use for the [Client]. */
+ fun okHttpClient(okHttpClient: OkHttpClient): SELF {
+ this.okHttpClient = okHttpClient
+ return self()
+ }
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/ClientHelpers.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/ClientHelpers.kt
index 9c67f6fb8f..b2ed3e3422 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/ClientHelpers.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/ClientHelpers.kt
@@ -17,5 +17,5 @@ package com.expediagroup.sdk.core.client
/** Handy utils and helpers for a client. */
abstract class ClientHelpers(
- val client: Client,
+ val client: Client
)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/Environment.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/Environment.kt
index a7a0aa3472..a0a76bcaff 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/Environment.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/Environment.kt
@@ -22,13 +22,11 @@ import io.ktor.client.request.HttpRequestBuilder
import io.ktor.http.HttpHeaders
interface EnvironmentProvider {
- fun HttpRequestBuilder.appendHeaders(
- extraHeaders: Map = mapOf(HeaderKey.TRANSACTION_ID to TransactionId().dequeue().toString()),
- )
+ fun HttpRequestBuilder.appendHeaders(extraHeaders: Map = mapOf(HeaderKey.TRANSACTION_ID to TransactionId().dequeue().toString()))
}
class DefaultEnvironmentProvider(
- namespace: String,
+ namespace: String
) : EnvironmentProvider {
private val properties = Properties.from(javaClass.classLoader.getResource("sdk.properties")!!)
private val javaVersion = System.getProperty("java.version")
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt
index 2d6f2bc132..b47306debb 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt
@@ -32,15 +32,14 @@ import io.ktor.client.engine.HttpClientEngine
abstract class ExpediaGroupClient(
namespace: String,
clientConfiguration: ExpediaGroupClientConfiguration,
- httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE,
+ httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE
) : Client(namespace) {
private val _configurationProvider: ConfigurationProvider =
ConfigurationCollector.create(
clientConfiguration.toProvider(),
- ExpediaGroupConfigurationProvider,
+ ExpediaGroupConfigurationProvider
)
- private val _httpClient: HttpClient =
- buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BEARER, httpClientEngine)
+ private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BEARER, httpClientEngine)
init {
finalize()
@@ -54,7 +53,7 @@ abstract class ExpediaGroupClient(
/** An [ExpediaGroupClient] builder. */
@Suppress("unused") // This is used by the generated SDK clients.
- abstract class Builder> : Client.Builder() {
+ abstract class Builder> : HttpConfigurableBuilder() {
/** Sets the API auth endpoint to use for requests. */
protected var authEndpoint: String? = null
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/HttpHandler.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/HttpHandler.kt
index e79eb79359..28101ef39d 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/HttpHandler.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/HttpHandler.kt
@@ -24,21 +24,20 @@ import io.ktor.http.HttpMethod
internal interface HttpHandler {
suspend fun performGet(
httpClient: HttpClient,
- link: String,
+ link: String
): HttpResponse
}
internal class DefaultHttpHandler(
- private val environmentProvider: EnvironmentProvider,
+ private val environmentProvider: EnvironmentProvider
) : HttpHandler, EnvironmentProvider by environmentProvider {
override suspend fun performGet(
httpClient: HttpClient,
- link: String,
- ): HttpResponse {
- return httpClient.request {
+ link: String
+ ): HttpResponse =
+ httpClient.request {
method = HttpMethod.Get
url(link)
appendHeaders()
}
- }
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/client/OkHttpEventListener.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/client/OkHttpEventListener.kt
index a7d0bea39c..7986d95201 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/client/OkHttpEventListener.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/OkHttpEventListener.kt
@@ -27,52 +27,69 @@ import okhttp3.Response
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Proxy
+import java.util.concurrent.atomic.AtomicReference
-object OkHttpEventListener : EventListener() {
+/**
+ * An `EventListener` implementation for OkHttp that logs various events during the lifecycle of an HTTP call.
+ *
+ * This listener logs events such as call start, call end, connection start, connection end, request headers start,
+ * request headers end, request body start, request body end, response headers start, response headers end,
+ * response body start, response body end, and failures.
+ *
+ * @property transactionId A reference to the unique transaction ID associated with the HTTP call.
+ */
+class OkHttpEventListener private constructor(private val transactionId: AtomicReference) : EventListener() {
private val log = ExpediaGroupLoggerFactory.getLogger(this::class.java)
- fun Call.getTransactionId() = request().headers[HeaderKey.TRANSACTION_ID]
+ companion object {
+ val FACTORY: Factory =
+ Factory { call ->
+ val transactionIdHeader = call.request().header(HeaderKey.TRANSACTION_ID)
+ val transactionId = AtomicReference(transactionIdHeader.toString())
+ OkHttpEventListener(transactionId)
+ }
+ }
override fun callStart(call: Call) {
super.callStart(call)
- log.debug("Call start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Call start for transaction-id: [{}]", transactionId.get())
}
override fun callEnd(call: Call) {
super.callEnd(call)
- log.debug("Call end for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Call end for transaction-id: [{}]", transactionId.get())
}
override fun callFailed(
call: Call,
- ioe: IOException,
+ ioe: IOException
) {
super.callFailed(call, ioe)
- log.debug("Call failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}")
+ log.debug("Call failed for transaction-id: [{}] with exception message: {}", transactionId.get(), ioe.message)
}
override fun canceled(call: Call) {
super.canceled(call)
- log.debug("Call canceled for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Call canceled for transaction-id: [{}]", transactionId.get())
}
override fun connectStart(
call: Call,
inetSocketAddress: InetSocketAddress,
- proxy: Proxy,
+ proxy: Proxy
) {
super.connectStart(call, inetSocketAddress, proxy)
- log.debug("Connect start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Connect start for transaction-id: [{}]", transactionId.get())
}
override fun connectEnd(
call: Call,
inetSocketAddress: InetSocketAddress,
proxy: Proxy,
- protocol: Protocol?,
+ protocol: Protocol?
) {
super.connectEnd(call, inetSocketAddress, proxy, protocol)
- log.debug("Connect end for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Connect end for transaction-id: [{}]", transactionId.get())
}
override fun connectFailed(
@@ -80,106 +97,106 @@ object OkHttpEventListener : EventListener() {
inetSocketAddress: InetSocketAddress,
proxy: Proxy,
protocol: Protocol?,
- ioe: IOException,
+ ioe: IOException
) {
super.connectFailed(call, inetSocketAddress, proxy, protocol, ioe)
- log.debug("Connect failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}")
+ log.debug("Connect failed for transaction-id: [{}] with exception message: {}", transactionId.get(), ioe.message)
}
override fun connectionAcquired(
call: Call,
- connection: Connection,
+ connection: Connection
) {
super.connectionAcquired(call, connection)
- log.debug("Connection acquired for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Connection acquired for transaction-id: [{}]", transactionId.get())
}
override fun connectionReleased(
call: Call,
- connection: Connection,
+ connection: Connection
) {
super.connectionReleased(call, connection)
- log.debug("Connection released for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Connection released for transaction-id: [{}]", transactionId.get())
}
override fun secureConnectStart(call: Call) {
super.secureConnectStart(call)
- log.debug("Secure connect start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Secure connect start for transaction-id: [{}]", transactionId.get())
}
override fun secureConnectEnd(
call: Call,
- handshake: Handshake?,
+ handshake: Handshake?
) {
super.secureConnectEnd(call, handshake)
- log.debug("Secure connect end for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Secure connect end for transaction-id: [{}]", transactionId.get())
}
override fun requestHeadersStart(call: Call) {
super.requestHeadersStart(call)
- log.debug("Sending request headers start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Sending request headers start for transaction-id: [{}]", transactionId.get())
}
override fun requestHeadersEnd(
call: Call,
- request: Request,
+ request: Request
) {
super.requestHeadersEnd(call, request)
- log.debug("Sending request headers end for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Sending request headers end for transaction-id: [{}]", transactionId.get())
}
override fun requestBodyStart(call: Call) {
super.requestBodyStart(call)
- log.debug("Sending request body start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Sending request body start for transaction-id: [{}]", transactionId.get())
}
override fun requestBodyEnd(
call: Call,
- byteCount: Long,
+ byteCount: Long
) {
super.requestBodyEnd(call, byteCount)
- log.debug("Sending request body end for transaction-id: [${call.getTransactionId()}] with byte count: $byteCount")
+ log.debug("Sending request body end for transaction-id: [{}] with byte count: {}", transactionId.get(), byteCount)
}
override fun requestFailed(
call: Call,
- ioe: IOException,
+ ioe: IOException
) {
super.requestFailed(call, ioe)
- log.debug("Request failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}")
+ log.debug("Request failed for transaction-id: [{}] with exception message: {}", transactionId.get(), ioe.message)
}
override fun responseHeadersStart(call: Call) {
super.responseHeadersStart(call)
- log.debug("Receiving response headers start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Receiving response headers start for transaction-id: [{}]", transactionId.get())
}
override fun responseHeadersEnd(
call: Call,
- response: Response,
+ response: Response
) {
super.responseHeadersEnd(call, response)
- log.debug("Receiving response headers end for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Receiving response headers end for transaction-id: [{}]", transactionId.get())
}
override fun responseBodyStart(call: Call) {
super.responseBodyStart(call)
- log.debug("Receiving response body start for transaction-id: [${call.getTransactionId()}]")
+ log.debug("Receiving response body start for transaction-id: [{}]", transactionId.get())
}
override fun responseBodyEnd(
call: Call,
- byteCount: Long,
+ byteCount: Long
) {
super.responseBodyEnd(call, byteCount)
- log.debug("Receiving response body end for transaction-id: [${call.getTransactionId()}] with byte count: $byteCount")
+ log.debug("Receiving response body end for transaction-id: [{}] with byte count: {}", transactionId.get(), byteCount)
}
override fun responseFailed(
call: Call,
- ioe: IOException,
+ ioe: IOException
) {
super.responseFailed(call, ioe)
- log.debug("Receiving response failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}")
+ log.debug("Receiving response failed for transaction-id: [{}] with exception message: {}", transactionId.get(), ioe.message)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt
index bbf4f82533..557db5ed67 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt
@@ -16,6 +16,7 @@
package com.expediagroup.sdk.core.configuration
import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider
+import okhttp3.OkHttpClient
interface ClientConfiguration {
val key: String?
@@ -26,6 +27,7 @@ interface ClientConfiguration {
val socketTimeout: Long?
val maskedLoggingHeaders: Set?
val maskedLoggingBodyFields: Set?
+ val okHttpClient: OkHttpClient?
/** Build a [RuntimeConfigurationProvider] from a [ClientConfiguration]. */
fun toProvider(): RuntimeConfigurationProvider =
@@ -38,5 +40,6 @@ interface ClientConfiguration {
socketTimeout = socketTimeout,
maskedLoggingHeaders = maskedLoggingHeaders,
maskedLoggingBodyFields = maskedLoggingBodyFields,
+ okHttpClient = okHttpClient
)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt
index ba8019fdaf..1e249b8105 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt
@@ -23,7 +23,7 @@ package com.expediagroup.sdk.core.configuration
*/
internal data class Credentials(
val key: String,
- val secret: String,
+ val secret: String
) {
/**
* A factory of [Credentials].
@@ -39,7 +39,7 @@ internal data class Credentials(
@JvmStatic
fun from(
key: String,
- secret: String,
+ secret: String
): Credentials = Credentials(key, secret)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt
index 757e1108da..917604d763 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt
@@ -17,6 +17,7 @@ package com.expediagroup.sdk.core.configuration
import com.expediagroup.sdk.core.client.ExpediaGroupClient
import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider
+import okhttp3.OkHttpClient
/**
* Configuration for the [ExpediaGroupClient].
@@ -30,6 +31,7 @@ import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProv
* @property maskedLoggingHeaders The headers to be masked in logging.
* @property maskedLoggingBodyFields The body fields to be masked in logging.
* @property authEndpoint The API endpoint to use for authentication.
+ * @property okHttpClient The okhttp client to be used by the sdk.
*/
data class ExpediaGroupClientConfiguration(
override val key: String? = null,
@@ -40,7 +42,8 @@ data class ExpediaGroupClientConfiguration(
override val socketTimeout: Long? = null,
override val maskedLoggingHeaders: Set? = null,
override val maskedLoggingBodyFields: Set? = null,
- val authEndpoint: String? = null,
+ override val okHttpClient: OkHttpClient? = null,
+ val authEndpoint: String? = null
) : ClientConfiguration {
/** Build a [RuntimeConfigurationProvider] from an [ExpediaGroupClientConfiguration]. */
override fun toProvider(): RuntimeConfigurationProvider = super.toProvider().copy(authEndpoint = authEndpoint)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt
index 6c8f6974f5..48a1cef94a 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt
@@ -16,6 +16,7 @@
package com.expediagroup.sdk.core.configuration
import com.expediagroup.sdk.core.client.BaseRapidClient
+import okhttp3.OkHttpClient
/**
* Configuration for the [BaseRapidClient].
@@ -38,4 +39,5 @@ data class RapidClientConfiguration(
override val socketTimeout: Long? = null,
override val maskedLoggingHeaders: Set? = null,
override val maskedLoggingBodyFields: Set? = null,
+ override val okHttpClient: OkHttpClient? = null
) : ClientConfiguration
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/XapClientConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/XapClientConfiguration.kt
index 4b19e6dd15..ec72f80d71 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/XapClientConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/XapClientConfiguration.kt
@@ -16,6 +16,7 @@
package com.expediagroup.sdk.core.configuration
import com.expediagroup.sdk.core.client.BaseXapClient
+import okhttp3.OkHttpClient
/**
* Configuration for the [BaseXapClient].
@@ -38,4 +39,5 @@ data class XapClientConfiguration(
override val socketTimeout: Long? = null,
override val maskedLoggingHeaders: Set? = null,
override val maskedLoggingBodyFields: Set? = null,
+ override val okHttpClient: OkHttpClient? = null
) : ClientConfiguration
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt
index 6808786126..49b674182b 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt
@@ -28,6 +28,7 @@ import com.expediagroup.sdk.core.constant.ConfigurationName.SECRET
import com.expediagroup.sdk.core.constant.ConfigurationName.SOCKET_TIMEOUT_MILLIS
import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider
import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory
+import okhttp3.OkHttpClient
/**
* Configuration collector that collects configuration from all available providers.
@@ -54,8 +55,7 @@ internal class ConfigurationCollector private constructor(providers: Configurati
* @param providers the [ConfigurationProvider]s to use.
* @return a new [ConfigurationCollector] with the given [providers].
*/
- fun create(vararg providers: ConfigurationProvider): ConfigurationCollector =
- create(ConfigurationProviderQueue.from(providers.asList()))
+ fun create(vararg providers: ConfigurationProvider): ConfigurationCollector = create(ConfigurationProviderQueue.from(providers.asList()))
}
override val key: String? = providers.firstWith { it.key }.also { it?.log(KEY) }?.retrieve()
@@ -63,21 +63,11 @@ internal class ConfigurationCollector private constructor(providers: Configurati
override val endpoint: String? = providers.firstWith { it.endpoint }.also { it?.log(ENDPOINT) }?.retrieve()
override val authEndpoint: String? = providers.firstWith { it.authEndpoint }.also { it?.log(AUTH_ENDPOINT) }?.retrieve()
override val requestTimeout: Long? = providers.firstWith { it.requestTimeout }.also { it?.log(REQUEST_TIMEOUT_MILLIS) }?.retrieve()
- override val connectionTimeout: Long? =
- providers.firstWith { it.connectionTimeout }.also {
- it?.log(
- CONNECTION_TIMEOUT_MILLIS,
- )
- }?.retrieve()
+ override val connectionTimeout: Long? = providers.firstWith { it.connectionTimeout }.also { it?.log(CONNECTION_TIMEOUT_MILLIS) }?.retrieve()
override val socketTimeout: Long? = providers.firstWith { it.socketTimeout }.also { it?.log(SOCKET_TIMEOUT_MILLIS) }?.retrieve()
- override val maskedLoggingHeaders: Set? =
- providers.firstWith {
- it.maskedLoggingHeaders
- }.also { it?.log(MASKED_LOGGING_HEADERS) }?.retrieve()
- override val maskedLoggingBodyFields: Set? =
- providers.firstWith {
- it.maskedLoggingBodyFields
- }.also { it?.log(MASKED_LOGGING_BODY_FIELDS) }?.retrieve()
+ override val maskedLoggingHeaders: Set? = providers.firstWith { it.maskedLoggingHeaders }.also { it?.log(MASKED_LOGGING_HEADERS) }?.retrieve()
+ override val maskedLoggingBodyFields: Set? = providers.firstWith { it.maskedLoggingBodyFields }.also { it?.log(MASKED_LOGGING_BODY_FIELDS) }?.retrieve()
+ override val okHttpClient: OkHttpClient? = providers.firstWith { it.okHttpClient }?.retrieve()
private fun ProvidedConfiguration.log(configurationName: String) {
log.info(LoggingMessageProvider.getChosenProviderMessage(configurationName, providerName))
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt
index 79784f2e0d..3a964739c0 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt
@@ -30,8 +30,7 @@ internal class ConfigurationProviderQueue private constructor(private val provid
fun first(predicate: (ConfigurationProvider) -> Boolean): ConfigurationProvider? = providers.firstOrNull(predicate)
/** Returns the first provider in the queue that matches the given [predicate] if found, null otherwise.*/
- fun firstWith(predicate: (provider: ConfigurationProvider) -> T?): ProvidedConfiguration? =
- first { predicate(it) != null }?.let { ProvidedConfiguration(predicate(it)!!, it.name) }
+ fun firstWith(predicate: (provider: ConfigurationProvider) -> T?): ProvidedConfiguration? = first { predicate(it) != null }?.let { ProvidedConfiguration(predicate(it)!!, it.name) }
companion object {
/** Builds a [ConfigurationProviderQueue] from the given [providers].
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt
index ac7f7ea438..0a14edd194 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt
@@ -16,6 +16,7 @@
package com.expediagroup.sdk.core.configuration.provider
import com.expediagroup.sdk.core.constant.Constant
+import okhttp3.OkHttpClient
/**
* A configuration provider that can be used to provide configuration values.
@@ -55,4 +56,8 @@ interface ConfigurationProvider {
/** The body fields to be masked in logging.*/
val maskedLoggingBodyFields: Set?
get() = setOf()
+
+ /** The okhttp client to be used by the sdk.*/
+ val okHttpClient: OkHttpClient?
+ get() = null
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt
index b84114d3de..d6e607e09a 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt
@@ -16,6 +16,7 @@
package com.expediagroup.sdk.core.configuration.provider
import com.expediagroup.sdk.core.constant.ConfigurationName.RUNTIME_CONFIGURATION_PROVIDER
+import okhttp3.OkHttpClient
/**
* A runtime-built configuration provider.
@@ -42,4 +43,5 @@ data class RuntimeConfigurationProvider(
override val socketTimeout: Long? = null,
override val maskedLoggingHeaders: Set? = null,
override val maskedLoggingBodyFields: Set? = null,
+ override val okHttpClient: OkHttpClient? = null
) : ConfigurationProvider
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt
index 0004086b79..0d9b9a9556 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt
@@ -37,4 +37,6 @@ internal object ConfigurationName {
const val RUNTIME_CONFIGURATION_PROVIDER = "runtime configuration"
const val CONFIGURATION_COLLECTOR = "configuration collector"
+
+ const val OKHTTP_CLIENT = "okhttp client"
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingFields.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingFields.kt
index 40ede773e7..f666813461 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingFields.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingFields.kt
@@ -31,6 +31,6 @@ internal data object LogMaskingFields {
"account_number",
"card_avs_response",
"card_cvv_response",
- "card_cvv2_response",
+ "card_cvv2_response"
)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt
index 95d93c0862..316ef39061 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt
@@ -22,7 +22,7 @@ internal object ExceptionMessageProvider {
fun getExceptionOccurredWithTransactionIdMessage(
transactionId: String?,
- message: String?,
+ message: String?
): String = "Exception occurred" + getTransactionIdMessage(transactionId) + getConcatenatedMessage(message)
private fun getConcatenatedMessage(message: String?) = if (message != null) ": $message" else ""
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt
index 5f978cad50..475e6f4c2d 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt
@@ -16,6 +16,5 @@
package com.expediagroup.sdk.core.constant.provider
internal object LogMaskingRegexProvider {
- fun getMaskedFieldsRegex(maskedBodyFields: Set) =
- "(?<=[\"']?(${maskedBodyFields.joinToString("|")})[\"']?:\\s?[\"'])(\\s*[^\"']+\\s*)(?=[\"'])".toRegex()
+ fun getMaskedFieldsRegex(maskedBodyFields: Set) = "(?<=[\"']?(${maskedBodyFields.joinToString("|")})[\"']?:\\s?[\"'])(\\s*[^\"']+\\s*)(?=[\"'])".toRegex()
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt
index d1c7c56542..f9d358ad33 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt
@@ -22,27 +22,27 @@ internal object LoggingMessageProvider {
fun getResponseUnsuccessfulMessage(
httpStatusCode: HttpStatusCode,
- transactionId: String?,
+ transactionId: String?
) = "Unsuccessful response [$httpStatusCode]${getTransactionIdMessage(transactionId)}"
fun getChosenProviderMessage(
property: String,
- providerName: String,
+ providerName: String
) = "Successfully loaded [$property] from [$providerName]"
fun getRuntimeConfigurationProviderMessage(
property: String,
- value: T,
+ value: T
) = "Setting [$property] to [$value] from runtime configuration provider"
fun getResponseBodyMessage(
body: String,
- transactionId: String?,
+ transactionId: String?
) = "Response Body${getTransactionIdMessage(transactionId)}: $body"
fun getRequestBodyMessage(
body: String,
- transactionId: String?,
+ transactionId: String?
) = "Request Body${getTransactionIdMessage(transactionId)}: $body"
fun getTransactionIdMessage(transactionId: String?) = if (transactionId != null) " for transaction-id [$transactionId]" else ""
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt
index b102043866..6527759cad 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt
@@ -23,7 +23,7 @@ internal typealias Operation = (String) -> String
* @property operation The operation to perform on a string.
*/
internal enum class Contract(val operation: Operation) {
- TRAILING_SLASH({ if (it.endsWith("/")) it else "$it/" }),
+ TRAILING_SLASH({ if (it.endsWith("/")) it else "$it/" })
}
/**
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Operation.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Operation.kt
index 259d4a39a7..baf620810a 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Operation.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Operation.kt
@@ -20,7 +20,7 @@ abstract class Operation(
val method: String,
val operationId: String,
val requestBody: T?,
- val params: OperationParams?,
+ val params: OperationParams?
) {
var transactionId: TransactionId = TransactionId()
private set
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Properties.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Properties.kt
index 4a888d01d5..5c93b9990a 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Properties.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Properties.kt
@@ -27,7 +27,7 @@ class Properties(private val data: Map) {
Properties(
java.util.Properties().apply {
load(BufferedReader(InputStreamReader(path.openStream())))
- }.map { it.key.toString() to it.value.toString() }.toMap(),
+ }.map { it.key.toString() to it.value.toString() }.toMap()
)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Response.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Response.kt
index fbf6730570..d5bd9747ef 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Response.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Response.kt
@@ -31,7 +31,7 @@ import kotlin.collections.Map.Entry
open class Response(
val statusCode: Int,
val data: T,
- val headers: Map>,
+ val headers: Map>
) {
constructor(statusCode: Int, data: T, headers: Set>>) : this(statusCode, data, toHeadersMap(headers))
@@ -41,8 +41,8 @@ open class Response(
headers.stream().collect(
Collectors.toMap(
Entry>::key,
- Entry>::value,
- ),
+ Entry>::value
+ )
)
}
@@ -54,7 +54,7 @@ open class Response(
class EmptyResponse(
statusCode: Int,
- headers: Map>,
+ headers: Map>
) : Response(statusCode, Nothing, headers) {
constructor(statusCode: Int, headers: Set>>) : this(statusCode, toHeadersMap(headers))
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/TransactionId.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/TransactionId.kt
index d5a6e46d57..07333147e7 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/TransactionId.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/TransactionId.kt
@@ -20,11 +20,7 @@ import java.util.UUID
class TransactionId {
private var transactionId: UUID = UUID.randomUUID()
- fun peek(): UUID {
- return transactionId
- }
+ fun peek(): UUID = transactionId
- fun dequeue(): UUID {
- return transactionId.also { transactionId = UUID.randomUUID() }
- }
+ fun dequeue(): UUID = transactionId.also { transactionId = UUID.randomUUID() }
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExceptionUtils.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExceptionUtils.kt
index 6500615aed..02fcaabd86 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExceptionUtils.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExceptionUtils.kt
@@ -34,7 +34,7 @@ fun Throwable.handleWith(transactionId: String?): Nothing {
else -> throw ExpediaGroupServiceException(
ExceptionMessageProvider.getExceptionOccurredWithTransactionIdMessage(transactionId, message),
this,
- transactionId,
+ transactionId
)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt
index 3a7eaf1a29..cf3d8b72c7 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt
@@ -23,5 +23,5 @@ package com.expediagroup.sdk.core.model.exception
*/
open class ExpediaGroupException(
message: String? = null,
- cause: Throwable? = null,
+ cause: Throwable? = null
) : RuntimeException(message, cause)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt
index 20f2b6c0ad..4ea0b2ed2c 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt
@@ -25,5 +25,5 @@ import com.expediagroup.sdk.core.model.exception.ExpediaGroupException
*/
open class ExpediaGroupClientException(
message: String? = null,
- cause: Throwable? = null,
+ cause: Throwable? = null
) : ExpediaGroupException(message, cause)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt
index 8a0f926805..63fd9ca962 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt
@@ -23,5 +23,5 @@ package com.expediagroup.sdk.core.model.exception.client
*/
class ExpediaGroupConfigurationException(
message: String? = null,
- cause: Throwable? = null,
+ cause: Throwable? = null
) : ExpediaGroupClientException(message, cause)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupInvalidFieldNameException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupInvalidFieldNameException.kt
index b791d49e9a..6d06ffc874 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupInvalidFieldNameException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupInvalidFieldNameException.kt
@@ -21,6 +21,4 @@ package com.expediagroup.sdk.core.model.exception.client
* @param invalidFields the names of the invalid fields.
*/
class ExpediaGroupInvalidFieldNameException(invalidFields: Collection) :
- ExpediaGroupClientException(
- "All fields names must contain only alphanumeric characters in addition to - and _ but found [${invalidFields.joinToString(",")}]",
- )
+ ExpediaGroupClientException("All fields names must contain only alphanumeric characters in addition to - and _ but found [${invalidFields.joinToString(",")}]")
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolationException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/PropertyConstraintViolationException.kt
similarity index 66%
rename from code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolationException.kt
rename to code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/PropertyConstraintViolationException.kt
index 7b1c23d8ea..8f05fec810 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolationException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/PropertyConstraintViolationException.kt
@@ -13,24 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- *
- * Please note:
- * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * Do not edit this file manually.
- *
- */
-
-@file:Suppress(
- "ArrayInDataClass",
- "EnumEntryName",
- "RemoveRedundantQualifierName",
- "UnusedImport",
-)
-
-package com.expediagroup.sdk.rapid.models.exception
-
-import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupClientException
+package com.expediagroup.sdk.core.model.exception.client
/**
* An exception to be thrown when a constraint on some property has been violated.
@@ -39,6 +22,6 @@ import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupClientExcept
* @property constraintViolations A list of the constraint violations that occurred
*/
class PropertyConstraintViolationException(
- message: String,
- val constraintViolations: List,
+ message: String = "Some field constraints have been violated",
+ constraintViolations: List
) : ExpediaGroupClientException("$message ${constraintViolations.joinToString(separator = ",\n\t- ", prefix = "[\n\t- ", postfix = "\n]")}")
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt
index 7cb15d64e7..64e901c528 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt
@@ -18,10 +18,6 @@ package com.expediagroup.sdk.core.model.exception.service
import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider.getTransactionIdMessage
abstract class ExpediaGroupApiException(val statusCode: Int, open val errorObject: Any, transactionId: String?) :
- ExpediaGroupServiceException(
- "Unsuccessful response code [$statusCode]${getTransactionIdMessage(transactionId)}${stringifyErrorObject(errorObject.toString())}",
- transactionId = transactionId,
- )
+ ExpediaGroupServiceException("Unsuccessful response code [$statusCode]${getTransactionIdMessage(transactionId)}${stringifyErrorObject(errorObject.toString())}", transactionId = transactionId)
-private fun stringifyErrorObject(stringValue: String): String =
- if (stringValue.isBlank()) " with an empty response body" else ": $stringValue"
+private fun stringifyErrorObject(stringValue: String): String = if (stringValue.isBlank()) " with an empty response body" else ": $stringValue"
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt
index 982b728ade..d3d6ac1494 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.kt
@@ -27,7 +27,7 @@ import io.ktor.http.HttpStatusCode
class ExpediaGroupAuthException(
message: String? = null,
cause: Throwable? = null,
- transactionId: String? = null,
+ transactionId: String? = null
) : ExpediaGroupServiceException(message, cause, transactionId) {
/**
* An exception that is thrown when an authentication error occurs.
@@ -38,6 +38,6 @@ class ExpediaGroupAuthException(
constructor(
errorCode: HttpStatusCode,
message: String,
- transactionId: String?,
+ transactionId: String?
) : this(message = "[${errorCode.value}] $message", transactionId = transactionId)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceDefaultErrorException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceDefaultErrorException.kt
index 94786daa4d..e25db920bd 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceDefaultErrorException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceDefaultErrorException.kt
@@ -15,8 +15,4 @@
*/
package com.expediagroup.sdk.core.model.exception.service
-class ExpediaGroupServiceDefaultErrorException(code: Int, override val errorObject: String, transactionId: String?) : ExpediaGroupApiException(
- code,
- errorObject,
- transactionId,
-)
+class ExpediaGroupServiceDefaultErrorException(code: Int, override val errorObject: String, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt
index b8584ab521..130c1c19f5 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt
@@ -26,5 +26,5 @@ import com.expediagroup.sdk.core.model.exception.ExpediaGroupException
open class ExpediaGroupServiceException(
message: String? = null,
cause: Throwable? = null,
- val transactionId: String? = null,
+ val transactionId: String? = null
) : ExpediaGroupException(message, cause)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/Paginator.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/Paginator.kt
index a466098172..7fbaa064b2 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/Paginator.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/Paginator.kt
@@ -25,20 +25,19 @@ sealed class BasePaginator(
private val client: Client,
firstResponse: Response,
private val fallbackBody: T,
- private val getBody: suspend (HttpResponse) -> T,
+ private val getBody: suspend (HttpResponse) -> T
) : Iterator {
private var state: ResponseState = DefaultResponseState(firstResponse)
val paginationTotalResults: Long = firstResponse.headers[PAGINATION_TOTAL_RESULTS]?.getOrNull(0)?.toLongOrNull() ?: 0
override fun hasNext(): Boolean = state.hasNext()
- private fun extractLink(headers: Map>): String? {
- return headers[LINK]?.getOrNull(0)?.split(";")?.let {
+ private fun extractLink(headers: Map>): String? =
+ headers[LINK]?.getOrNull(0)?.split(";")?.let {
if (it.isNotEmpty()) it[0] else null
}?.let {
it.substring(it.indexOf("<") + 1, it.indexOf(">"))
}
- }
protected fun nextResponse(): Response {
val response = state.getNextResponse()
@@ -58,7 +57,7 @@ class Paginator(
client: Client,
firstResponse: Response,
fallbackBody: T,
- getBody: suspend (HttpResponse) -> T,
+ getBody: suspend (HttpResponse) -> T
) : BasePaginator(client, firstResponse, fallbackBody, getBody) {
/**
* Returns the body of the next response.
@@ -79,7 +78,7 @@ class ResponsePaginator(
client: Client,
firstResponse: Response,
fallbackBody: T,
- getBody: suspend (HttpResponse) -> T,
+ getBody: suspend (HttpResponse) -> T
) : BasePaginator, T>(client, firstResponse, fallbackBody, getBody) {
/**
* Returns the next response.
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/ResponseState.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/ResponseState.kt
index 5d1b4e5a3c..19897831d8 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/ResponseState.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/ResponseState.kt
@@ -35,60 +35,39 @@ internal interface ResponseState {
}
internal class DefaultResponseState(
- private val response: Response,
+ private val response: Response
) : ResponseState {
- override fun getNextResponse(): Response {
- return response
- }
+ override fun getNextResponse(): Response = response
- override fun hasNext(): Boolean {
- return true
- }
+ override fun hasNext(): Boolean = true
}
internal class LastResponseState : ResponseState {
- override fun getNextResponse(): Response {
- throw NoSuchElementException()
- }
+ override fun getNextResponse(): Response = throw NoSuchElementException()
- override fun hasNext(): Boolean {
- return false
- }
+ override fun hasNext(): Boolean = false
}
internal class FetchLinkState(
private val link: String,
private val client: Client,
private val fallbackBody: T,
- private val getBody: suspend (HttpResponse) -> T,
+ private val getBody: suspend (HttpResponse) -> T
) : ResponseState {
- override fun getNextResponse(): Response {
- return runBlocking {
+ override fun getNextResponse(): Response =
+ runBlocking {
val response = client.performGet(link)
val body = parseBody(response)
Response(response.status.value, body, response.headers.entries())
}
- }
- override fun hasNext(): Boolean {
- return true
- }
+ override fun hasNext(): Boolean = true
- private suspend fun parseBody(response: HttpResponse): T {
- return if (decodeBody(response).isEmpty()) fallbackBody else getBody(response)
- }
+ private suspend fun parseBody(response: HttpResponse): T = if (decodeBody(response).isEmpty()) fallbackBody else getBody(response)
private suspend fun decodeBody(response: HttpResponse): String {
val byteReadChannel = prepareByteReadChannel(response)
- val decodedByteReadChannel =
- if (response.contentEncoding().equals(
- HeaderValue.GZIP,
- )
- ) {
- client.httpClient.decode(byteReadChannel)
- } else {
- byteReadChannel
- }
+ val decodedByteReadChannel = if (response.contentEncoding().equals(HeaderValue.GZIP)) client.httpClient.decode(byteReadChannel) else byteReadChannel
val bodyString: String = decodedByteReadChannel.readRemaining().readText()
return bodyString
}
@@ -109,9 +88,7 @@ internal class ResponseStateFactory {
link: String?,
client: Client,
fallbackBody: T,
- getBody: suspend (HttpResponse) -> T,
- ): ResponseState {
- return link?.let { FetchLinkState(it, client, fallbackBody, getBody) } ?: LastResponseState()
- }
+ getBody: suspend (HttpResponse) -> T
+ ): ResponseState = link?.let { FetchLinkState(it, client, fallbackBody, getBody) } ?: LastResponseState()
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt
index 19ef18954d..9a688c6b2e 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt
@@ -29,7 +29,7 @@ internal interface HookBuilder {
*/
internal open class Hook(
private val configuration: C,
- private val builder: HookBuilder,
+ private val builder: HookBuilder
) {
fun execute() = builder.build(configuration)
}
@@ -40,7 +40,7 @@ internal object Hooks {
fun add(
client: Client,
- hook: Hook,
+ hook: Hook
) {
clientsHooks.getOrPut(client) { mutableListOf() } += hook
}
@@ -70,6 +70,6 @@ internal class HookContext(private val client: Client) {
internal interface HookFactory {
fun create(
client: Client,
- configuration: C,
+ configuration: C
): Hook
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt
index 9d2818beeb..6a81db9d90 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.kt
@@ -21,7 +21,7 @@ internal interface Plugin {
/** Install a plugin. */
fun install(
client: Client,
- configurations: C,
+ configurations: C
)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt
index 27537477a5..4e0a69c261 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt
@@ -25,14 +25,14 @@ internal data class AuthenticationConfiguration(
override val httpClientConfiguration: HttpClientConfig,
val credentials: Credentials,
val authUrl: String,
- val authType: AuthenticationType,
+ val authType: AuthenticationType
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(
httpClientConfig: HttpClientConfig,
credentials: Credentials,
authUrl: String,
- authType: AuthenticationType = AuthenticationType.BEARER,
+ authType: AuthenticationType = AuthenticationType.BEARER
) = AuthenticationConfiguration(httpClientConfig, credentials, authUrl, authType)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt
index f14ac2dcdc..ca6d13a767 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt
@@ -30,10 +30,8 @@ import kotlinx.coroutines.delay
internal object AuthenticationHookFactory : HookFactory {
override fun create(
client: Client,
- configuration: AuthenticationConfiguration,
- ): Hook {
- return Hook(configuration, AuthenticationHookBuilder(client))
- }
+ configuration: AuthenticationConfiguration
+ ): Hook = Hook(configuration, AuthenticationHookBuilder(client))
}
private class AuthenticationHookBuilder(private val client: Client) : HookBuilder {
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt
index 41a8fae7bc..174f9feea7 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt
@@ -28,7 +28,7 @@ internal object AuthenticationPlugin : Plugin {
override fun install(
client: Client,
- configurations: AuthenticationConfiguration,
+ configurations: AuthenticationConfiguration
) {
val strategy = AuthenticationStrategy.from(configurations, client)
clientAuthenticationStrategies[client] = strategy
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt
index e474b621ad..6a44a53d49 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt
@@ -37,7 +37,7 @@ internal interface AuthenticationStrategy {
companion object {
fun from(
configs: AuthenticationConfiguration,
- client: Client,
+ client: Client
): AuthenticationStrategy =
when (configs.authType) {
BASIC -> BasicAuthenticationStrategy(configs)
@@ -49,6 +49,6 @@ internal interface AuthenticationStrategy {
enum class AuthenticationType {
BASIC,
BEARER,
- SIGNATURE,
+ SIGNATURE
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/BasicAuthenticationStrategy.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/BasicAuthenticationStrategy.kt
index a44b661a04..2d87d76dfb 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/BasicAuthenticationStrategy.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/BasicAuthenticationStrategy.kt
@@ -22,7 +22,7 @@ import io.ktor.client.plugins.auth.providers.basic
import io.ktor.client.request.HttpRequestBuilder
internal class BasicAuthenticationStrategy(
- private val configs: AuthenticationConfiguration,
+ private val configs: AuthenticationConfiguration
) : AuthenticationStrategy {
override fun loadAuth(auth: Auth) {
auth.basic {
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt
index 4bfecae707..1404a27bc0 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.kt
@@ -48,7 +48,7 @@ import java.time.LocalDateTime
internal class ExpediaGroupAuthenticationStrategy(
private val client: Client,
- private val configs: AuthenticationConfiguration,
+ private val configs: AuthenticationConfiguration
) : AuthenticationStrategy {
private val log = ExpediaGroupLoggerFactory.getLogger(javaClass)
private var bearerTokenStorage = BearerTokensInfo.emptyBearerTokenInfo
@@ -61,8 +61,7 @@ internal class ExpediaGroupAuthenticationStrategy(
}
}
- override fun isTokenAboutToExpire(): Boolean =
- bearerTokenStorage.isAboutToExpire().also { if (it) log.info(LoggingMessage.TOKEN_EXPIRED) }
+ override fun isTokenAboutToExpire(): Boolean = bearerTokenStorage.isAboutToExpire().also { if (it) log.info(LoggingMessage.TOKEN_EXPIRED) }
override fun renewToken() {
val httpClient = client.httpClient
@@ -80,11 +79,7 @@ internal class ExpediaGroupAuthenticationStrategy(
}
}
if (renewTokenResponse.status.value !in Constant.SUCCESSFUL_STATUS_CODES_RANGE) {
- throw ExpediaGroupAuthException(
- renewTokenResponse.status,
- ExceptionMessage.AUTHENTICATION_FAILURE,
- renewTokenResponse.headers.getTransactionId(),
- )
+ throw ExpediaGroupAuthException(renewTokenResponse.status, ExceptionMessage.AUTHENTICATION_FAILURE, renewTokenResponse.headers.getTransactionId())
}
val renewedTokenInfo: TokenResponse = runBlocking { renewTokenResponse.body() }
log.info(LoggingMessage.TOKEN_RENEWAL_SUCCESSFUL)
@@ -92,7 +87,7 @@ internal class ExpediaGroupAuthenticationStrategy(
bearerTokenStorage =
BearerTokensInfo(
BearerTokens(renewedTokenInfo.accessToken, renewedTokenInfo.accessToken),
- renewedTokenInfo.expiresIn,
+ renewedTokenInfo.expiresIn
)
bearerTokenStorage
}
@@ -109,14 +104,11 @@ internal class ExpediaGroupAuthenticationStrategy(
private fun HttpRequestBuilder.basicAuth(credentials: Credentials) {
basicAuth(
credentials.key,
- credentials.secret,
+ credentials.secret
)
}
- override fun isIdentityRequest(request: HttpRequestBuilder): Boolean =
- request.url.clone().apply {
- encodedParameters = ParametersBuilder()
- }.buildString() == configs.authUrl
+ override fun isIdentityRequest(request: HttpRequestBuilder): Boolean = request.url.clone().apply { encodedParameters = ParametersBuilder() }.buildString() == configs.authUrl
override fun getAuthorizationHeader() = "${Authentication.BEARER} ${getTokens().accessToken}"
@@ -141,6 +133,6 @@ internal class ExpediaGroupAuthenticationStrategy(
internal data class TokenResponse(
val accessToken: String,
- val expiresIn: Int,
+ val expiresIn: Int
)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt
index 9e568c2302..0927b75666 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt
@@ -45,7 +45,7 @@ internal class RapidAuthenticationStrategy(private val configs: AuthenticationCo
private fun calculateSignature(
apiKey: String,
secret: String,
- timestamp: Long,
+ timestamp: Long
): String {
val toBeHashed = apiKey + secret + timestamp
val messageDigest = MessageDigest.getInstance(MGF1ParameterSpec.SHA512.digestAlgorithm)
@@ -53,11 +53,7 @@ internal class RapidAuthenticationStrategy(private val configs: AuthenticationCo
val signature =
buildString {
bytes.forEach {
- append(
- ((it.toInt() and SignatureValues.ONE_BYTE_MASK) + SignatureValues.INCREMENT).toString(
- SignatureValues.RADIX,
- ).substring(BigInteger.ONE.toInt()),
- )
+ append(((it.toInt() and SignatureValues.ONE_BYTE_MASK) + SignatureValues.INCREMENT).toString(SignatureValues.RADIX).substring(BigInteger.ONE.toInt()))
}
}
return "${SignatureValues.API_KEY}=$apiKey,${SignatureValues.SIGNATURE}=$signature,${SignatureValues.TIMESTAMP}=$timestamp"
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt
index 16aa556bd0..c789bc69fc 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt
@@ -20,7 +20,7 @@ import io.ktor.client.HttpClientConfig
import io.ktor.client.engine.HttpClientEngineConfig
internal data class EncodingConfiguration(
- override val httpClientConfiguration: HttpClientConfig,
+ override val httpClientConfiguration: HttpClientConfig
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(httpClientConfig: HttpClientConfig) = EncodingConfiguration(httpClientConfig)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt
index fe97efac3d..658dd6362c 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt
@@ -22,7 +22,7 @@ import io.ktor.client.plugins.compression.ContentEncoding
internal object EncodingPlugin : Plugin {
override fun install(
client: Client,
- configurations: EncodingConfiguration,
+ configurations: EncodingConfiguration
) {
configurations.httpClientConfiguration.install(ContentEncoding) {
gzip()
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingConfiguration.kt
index 906d2386ac..89cdd14c49 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingConfiguration.kt
@@ -20,7 +20,7 @@ import io.ktor.client.HttpClientConfig
import io.ktor.client.engine.HttpClientEngineConfig
internal data class ExceptionHandlingConfiguration(
- override val httpClientConfiguration: HttpClientConfig,
+ override val httpClientConfiguration: HttpClientConfig
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(httpClientConfig: HttpClientConfig) = ExceptionHandlingConfiguration(httpClientConfig)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingPlugin.kt
index c8cbfe0b9f..15d58a136a 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingPlugin.kt
@@ -24,7 +24,7 @@ import io.ktor.client.plugins.HttpResponseValidator
internal object ExceptionHandlingPlugin : Plugin {
override fun install(
client: Client,
- configurations: ExceptionHandlingConfiguration,
+ configurations: ExceptionHandlingConfiguration
) {
with(configurations.httpClientConfiguration) {
HttpResponseValidator {
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt
index 73b6b377a0..a0d28f3cbc 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt
@@ -23,14 +23,14 @@ internal data class HttpTimeoutConfiguration(
override val httpClientConfiguration: HttpClientConfig,
val requestTimeout: Long,
val connectionTimeout: Long,
- val socketTimeout: Long,
+ val socketTimeout: Long
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(
httpClientConfig: HttpClientConfig,
requestTimeout: Long,
connectionTimeout: Long,
- socketTimeout: Long,
+ socketTimeout: Long
) = HttpTimeoutConfiguration(httpClientConfig, requestTimeout, connectionTimeout, socketTimeout)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt
index 13443b87d7..0590d88471 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt
@@ -22,7 +22,7 @@ import io.ktor.client.plugins.HttpTimeout
internal object HttpTimeoutPlugin : Plugin {
override fun install(
client: Client,
- configurations: HttpTimeoutConfiguration,
+ configurations: HttpTimeoutConfiguration
) {
configurations.httpClientConfiguration.install(HttpTimeout) {
requestTimeoutMillis = configurations.requestTimeout
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldFilter.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldFilter.kt
index 7a4e0128bf..9a60c277dd 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldFilter.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldFilter.kt
@@ -19,5 +19,5 @@ import com.ebay.ejmask.core.BaseFilter
internal class ExpediaGroupJsonFieldFilter(maskedFields: Array) : BaseFilter(
ExpediaGroupJsonFieldPatternBuilder::class.java,
- *maskedFields,
+ *maskedFields
)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldPatternBuilder.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldPatternBuilder.kt
index 1d37a26d2c..63ca9cfdba 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldPatternBuilder.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldPatternBuilder.kt
@@ -21,6 +21,6 @@ import com.expediagroup.sdk.core.constant.LoggingMessage.OMITTED
internal class ExpediaGroupJsonFieldPatternBuilder : JsonFieldPatternBuilder() {
override fun buildReplacement(
visibleCharacters: Int,
- vararg fieldNames: String?,
+ vararg fieldNames: String?
): String = "\"$1$2$OMITTED\""
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt
index 4b25547640..6390f5c7aa 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt
@@ -43,11 +43,10 @@ internal class ExpediaGroupLogger(private val logger: Logger, private val client
private fun decorate(msg: String): String = "$LOGGING_PREFIX ${mask(msg)}"
- private fun getMaskedBodyFields(): Set =
- client?.getLoggingMaskedFieldsProvider()?.getMaskedBodyFields() ?: LogMaskingFields.DEFAULT_MASKED_BODY_FIELDS
+ private fun getMaskedBodyFields(): Set = client?.getLoggingMaskedFieldsProvider()?.getMaskedBodyFields() ?: LogMaskingFields.DEFAULT_MASKED_BODY_FIELDS
private fun getMaskedBodyFieldFilters(): Iterable =
listOf(
- ExpediaGroupJsonFieldFilter(getMaskedBodyFields().toTypedArray()),
+ ExpediaGroupJsonFieldFilter(getMaskedBodyFields().toTypedArray())
)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt
index 458363de74..e2d2326ebd 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt
@@ -23,6 +23,6 @@ internal object ExpediaGroupLoggerFactory {
fun getLogger(
clazz: Class<*>,
- client: Client,
+ client: Client
) = ExpediaGroupLogger(LoggerFactory.getLogger(clazz), client)
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt
index 7424431410..36628610f8 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt
@@ -21,7 +21,7 @@ import com.ebay.ejmask.core.EJMaskInitializer
import com.ebay.ejmask.core.util.LoggerUtil
internal class LogMasker(
- filters: Iterable,
+ filters: Iterable
) : (String) -> String {
init {
LoggerUtil.register { _, _, _ -> /* disable logging */ }
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt
index 0e55196d14..cd34324a95 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.kt
@@ -27,13 +27,13 @@ internal data class LoggingConfiguration(
val maskedLoggingHeaders: Set,
val maskedLoggingBodyFields: Set,
val level: LogLevel = LogLevel.HEADERS,
- val getLogger: (client: Client) -> Logger = createCustomLogger,
+ val getLogger: (client: Client) -> Logger = createCustomLogger
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(
httpClientConfig: HttpClientConfig,
maskedLoggingHeaders: Set,
- maskedLoggingBodyFields: Set,
+ maskedLoggingBodyFields: Set
) = LoggingConfiguration(httpClientConfig, maskedLoggingHeaders, maskedLoggingBodyFields)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt
index 8970569020..758a5df725 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt
@@ -27,12 +27,12 @@ internal object LoggingPlugin : Plugin {
override fun install(
client: Client,
- configurations: LoggingConfiguration,
+ configurations: LoggingConfiguration
) {
clientLoggingMaskedFieldsProviders[client] =
LoggingMaskedFieldsProvider(
configurations.maskedLoggingHeaders,
- configurations.maskedLoggingBodyFields,
+ configurations.maskedLoggingBodyFields
)
configurations.httpClientConfiguration.install(Logging) {
logger = configurations.getLogger(client)
@@ -47,6 +47,4 @@ internal object LoggingPlugin : Plugin {
}
internal fun Client.getLoggingMaskedFieldsProvider(): LoggingMaskedFieldsProvider =
- LoggingPlugin.clientLoggingMaskedFieldsProviders[this] ?: throw ExpediaGroupClientException(
- ExceptionMessage.LOGGING_MASKED_FIELDS_NOT_CONFIGURED_FOR_CLIENT,
- )
+ LoggingPlugin.clientLoggingMaskedFieldsProviders[this] ?: throw ExpediaGroupClientException(ExceptionMessage.LOGGING_MASKED_FIELDS_NOT_CONFIGURED_FOR_CLIENT)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/RequestBodyLogger.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/RequestBodyLogger.kt
index 36ed9288a1..5a077a148e 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/RequestBodyLogger.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/RequestBodyLogger.kt
@@ -37,7 +37,7 @@ internal class RequestBodyLogger {
override fun install(
plugin: RequestBodyLogger,
- scope: HttpClient,
+ scope: HttpClient
) {
scope.sendPipeline.intercept(HttpSendPipeline.Monitoring) {
val body: String = getBody()
@@ -63,9 +63,7 @@ internal class RequestBodyLogger {
return body.toString()
}
- override fun prepare(block: RequestBodyLoggerConfig.() -> Unit): RequestBodyLogger {
- return RequestBodyLogger()
- }
+ override fun prepare(block: RequestBodyLoggerConfig.() -> Unit): RequestBodyLogger = RequestBodyLogger()
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ResponseBodyLogger.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ResponseBodyLogger.kt
index 0b35306253..c06f8fdc7f 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ResponseBodyLogger.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ResponseBodyLogger.kt
@@ -43,31 +43,19 @@ class ResponseBodyLogger {
@OptIn(InternalAPI::class)
override fun install(
plugin: ResponseBodyLogger,
- scope: HttpClient,
+ scope: HttpClient
) {
scope.responsePipeline.intercept(HttpResponsePipeline.Receive) {
val response: HttpResponse = context.response
- val byteReadChannel: ByteReadChannel =
- if (response.contentEncoding().equals(
- HeaderValue.GZIP,
- )
- ) {
- scope.decode(response.content)
- } else {
- response.content
- }
+ val byteReadChannel: ByteReadChannel = if (response.contentEncoding().equals(HeaderValue.GZIP)) scope.decode(response.content) else response.content
when {
response.contentType() in LoggableContentTypes ->
LoggingMessageProvider.getResponseBodyMessage(
byteReadChannel.readRemaining().readText(),
- response.request.headers.getTransactionId(),
- )
- else ->
- LoggingMessageProvider.getResponseBodyMessage(
- "Body of type ${response.contentType()?.contentType} cannot be logged!",
- response.request.headers.getTransactionId(),
+ response.request.headers.getTransactionId()
)
+ else -> LoggingMessageProvider.getResponseBodyMessage("Body of type ${response.contentType()?.contentType} cannot be logged!", response.request.headers.getTransactionId())
}.let {
plugin.log.debug(it)
}
@@ -76,9 +64,7 @@ class ResponseBodyLogger {
}
}
- override fun prepare(block: ResponseBodyLoggerConfig.() -> Unit): ResponseBodyLogger {
- return ResponseBodyLogger()
- }
+ override fun prepare(block: ResponseBodyLoggerConfig.() -> Unit): ResponseBodyLogger = ResponseBodyLogger()
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt
index b34426f7a1..c1114a2214 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt
@@ -21,12 +21,12 @@ import io.ktor.client.engine.HttpClientEngineConfig
internal data class DefaultRequestConfiguration(
override val httpClientConfiguration: HttpClientConfig,
- val endpoint: String,
+ val endpoint: String
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(
httpClientConfig: HttpClientConfig,
- endpoint: String,
+ endpoint: String
) = DefaultRequestConfiguration(httpClientConfig, endpoint)
}
}
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt
index 0c3551a6aa..745c67718a 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt
@@ -22,7 +22,7 @@ import io.ktor.client.plugins.DefaultRequest
internal object DefaultRequestPlugin : Plugin {
override fun install(
client: Client,
- configurations: DefaultRequestConfiguration,
+ configurations: DefaultRequestConfiguration
) {
configurations.httpClientConfiguration.install(DefaultRequest) {
url(configurations.endpoint)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt
index e590b7573b..dc1546df34 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt
@@ -22,7 +22,7 @@ import io.ktor.http.ContentType
internal data class SerializationConfiguration(
override val httpClientConfiguration: HttpClientConfig,
- val contentType: ContentType = ContentType.Application.Json,
+ val contentType: ContentType = ContentType.Application.Json
) : KtorPluginConfiguration(httpClientConfiguration) {
companion object {
fun from(httpClientConfig: HttpClientConfig) = SerializationConfiguration(httpClientConfig)
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt
index 08153243b2..58a751ba71 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt
@@ -26,7 +26,7 @@ import java.text.SimpleDateFormat
internal object SerializationPlugin : Plugin {
override fun install(
client: Client,
- configurations: SerializationConfiguration,
+ configurations: SerializationConfiguration
) {
configurations.httpClientConfiguration.install(ContentNegotiation) {
jackson {
diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/client/RapidClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/client/RapidClient.kt
index a90ce77af8..20de3f7b4e 100644
--- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/client/RapidClient.kt
+++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/client/RapidClient.kt
@@ -17,11 +17,14 @@ package com.expediagroup.sdk.rapid.client
import com.expediagroup.sdk.core.client.BaseRapidClient
import com.expediagroup.sdk.core.configuration.RapidClientConfiguration
+import com.expediagroup.sdk.core.constant.ConfigurationName
import com.expediagroup.sdk.core.constant.HeaderKey
+import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getMissingRequiredConfigurationMessage
import com.expediagroup.sdk.core.model.EmptyResponse
import com.expediagroup.sdk.core.model.Nothing
import com.expediagroup.sdk.core.model.Operation
import com.expediagroup.sdk.core.model.Response
+import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupConfigurationException
import com.expediagroup.sdk.core.model.exception.handle
import com.expediagroup.sdk.core.model.paging.Paginator
import com.expediagroup.sdk.core.model.paging.ResponsePaginator
@@ -83,7 +86,6 @@ import com.expediagroup.sdk.rapid.operations.RequestTestNotificationOperation
import com.expediagroup.sdk.rapid.operations.RequestTestNotificationOperationParams
import com.expediagroup.sdk.rapid.operations.RequestUndeliveredNotificationsOperation
import com.expediagroup.sdk.rapid.operations.RequestUndeliveredNotificationsOperationParams
-import com.expediagroup.sdk.rapid.validation.PropertyConstraintsValidator.validateConstraints
import io.ktor.client.call.body
import io.ktor.client.request.request
import io.ktor.client.request.setBody
@@ -107,32 +109,35 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
class Builder : BaseRapidClient.Builder() {
override fun build() =
RapidClient(
- RapidClientConfiguration(
- key,
- secret,
- endpoint,
- requestTimeout,
- connectionTimeout,
- socketTimeout,
- maskedLoggingHeaders,
- maskedLoggingBodyFields,
- ),
+ RapidClientConfiguration(key, secret, endpoint, requestTimeout, connectionTimeout, socketTimeout, maskedLoggingHeaders, maskedLoggingBodyFields, null)
)
}
+ class BuilderWithHttpClient() : BaseRapidClient.BuilderWithHttpClient() {
+ override fun build(): RapidClient {
+ if (okHttpClient == null) {
+ throw ExpediaGroupConfigurationException(getMissingRequiredConfigurationMessage(ConfigurationName.OKHTTP_CLIENT))
+ }
+
+ return RapidClient(
+ RapidClientConfiguration(key, secret, endpoint, null, null, null, maskedLoggingHeaders, maskedLoggingBodyFields, okHttpClient)
+ )
+ }
+ }
+
companion object {
@JvmStatic fun builder() = Builder()
+
+ @JvmStatic fun builderWithHttpClient() = BuilderWithHttpClient()
}
override suspend fun throwServiceException(
response: HttpResponse,
- operationId: String,
- ) {
- throw ErrorObjectMapper.process(response, operationId)
- }
+ operationId: String
+ ): Unit = throw ErrorObjectMapper.process(response, operationId)
- private suspend inline fun executeHttpRequest(operation: Operation): HttpResponse {
- return httpClient.request {
+ private suspend inline fun executeHttpRequest(operation: Operation): HttpResponse =
+ httpClient.request {
method = HttpMethod.parse(operation.method)
url(operation.url)
@@ -150,11 +155,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
}
appendHeaders(extraHeaders)
- validateConstraints(operation.requestBody)
contentType(ContentType.Application.Json)
setBody(operation.requestBody)
}
- }
private inline fun executeWithEmptyResponse(operation: Operation): EmptyResponse {
try {
@@ -164,10 +167,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
}
}
- private inline fun executeAsyncWithEmptyResponse(
- operation: Operation,
- ): CompletableFuture {
- return GlobalScope.future(Dispatchers.IO) {
+ private inline fun executeAsyncWithEmptyResponse(operation: Operation): CompletableFuture =
+ GlobalScope.future(Dispatchers.IO) {
try {
val response = executeHttpRequest(operation)
throwIfError(response, operation.operationId)
@@ -176,7 +177,6 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
exception.handle()
}
}
- }
private inline fun execute(operation: Operation): Response {
try {
@@ -186,10 +186,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
}
}
- private inline fun executeAsync(
- operation: Operation,
- ): CompletableFuture> {
- return GlobalScope.future(Dispatchers.IO) {
+ private inline fun executeAsync(operation: Operation): CompletableFuture> =
+ GlobalScope.future(Dispatchers.IO) {
try {
val response = executeHttpRequest(operation)
throwIfError(response, operation.operationId)
@@ -198,7 +196,6 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
exception.handle()
}
}
- }
/**
* Change details of a room.
@@ -207,9 +204,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type Nothing
*/
- fun execute(operation: ChangeRoomDetailsOperation): EmptyResponse {
- return executeWithEmptyResponse(operation)
- }
+ fun execute(operation: ChangeRoomDetailsOperation): EmptyResponse = executeWithEmptyResponse(operation)
/**
* Change details of a room.
@@ -218,9 +213,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type Nothing
*/
- fun executeAsync(operation: ChangeRoomDetailsOperation): CompletableFuture {
- return executeAsyncWithEmptyResponse(operation)
- }
+ fun executeAsync(operation: ChangeRoomDetailsOperation): CompletableFuture = executeAsyncWithEmptyResponse(operation)
private suspend inline fun kchangeRoomDetailsWithResponse(
customerIp: kotlin.String,
@@ -231,7 +224,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: ChangeRoomDetailsOperationParams.Test? =
- null,
+ null
): Response {
val params =
ChangeRoomDetailsOperationParams(
@@ -240,13 +233,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerIp = customerIp,
customerSessionId = customerSessionId,
test = test,
- token = token,
+ token = token
)
val operation =
ChangeRoomDetailsOperation(
params,
- changeRoomDetailsRequest,
+ changeRoomDetailsRequest
)
return execute(operation)
@@ -266,7 +259,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: ChangeRoomDetailsOperation)"))
@@ -279,10 +272,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: ChangeRoomDetailsOperationParams.Test? =
- null,
- ): Nothing {
- return changeRoomDetailsWithResponse(customerIp, itineraryId, roomId, token, changeRoomDetailsRequest, customerSessionId, test).data
- }
+ null
+ ): Nothing = changeRoomDetailsWithResponse(customerIp, itineraryId, roomId, token, changeRoomDetailsRequest, customerSessionId, test).data
/**
* Change details of a room.
@@ -298,7 +289,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return a [Response] object with a body of type Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: ChangeRoomDetailsOperation)"))
@@ -311,7 +302,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: ChangeRoomDetailsOperationParams.Test? =
- null,
+ null
): Response {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -329,9 +320,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type Nothing
*/
- fun execute(operation: CommitChangeOperation): EmptyResponse {
- return executeWithEmptyResponse(operation)
- }
+ fun execute(operation: CommitChangeOperation): EmptyResponse = executeWithEmptyResponse(operation)
/**
* Commit a change of itinerary that may require additional payment or refund.
@@ -340,9 +329,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type Nothing
*/
- fun executeAsync(operation: CommitChangeOperation): CompletableFuture {
- return executeAsyncWithEmptyResponse(operation)
- }
+ fun executeAsync(operation: CommitChangeOperation): CompletableFuture = executeAsyncWithEmptyResponse(operation)
private suspend inline fun kcommitChangeWithResponse(
customerIp: kotlin.String,
@@ -354,7 +341,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: CommitChangeOperationParams.Test? =
null,
commitChangeRoomRequestBody: CommitChangeRoomRequestBody? =
- null,
+ null
): Response {
val params =
CommitChangeOperationParams(
@@ -363,13 +350,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerIp = customerIp,
customerSessionId = customerSessionId,
test = test,
- token = token,
+ token = token
)
val operation =
CommitChangeOperation(
params,
- commitChangeRoomRequestBody,
+ commitChangeRoomRequestBody
)
return execute(operation)
@@ -378,7 +365,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
/**
* Commit a change of itinerary that may require additional payment or refund.
* This link will be available in the change response to confirm and complete the change transaction. If additional charges are due, a payment must be submitted with this request. Note that Two-Factor Authentication is not supported at this time.
- * @param customerIp IP address of the customer, as captured by your integration. Send IPV4 addresses only.
Ensure your integration passes the customer's IP, not your own. This value helps determine their location and assign the correct payment gateway.
Also used for fraud recovery and other important analytics.
+ * @param customerIp IP address of the customer, as captured by your integration.
Ensure your integration passes the customer's IP, not your own. This value helps determine their location and assign the correct payment gateway.
Also used for fraud recovery and other important analytics.
* @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
* @param roomId Room ID of a property.
* @param token Provided as part of the link object and used to maintain state across calls. This simplifies each subsequent call by limiting the amount of information required at each step and reduces the potential for errors. Token values cannot be viewed or changed.
@@ -389,7 +376,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: CommitChangeOperation)"))
@@ -403,15 +390,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: CommitChangeOperationParams.Test? =
null,
commitChangeRoomRequestBody: CommitChangeRoomRequestBody? =
- null,
- ): Nothing {
- return commitChangeWithResponse(customerIp, itineraryId, roomId, token, customerSessionId, test, commitChangeRoomRequestBody).data
- }
+ null
+ ): Nothing = commitChangeWithResponse(customerIp, itineraryId, roomId, token, customerSessionId, test, commitChangeRoomRequestBody).data
/**
* Commit a change of itinerary that may require additional payment or refund.
* This link will be available in the change response to confirm and complete the change transaction. If additional charges are due, a payment must be submitted with this request. Note that Two-Factor Authentication is not supported at this time.
- * @param customerIp IP address of the customer, as captured by your integration. Send IPV4 addresses only.
Ensure your integration passes the customer's IP, not your own. This value helps determine their location and assign the correct payment gateway.
Also used for fraud recovery and other important analytics.
+ * @param customerIp IP address of the customer, as captured by your integration.
Ensure your integration passes the customer's IP, not your own. This value helps determine their location and assign the correct payment gateway.
Also used for fraud recovery and other important analytics.
* @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
* @param roomId Room ID of a property.
* @param token Provided as part of the link object and used to maintain state across calls. This simplifies each subsequent call by limiting the amount of information required at each step and reduces the potential for errors. Token values cannot be viewed or changed.
@@ -422,7 +407,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return a [Response] object with a body of type Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: CommitChangeOperation)"))
@@ -436,7 +421,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: CommitChangeOperationParams.Test? =
null,
commitChangeRoomRequestBody: CommitChangeRoomRequestBody? =
- null,
+ null
): Response {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -454,9 +439,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type Nothing
*/
- fun execute(operation: DeleteHeldBookingOperation): EmptyResponse {
- return executeWithEmptyResponse(operation)
- }
+ fun execute(operation: DeleteHeldBookingOperation): EmptyResponse = executeWithEmptyResponse(operation)
/**
* Cancel Held Booking
@@ -465,9 +448,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type Nothing
*/
- fun executeAsync(operation: DeleteHeldBookingOperation): CompletableFuture {
- return executeAsyncWithEmptyResponse(operation)
- }
+ fun executeAsync(operation: DeleteHeldBookingOperation): CompletableFuture = executeAsyncWithEmptyResponse(operation)
private suspend inline fun kdeleteHeldBookingWithResponse(
customerIp: kotlin.String,
@@ -476,7 +457,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: DeleteHeldBookingOperationParams.Test? =
- null,
+ null
): Response {
val params =
DeleteHeldBookingOperationParams(
@@ -484,12 +465,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerIp = customerIp,
customerSessionId = customerSessionId,
test = test,
- token = token,
+ token = token
)
val operation =
DeleteHeldBookingOperation(
- params,
+ params
)
return execute(operation)
@@ -507,7 +488,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: DeleteHeldBookingOperation)"))
@@ -518,10 +499,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: DeleteHeldBookingOperationParams.Test? =
- null,
- ): Nothing {
- return deleteHeldBookingWithResponse(customerIp, itineraryId, token, customerSessionId, test).data
- }
+ null
+ ): Nothing = deleteHeldBookingWithResponse(customerIp, itineraryId, token, customerSessionId, test).data
/**
* Cancel Held Booking
@@ -535,7 +514,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return a [Response] object with a body of type Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: DeleteHeldBookingOperation)"))
@@ -546,7 +525,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: DeleteHeldBookingOperationParams.Test? =
- null,
+ null
): Response {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -564,9 +543,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type Nothing
*/
- fun execute(operation: DeleteRoomOperation): EmptyResponse {
- return executeWithEmptyResponse(operation)
- }
+ fun execute(operation: DeleteRoomOperation): EmptyResponse = executeWithEmptyResponse(operation)
/**
* Cancel a room.
@@ -575,9 +552,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type Nothing
*/
- fun executeAsync(operation: DeleteRoomOperation): CompletableFuture {
- return executeAsyncWithEmptyResponse(operation)
- }
+ fun executeAsync(operation: DeleteRoomOperation): CompletableFuture = executeAsyncWithEmptyResponse(operation)
private suspend inline fun kdeleteRoomWithResponse(
customerIp: kotlin.String,
@@ -587,7 +562,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: DeleteRoomOperationParams.Test? =
- null,
+ null
): Response {
val params =
DeleteRoomOperationParams(
@@ -596,12 +571,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerIp = customerIp,
customerSessionId = customerSessionId,
test = test,
- token = token,
+ token = token
)
val operation =
DeleteRoomOperation(
- params,
+ params
)
return execute(operation)
@@ -620,7 +595,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: DeleteRoomOperation)"))
@@ -632,10 +607,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: DeleteRoomOperationParams.Test? =
- null,
- ): Nothing {
- return deleteRoomWithResponse(customerIp, itineraryId, roomId, token, customerSessionId, test).data
- }
+ null
+ ): Nothing = deleteRoomWithResponse(customerIp, itineraryId, roomId, token, customerSessionId, test).data
/**
* Cancel a room.
@@ -650,7 +623,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return a [Response] object with a body of type Nothing
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: DeleteRoomOperation)"))
@@ -662,7 +635,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId: kotlin.String? =
null,
test: DeleteRoomOperationParams.Test? =
- null,
+ null
): Response {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -680,9 +653,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type kotlin.collections.List
*/
- fun execute(operation: GetAdditionalAvailabilityOperation): Response> {
- return execute>(operation)
- }
+ fun execute(operation: GetAdditionalAvailabilityOperation): Response> = execute>(operation)
/**
* Get additional property room rates and availability
@@ -691,11 +662,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type kotlin.collections.List
*/
- fun executeAsync(
- operation: GetAdditionalAvailabilityOperation,
- ): CompletableFuture>> {
- return executeAsync>(operation)
- }
+ fun executeAsync(operation: GetAdditionalAvailabilityOperation): CompletableFuture>> =
+ executeAsync>(operation)
private suspend inline fun kgetAdditionalAvailabilityWithResponse(
propertyId: kotlin.String,
@@ -711,29 +679,29 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
checkout: kotlin.String? =
null,
exclusion: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Exclusion,
+ GetAdditionalAvailabilityOperationParams.Exclusion
>? =
null,
filter: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Filter,
+ GetAdditionalAvailabilityOperationParams.Filter
>? =
null,
include: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Include,
+ GetAdditionalAvailabilityOperationParams.Include
>? =
null,
occupancy: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>? =
null,
rateOption: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.RateOption,
+ GetAdditionalAvailabilityOperationParams.RateOption
>? =
null,
salesChannel: kotlin.String? =
null,
currency: kotlin.String? =
- null,
+ null
): Response> {
val params =
GetAdditionalAvailabilityOperationParams(
@@ -750,12 +718,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
occupancy = occupancy,
rateOption = rateOption,
salesChannel = salesChannel,
- currency = currency,
+ currency = currency
)
val operation =
GetAdditionalAvailabilityOperation(
- params,
+ params
)
return execute(operation)
@@ -782,7 +750,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return kotlin.collections.List
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdditionalAvailabilityOperation)"))
@@ -800,31 +768,31 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
checkout: kotlin.String? =
null,
exclusion: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Exclusion,
+ GetAdditionalAvailabilityOperationParams.Exclusion
>? =
null,
filter: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Filter,
+ GetAdditionalAvailabilityOperationParams.Filter
>? =
null,
include: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Include,
+ GetAdditionalAvailabilityOperationParams.Include
>? =
null,
occupancy: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>? =
null,
rateOption: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.RateOption,
+ GetAdditionalAvailabilityOperationParams.RateOption
>? =
null,
salesChannel: kotlin.String? =
null,
currency: kotlin.String? =
- null,
- ): kotlin.collections.List {
- return getAdditionalAvailabilityWithResponse(
+ null
+ ): kotlin.collections.List =
+ getAdditionalAvailabilityWithResponse(
propertyId,
token,
customerIp,
@@ -838,9 +806,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
occupancy,
rateOption,
salesChannel,
- currency,
+ currency
).data
- }
/**
* Get additional property room rates and availability
@@ -863,7 +830,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return a [Response] object with a body of type kotlin.collections.List
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdditionalAvailabilityOperation)"))
@@ -881,29 +848,29 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
checkout: kotlin.String? =
null,
exclusion: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Exclusion,
+ GetAdditionalAvailabilityOperationParams.Exclusion
>? =
null,
filter: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Filter,
+ GetAdditionalAvailabilityOperationParams.Filter
>? =
null,
include: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.Include,
+ GetAdditionalAvailabilityOperationParams.Include
>? =
null,
occupancy: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>? =
null,
rateOption: kotlin.collections.List<
- GetAdditionalAvailabilityOperationParams.RateOption,
+ GetAdditionalAvailabilityOperationParams.RateOption
>? =
null,
salesChannel: kotlin.String? =
null,
currency: kotlin.String? =
- null,
+ null
): Response> {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -921,7 +888,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
occupancy,
rateOption,
salesChannel,
- currency,
+ currency
)
}.get()
} catch (exception: Exception) {
@@ -936,9 +903,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type kotlin.collections.List
*/
- fun execute(operation: GetAvailabilityOperation): Response> {
- return execute>(operation)
- }
+ fun execute(operation: GetAvailabilityOperation): Response> = execute>(operation)
/**
* Get property room rates and availability
@@ -947,9 +912,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type kotlin.collections.List
*/
- fun executeAsync(operation: GetAvailabilityOperation): CompletableFuture>> {
- return executeAsync>(operation)
- }
+ fun executeAsync(operation: GetAvailabilityOperation): CompletableFuture>> = executeAsync>(operation)
private suspend inline fun kgetAvailabilityWithResponse(
checkin: kotlin.String,
@@ -958,10 +921,10 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
countryCode: kotlin.String,
language: kotlin.String,
occupancy: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>,
propertyId: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>,
ratePlanCount: java.math.BigDecimal,
salesChannel: kotlin.String,
@@ -973,35 +936,35 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: GetAvailabilityOperationParams.Test? =
null,
amenityCategory: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>? =
null,
exclusion: kotlin.collections.List<
- GetAvailabilityOperationParams.Exclusion,
+ GetAvailabilityOperationParams.Exclusion
>? =
null,
filter: kotlin.collections.List<
- GetAvailabilityOperationParams.Filter,
+ GetAvailabilityOperationParams.Filter
>? =
null,
include: kotlin.collections.List<
- GetAvailabilityOperationParams.Include,
+ GetAvailabilityOperationParams.Include
>? =
null,
rateOption: kotlin.collections.List<
- GetAvailabilityOperationParams.RateOption,
+ GetAvailabilityOperationParams.RateOption
>? =
null,
travelPurpose: GetAvailabilityOperationParams.TravelPurpose? =
null,
billingTerms: kotlin.String? =
null,
- paymentTerms: kotlin.String? =
- null,
partnerPointOfSale: kotlin.String? =
null,
- platformName: kotlin.String? =
+ paymentTerms: kotlin.String? =
null,
+ platformName: kotlin.String? =
+ null
): Response> {
val params =
GetAvailabilityOperationParams(
@@ -1025,14 +988,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
rateOption = rateOption,
travelPurpose = travelPurpose,
billingTerms = billingTerms,
- paymentTerms = paymentTerms,
partnerPointOfSale = partnerPointOfSale,
- platformName = platformName,
+ paymentTerms = paymentTerms,
+ platformName = platformName
)
val operation =
GetAvailabilityOperation(
- params,
+ params
)
return execute(operation)
@@ -1061,14 +1024,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @param rateOption Request specific rate options for each property. Send multiple instances of this parameter to request multiple rate options. Accepted values:
* `member` - Return member rates for each property. This feature must be enabled and requires a user to be logged in to request these rates. * `net_rates` - Return net rates for each property. This feature must be enabled to request these rates. * `cross_sell` - Identify if the traffic is coming from a cross sell booking. Where the traveler has booked another service (flight, car, activities...) before hotel. (optional)
* @param travelPurpose This parameter is to specify the travel purpose of the booking. This may impact available rate plans, pricing, or tax calculations. * `leisure` * `business` (optional)
* @param billingTerms This parameter is to specify the terms of how a resulting booking should be billed. If this field is needed, the value for this will be provided to you separately. (optional)
- * @param paymentTerms This parameter is to specify what terms should be used when being paid for a resulting booking. If this field is needed, the value for this will be provided to you separately. (optional)
* @param partnerPointOfSale This parameter is to specify what point of sale is being used to shop and book. If this field is needed, the value for this will be provided to you separately. (optional)
+ * @param paymentTerms This parameter is to specify what terms should be used when being paid for a resulting booking. If this field is needed, the value for this will be provided to you separately. (optional)
* @param platformName This parameter is to specify what platform is being used to shop and book. If this field is needed, the value for this will be provided to you separately. (optional)
* @throws ExpediaGroupApiErrorException
* @return kotlin.collections.List
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAvailabilityOperation)"))
@@ -1079,10 +1042,10 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
countryCode: kotlin.String,
language: kotlin.String,
occupancy: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>,
propertyId: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>,
ratePlanCount: java.math.BigDecimal,
salesChannel: kotlin.String,
@@ -1094,37 +1057,37 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: GetAvailabilityOperationParams.Test? =
null,
amenityCategory: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>? =
null,
exclusion: kotlin.collections.List<
- GetAvailabilityOperationParams.Exclusion,
+ GetAvailabilityOperationParams.Exclusion
>? =
null,
filter: kotlin.collections.List<
- GetAvailabilityOperationParams.Filter,
+ GetAvailabilityOperationParams.Filter
>? =
null,
include: kotlin.collections.List<
- GetAvailabilityOperationParams.Include,
+ GetAvailabilityOperationParams.Include
>? =
null,
rateOption: kotlin.collections.List<
- GetAvailabilityOperationParams.RateOption,
+ GetAvailabilityOperationParams.RateOption
>? =
null,
travelPurpose: GetAvailabilityOperationParams.TravelPurpose? =
null,
billingTerms: kotlin.String? =
null,
- paymentTerms: kotlin.String? =
- null,
partnerPointOfSale: kotlin.String? =
null,
- platformName: kotlin.String? =
+ paymentTerms: kotlin.String? =
null,
- ): kotlin.collections.List {
- return getAvailabilityWithResponse(
+ platformName: kotlin.String? =
+ null
+ ): kotlin.collections.List =
+ getAvailabilityWithResponse(
checkin,
checkout,
currency,
@@ -1145,11 +1108,10 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
rateOption,
travelPurpose,
billingTerms,
- paymentTerms,
partnerPointOfSale,
- platformName,
+ paymentTerms,
+ platformName
).data
- }
/**
* Get property room rates and availability
@@ -1174,14 +1136,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @param rateOption Request specific rate options for each property. Send multiple instances of this parameter to request multiple rate options. Accepted values:
* `member` - Return member rates for each property. This feature must be enabled and requires a user to be logged in to request these rates. * `net_rates` - Return net rates for each property. This feature must be enabled to request these rates. * `cross_sell` - Identify if the traffic is coming from a cross sell booking. Where the traveler has booked another service (flight, car, activities...) before hotel. (optional)
* @param travelPurpose This parameter is to specify the travel purpose of the booking. This may impact available rate plans, pricing, or tax calculations. * `leisure` * `business` (optional)
* @param billingTerms This parameter is to specify the terms of how a resulting booking should be billed. If this field is needed, the value for this will be provided to you separately. (optional)
- * @param paymentTerms This parameter is to specify what terms should be used when being paid for a resulting booking. If this field is needed, the value for this will be provided to you separately. (optional)
* @param partnerPointOfSale This parameter is to specify what point of sale is being used to shop and book. If this field is needed, the value for this will be provided to you separately. (optional)
+ * @param paymentTerms This parameter is to specify what terms should be used when being paid for a resulting booking. If this field is needed, the value for this will be provided to you separately. (optional)
* @param platformName This parameter is to specify what platform is being used to shop and book. If this field is needed, the value for this will be provided to you separately. (optional)
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type kotlin.collections.List
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAvailabilityOperation)"))
@@ -1192,10 +1154,10 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
countryCode: kotlin.String,
language: kotlin.String,
occupancy: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>,
propertyId: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>,
ratePlanCount: java.math.BigDecimal,
salesChannel: kotlin.String,
@@ -1207,35 +1169,35 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: GetAvailabilityOperationParams.Test? =
null,
amenityCategory: kotlin.collections.List<
- kotlin.String,
+ kotlin.String
>? =
null,
exclusion: kotlin.collections.List<
- GetAvailabilityOperationParams.Exclusion,
+ GetAvailabilityOperationParams.Exclusion
>? =
null,
filter: kotlin.collections.List<
- GetAvailabilityOperationParams.Filter,
+ GetAvailabilityOperationParams.Filter
>? =
null,
include: kotlin.collections.List<
- GetAvailabilityOperationParams.Include,
+ GetAvailabilityOperationParams.Include
>? =
null,
rateOption: kotlin.collections.List<
- GetAvailabilityOperationParams.RateOption,
+ GetAvailabilityOperationParams.RateOption
>? =
null,
travelPurpose: GetAvailabilityOperationParams.TravelPurpose? =
null,
billingTerms: kotlin.String? =
null,
- paymentTerms: kotlin.String? =
- null,
partnerPointOfSale: kotlin.String? =
null,
- platformName: kotlin.String? =
+ paymentTerms: kotlin.String? =
null,
+ platformName: kotlin.String? =
+ null
): Response> {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -1260,9 +1222,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
rateOption,
travelPurpose,
billingTerms,
- paymentTerms,
partnerPointOfSale,
- platformName,
+ paymentTerms,
+ platformName
)
}.get()
} catch (exception: Exception) {
@@ -1277,9 +1239,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type java.io.InputStream
*/
- fun execute(operation: GetBookingReceiptOperation): Response {
- return execute(operation)
- }
+ fun execute(operation: GetBookingReceiptOperation): Response = execute(operation)
/**
* Booking Receipt
@@ -1288,9 +1248,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture] object with a body of type java.io.InputStream
*/
- fun executeAsync(operation: GetBookingReceiptOperation): CompletableFuture> {
- return executeAsync(operation)
- }
+ fun executeAsync(operation: GetBookingReceiptOperation): CompletableFuture> = executeAsync(operation)
private suspend inline fun kgetBookingReceiptWithResponse(
customerIp: kotlin.String,
@@ -1301,7 +1259,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: GetBookingReceiptOperationParams.Test? =
null,
branding: GetBookingReceiptOperationParams.Branding? =
- null,
+ null
): Response {
val params =
GetBookingReceiptOperationParams(
@@ -1310,12 +1268,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
customerSessionId = customerSessionId,
test = test,
token = token,
- branding = branding,
+ branding = branding
)
val operation =
GetBookingReceiptOperation(
- params,
+ params
)
return execute(operation)
@@ -1334,7 +1292,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return java.io.InputStream
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetBookingReceiptOperation)"))
@@ -1347,10 +1305,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: GetBookingReceiptOperationParams.Test? =
null,
branding: GetBookingReceiptOperationParams.Branding? =
- null,
- ): java.io.InputStream {
- return getBookingReceiptWithResponse(customerIp, itineraryId, token, customerSessionId, test, branding).data
- }
+ null
+ ): java.io.InputStream = getBookingReceiptWithResponse(customerIp, itineraryId, token, customerSessionId, test, branding).data
/**
* Booking Receipt
@@ -1365,7 +1321,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @return a [Response] object with a body of type java.io.InputStream
*/
@Throws(
- ExpediaGroupApiErrorException::class,
+ ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetBookingReceiptOperation)"))
@@ -1378,7 +1334,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
test: GetBookingReceiptOperationParams.Test? =
null,
branding: GetBookingReceiptOperationParams.Branding? =
- null,
+ null
): Response {
try {
return GlobalScope.future(Dispatchers.IO) {
@@ -1396,9 +1352,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type kotlin.collections.List
*/
- fun execute(operation: GetCalendarAvailabilityOperation): Response