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> { - return execute>(operation) - } + fun execute(operation: GetCalendarAvailabilityOperation): Response> = + execute>(operation) /** * Get a calendar of availability dates for properties. This is currently a Vrbo property only feature. @@ -1407,32 +1362,29 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.List */ - fun executeAsync( - operation: GetCalendarAvailabilityOperation, - ): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: GetCalendarAvailabilityOperation): CompletableFuture>> = + executeAsync>(operation) private suspend inline fun kgetCalendarAvailabilityWithResponse( propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >, startDate: java.time.LocalDate, endDate: java.time.LocalDate, test: GetCalendarAvailabilityOperationParams.Test? = - null, + null ): Response> { val params = GetCalendarAvailabilityOperationParams( test = test, propertyId = propertyId, startDate = startDate, - endDate = endDate, + endDate = endDate ) val operation = GetCalendarAvailabilityOperation( - params, + params ) return execute(operation) @@ -1444,26 +1396,24 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param propertyId The ID of the property you want to search for. You can provide 1 to 250 property_id parameters. * @param startDate The first day of availability information to be returned, in ISO 8601 format (YYYY-MM-DD), up to 500 days in the future from the current date. * @param endDate The last day of availability information to be returned, in ISO 8601 format (YYYY-MM-DD). This must be 365 days or less from the start_date. - * @param test Shop calls have a test header that can be used to return set responses with the following keywords:
* `standard` * `service_unavailable` * `unknown_internal_error` (optional) + * @param test Shop calls have a test header that can be used to return set responses with the following keywords: * `standard` * `service_unavailable` * `unknown_internal_error` (optional) * @throws ExpediaGroupApiErrorException * @return kotlin.collections.List */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetCalendarAvailabilityOperation)")) fun getCalendarAvailability( propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >, startDate: java.time.LocalDate, endDate: java.time.LocalDate, test: GetCalendarAvailabilityOperationParams.Test? = - null, - ): kotlin.collections.List { - return getCalendarAvailabilityWithResponse(propertyId, startDate, endDate, test).data - } + null + ): kotlin.collections.List = getCalendarAvailabilityWithResponse(propertyId, startDate, endDate, test).data /** * Get a calendar of availability dates for properties. This is currently a Vrbo property only feature. @@ -1471,23 +1421,23 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param propertyId The ID of the property you want to search for. You can provide 1 to 250 property_id parameters. * @param startDate The first day of availability information to be returned, in ISO 8601 format (YYYY-MM-DD), up to 500 days in the future from the current date. * @param endDate The last day of availability information to be returned, in ISO 8601 format (YYYY-MM-DD). This must be 365 days or less from the start_date. - * @param test Shop calls have a test header that can be used to return set responses with the following keywords:
* `standard` * `service_unavailable` * `unknown_internal_error` (optional) + * @param test Shop calls have a test header that can be used to return set responses with the following keywords: * `standard` * `service_unavailable` * `unknown_internal_error` (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: GetCalendarAvailabilityOperation)")) fun getCalendarAvailabilityWithResponse( propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >, startDate: java.time.LocalDate, endDate: java.time.LocalDate, test: GetCalendarAvailabilityOperationParams.Test? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { @@ -1500,25 +1450,22 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat /** * Chain Reference - * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including Doubletree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. + * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including DoubleTree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. * @param operation [GetChainReferenceOperation] * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.Map */ - fun execute(operation: GetChainReferenceOperation): Response> { - return execute>(operation) - } + fun execute(operation: GetChainReferenceOperation): Response> = execute>(operation) /** * Chain Reference - * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including Doubletree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. + * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including DoubleTree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. * @param operation [GetChainReferenceOperation] * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.Map */ - fun executeAsync(operation: GetChainReferenceOperation): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: GetChainReferenceOperation): CompletableFuture>> = + executeAsync>(operation) private suspend inline fun kgetChainReferenceWithResponse( customerSessionId: kotlin.String? = @@ -1530,7 +1477,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { val params = GetChainReferenceOperationParams( @@ -1538,12 +1485,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) val operation = GetChainReferenceOperation( - params, + params ) return execute(operation) @@ -1551,7 +1498,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat /** * Chain Reference - * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including Doubletree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. + * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including DoubleTree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 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) @@ -1561,7 +1508,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return kotlin.collections.Map */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetChainReferenceOperation)")) @@ -1575,14 +1522,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - ): kotlin.collections.Map { - return getChainReferenceWithResponse(customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName).data - } + null + ): kotlin.collections.Map = getChainReferenceWithResponse(customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Chain Reference - * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including Doubletree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. + * Returns a complete collection of chains recognized by the Rapid API.
Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including DoubleTree, Hampton Inn and Embassy Suites.
The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands.
Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
Chain and brand names are provided in English only. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 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) @@ -1592,7 +1537,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type kotlin.collections.Map */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetChainReferenceOperation)")) @@ -1606,7 +1551,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { @@ -1624,9 +1569,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.List */ - fun execute(operation: GetInactivePropertiesOperation): Response> { - return execute>(operation) - } + fun execute(operation: GetInactivePropertiesOperation): Response> = execute>(operation) /** * Inactive Properties @@ -1635,9 +1578,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.List */ - fun executeAsync(operation: GetInactivePropertiesOperation): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: GetInactivePropertiesOperation): CompletableFuture>> = + executeAsync>(operation) private suspend inline fun kgetInactivePropertiesWithResponse( customerSessionId: kotlin.String? = @@ -1648,12 +1590,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat 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 = GetInactivePropertiesOperationParams( @@ -1661,14 +1603,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat since = since, token = token, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) val operation = GetInactivePropertiesOperation( - params, + params ) return execute(operation) @@ -1681,14 +1623,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param since Required on initial call, not accepted on subsequent paging links provided in response header.
The earliest date that a property became inactive to include in the results. ISO 8601 format (YYYY-MM-DD) (optional) * @param token Only used for requesting additional pages of data. Provided by the `next` URL in the `Link` response header. (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: GetInactivePropertiesOperation)")) @@ -1701,23 +1643,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat null, billingTerms: kotlin.String? = null, - paymentTerms: kotlin.String? = - null, partnerPointOfSale: kotlin.String? = null, - platformName: kotlin.String? = + paymentTerms: kotlin.String? = null, - ): kotlin.collections.List { - return getInactivePropertiesWithResponse( - customerSessionId, - since, - token, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ).data - } + platformName: kotlin.String? = + null + ): kotlin.collections.List = getInactivePropertiesWithResponse(customerSessionId, since, token, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Inactive Properties @@ -1726,14 +1658,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param since Required on initial call, not accepted on subsequent paging links provided in response header.
The earliest date that a property became inactive to include in the results. ISO 8601 format (YYYY-MM-DD) (optional) * @param token Only used for requesting additional pages of data. Provided by the `next` URL in the `Link` response header. (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: GetInactivePropertiesOperation)")) @@ -1746,24 +1678,16 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat 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) { - kgetInactivePropertiesWithResponse( - customerSessionId, - since, - token, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ) + kgetInactivePropertiesWithResponse(customerSessionId, since, token, billingTerms, partnerPointOfSale, paymentTerms, platformName) }.get() } catch (exception: Exception) { exception.handle() @@ -1787,15 +1711,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat null, billingTerms: kotlin.String? = null, - paymentTerms: kotlin.String? = - null, partnerPointOfSale: kotlin.String? = null, - platformName: kotlin.String? = + paymentTerms: kotlin.String? = null, + platformName: kotlin.String? = + null ): Paginator> { - val response = - getInactivePropertiesWithResponse(customerSessionId, since, token, billingTerms, paymentTerms, partnerPointOfSale, platformName) + val response = getInactivePropertiesWithResponse(customerSessionId, since, token, billingTerms, partnerPointOfSale, paymentTerms, platformName) return Paginator(this, response, emptyList()) { it.body>() } } @@ -1810,15 +1733,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat null, billingTerms: kotlin.String? = null, - paymentTerms: kotlin.String? = - null, partnerPointOfSale: kotlin.String? = null, - platformName: kotlin.String? = + paymentTerms: kotlin.String? = null, + platformName: kotlin.String? = + null ): ResponsePaginator> { - val response = - getInactivePropertiesWithResponse(customerSessionId, since, token, billingTerms, paymentTerms, partnerPointOfSale, platformName) + val response = getInactivePropertiesWithResponse(customerSessionId, since, token, billingTerms, partnerPointOfSale, paymentTerms, platformName) return ResponsePaginator(this, response, emptyList()) { it.body>() } } @@ -1829,9 +1751,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type PaymentOption */ - fun execute(operation: GetPaymentOptionsOperation): Response { - return execute(operation) - } + fun execute(operation: GetPaymentOptionsOperation): Response = execute(operation) /** * Get Accepted Payment Types - EPS MOR Only @@ -1840,9 +1760,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type PaymentOption */ - fun executeAsync(operation: GetPaymentOptionsOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: GetPaymentOptionsOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kgetPaymentOptionsWithResponse( propertyId: kotlin.String, @@ -1850,19 +1768,19 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerIp: kotlin.String? = null, customerSessionId: kotlin.String? = - null, + null ): Response { val params = GetPaymentOptionsOperationParams( propertyId = propertyId, customerIp = customerIp, customerSessionId = customerSessionId, - token = token, + token = token ) val operation = GetPaymentOptionsOperation( - params, + params ) return execute(operation) @@ -1879,7 +1797,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return PaymentOption */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPaymentOptionsOperation)")) @@ -1889,10 +1807,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerIp: kotlin.String? = null, customerSessionId: kotlin.String? = - null, - ): PaymentOption { - return getPaymentOptionsWithResponse(propertyId, token, customerIp, customerSessionId).data - } + null + ): PaymentOption = getPaymentOptionsWithResponse(propertyId, token, customerIp, customerSessionId).data /** * Get Accepted Payment Types - EPS MOR Only @@ -1905,7 +1821,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type PaymentOption */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPaymentOptionsOperation)")) @@ -1915,7 +1831,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerIp: kotlin.String? = null, customerSessionId: kotlin.String? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -1933,9 +1849,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Link */ - fun execute(operation: GetPropertyCatalogFileOperation): Response { - return execute(operation) - } + fun execute(operation: GetPropertyCatalogFileOperation): Response = execute(operation) /** * Property Catalog File @@ -1944,9 +1858,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type Link */ - fun executeAsync(operation: GetPropertyCatalogFileOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: GetPropertyCatalogFileOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kgetPropertyCatalogFileWithResponse( language: kotlin.String, @@ -1955,12 +1867,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat 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 = GetPropertyCatalogFileOperationParams( @@ -1968,14 +1880,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat language = language, supplySource = supplySource, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) val operation = GetPropertyCatalogFileOperation( - params, + params ) return execute(operation) @@ -1988,14 +1900,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 Link */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyCatalogFileOperation)")) @@ -2006,23 +1918,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat null, billingTerms: kotlin.String? = null, - paymentTerms: kotlin.String? = - null, partnerPointOfSale: kotlin.String? = null, - platformName: kotlin.String? = + paymentTerms: kotlin.String? = null, - ): Link { - return getPropertyCatalogFileWithResponse( - language, - supplySource, - customerSessionId, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ).data - } + platformName: kotlin.String? = + null + ): Link = getPropertyCatalogFileWithResponse(language, supplySource, customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Property Catalog File @@ -2031,14 +1933,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 Link */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyCatalogFileOperation)")) @@ -2049,24 +1951,16 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat 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) { - kgetPropertyCatalogFileWithResponse( - language, - supplySource, - customerSessionId, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ) + kgetPropertyCatalogFileWithResponse(language, supplySource, customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName) }.get() } catch (exception: Exception) { exception.handle() @@ -2080,9 +1974,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.Map */ - fun execute(operation: GetPropertyContentOperation): Response> { - return execute>(operation) - } + fun execute(operation: GetPropertyContentOperation): Response> = + execute>(operation) /** * Property Content @@ -2091,11 +1984,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.Map */ - fun executeAsync( - operation: GetPropertyContentOperation, - ): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: GetPropertyContentOperation): CompletableFuture>> = + executeAsync>(operation) private suspend inline fun kgetPropertyContentWithResponse( language: kotlin.String, @@ -2103,39 +1993,39 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, dateAddedEnd: kotlin.String? = @@ -2147,13 +2037,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat dateUpdatedStart: kotlin.String? = null, include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, multiUnit: kotlin.Boolean? = null, propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, propertyRatingMax: kotlin.String? = @@ -2161,7 +2051,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat propertyRatingMin: kotlin.String? = null, spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -2171,7 +2061,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { val params = GetPropertyContentOperationParams( @@ -2200,12 +2090,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) val operation = GetPropertyContentOperation( - params, + params ) return execute(operation) @@ -2214,7 +2104,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat /** * Property Content * Search property content for active properties in the requested language.

When searching with query parameter, `property_id`, you may request 1 to 250 properties at a time.

When searching with query parameters other than `property_id`, the response will be paginated. See the `Link` header in the 200 response section.

The response is a JSON map where the key is the property ID and the value is the property object itself, which can include property-level, room-level and rate-level information. - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/)
Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param allInclusive Search to include properties that have the requested `all_inclusive` values equal to true. If this parameter is not supplied, all `all_inclusive` scenarios are included. This parameter can be supplied multiple times with different values, which will include properties that match any of the requested scenarios. * `all_rate_plans` - Return properties where `all_inclusive.all_rate_plans` is true. * `some_rate_plans` = Return properties where `all_inclusive.some_rate_plans` is true. (optional) @@ -2244,7 +2134,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return kotlin.collections.Map */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyContentOperation)")) @@ -2254,39 +2144,39 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, dateAddedEnd: kotlin.String? = @@ -2298,13 +2188,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat dateUpdatedStart: kotlin.String? = null, include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, multiUnit: kotlin.Boolean? = null, propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, propertyRatingMax: kotlin.String? = @@ -2312,7 +2202,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat propertyRatingMin: kotlin.String? = null, spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -2322,9 +2212,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - ): kotlin.collections.Map { - return getPropertyContentWithResponse( + null + ): kotlin.collections.Map = + getPropertyContentWithResponse( language, supplySource, customerSessionId, @@ -2350,14 +2240,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ).data - } /** * Property Content * Search property content for active properties in the requested language.

When searching with query parameter, `property_id`, you may request 1 to 250 properties at a time.

When searching with query parameters other than `property_id`, the response will be paginated. See the `Link` header in the 200 response section.

The response is a JSON map where the key is the property ID and the value is the property object itself, which can include property-level, room-level and rate-level information. - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/)
Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param allInclusive Search to include properties that have the requested `all_inclusive` values equal to true. If this parameter is not supplied, all `all_inclusive` scenarios are included. This parameter can be supplied multiple times with different values, which will include properties that match any of the requested scenarios. * `all_rate_plans` - Return properties where `all_inclusive.all_rate_plans` is true. * `some_rate_plans` = Return properties where `all_inclusive.some_rate_plans` is true. (optional) @@ -2387,7 +2276,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type kotlin.collections.Map */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyContentOperation)")) @@ -2397,39 +2286,39 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, dateAddedEnd: kotlin.String? = @@ -2441,13 +2330,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat dateUpdatedStart: kotlin.String? = null, include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, multiUnit: kotlin.Boolean? = null, propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, propertyRatingMax: kotlin.String? = @@ -2455,7 +2344,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat propertyRatingMin: kotlin.String? = null, spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -2465,7 +2354,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { @@ -2495,7 +2384,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ) }.get() } catch (exception: Exception) { @@ -2517,39 +2406,39 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, dateAddedEnd: kotlin.String? = @@ -2561,13 +2450,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat dateUpdatedStart: kotlin.String? = null, include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, multiUnit: kotlin.Boolean? = null, propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, propertyRatingMax: kotlin.String? = @@ -2575,7 +2464,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat propertyRatingMin: kotlin.String? = null, spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -2585,7 +2474,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Paginator> { val response = getPropertyContentWithResponse( @@ -2614,7 +2503,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ) return Paginator(this, response, emptyMap()) { it.body>() } } @@ -2627,39 +2516,39 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, dateAddedEnd: kotlin.String? = @@ -2671,13 +2560,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat dateUpdatedStart: kotlin.String? = null, include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, multiUnit: kotlin.Boolean? = null, propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, propertyRatingMax: kotlin.String? = @@ -2685,7 +2574,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat propertyRatingMin: kotlin.String? = null, spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -2695,7 +2584,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): ResponsePaginator> { val response = getPropertyContentWithResponse( @@ -2724,32 +2613,28 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ) return ResponsePaginator(this, response, emptyMap()) { it.body>() } } /** * Property Content File - * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

You'll be asked to pay the following charges at the hotel:

  • Deposit: USD 50 per day
  • Resort fee: USD 29.12 per accommodation, per night
The hotel resort fee includes:
  • Fitness center access
  • Internet access
  • Phone calls
  • Additional inclusions

We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

\",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} ``` + * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} ``` * @param operation [GetPropertyContentFileOperation] * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Link */ - fun execute(operation: GetPropertyContentFileOperation): Response { - return execute(operation) - } + fun execute(operation: GetPropertyContentFileOperation): Response = execute(operation) /** * Property Content File - * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} ``` + * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} ``` * @param operation [GetPropertyContentFileOperation] * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type Link */ - fun executeAsync(operation: GetPropertyContentFileOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: GetPropertyContentFileOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kgetPropertyContentFileWithResponse( language: kotlin.String, @@ -2758,12 +2643,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat 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 = GetPropertyContentFileOperationParams( @@ -2771,14 +2656,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat language = language, supplySource = supplySource, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) val operation = GetPropertyContentFileOperation( - params, + params ) return execute(operation) @@ -2786,19 +2671,19 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat /** * Property Content File - * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} ``` - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} ``` + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 Link */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyContentFileOperation)")) @@ -2809,39 +2694,29 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat null, billingTerms: kotlin.String? = null, - paymentTerms: kotlin.String? = - null, partnerPointOfSale: kotlin.String? = null, - platformName: kotlin.String? = + paymentTerms: kotlin.String? = null, - ): Link { - return getPropertyContentFileWithResponse( - language, - supplySource, - customerSessionId, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ).data - } + platformName: kotlin.String? = + null + ): Link = getPropertyContentFileWithResponse(language, supplySource, customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Property Content File - * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\"} ``` - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * Returns a link to download all content for all of EPS’s active properties in the requested language. The response includes property-level, room-level and rate-level information.
    This file is in JSONL format and is gzipped. The schema of each JSON object in the JSONL file is the same as the schema of each JSON object from the Property Content call.
    Example of a JSONL file with 2 properties: ``` {\"property_id\":\"12345\",\"name\":\"Test Property Name\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":false,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345\"},\"fr-FR\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":48382,\"overall\":\"3.1\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"73%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838}},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":false},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":20,\"square_feet\":215},\"views\":{\"4146\":{\"id\":\"4146\",\"name\":\"Courtyard view\"}},\"occupancy\":{\"max_allowed\":{\"total\":5,\"children\":2,\"adults\":4},\"age_categories\":{\"Adult\":{\"name\":\"Adult\",\"minimum_age\":9}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-19T05:00:00.000Z\",\"updated\":\"2018-03-22T07:23:14.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"AB-012-987-1234-01\",\"chain\":{\"id\":\"-6\",\"name\":\"Hyatt Hotels\"},\"brand\":{\"id\":\"2209\",\"name\":\"Hyatt Place\"},\"spoken_languages\":{\"vi\":{\"id\":\"vi\",\"name\":\"Vietnamese\"}},\"multi_unit\":true,\"payment_registration_recommended\":false,\"vacation_rental_details\": {\"registry_number\": \"Property Registration Number 123456\",\"private_host\": \"true\",\"property_manager\": {\"name\": \"Victor\",\"links\": {\"image\": {\"method\": \"GET\",\"href\": \"https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg\"}}},\"rental_agreement\": {\"links\": {\"rental_agreement\": {\"method\": \"GET\",\"href\": \"https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf\"}}},\"house_rules\": [\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\": {\"4296\": {\"id\": \"4296\",\"name\": \"Furnished balcony or patio\"},\"2859\": {\"id\": \"2859\",\"name\": \"Private pool\"}},\"vrbo_srp_id\": \"123.1234567.5678910\",\"listing_id\": \"1234567\",\"listing_number\": \"5678910\",\"listing_source\": \"HOMEAWAY_US\",\"listing_unit\": \"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} {\"property_id\":\"67890\",\"name\":\"Test Property Name 2\",\"address\":{\"line_1\":\"123 Main St\",\"line_2\":\"Apt A\",\"city\":\"Springfield\",\"state_province_code\":\"MO\",\"state_province_name\":\"Missouri\",\"postal_code\":\"65804\",\"country_code\":\"US\",\"obfuscation_required\":true,\"localized\":{\"links\":{\"es-ES\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890\"},\"de-DE\":{\"method\":\"GET\",\"href\":\"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890\"}}}},\"ratings\":{\"property\":{\"rating\":\"3.5\",\"type\":\"Star\"},\"guest\":{\"count\":7651,\"overall\":\"4.3\",\"cleanliness\":\"4.2\",\"service\":\"1.1\",\"comfort\":\"4.3\",\"condition\":\"1.6\",\"location\":\"4.0\",\"neighborhood\":\"3.4\",\"quality\":\"3.4\",\"value\":\"2.2\",\"amenities\":\"1.4\",\"recommendation_percent\":\"80%\"}},\"location\":{\"coordinates\":{\"latitude\":37.15845,\"longitude\":-93.26838},\"obfuscated_coordinates\":{\"latitude\":28.339303,\"longitude\":-81.47791},\"obfuscation_required\":true},\"phone\":\"1-417-862-0153\",\"fax\":\"1-417-863-7249\",\"category\":{\"id\":\"1\",\"name\":\"Hotel\"},\"rank\":42,\"business_model\":{\"expedia_collect\":true,\"property_collect\":true},\"checkin\":{\"24_hour\":\"24-hour check-in\",\"begin_time\":\"3:00 PM\",\"end_time\":\"11:00 PM\",\"instructions\":\"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />\",\"special_instructions\":\"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.\",\"min_age\":18},\"checkout\":{\"time\":\"11:00 AM\"},\"fees\":{\"mandatory\":\"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    \",\"optional\":\"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • \"},\"policies\":{\"know_before_you_go\":\"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • \"},\"attributes\":{\"general\":{\"2549\":{\"id\":\"2549\",\"name\":\"No elevators\"},\"3357\":{\"id\":\"3357\",\"name\":\"Caters to adults only\"}},\"pets\":{\"51\":{\"id\":\"51\",\"name\":\"Pets allowed\"},\"2809\":{\"id\":\"2809\",\"name\":\"Dogs only\"},\"3321\":{\"id\":\"3321\",\"name\":\"Pet maximum weight in kg is - 24\",\"value\":24}}},\"amenities\":{\"9\":{\"id\":\"9\",\"name\":\"Fitness facilities\"},\"2820\":{\"id\":\"2820\",\"name\":\"Number of indoor pools - 10\",\"value\":10}},\"images\":[{\"caption\":\"Featured Image\",\"hero_image\":true,\"category\":3,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}}}],\"onsite_payments\":{\"currency\":\"USD\",\"types\":{\"171\":{\"id\":\"171\",\"name\":\"American Express\"}}},\"rooms\":{\"224829\":{\"id\":\"224829\",\"name\":\"Single Room\",\"descriptions\":{\"overview\":\"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    \"},\"amenities\":{\"130\":{\"id\":\"130\",\"name\":\"Refrigerator\"},\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"}},\"images\":[{\"hero_image\":true,\"category\":21001,\"links\":{\"70px\":{\"method\":\"GET\",\"href\":\"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg\"}},\"caption\":\"Guestroom\"}],\"bed_groups\":{\"37321\":{\"id\":\"37321\",\"description\":\"1 King Bed\",\"configuration\":[{\"type\":\"KingBed\",\"size\":\"King\",\"quantity\":1}]}},\"area\":{\"square_meters\":17},\"views\":{\"4134\":{\"id\":\"4134\",\"name\":\"City view\"}},\"occupancy\":{\"max_allowed\":{\"total\":3,\"children\":2,\"adults\":3},\"age_categories\":{\"ChildAgeA\":{\"name\":\"ChildAgeA\",\"minimum_age\":3}}}}},\"rates\":{\"333abc\":{\"id\":\"333abc\",\"amenities\":{\"1234\":{\"id\":\"1234\",\"name\":\"Test Amenity - 200\",\"value\":\"200\"},\"2104\":{\"id\":\"2104\",\"name\":\"Full Breakfast\"}},\"special_offer_description\":\"Breakfast for 2 - Rate includes the following:\\r\\n
    • Accommodations as selected
    • \\r\\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \\r\\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\\r\\n\"}},\"dates\":{\"added\":\"1998-07-20T05:00:00.000Z\",\"updated\":\"2018-03-22T13:33:17.000Z\"},\"descriptions\":{\"amenities\":\"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.\",\"dining\":\"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.\",\"renovations\":\"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    \",\"national_ratings\":\"For the benefit of our customers, we have provided a rating based on our rating system.\",\"business_amenities\":\"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.\",\"rooms\":\"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.\",\"attractions\":\"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    \",\"location\":\"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.\",\"headline\":\"Near National Museum of Natural Science\",\"general\":\"General description\"},\"statistics\":{\"52\":{\"id\":\"52\",\"name\":\"Total number of rooms - 820\",\"value\":\"820\"},\"54\":{\"id\":\"54\",\"name\":\"Number of floors - 38\",\"value\":\"38\"}},\"airports\":{\"preferred\":{\"iata_airport_code\":\"SGF\"}},\"themes\":{\"2337\":{\"id\":\"2337\",\"name\":\"Luxury Hotel\"},\"2341\":{\"id\":\"2341\",\"name\":\"Spa Hotel\"}},\"all_inclusive\":{\"all_rate_plans\":true,\"some_rate_plans\":false,\"details\":\"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    \"},\"tax_id\":\"CD-012-987-1234-02\",\"chain\":{\"id\":\"-5\",\"name\":\"Hilton Worldwide\"},\"brand\":{\"id\":\"358\",\"name\":\"Hampton Inn\"},\"spoken_languages\":{\"en\":{\"id\":\"en\",\"name\":\"English\"}},\"multi_unit\":true,\"payment_registration_recommended\":true,\"vacation_rental_details\":{\"registry_number\":\"Property Registration Number 123456\",\"private_host\":\"true\",\"property_manager\":{\"name\":\"John Smith\",\"links\":{\"image\":{\"method\":\"GET\",\"href\":\"https://example.com/profile.jpg\"}}},\"rental_agreement\":{\"links\":{\"rental_agreement\":{\"method\":\"GET\",\"href\":\"https:/example.com/rentalconditions.pdf\"}}},\"house_rules\":[\"Children welcome\",\"No pets\",\"No smoking\",\"No parties or events\"],\"amenities\":{\"2859\":{\"id\":\"2859\",\"name\":\"Private pool\"},\"4296\":{\"id\":\"4296\",\"name\":\"Furnished balcony or patio\"}},\"vrbo_srp_id\":\"123.1234567.5678910\",\"listing_id\":\"1234567\",\"listing_number\":\"5678910\",\"listing_source\":\"HOMEAWAY_US\",\"listing_unit\":\"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60\"},\"supply_source\":\"vrbo\",\"registry_number\":\"Property Registration Number 123456\"} ``` + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 Link */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyContentFileOperation)")) @@ -2852,24 +2727,16 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat 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) { - kgetPropertyContentFileWithResponse( - language, - supplySource, - customerSessionId, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ) + kgetPropertyContentFileWithResponse(language, supplySource, customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName) }.get() } catch (exception: Exception) { exception.handle() @@ -2883,9 +2750,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type GuestReviews */ - fun execute(operation: GetPropertyGuestReviewsOperation): Response { - return execute(operation) - } + fun execute(operation: GetPropertyGuestReviewsOperation): Response = execute(operation) /** * Property Guest Reviews @@ -2894,9 +2759,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type GuestReviews */ - fun executeAsync(operation: GetPropertyGuestReviewsOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: GetPropertyGuestReviewsOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kgetPropertyGuestReviewsWithResponse( propertyId: kotlin.String, @@ -2904,21 +2767,21 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, filter: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.Filter, + GetPropertyGuestReviewsOperationParams.Filter >? = null, tripReason: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.TripReason, + GetPropertyGuestReviewsOperationParams.TripReason >? = 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 = GetPropertyGuestReviewsOperationParams( @@ -2928,14 +2791,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat filter = filter, tripReason = tripReason, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) val operation = GetPropertyGuestReviewsOperation( - params, + params ) return execute(operation) @@ -2944,20 +2807,20 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat /** * Property Guest Reviews * Note: Property Guest Reviews are only available if your account is configured for access and all launch requirements have been followed. Please find the launch requirements here [https://support.expediapartnersolutions.com/hc/en-us/articles/360008646799](https://support.expediapartnersolutions.com/hc/en-us/articles/360008646799) and contact your Account Manager for more details. The response is an individual Guest Reviews object containing multiple guest reviews for the requested active property. To ensure you always show the latest guest reviews, this call should be made whenever a customer looks at the details for a specific property. - * @param propertyId Expedia Property ID.
    - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param propertyId Expedia Property ID. + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param filter Single filter value. Send multiple instances of this parameter to request multiple filters. * `language` - Filters reviews to only those that match the specified `language` parameter value. Without this filter, the matching language will be preferred, but other language results can be returned. Specifying this filter could produce an error when there are no matching results. (optional) * @param tripReason Desired reason provided for the reviewer's trip that you wish to display. This parameter can be supplied multiple times with different values, which will include reviews that match any of the requested trip reasons. (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 GuestReviews */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyGuestReviewsOperation)")) @@ -2967,52 +2830,40 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, filter: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.Filter, + GetPropertyGuestReviewsOperationParams.Filter >? = null, tripReason: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.TripReason, + GetPropertyGuestReviewsOperationParams.TripReason >? = null, billingTerms: kotlin.String? = null, - paymentTerms: kotlin.String? = - null, partnerPointOfSale: kotlin.String? = null, - platformName: kotlin.String? = + paymentTerms: kotlin.String? = null, - ): GuestReviews { - return getPropertyGuestReviewsWithResponse( - propertyId, - language, - customerSessionId, - filter, - tripReason, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ).data - } + platformName: kotlin.String? = + null + ): GuestReviews = getPropertyGuestReviewsWithResponse(propertyId, language, customerSessionId, filter, tripReason, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Property Guest Reviews * Note: Property Guest Reviews are only available if your account is configured for access and all launch requirements have been followed. Please find the launch requirements here [https://support.expediapartnersolutions.com/hc/en-us/articles/360008646799](https://support.expediapartnersolutions.com/hc/en-us/articles/360008646799) and contact your Account Manager for more details. The response is an individual Guest Reviews object containing multiple guest reviews for the requested active property. To ensure you always show the latest guest reviews, this call should be made whenever a customer looks at the details for a specific property. - * @param propertyId Expedia Property ID.
    - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param propertyId Expedia Property ID. + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param filter Single filter value. Send multiple instances of this parameter to request multiple filters. * `language` - Filters reviews to only those that match the specified `language` parameter value. Without this filter, the matching language will be preferred, but other language results can be returned. Specifying this filter could produce an error when there are no matching results. (optional) * @param tripReason Desired reason provided for the reviewer's trip that you wish to display. This parameter can be supplied multiple times with different values, which will include reviews that match any of the requested trip reasons. (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 GuestReviews */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetPropertyGuestReviewsOperation)")) @@ -3022,35 +2873,25 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, filter: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.Filter, + GetPropertyGuestReviewsOperationParams.Filter >? = null, tripReason: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.TripReason, + GetPropertyGuestReviewsOperationParams.TripReason >? = 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) { - kgetPropertyGuestReviewsWithResponse( - propertyId, - language, - customerSessionId, - filter, - tripReason, - billingTerms, - paymentTerms, - partnerPointOfSale, - platformName, - ) + kgetPropertyGuestReviewsWithResponse(propertyId, language, customerSessionId, filter, tripReason, billingTerms, partnerPointOfSale, paymentTerms, platformName) }.get() } catch (exception: Exception) { exception.handle() @@ -3064,9 +2905,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Region */ - fun execute(operation: GetRegionOperation): Response { - return execute(operation) - } + fun execute(operation: GetRegionOperation): Response = execute(operation) /** * Region @@ -3075,18 +2914,18 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type Region */ - fun executeAsync(operation: GetRegionOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: GetRegionOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kgetRegionWithResponse( regionId: kotlin.String, language: kotlin.String, include: kotlin.collections.List< - GetRegionOperationParams.Include, + GetRegionOperationParams.Include >, customerSessionId: kotlin.String? = null, + supplySource: kotlin.String? = + null, billingTerms: kotlin.String? = null, partnerPointOfSale: kotlin.String? = @@ -3094,9 +2933,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - supplySource: kotlin.String? = - null, + null ): Response { val params = GetRegionOperationParams( @@ -3104,16 +2941,16 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId = customerSessionId, language = language, include = include, + supplySource = supplySource, billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, - supplySource = supplySource, + platformName = platformName ) val operation = GetRegionOperation( - params, + params ) return execute(operation) @@ -3126,16 +2963,16 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The value must be lower case. * details - Include the metadata, coordinates and full hierarchy of the region. * property_ids - Include the list of property IDs within the bounding polygon of the region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of the region and property IDs from the surrounding area if minimal properties are within the region. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) + * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. (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 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) - * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. (optional) * @throws ExpediaGroupApiErrorException * @return Region */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetRegionOperation)")) @@ -3143,10 +2980,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat regionId: kotlin.String, language: kotlin.String, include: kotlin.collections.List< - GetRegionOperationParams.Include, + GetRegionOperationParams.Include >, customerSessionId: kotlin.String? = null, + supplySource: kotlin.String? = + null, billingTerms: kotlin.String? = null, partnerPointOfSale: kotlin.String? = @@ -3154,22 +2993,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - supplySource: kotlin.String? = - null, - ): Region { - return getRegionWithResponse( - regionId, - language, - include, - customerSessionId, - billingTerms, - partnerPointOfSale, - paymentTerms, - platformName, - supplySource, - ).data - } + null + ): Region = getRegionWithResponse(regionId, language, include, customerSessionId, supplySource, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Region @@ -3178,16 +3003,16 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The value must be lower case. * details - Include the metadata, coordinates and full hierarchy of the region. * property_ids - Include the list of property IDs within the bounding polygon of the region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of the region and property IDs from the surrounding area if minimal properties are within the region. * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) + * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. (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 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) - * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. (optional) * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Region */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetRegionOperation)")) @@ -3195,10 +3020,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat regionId: kotlin.String, language: kotlin.String, include: kotlin.collections.List< - GetRegionOperationParams.Include, + GetRegionOperationParams.Include >, customerSessionId: kotlin.String? = null, + supplySource: kotlin.String? = + null, billingTerms: kotlin.String? = null, partnerPointOfSale: kotlin.String? = @@ -3206,23 +3033,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - supplySource: kotlin.String? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { - kgetRegionWithResponse( - regionId, - language, - include, - customerSessionId, - billingTerms, - partnerPointOfSale, - paymentTerms, - platformName, - supplySource, - ) + kgetRegionWithResponse(regionId, language, include, customerSessionId, supplySource, billingTerms, partnerPointOfSale, paymentTerms, platformName) }.get() } catch (exception: Exception) { exception.handle() @@ -3236,9 +3051,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.List */ - fun execute(operation: GetRegionsOperation): Response> { - return execute>(operation) - } + fun execute(operation: GetRegionsOperation): Response> = execute>(operation) /** * Regions @@ -3247,13 +3060,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.List */ - fun executeAsync(operation: GetRegionsOperation): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: GetRegionsOperation): CompletableFuture>> = executeAsync>(operation) private suspend inline fun kgetRegionsWithResponse( include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >, language: kotlin.String, customerSessionId: kotlin.String? = @@ -3263,11 +3074,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat area: kotlin.String? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, iataLocationCode: kotlin.String? = @@ -3277,7 +3088,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat supplySource: kotlin.String? = null, type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -3287,7 +3098,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { val params = GetRegionsOperationParams( @@ -3305,12 +3116,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) val operation = GetRegionsOperation( - params, + params ) return execute(operation) @@ -3319,8 +3130,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat /** * Regions * Returns the geographic definition and property mappings of regions matching the specified parameters.

    To request all regions in the world, omit the `ancestor` query parameter. To request all regions in a specific continent, country or other level, specify the ID of that region as the `ancestor`. Refer to the list of [top level regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists).

    The response is a paginated list of regions. See the `Link` header in the 200 response section. - * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param ancestorId Search for regions whose ancestors include the requested ancestor region ID. Refer to the list of [top level regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists). (optional) * @param area Filter the results to regions that intersect with a specified area.

    The area may be defined in one of two ways: * radius,region_id * radius,latitude,longitude Radius combined with region id would search an area that extends the number of kilometers out from the boundaries of the region in all directions.
    Radius combined with a single point, specified by a latitude, longitude pair would search an area in a circle with the specified radius and the point as the center.
    Radius should be specified in non-negative whole kilometers, decimals will return an error. A radius of 0 is allowed.
    When specifying the area parameter, there will be a limit of 100 results, which can be narrowed further by the limit parameter.
    Due to the number of results, unless `point_of_interest` is specified as the only type, regions of type `point_of_interest` will not be included in a request that filters to an area.

    An example use case would be searching for the closest 3 airports within 50 kilometers of a specified point.
    `&type=airport&limit=3&area=50,37.227924,-93.310036` (optional) @@ -3338,13 +3149,13 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return kotlin.collections.List */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetRegionsOperation)")) fun getRegions( include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >, language: kotlin.String, customerSessionId: kotlin.String? = @@ -3354,11 +3165,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat area: kotlin.String? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, iataLocationCode: kotlin.String? = @@ -3368,7 +3179,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat supplySource: kotlin.String? = null, type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -3378,9 +3189,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - ): kotlin.collections.List { - return getRegionsWithResponse( + null + ): kotlin.collections.List = + getRegionsWithResponse( include, language, customerSessionId, @@ -3395,15 +3206,14 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ).data - } /** * Regions * Returns the geographic definition and property mappings of regions matching the specified parameters.

    To request all regions in the world, omit the `ancestor` query parameter. To request all regions in a specific continent, country or other level, specify the ID of that region as the `ancestor`. Refer to the list of [top level regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists).

    The response is a paginated list of regions. See the `Link` header in the 200 response section. - * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param ancestorId Search for regions whose ancestors include the requested ancestor region ID. Refer to the list of [top level regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists). (optional) * @param area Filter the results to regions that intersect with a specified area.

    The area may be defined in one of two ways: * radius,region_id * radius,latitude,longitude Radius combined with region id would search an area that extends the number of kilometers out from the boundaries of the region in all directions.
    Radius combined with a single point, specified by a latitude, longitude pair would search an area in a circle with the specified radius and the point as the center.
    Radius should be specified in non-negative whole kilometers, decimals will return an error. A radius of 0 is allowed.
    When specifying the area parameter, there will be a limit of 100 results, which can be narrowed further by the limit parameter.
    Due to the number of results, unless `point_of_interest` is specified as the only type, regions of type `point_of_interest` will not be included in a request that filters to an area.

    An example use case would be searching for the closest 3 airports within 50 kilometers of a specified point.
    `&type=airport&limit=3&area=50,37.227924,-93.310036` (optional) @@ -3421,13 +3231,13 @@ 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: GetRegionsOperation)")) fun getRegionsWithResponse( include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >, language: kotlin.String, customerSessionId: kotlin.String? = @@ -3437,11 +3247,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat area: kotlin.String? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, iataLocationCode: kotlin.String? = @@ -3451,7 +3261,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat supplySource: kotlin.String? = null, type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -3461,7 +3271,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { @@ -3480,7 +3290,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ) }.get() } catch (exception: Exception) { @@ -3498,7 +3308,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat @Deprecated("Use getPaginator method instead", ReplaceWith("getPaginator(operation: GetRegionsOperation)")) fun getRegionsPaginator( include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >, language: kotlin.String, customerSessionId: kotlin.String? = @@ -3508,11 +3318,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat area: kotlin.String? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, iataLocationCode: kotlin.String? = @@ -3522,7 +3332,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat supplySource: kotlin.String? = null, type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -3532,7 +3342,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Paginator> { val response = getRegionsWithResponse( @@ -3550,7 +3360,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ) return Paginator(this, response, emptyList()) { it.body>() } } @@ -3559,7 +3369,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat @Deprecated("Use getPaginator method instead", ReplaceWith("getPaginator(operation: GetRegionsOperation)")) fun getRegionsPaginatorWithResponse( include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >, language: kotlin.String, customerSessionId: kotlin.String? = @@ -3569,11 +3379,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat area: kotlin.String? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, iataLocationCode: kotlin.String? = @@ -3583,7 +3393,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat supplySource: kotlin.String? = null, type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -3593,7 +3403,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): ResponsePaginator> { val response = getRegionsWithResponse( @@ -3611,7 +3421,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms, partnerPointOfSale, paymentTerms, - platformName, + platformName ) return ResponsePaginator(this, response, emptyList()) { it.body>() } } @@ -3623,9 +3433,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.List */ - fun execute(operation: GetReservationOperation): Response> { - return execute>(operation) - } + fun execute(operation: GetReservationOperation): Response> = execute>(operation) /** * Search for and retrieve Bookings with Affiliate Reference Id @@ -3634,9 +3442,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.List */ - fun executeAsync(operation: GetReservationOperation): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: GetReservationOperation): CompletableFuture>> = executeAsync>(operation) private suspend inline fun kgetReservationWithResponse( customerIp: kotlin.String, @@ -3647,9 +3453,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat test: GetReservationOperationParams.Test? = null, include: kotlin.collections.List< - GetReservationOperationParams.Include, + GetReservationOperationParams.Include >? = - null, + null ): Response> { val params = GetReservationOperationParams( @@ -3658,12 +3464,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat test = test, affiliateReferenceId = affiliateReferenceId, email = email, - include = include, + include = include ) val operation = GetReservationOperation( - params, + params ) return execute(operation) @@ -3677,12 +3483,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param email Email associated with the booking. Special characters in the local part or domain should be encoded.
    * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param test The retrieve call has a test header that can be used to return set responses with the following keywords:
    * `standard` - Requires valid test booking. * `service_unavailable` * `internal_server_error` (optional) - * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary (optional) + * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. (optional) * @throws ExpediaGroupApiErrorException * @return kotlin.collections.List */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetReservationOperation)")) @@ -3695,12 +3501,10 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat test: GetReservationOperationParams.Test? = null, include: kotlin.collections.List< - GetReservationOperationParams.Include, + GetReservationOperationParams.Include >? = - null, - ): kotlin.collections.List { - return getReservationWithResponse(customerIp, affiliateReferenceId, email, customerSessionId, test, include).data - } + null + ): kotlin.collections.List = getReservationWithResponse(customerIp, affiliateReferenceId, email, customerSessionId, test, include).data /** * Search for and retrieve Bookings with Affiliate Reference Id @@ -3710,12 +3514,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param email Email associated with the booking. Special characters in the local part or domain should be encoded.
    * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (optional) * @param test The retrieve call has a test header that can be used to return set responses with the following keywords:
    * `standard` - Requires valid test booking. * `service_unavailable` * `internal_server_error` (optional) - * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary (optional) + * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. (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: GetReservationOperation)")) @@ -3728,9 +3532,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat test: GetReservationOperationParams.Test? = null, include: kotlin.collections.List< - GetReservationOperationParams.Include, + GetReservationOperationParams.Include >? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { @@ -3748,9 +3552,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Itinerary */ - fun execute(operation: GetReservationByItineraryIdOperation): Response { - return execute(operation) - } + fun execute(operation: GetReservationByItineraryIdOperation): Response = execute(operation) /** * Retrieve Booking @@ -3759,9 +3561,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type Itinerary */ - fun executeAsync(operation: GetReservationByItineraryIdOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: GetReservationByItineraryIdOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kgetReservationByItineraryIdWithResponse( customerIp: kotlin.String, @@ -3775,9 +3575,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat email: kotlin.String? = null, include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, + GetReservationByItineraryIdOperationParams.Include >? = - null, + null ): Response { val params = GetReservationByItineraryIdOperationParams( @@ -3787,12 +3587,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat test = test, token = token, email = email, - include = include, + include = include ) val operation = GetReservationByItineraryIdOperation( - params, + params ) return execute(operation) @@ -3807,12 +3607,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param test The retrieve call has a test header that can be used to return set responses. Passing standard in the Test header will retrieve a test booking, and passing any of the errors listed below will return a stubbed error response that you can use to test your error handling code. Additionally, refer to the Test Request documentation for more details on how these header values are used. * `standard` - Requires valid test booking. * `service_unavailable` * `internal_server_error` (optional) * @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. (optional) * @param email Email associated with the booking. Special characters in the local part or domain should be encoded. (Email is required if the token is not provided the request)
    (optional) - * @param include Options for which information to return in the response. The value must be lower case. * history - Include itinerary history, showing details of the changes made to this itinerary (optional) + * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. (optional) * @throws ExpediaGroupApiErrorException * @return Itinerary */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetReservationByItineraryIdOperation)")) @@ -3828,12 +3628,10 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat email: kotlin.String? = null, include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, + GetReservationByItineraryIdOperationParams.Include >? = - null, - ): Itinerary { - return getReservationByItineraryIdWithResponse(customerIp, itineraryId, customerSessionId, test, token, email, include).data - } + null + ): Itinerary = getReservationByItineraryIdWithResponse(customerIp, itineraryId, customerSessionId, test, token, email, include).data /** * Retrieve Booking @@ -3844,12 +3642,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param test The retrieve call has a test header that can be used to return set responses. Passing standard in the Test header will retrieve a test booking, and passing any of the errors listed below will return a stubbed error response that you can use to test your error handling code. Additionally, refer to the Test Request documentation for more details on how these header values are used. * `standard` - Requires valid test booking. * `service_unavailable` * `internal_server_error` (optional) * @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. (optional) * @param email Email associated with the booking. Special characters in the local part or domain should be encoded. (Email is required if the token is not provided the request)
    (optional) - * @param include Options for which information to return in the response. The value must be lower case. * history - Include itinerary history, showing details of the changes made to this itinerary (optional) + * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. (optional) * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Itinerary */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetReservationByItineraryIdOperation)")) @@ -3865,9 +3663,9 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat email: kotlin.String? = null, include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, + GetReservationByItineraryIdOperationParams.Include >? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -3885,9 +3683,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.Map */ - fun execute(operation: PostGeographyOperation): Response> { - return execute>(operation) - } + fun execute(operation: PostGeographyOperation): Response> = + execute>(operation) /** * Properties within Polygon @@ -3896,14 +3693,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type kotlin.collections.Map */ - fun executeAsync( - operation: PostGeographyOperation, - ): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: PostGeographyOperation): CompletableFuture>> = + executeAsync>(operation) private suspend inline fun kpostGeographyWithResponse( include: kotlin.String, + supplySource: kotlin.String, propertiesGeoJsonRequest: PropertiesGeoJsonRequest, customerSessionId: kotlin.String? = null, @@ -3914,25 +3709,23 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - supplySource: kotlin.String? = - null, + null ): Response> { val params = PostGeographyOperationParams( customerSessionId = customerSessionId, include = include, + supplySource = supplySource, billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, - supplySource = supplySource, + platformName = platformName ) val operation = PostGeographyOperation( params, - propertiesGeoJsonRequest, + propertiesGeoJsonRequest ) return execute(operation) @@ -3942,23 +3735,24 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * Properties within Polygon * Returns the properties within an custom polygon that represents a multi-city area or smaller. The coordinates of the polygon should be in [GeoJSON format](https://tools.ietf.org/html/rfc7946) and the polygon must conform to the following restrictions: * Polygon size - diagonal distance of the polygon must be less than 500km * Polygon type - only single polygons are supported * Number of coordinates - must be <= 2000 * @param include Options for which content to return in the response. The value must be lower case. * property_ids - Include the property IDs. + * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param propertiesGeoJsonRequest * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 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) - * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. (optional) * @throws ExpediaGroupApiErrorException * @return kotlin.collections.Map */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PostGeographyOperation)")) fun postGeography( include: kotlin.String, + supplySource: kotlin.String, propertiesGeoJsonRequest: PropertiesGeoJsonRequest, customerSessionId: kotlin.String? = null, @@ -3969,43 +3763,32 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - supplySource: kotlin.String? = - null, - ): kotlin.collections.Map { - return postGeographyWithResponse( - include, - propertiesGeoJsonRequest, - customerSessionId, - billingTerms, - partnerPointOfSale, - paymentTerms, - platformName, - supplySource, - ).data - } + null + ): kotlin.collections.Map = + postGeographyWithResponse(include, supplySource, propertiesGeoJsonRequest, customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Properties within Polygon * Returns the properties within an custom polygon that represents a multi-city area or smaller. The coordinates of the polygon should be in [GeoJSON format](https://tools.ietf.org/html/rfc7946) and the polygon must conform to the following restrictions: * Polygon size - diagonal distance of the polygon must be less than 500km * Polygon type - only single polygons are supported * Number of coordinates - must be <= 2000 * @param include Options for which content to return in the response. The value must be lower case. * property_ids - Include the property IDs. + * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @param propertiesGeoJsonRequest * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. (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 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) - * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. (optional) * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type kotlin.collections.Map */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PostGeographyOperation)")) fun postGeographyWithResponse( include: kotlin.String, + supplySource: kotlin.String, propertiesGeoJsonRequest: PropertiesGeoJsonRequest, customerSessionId: kotlin.String? = null, @@ -4016,22 +3799,11 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - supplySource: kotlin.String? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { - kpostGeographyWithResponse( - include, - propertiesGeoJsonRequest, - customerSessionId, - billingTerms, - partnerPointOfSale, - paymentTerms, - platformName, - supplySource, - ) + kpostGeographyWithResponse(include, supplySource, propertiesGeoJsonRequest, customerSessionId, billingTerms, partnerPointOfSale, paymentTerms, platformName) }.get() } catch (exception: Exception) { exception.handle() @@ -4045,9 +3817,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type ItineraryCreation */ - fun execute(operation: PostItineraryOperation): Response { - return execute(operation) - } + fun execute(operation: PostItineraryOperation): Response = execute(operation) /** * Create Booking @@ -4056,9 +3826,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type ItineraryCreation */ - fun executeAsync(operation: PostItineraryOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: PostItineraryOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kpostItineraryWithResponse( customerIp: kotlin.String, @@ -4067,20 +3835,20 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PostItineraryOperationParams.Test? = - null, + null ): Response { val params = PostItineraryOperationParams( customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) val operation = PostItineraryOperation( params, - createItineraryRequest, + createItineraryRequest ) return execute(operation) @@ -4098,7 +3866,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return ItineraryCreation */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PostItineraryOperation)")) @@ -4109,10 +3877,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PostItineraryOperationParams.Test? = - null, - ): ItineraryCreation { - return postItineraryWithResponse(customerIp, token, createItineraryRequest, customerSessionId, test).data - } + null + ): ItineraryCreation = postItineraryWithResponse(customerIp, token, createItineraryRequest, customerSessionId, test).data /** * Create Booking @@ -4126,7 +3892,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type ItineraryCreation */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PostItineraryOperation)")) @@ -4137,7 +3903,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PostItineraryOperationParams.Test? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -4155,9 +3921,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type PaymentSessions */ - fun execute(operation: PostPaymentSessionsOperation): Response { - return execute(operation) - } + fun execute(operation: PostPaymentSessionsOperation): Response = execute(operation) /** * Register Payments @@ -4166,9 +3930,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type PaymentSessions */ - fun executeAsync(operation: PostPaymentSessionsOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: PostPaymentSessionsOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kpostPaymentSessionsWithResponse( customerIp: kotlin.String, @@ -4177,20 +3939,20 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PostPaymentSessionsOperationParams.Test? = - null, + null ): Response { val params = PostPaymentSessionsOperationParams( customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) val operation = PostPaymentSessionsOperation( params, - paymentSessionsRequest, + paymentSessionsRequest ) return execute(operation) @@ -4208,7 +3970,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return PaymentSessions */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PostPaymentSessionsOperation)")) @@ -4219,10 +3981,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PostPaymentSessionsOperationParams.Test? = - null, - ): PaymentSessions { - return postPaymentSessionsWithResponse(customerIp, token, paymentSessionsRequest, customerSessionId, test).data - } + null + ): PaymentSessions = postPaymentSessionsWithResponse(customerIp, token, paymentSessionsRequest, customerSessionId, test).data /** * Register Payments @@ -4236,7 +3996,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type PaymentSessions */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PostPaymentSessionsOperation)")) @@ -4247,7 +4007,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PostPaymentSessionsOperationParams.Test? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -4265,9 +4025,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type RoomPriceCheck */ - fun execute(operation: PriceCheckOperation): Response { - return execute(operation) - } + fun execute(operation: PriceCheckOperation): Response = execute(operation) /** * Price-Check @@ -4276,9 +4034,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type RoomPriceCheck */ - fun executeAsync(operation: PriceCheckOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: PriceCheckOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kpriceCheckWithResponse( propertyId: kotlin.String, @@ -4290,7 +4046,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PriceCheckOperationParams.Test? = - null, + null ): Response { val params = PriceCheckOperationParams( @@ -4300,12 +4056,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) val operation = PriceCheckOperation( - params, + params ) return execute(operation) @@ -4325,7 +4081,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return RoomPriceCheck */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PriceCheckOperation)")) @@ -4339,10 +4095,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PriceCheckOperationParams.Test? = - null, - ): RoomPriceCheck { - return priceCheckWithResponse(propertyId, roomId, rateId, token, customerIp, customerSessionId, test).data - } + null + ): RoomPriceCheck = priceCheckWithResponse(propertyId, roomId, rateId, token, customerIp, customerSessionId, test).data /** * Price-Check @@ -4358,7 +4112,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type RoomPriceCheck */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PriceCheckOperation)")) @@ -4372,7 +4126,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PriceCheckOperationParams.Test? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -4390,9 +4144,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type CompletePaymentSession */ - fun execute(operation: PutCompletePaymentSessionOperation): Response { - return execute(operation) - } + fun execute(operation: PutCompletePaymentSessionOperation): Response = execute(operation) /** * Complete Payment Session @@ -4401,9 +4153,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type CompletePaymentSession */ - fun executeAsync(operation: PutCompletePaymentSessionOperation): CompletableFuture> { - return executeAsync(operation) - } + fun executeAsync(operation: PutCompletePaymentSessionOperation): CompletableFuture> = executeAsync(operation) private suspend inline fun kputCompletePaymentSessionWithResponse( customerIp: kotlin.String, @@ -4412,7 +4162,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PutCompletePaymentSessionOperationParams.Test? = - null, + null ): Response { val params = PutCompletePaymentSessionOperationParams( @@ -4420,12 +4170,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) val operation = PutCompletePaymentSessionOperation( - params, + params ) return execute(operation) @@ -4443,7 +4193,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return CompletePaymentSession */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PutCompletePaymentSessionOperation)")) @@ -4454,10 +4204,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PutCompletePaymentSessionOperationParams.Test? = - null, - ): CompletePaymentSession { - return putCompletePaymentSessionWithResponse(customerIp, itineraryId, token, customerSessionId, test).data - } + null + ): CompletePaymentSession = putCompletePaymentSessionWithResponse(customerIp, itineraryId, token, customerSessionId, test).data /** * Complete Payment Session @@ -4471,7 +4219,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return a [Response] object with a body of type CompletePaymentSession */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PutCompletePaymentSessionOperation)")) @@ -4482,7 +4230,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PutCompletePaymentSessionOperationParams.Test? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -4500,9 +4248,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Nothing */ - fun execute(operation: PutResumeBookingOperation): EmptyResponse { - return executeWithEmptyResponse(operation) - } + fun execute(operation: PutResumeBookingOperation): EmptyResponse = executeWithEmptyResponse(operation) /** * Resume Booking @@ -4511,9 +4257,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type Nothing */ - fun executeAsync(operation: PutResumeBookingOperation): CompletableFuture { - return executeAsyncWithEmptyResponse(operation) - } + fun executeAsync(operation: PutResumeBookingOperation): CompletableFuture = executeAsyncWithEmptyResponse(operation) private suspend inline fun kputResumeBookingWithResponse( customerIp: kotlin.String, @@ -4522,7 +4266,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PutResumeBookingOperationParams.Test? = - null, + null ): Response { val params = PutResumeBookingOperationParams( @@ -4530,12 +4274,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) val operation = PutResumeBookingOperation( - params, + params ) return execute(operation) @@ -4553,7 +4297,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return Nothing */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: PutResumeBookingOperation)")) @@ -4564,10 +4308,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PutResumeBookingOperationParams.Test? = - null, - ): Nothing { - return putResumeBookingWithResponse(customerIp, itineraryId, token, customerSessionId, test).data - } + null + ): Nothing = putResumeBookingWithResponse(customerIp, itineraryId, token, customerSessionId, test).data /** * Resume Booking @@ -4581,7 +4323,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: PutResumeBookingOperation)")) @@ -4592,7 +4334,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat customerSessionId: kotlin.String? = null, test: PutResumeBookingOperationParams.Test? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -4610,9 +4352,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [Response] object with a body of type Nothing */ - fun execute(operation: RequestTestNotificationOperation): EmptyResponse { - return executeWithEmptyResponse(operation) - } + fun execute(operation: RequestTestNotificationOperation): EmptyResponse = executeWithEmptyResponse(operation) /** * Request Test Notification @@ -4621,9 +4361,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @throws ExpediaGroupApiErrorException * @return a [CompletableFuture] object with a body of type Nothing */ - fun executeAsync(operation: RequestTestNotificationOperation): CompletableFuture { - return executeAsyncWithEmptyResponse(operation) - } + fun executeAsync(operation: RequestTestNotificationOperation): CompletableFuture = executeAsyncWithEmptyResponse(operation) private suspend inline fun krequestTestNotificationWithResponse( testNotificationRequest: TestNotificationRequest, @@ -4634,20 +4372,20 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response { val params = RequestTestNotificationOperationParams( billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) val operation = RequestTestNotificationOperation( params, - testNotificationRequest, + testNotificationRequest ) return execute(operation) @@ -4665,7 +4403,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @return Nothing */ @Throws( - ExpediaGroupApiErrorException::class, + ExpediaGroupApiErrorException::class ) @JvmOverloads @Deprecated("Use execute method instead", ReplaceWith("execute(operation: RequestTestNotificationOperation)")) @@ -4678,16 +4416,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - ): Nothing { - return requestTestNotificationWithResponse( - testNotificationRequest, - billingTerms, - partnerPointOfSale, - paymentTerms, - platformName, - ).data - } + null + ): Nothing = requestTestNotificationWithResponse(testNotificationRequest, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Request Test Notification @@ -4701,7 +4431,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: RequestTestNotificationOperation)")) @@ -4714,7 +4444,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response { try { return GlobalScope.future(Dispatchers.IO) { @@ -4731,9 +4461,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param operation [RequestUndeliveredNotificationsOperation] * @return a [Response] object with a body of type kotlin.collections.List */ - fun execute(operation: RequestUndeliveredNotificationsOperation): Response> { - return execute>(operation) - } + fun execute(operation: RequestUndeliveredNotificationsOperation): Response> = execute>(operation) /** * Request Undelivered Notifications @@ -4741,11 +4469,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat * @param operation [RequestUndeliveredNotificationsOperation] * @return a [CompletableFuture] object with a body of type kotlin.collections.List */ - fun executeAsync( - operation: RequestUndeliveredNotificationsOperation, - ): CompletableFuture>> { - return executeAsync>(operation) - } + fun executeAsync(operation: RequestUndeliveredNotificationsOperation): CompletableFuture>> = + executeAsync>(operation) private suspend inline fun krequestUndeliveredNotificationsWithResponse( undeliverable: kotlin.Boolean, @@ -4756,7 +4481,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { val params = RequestUndeliveredNotificationsOperationParams( @@ -4764,12 +4489,12 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) val operation = RequestUndeliveredNotificationsOperation( - params, + params ) return execute(operation) @@ -4797,10 +4522,8 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, - ): kotlin.collections.List { - return requestUndeliveredNotificationsWithResponse(undeliverable, billingTerms, partnerPointOfSale, paymentTerms, platformName).data - } + null + ): kotlin.collections.List = requestUndeliveredNotificationsWithResponse(undeliverable, billingTerms, partnerPointOfSale, paymentTerms, platformName).data /** * Request Undelivered Notifications @@ -4824,7 +4547,7 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ): Response> { try { return GlobalScope.future(Dispatchers.IO) { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address.kt index bbd29b5b5d..7f57a5c14d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Localized import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Container for the property's address information. @@ -86,7 +84,7 @@ data class Address( val obfuscationRequired: kotlin.Boolean? = null, @JsonProperty("localized") @field:Valid - val localized: Localized? = null, + val localized: Localized? = null ) { companion object { @JvmStatic @@ -102,7 +100,7 @@ data class Address( private var postalCode: kotlin.String? = null, private var countryCode: kotlin.String? = null, private var obfuscationRequired: kotlin.Boolean? = null, - private var localized: Localized? = null, + private var localized: Localized? = null ) { fun line1(line1: kotlin.String?) = apply { this.line1 = line1 } @@ -123,17 +121,40 @@ data class Address( fun localized(localized: Localized?) = apply { this.localized = localized } fun build(): Address { - return Address( - line1 = line1, - line2 = line2, - city = city, - stateProvinceCode = stateProvinceCode, - stateProvinceName = stateProvinceName, - postalCode = postalCode, - countryCode = countryCode, - obfuscationRequired = obfuscationRequired, - localized = localized, - ) + val instance = + Address( + line1 = line1, + line2 = line2, + city = city, + stateProvinceCode = stateProvinceCode, + stateProvinceName = stateProvinceName, + postalCode = postalCode, + countryCode = countryCode, + obfuscationRequired = obfuscationRequired, + localized = localized + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Address) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -147,6 +168,6 @@ data class Address( postalCode = postalCode, countryCode = countryCode, obfuscationRequired = obfuscationRequired, - localized = localized, + localized = localized ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address1.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address1.kt index 00d971a365..de0c15eb9e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address1.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Address1.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -76,7 +74,7 @@ data class Address1( // Country code, in two-letter ISO 3166-1 alpha-2 format. @JsonProperty("country_code") @field:Valid - val countryCode: kotlin.String? = null, + val countryCode: kotlin.String? = null ) { companion object { @JvmStatic @@ -90,7 +88,7 @@ data class Address1( private var city: kotlin.String? = null, private var stateProvinceCode: kotlin.String? = null, private var postalCode: kotlin.String? = null, - private var countryCode: kotlin.String? = null, + private var countryCode: kotlin.String? = null ) { fun line1(line1: kotlin.String?) = apply { this.line1 = line1 } @@ -107,15 +105,38 @@ data class Address1( fun countryCode(countryCode: kotlin.String?) = apply { this.countryCode = countryCode } fun build(): Address1 { - return Address1( - line1 = line1, - line2 = line2, - line3 = line3, - city = city, - stateProvinceCode = stateProvinceCode, - postalCode = postalCode, - countryCode = countryCode, - ) + val instance = + Address1( + line1 = line1, + line2 = line2, + line3 = line3, + city = city, + stateProvinceCode = stateProvinceCode, + postalCode = postalCode, + countryCode = countryCode + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Address1) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -127,6 +148,6 @@ data class Address1( city = city, stateProvinceCode = stateProvinceCode, postalCode = postalCode, - countryCode = countryCode, + countryCode = countryCode ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Adjustment.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Adjustment.kt index 53ff97130c..54025c090c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Adjustment.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Adjustment.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Any price adjustments associated with this itinerary. @@ -56,7 +54,7 @@ data class Adjustment( // The currency of the adjustment. @JsonProperty("currency") @field:Valid - val currency: kotlin.String? = null, + val currency: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Adjustment( class Builder( private var `value`: kotlin.String? = null, private var type: kotlin.String? = null, - private var currency: kotlin.String? = null, + private var currency: kotlin.String? = null ) { fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } @@ -75,11 +73,34 @@ data class Adjustment( fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun build(): Adjustment { - return Adjustment( - `value` = `value`, - type = type, - currency = currency, - ) + val instance = + Adjustment( + `value` = `value`, + type = type, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Adjustment) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Adjustment( Builder( `value` = `value`, type = type, - currency = currency, + currency = currency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AffiliateCollect.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AffiliateCollect.kt index 287913d682..4c3466c43f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AffiliateCollect.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AffiliateCollect.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * This option will be returned if a booking can be made using Expedia Affiliate Collect. @@ -46,7 +44,7 @@ data class AffiliateCollect( // Display name of payment option. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class AffiliateCollect( } class Builder( - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } fun build(): AffiliateCollect { - return AffiliateCollect( - name = name, - ) + val instance = + AffiliateCollect( + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AffiliateCollect) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AllInclusive.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AllInclusive.kt index bcb3ea86c6..8c826e534e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AllInclusive.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AllInclusive.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information about the all-inclusive rate plans available at the property. @@ -56,7 +54,7 @@ data class AllInclusive( // Details about amenities and services included in the all-inclusive rates. @JsonProperty("details") @field:Valid - val details: kotlin.String? = null, + val details: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class AllInclusive( class Builder( private var allRatePlans: kotlin.Boolean? = null, private var someRatePlans: kotlin.Boolean? = null, - private var details: kotlin.String? = null, + private var details: kotlin.String? = null ) { fun allRatePlans(allRatePlans: kotlin.Boolean?) = apply { this.allRatePlans = allRatePlans } @@ -75,11 +73,34 @@ data class AllInclusive( fun details(details: kotlin.String?) = apply { this.details = details } fun build(): AllInclusive { - return AllInclusive( - allRatePlans = allRatePlans, - someRatePlans = someRatePlans, - details = details, - ) + val instance = + AllInclusive( + allRatePlans = allRatePlans, + someRatePlans = someRatePlans, + details = details + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AllInclusive) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class AllInclusive( Builder( allRatePlans = allRatePlans, someRatePlans = someRatePlans, - details = details, + details = details ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amenity.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amenity.kt index 1387ed9070..41cc1fa664 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amenity.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amenity.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual amenity. @@ -61,7 +59,7 @@ data class Amenity( // This is an optional field and will be present only if the amenity falls into one or more of these amenity categories.
    See the Amenity Categories section of the [Content Reference Lists](https://developers.expediagroup.com/docs/rapid/lodging/content/content-reference-lists) for a list of values. @JsonProperty("categories") @field:Valid - val categories: kotlin.collections.List? = null, + val categories: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -72,7 +70,7 @@ data class Amenity( private var id: kotlin.String? = null, private var name: kotlin.String? = null, private var `value`: kotlin.String? = null, - private var categories: kotlin.collections.List? = null, + private var categories: kotlin.collections.List? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -83,12 +81,35 @@ data class Amenity( fun categories(categories: kotlin.collections.List?) = apply { this.categories = categories } fun build(): Amenity { - return Amenity( - id = id, - name = name, - `value` = `value`, - categories = categories, - ) + val instance = + Amenity( + id = id, + name = name, + `value` = `value`, + categories = categories + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Amenity) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -97,6 +118,6 @@ data class Amenity( id = id, name = name, `value` = `value`, - categories = categories, + categories = categories ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amount.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amount.kt index 0c49d89274..85e62067ad 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amount.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Amount.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The monetary amount. @@ -51,7 +49,7 @@ data class Amount( // Currency of the amount object. @JsonProperty("currency") @field:Valid - val currency: kotlin.String? = null, + val currency: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Amount( class Builder( private var `value`: kotlin.String? = null, - private var currency: kotlin.String? = null, + private var currency: kotlin.String? = null ) { fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun build(): Amount { - return Amount( - `value` = `value`, - currency = currency, - ) + val instance = + Amount( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Amount) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( `value` = `value`, - currency = currency, + currency = currency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ancestors.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ancestors.kt index 2020329b33..5b82a491cb 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ancestors.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ancestors.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A region ancestor. @@ -51,7 +49,7 @@ data class Ancestors( // Region type of ancestor region. @JsonProperty("type") @field:Valid - val type: kotlin.String? = null, + val type: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Ancestors( class Builder( private var id: kotlin.String? = null, - private var type: kotlin.String? = null, + private var type: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun type(type: kotlin.String?) = apply { this.type = type } fun build(): Ancestors { - return Ancestors( - id = id, - type = type, - ) + val instance = + Ancestors( + id = id, + type = type + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Ancestors) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - type = type, + type = type ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Area.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Area.kt index e5998f1fb1..472038edf5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Area.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Area.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information about the area of the room. @@ -51,7 +49,7 @@ data class Area( // The room's area, measured in square feet. @JsonProperty("square_feet") @field:Valid - val squareFeet: java.math.BigDecimal? = null, + val squareFeet: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Area( class Builder( private var squareMeters: java.math.BigDecimal? = null, - private var squareFeet: java.math.BigDecimal? = null, + private var squareFeet: java.math.BigDecimal? = null ) { fun squareMeters(squareMeters: java.math.BigDecimal?) = apply { this.squareMeters = squareMeters } fun squareFeet(squareFeet: java.math.BigDecimal?) = apply { this.squareFeet = squareFeet } fun build(): Area { - return Area( - squareMeters = squareMeters, - squareFeet = squareFeet, - ) + val instance = + Area( + squareMeters = squareMeters, + squareFeet = squareFeet + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Area) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( squareMeters = squareMeters, - squareFeet = squareFeet, + squareFeet = squareFeet ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AssociatedAirports.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AssociatedAirports.kt index 4eba13fbc6..96d7da86f1 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AssociatedAirports.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AssociatedAirports.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Preferred import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Airports related to the property. @@ -46,7 +44,7 @@ import javax.validation.constraints.Size data class AssociatedAirports( @JsonProperty("preferred") @field:Valid - val preferred: Preferred? = null, + val preferred: Preferred? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class AssociatedAirports( } class Builder( - private var preferred: Preferred? = null, + private var preferred: Preferred? = null ) { fun preferred(preferred: Preferred?) = apply { this.preferred = preferred } fun build(): AssociatedAirports { - return AssociatedAirports( - preferred = preferred, - ) + val instance = + AssociatedAirports( + preferred = preferred + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AssociatedAirports) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - preferred = preferred, + preferred = preferred ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attribute.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attribute.kt index 5994d4ae7a..40bed0a982 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attribute.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attribute.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual attribute. @@ -56,7 +54,7 @@ data class Attribute( // Attribute value. @JsonProperty("value") @field:Valid - val `value`: kotlin.String? = null, + val `value`: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Attribute( class Builder( private var id: kotlin.String? = null, private var name: kotlin.String? = null, - private var `value`: kotlin.String? = null, + private var `value`: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -75,11 +73,34 @@ data class Attribute( fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } fun build(): Attribute { - return Attribute( - id = id, - name = name, - `value` = `value`, - ) + val instance = + Attribute( + id = id, + name = name, + `value` = `value` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Attribute) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Attribute( Builder( id = id, name = name, - `value` = `value`, + `value` = `value` ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attributes.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attributes.kt index 70ddd4c2d7..0661e86bc5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attributes.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Attributes.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Attribute import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Attributes about the property. See our [attributes reference](https://developers.expediagroup.com/docs/rapid/lodging/content/content-reference-lists) for current known attribute ID and name values. @@ -52,7 +50,7 @@ data class Attributes( // Lists all of the pet attributes about the property. @JsonProperty("pets") @field:Valid - val pets: kotlin.collections.Map? = null, + val pets: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -61,23 +59,46 @@ data class Attributes( class Builder( private var general: kotlin.collections.Map? = null, - private var pets: kotlin.collections.Map? = null, + private var pets: kotlin.collections.Map? = null ) { fun general(general: kotlin.collections.Map?) = apply { this.general = general } fun pets(pets: kotlin.collections.Map?) = apply { this.pets = pets } fun build(): Attributes { - return Attributes( - general = general, - pets = pets, - ) + val instance = + Attributes( + general = general, + pets = pets + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Attributes) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( general = general, - pets = pets, + pets = pets ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroup.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroup.kt index 29b496c8c7..b89df1851b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroup.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroup.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BedGroupConfiguration import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual bed group. @@ -57,7 +55,7 @@ data class BedGroup( // An array of bed configurations for this room. @JsonProperty("configuration") @field:Valid - val configuration: kotlin.collections.List? = null, + val configuration: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -67,7 +65,7 @@ data class BedGroup( class Builder( private var id: kotlin.String? = null, private var description: kotlin.String? = null, - private var configuration: kotlin.collections.List? = null, + private var configuration: kotlin.collections.List? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -76,11 +74,34 @@ data class BedGroup( fun configuration(configuration: kotlin.collections.List?) = apply { this.configuration = configuration } fun build(): BedGroup { - return BedGroup( - id = id, - description = description, - configuration = configuration, - ) + val instance = + BedGroup( + id = id, + description = description, + configuration = configuration + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BedGroup) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -88,6 +109,6 @@ data class BedGroup( Builder( id = id, description = description, - configuration = configuration, + configuration = configuration ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailability.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailability.kt index 47ef259950..39b0eb0586 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailability.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailability.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BedGroupAvailabilityLinks import com.expediagroup.sdk.rapid.models.BedGroupConfiguration import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -62,7 +60,7 @@ data class BedGroupAvailability( // The bed configuration for a given room. This array can be empty for the related bed group. @JsonProperty("configuration") @field:Valid - val configuration: kotlin.collections.List? = null, + val configuration: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -73,7 +71,7 @@ data class BedGroupAvailability( private var links: BedGroupAvailabilityLinks? = null, private var id: kotlin.String? = null, private var description: kotlin.String? = null, - private var configuration: kotlin.collections.List? = null, + private var configuration: kotlin.collections.List? = null ) { fun links(links: BedGroupAvailabilityLinks?) = apply { this.links = links } @@ -84,12 +82,35 @@ data class BedGroupAvailability( fun configuration(configuration: kotlin.collections.List?) = apply { this.configuration = configuration } fun build(): BedGroupAvailability { - return BedGroupAvailability( - links = links, - id = id, - description = description, - configuration = configuration, - ) + val instance = + BedGroupAvailability( + links = links, + id = id, + description = description, + configuration = configuration + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BedGroupAvailability) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -98,6 +119,6 @@ data class BedGroupAvailability( links = links, id = id, description = description, - configuration = configuration, + configuration = configuration ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailabilityLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailabilityLinks.kt index 6c6a336965..772493f665 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailabilityLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupAvailabilityLinks.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.PriceCheckOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to confirm pricing and availability for the selected rate. @@ -48,7 +46,7 @@ import javax.validation.constraints.Size data class BedGroupAvailabilityLinks( @JsonProperty("price_check") @field:Valid - val priceCheck: PriceCheckOperationLink? = null, + val priceCheck: PriceCheckOperationLink? = null ) { companion object { @JvmStatic @@ -56,19 +54,42 @@ data class BedGroupAvailabilityLinks( } class Builder( - private var priceCheck: PriceCheckOperationLink? = null, + private var priceCheck: PriceCheckOperationLink? = null ) { fun priceCheck(priceCheck: PriceCheckOperationLink?) = apply { this.priceCheck = priceCheck } fun build(): BedGroupAvailabilityLinks { - return BedGroupAvailabilityLinks( - priceCheck = priceCheck, - ) + val instance = + BedGroupAvailabilityLinks( + priceCheck = priceCheck + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BedGroupAvailabilityLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - priceCheck = priceCheck, + priceCheck = priceCheck ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupConfiguration.kt index 6388c1fab6..f43664c117 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupConfiguration.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BedGroupConfiguration.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual bed configuration. @@ -56,7 +54,7 @@ data class BedGroupConfiguration( // The number of this bed configuration in the room. @JsonProperty("quantity") @field:Valid - val quantity: java.math.BigDecimal? = null, + val quantity: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class BedGroupConfiguration( class Builder( private var type: kotlin.String? = null, private var propertySize: kotlin.String? = null, - private var quantity: java.math.BigDecimal? = null, + private var quantity: java.math.BigDecimal? = null ) { fun type(type: kotlin.String?) = apply { this.type = type } @@ -75,11 +73,34 @@ data class BedGroupConfiguration( fun quantity(quantity: java.math.BigDecimal?) = apply { this.quantity = quantity } fun build(): BedGroupConfiguration { - return BedGroupConfiguration( - type = type, - propertySize = propertySize, - quantity = quantity, - ) + val instance = + BedGroupConfiguration( + type = type, + propertySize = propertySize, + quantity = quantity + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BedGroupConfiguration) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class BedGroupConfiguration( Builder( type = type, propertySize = propertySize, - quantity = quantity, + quantity = quantity ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContact.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContact.kt index 723fd657b5..4c7e0ee0c3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContact.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContact.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Address1 import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -56,7 +54,7 @@ data class BillingContact( val familyName: kotlin.String? = null, @JsonProperty("address") @field:Valid - val address: Address1? = null, + val address: Address1? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class BillingContact( class Builder( private var givenName: kotlin.String? = null, private var familyName: kotlin.String? = null, - private var address: Address1? = null, + private var address: Address1? = null ) { fun givenName(givenName: kotlin.String?) = apply { this.givenName = givenName } @@ -75,11 +73,34 @@ data class BillingContact( fun address(address: Address1?) = apply { this.address = address } fun build(): BillingContact { - return BillingContact( - givenName = givenName, - familyName = familyName, - address = address, - ) + val instance = + BillingContact( + givenName = givenName, + familyName = familyName, + address = address + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BillingContact) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class BillingContact( Builder( givenName = givenName, familyName = familyName, - address = address, + address = address ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequest.kt index 46925c5187..b41eeb7fdd 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequest.kt @@ -25,19 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BillingContactRequestAddress import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -48,15 +47,18 @@ import javax.validation.constraints.Size data class BillingContactRequest( // First/given name of the payment type account holder. Max 60 characters. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("given_name") + @field:NotNull @field:Valid val givenName: kotlin.String, // Last/family name of the payment type account holder. Max 60 characters. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("family_name") + @field:NotNull @field:Valid val familyName: kotlin.String, @JsonProperty("address") + @field:NotNull @field:Valid - val address: BillingContactRequestAddress, + val address: BillingContactRequestAddress ) { companion object { @JvmStatic @@ -66,7 +68,7 @@ data class BillingContactRequest( class Builder( private var givenName: kotlin.String? = null, private var familyName: kotlin.String? = null, - private var address: BillingContactRequestAddress? = null, + private var address: BillingContactRequestAddress? = null ) { fun givenName(givenName: kotlin.String) = apply { this.givenName = givenName } @@ -75,24 +77,33 @@ data class BillingContactRequest( fun address(address: BillingContactRequestAddress) = apply { this.address = address } fun build(): BillingContactRequest { - // Check required params - validateNullity() - return BillingContactRequest( - givenName = givenName!!, - familyName = familyName!!, - address = address!!, - ) + val instance = + BillingContactRequest( + givenName = givenName!!, + familyName = familyName!!, + address = address!! + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (givenName == null) { - throw NullPointerException("Required parameter givenName is missing") - } - if (familyName == null) { - throw NullPointerException("Required parameter familyName is missing") - } - if (address == null) { - throw NullPointerException("Required parameter address is missing") + private fun validate(instance: BillingContactRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -101,6 +112,6 @@ data class BillingContactRequest( Builder( givenName = givenName!!, familyName = familyName!!, - address = address!!, + address = address!! ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestAddress.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestAddress.kt index c768a36c71..80ab5e6768 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestAddress.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestAddress.kt @@ -25,18 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -51,6 +50,7 @@ import javax.validation.constraints.Size data class BillingContactRequestAddress( // Customer's country code, in two-letter ISO 3166-1 alpha-2 format. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. Only ISO-8859-1 compliant characters are allowed. @JsonProperty("country_code") + @field:NotNull @field:Valid val countryCode: kotlin.String, // First line of customer's street address. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. Only ISO-8859-1 compliant characters are allowed. @@ -76,7 +76,7 @@ data class BillingContactRequestAddress( // Customer's postal code. Mandatory for CA, GB, and US. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. Only ISO-8859-1 compliant characters are allowed. @JsonProperty("postal_code") @field:Valid - val postalCode: kotlin.String? = null, + val postalCode: kotlin.String? = null ) { companion object { @JvmStatic @@ -90,7 +90,7 @@ data class BillingContactRequestAddress( private var line3: kotlin.String? = null, private var city: kotlin.String? = null, private var stateProvinceCode: kotlin.String? = null, - private var postalCode: kotlin.String? = null, + private var postalCode: kotlin.String? = null ) { fun countryCode(countryCode: kotlin.String) = apply { this.countryCode = countryCode } @@ -107,22 +107,37 @@ data class BillingContactRequestAddress( fun postalCode(postalCode: kotlin.String?) = apply { this.postalCode = postalCode } fun build(): BillingContactRequestAddress { - // Check required params - validateNullity() - return BillingContactRequestAddress( - countryCode = countryCode!!, - line1 = line1, - line2 = line2, - line3 = line3, - city = city, - stateProvinceCode = stateProvinceCode, - postalCode = postalCode, - ) + val instance = + BillingContactRequestAddress( + countryCode = countryCode!!, + line1 = line1, + line2 = line2, + line3 = line3, + city = city, + stateProvinceCode = stateProvinceCode, + postalCode = postalCode + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (countryCode == null) { - throw NullPointerException("Required parameter countryCode is missing") + private fun validate(instance: BillingContactRequestAddress) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -135,6 +150,6 @@ data class BillingContactRequestAddress( line3 = line3, city = city, stateProvinceCode = stateProvinceCode, - postalCode = postalCode, + postalCode = postalCode ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestWithPhone.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestWithPhone.kt index c876583851..9f947f6fe1 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestWithPhone.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BillingContactRequestWithPhone.kt @@ -25,20 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BillingContactRequestAddress import com.expediagroup.sdk.rapid.models.PhoneRequest import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -50,18 +49,21 @@ import javax.validation.constraints.Size data class BillingContactRequestWithPhone( // First/given name of the payment type account holder. Max 60 characters. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("given_name") + @field:NotNull @field:Valid val givenName: kotlin.String, // Last/family name of the payment type account holder. Max 60 characters. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("family_name") + @field:NotNull @field:Valid val familyName: kotlin.String, @JsonProperty("address") + @field:NotNull @field:Valid val address: BillingContactRequestAddress, @JsonProperty("phone") @field:Valid - val phone: PhoneRequest? = null, + val phone: PhoneRequest? = null ) { companion object { @JvmStatic @@ -72,7 +74,7 @@ data class BillingContactRequestWithPhone( private var givenName: kotlin.String? = null, private var familyName: kotlin.String? = null, private var address: BillingContactRequestAddress? = null, - private var phone: PhoneRequest? = null, + private var phone: PhoneRequest? = null ) { fun givenName(givenName: kotlin.String) = apply { this.givenName = givenName } @@ -83,25 +85,34 @@ data class BillingContactRequestWithPhone( fun phone(phone: PhoneRequest?) = apply { this.phone = phone } fun build(): BillingContactRequestWithPhone { - // Check required params - validateNullity() - return BillingContactRequestWithPhone( - givenName = givenName!!, - familyName = familyName!!, - address = address!!, - phone = phone, - ) + val instance = + BillingContactRequestWithPhone( + givenName = givenName!!, + familyName = familyName!!, + address = address!!, + phone = phone + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (givenName == null) { - throw NullPointerException("Required parameter givenName is missing") - } - if (familyName == null) { - throw NullPointerException("Required parameter familyName is missing") - } - if (address == null) { - throw NullPointerException("Required parameter address is missing") + private fun validate(instance: BillingContactRequestWithPhone) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -111,6 +122,6 @@ data class BillingContactRequestWithPhone( givenName = givenName!!, familyName = familyName!!, address = address!!, - phone = phone, + phone = phone ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BoundingPolygon.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BoundingPolygon.kt index 45ac7b7b95..5122154720 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BoundingPolygon.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BoundingPolygon.kt @@ -25,22 +25,15 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models import com.fasterxml.jackson.annotation.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonSubTypes import com.fasterxml.jackson.annotation.JsonSubTypes.Type import com.fasterxml.jackson.annotation.JsonTypeInfo -import org.hibernate.validator.constraints.Length -import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size /** * @@ -50,7 +43,7 @@ import javax.validation.constraints.Size @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes( Type(value = MultiPolygon::class, name = "MultiPolygon"), - Type(value = Polygon::class, name = "Polygon"), + Type(value = Polygon::class, name = "Polygon") ) interface BoundingPolygon { // Type of bounding polygon. diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Brand.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Brand.kt index 78a9e1bcfb..17e0aa49a1 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Brand.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Brand.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual brand. @@ -51,7 +49,7 @@ data class Brand( // Brand name. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Brand( class Builder( private var id: kotlin.String? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun name(name: kotlin.String?) = apply { this.name = name } fun build(): Brand { - return Brand( - id = id, - name = name, - ) + val instance = + Brand( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Brand) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BusinessModel.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BusinessModel.kt index 7e3ac16fb9..5916f9dfd4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BusinessModel.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/BusinessModel.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * How and when the payment can be taken. @@ -51,7 +49,7 @@ data class BusinessModel( // Whether or not a payment for this property can be taken by the property upon arrival. @JsonProperty("property_collect") @field:Valid - val propertyCollect: kotlin.Boolean? = null, + val propertyCollect: kotlin.Boolean? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class BusinessModel( class Builder( private var expediaCollect: kotlin.Boolean? = null, - private var propertyCollect: kotlin.Boolean? = null, + private var propertyCollect: kotlin.Boolean? = null ) { fun expediaCollect(expediaCollect: kotlin.Boolean?) = apply { this.expediaCollect = expediaCollect } fun propertyCollect(propertyCollect: kotlin.Boolean?) = apply { this.propertyCollect = propertyCollect } fun build(): BusinessModel { - return BusinessModel( - expediaCollect = expediaCollect, - propertyCollect = propertyCollect, - ) + val instance = + BusinessModel( + expediaCollect = expediaCollect, + propertyCollect = propertyCollect + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BusinessModel) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( expediaCollect = expediaCollect, - propertyCollect = propertyCollect, + propertyCollect = propertyCollect ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelPenalty.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelPenalty.kt index 260c65abf1..d543aa2dd0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelPenalty.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelPenalty.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -71,7 +69,7 @@ data class CancelPenalty( // Percentage of total booking charged for as penalty. A thirty percent penalty would be returned as 30% @JsonProperty("percent") @field:Valid - val percent: kotlin.String? = null, + val percent: kotlin.String? = null ) { companion object { @JvmStatic @@ -84,7 +82,7 @@ data class CancelPenalty( private var end: kotlin.String? = null, private var amount: kotlin.String? = null, private var nights: kotlin.String? = null, - private var percent: kotlin.String? = null, + private var percent: kotlin.String? = null ) { fun currency(currency: kotlin.String?) = apply { this.currency = currency } @@ -99,14 +97,37 @@ data class CancelPenalty( fun percent(percent: kotlin.String?) = apply { this.percent = percent } fun build(): CancelPenalty { - return CancelPenalty( - currency = currency, - start = start, - end = end, - amount = amount, - nights = nights, - percent = percent, - ) + val instance = + CancelPenalty( + currency = currency, + start = start, + end = end, + amount = amount, + nights = nights, + percent = percent + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CancelPenalty) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -117,6 +138,6 @@ data class CancelPenalty( end = end, amount = amount, nights = nights, - percent = percent, + percent = percent ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelRefund.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelRefund.kt index 705d29c2e2..40ad3f1436 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelRefund.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CancelRefund.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The refund information for cancelling the itinerary. @@ -51,7 +49,7 @@ data class CancelRefund( // The currency of the refund amount. @JsonProperty("currency") @field:Valid - val currency: kotlin.String? = null, + val currency: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class CancelRefund( class Builder( private var amount: kotlin.String? = null, - private var currency: kotlin.String? = null, + private var currency: kotlin.String? = null ) { fun amount(amount: kotlin.String?) = apply { this.amount = amount } fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun build(): CancelRefund { - return CancelRefund( - amount = amount, - currency = currency, - ) + val instance = + CancelRefund( + amount = amount, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CancelRefund) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( amount = amount, - currency = currency, + currency = currency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CardOption.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CardOption.kt index e5935d00a2..ef0c670426 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CardOption.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CardOption.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -51,7 +49,7 @@ data class CardOption( // The country in which the payment will be processed. @JsonProperty("processing_country") @field:Valid - val processingCountry: kotlin.String? = null, + val processingCountry: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class CardOption( class Builder( private var name: kotlin.String? = null, - private var processingCountry: kotlin.String? = null, + private var processingCountry: kotlin.String? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } fun processingCountry(processingCountry: kotlin.String?) = apply { this.processingCountry = processingCountry } fun build(): CardOption { - return CardOption( - name = name, - processingCountry = processingCountry, - ) + val instance = + CardOption( + name = name, + processingCountry = processingCountry + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CardOption) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( name = name, - processingCountry = processingCountry, + processingCountry = processingCountry ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryAge.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryAge.kt index fb798bb4d7..d3d7bff59e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryAge.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryAge.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An age category. @@ -51,7 +49,7 @@ data class CategoryAge( // Age category minimum age. @JsonProperty("minimum_age") @field:Valid - val minimumAge: java.math.BigDecimal? = null, + val minimumAge: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class CategoryAge( class Builder( private var name: kotlin.String? = null, - private var minimumAge: java.math.BigDecimal? = null, + private var minimumAge: java.math.BigDecimal? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } fun minimumAge(minimumAge: java.math.BigDecimal?) = apply { this.minimumAge = minimumAge } fun build(): CategoryAge { - return CategoryAge( - name = name, - minimumAge = minimumAge, - ) + val instance = + CategoryAge( + name = name, + minimumAge = minimumAge + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CategoryAge) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( name = name, - minimumAge = minimumAge, + minimumAge = minimumAge ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryProperty.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryProperty.kt index 5cee8951fa..21c7236e5f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryProperty.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryProperty.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The property's category. See our [property categories reference](https://developers.expediagroup.com/docs/rapid/lodging/content/content-reference-lists) for current known category ID and name values. @@ -51,7 +49,7 @@ data class CategoryProperty( // The property's category. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class CategoryProperty( class Builder( private var id: kotlin.String? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun name(name: kotlin.String?) = apply { this.name = name } fun build(): CategoryProperty { - return CategoryProperty( - id = id, - name = name, - ) + val instance = + CategoryProperty( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CategoryProperty) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryValueAdd.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryValueAdd.kt index 5c9fd49a08..68e06f9db5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryValueAdd.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CategoryValueAdd.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -50,5 +50,5 @@ enum class CategoryValueAdd(val value: kotlin.String) { ACTIVITY("activity"), @JsonProperty("credit") - CREDIT("credit"), + CREDIT("credit") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Chain.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Chain.kt index 7eefb9f871..1066d3203e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Chain.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Chain.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Brand import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual chain. @@ -57,7 +55,7 @@ data class Chain( // Map of the chain's brands. @JsonProperty("brands") @field:Valid - val brands: kotlin.collections.Map? = null, + val brands: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -67,7 +65,7 @@ data class Chain( class Builder( private var id: kotlin.String? = null, private var name: kotlin.String? = null, - private var brands: kotlin.collections.Map? = null, + private var brands: kotlin.collections.Map? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -76,11 +74,34 @@ data class Chain( fun brands(brands: kotlin.collections.Map?) = apply { this.brands = brands } fun build(): Chain { - return Chain( - id = id, - name = name, - brands = brands, - ) + val instance = + Chain( + id = id, + name = name, + brands = brands + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Chain) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -88,6 +109,6 @@ data class Chain( Builder( id = id, name = name, - brands = brands, + brands = brands ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChangeRoomDetailsRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChangeRoomDetailsRequest.kt index de1fe7fa9e..f778dd70bc 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChangeRoomDetailsRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChangeRoomDetailsRequest.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Loyalty import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -71,7 +69,7 @@ data class ChangeRoomDetailsRequest( val loyaltyId: kotlin.String? = null, @JsonProperty("loyalty") @field:Valid - val loyalty: Loyalty? = null, + val loyalty: Loyalty? = null ) { companion object { @JvmStatic @@ -84,7 +82,7 @@ data class ChangeRoomDetailsRequest( private var smoking: kotlin.Boolean? = null, private var specialRequest: kotlin.String? = null, private var loyaltyId: kotlin.String? = null, - private var loyalty: Loyalty? = null, + private var loyalty: Loyalty? = null ) { fun givenName(givenName: kotlin.String?) = apply { this.givenName = givenName } @@ -99,14 +97,37 @@ data class ChangeRoomDetailsRequest( fun loyalty(loyalty: Loyalty?) = apply { this.loyalty = loyalty } fun build(): ChangeRoomDetailsRequest { - return ChangeRoomDetailsRequest( - givenName = givenName, - familyName = familyName, - smoking = smoking, - specialRequest = specialRequest, - loyaltyId = loyaltyId, - loyalty = loyalty, - ) + val instance = + ChangeRoomDetailsRequest( + givenName = givenName, + familyName = familyName, + smoking = smoking, + specialRequest = specialRequest, + loyaltyId = loyaltyId, + loyalty = loyalty + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ChangeRoomDetailsRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -117,6 +138,6 @@ data class ChangeRoomDetailsRequest( smoking = smoking, specialRequest = specialRequest, loyaltyId = loyaltyId, - loyalty = loyalty, + loyalty = loyalty ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Charge.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Charge.kt index 5c8163f541..470cc6cf05 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Charge.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Charge.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amount import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An object representing a charge. Information about the charge is provided in both the billable currency and the request currency. @@ -50,7 +48,7 @@ data class Charge( val billableCurrency: Amount? = null, @JsonProperty("request_currency") @field:Valid - val requestCurrency: Amount? = null, + val requestCurrency: Amount? = null ) { companion object { @JvmStatic @@ -59,23 +57,46 @@ data class Charge( class Builder( private var billableCurrency: Amount? = null, - private var requestCurrency: Amount? = null, + private var requestCurrency: Amount? = null ) { fun billableCurrency(billableCurrency: Amount?) = apply { this.billableCurrency = billableCurrency } fun requestCurrency(requestCurrency: Amount?) = apply { this.requestCurrency = requestCurrency } fun build(): Charge { - return Charge( - billableCurrency = billableCurrency, - requestCurrency = requestCurrency, - ) + val instance = + Charge( + billableCurrency = billableCurrency, + requestCurrency = requestCurrency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Charge) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( billableCurrency = billableCurrency, - requestCurrency = requestCurrency, + requestCurrency = requestCurrency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChargeCalculated.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChargeCalculated.kt index 82a90e75aa..50df8fa178 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChargeCalculated.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ChargeCalculated.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amount import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An object representing a charge. Information about the charge is provided in both the billable currency and the request currency. @@ -50,7 +48,7 @@ data class ChargeCalculated( val billableCurrency: Amount? = null, @JsonProperty("request_currency") @field:Valid - val requestCurrency: Amount? = null, + val requestCurrency: Amount? = null ) { companion object { @JvmStatic @@ -59,23 +57,46 @@ data class ChargeCalculated( class Builder( private var billableCurrency: Amount? = null, - private var requestCurrency: Amount? = null, + private var requestCurrency: Amount? = null ) { fun billableCurrency(billableCurrency: Amount?) = apply { this.billableCurrency = billableCurrency } fun requestCurrency(requestCurrency: Amount?) = apply { this.requestCurrency = requestCurrency } fun build(): ChargeCalculated { - return ChargeCalculated( - billableCurrency = billableCurrency, - requestCurrency = requestCurrency, - ) + val instance = + ChargeCalculated( + billableCurrency = billableCurrency, + requestCurrency = requestCurrency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ChargeCalculated) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( billableCurrency = billableCurrency, - requestCurrency = requestCurrency, + requestCurrency = requestCurrency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkin.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkin.kt index 37e0491fa7..f803e98e94 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkin.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkin.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The property's check-in information. @@ -71,7 +69,7 @@ data class Checkin( // The minimum age for a customer to be able to check-in at a property. @JsonProperty("min_age") @field:Valid - val minAge: java.math.BigDecimal? = null, + val minAge: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -84,7 +82,7 @@ data class Checkin( private var endTime: kotlin.String? = null, private var instructions: kotlin.String? = null, private var specialInstructions: kotlin.String? = null, - private var minAge: java.math.BigDecimal? = null, + private var minAge: java.math.BigDecimal? = null ) { fun `24hour`(`24hour`: kotlin.String?) = apply { this.`24hour` = `24hour` } @@ -99,14 +97,37 @@ data class Checkin( fun minAge(minAge: java.math.BigDecimal?) = apply { this.minAge = minAge } fun build(): Checkin { - return Checkin( - `24hour` = `24hour`, - beginTime = beginTime, - endTime = endTime, - instructions = instructions, - specialInstructions = specialInstructions, - minAge = minAge, - ) + val instance = + Checkin( + `24hour` = `24hour`, + beginTime = beginTime, + endTime = endTime, + instructions = instructions, + specialInstructions = specialInstructions, + minAge = minAge + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Checkin) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -117,6 +138,6 @@ data class Checkin( endTime = endTime, instructions = instructions, specialInstructions = specialInstructions, - minAge = minAge, + minAge = minAge ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkout.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkout.kt index 3c9d09e8ae..563716ed7a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkout.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Checkout.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The property's check-out information. @@ -46,7 +44,7 @@ data class Checkout( // The time by which a guest must check out. @JsonProperty("time") @field:Valid - val time: kotlin.String? = null, + val time: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class Checkout( } class Builder( - private var time: kotlin.String? = null, + private var time: kotlin.String? = null ) { fun time(time: kotlin.String?) = apply { this.time = time } fun build(): Checkout { - return Checkout( - time = time, - ) + val instance = + Checkout( + time = time + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Checkout) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - time = time, + time = time ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CommitChangeRoomRequestBody.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CommitChangeRoomRequestBody.kt index 25b121d845..bb1deb9726 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CommitChangeRoomRequestBody.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CommitChangeRoomRequestBody.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.PaymentRequestWithPhone import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -51,7 +49,7 @@ data class CommitChangeRoomRequestBody( val changeReferenceId: kotlin.String? = null, @JsonProperty("payments") @field:Valid - val payments: kotlin.collections.List? = null, + val payments: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class CommitChangeRoomRequestBody( class Builder( private var changeReferenceId: kotlin.String? = null, - private var payments: kotlin.collections.List? = null, + private var payments: kotlin.collections.List? = null ) { fun changeReferenceId(changeReferenceId: kotlin.String?) = apply { this.changeReferenceId = changeReferenceId } fun payments(payments: kotlin.collections.List?) = apply { this.payments = payments } fun build(): CommitChangeRoomRequestBody { - return CommitChangeRoomRequestBody( - changeReferenceId = changeReferenceId, - payments = payments, - ) + val instance = + CommitChangeRoomRequestBody( + changeReferenceId = changeReferenceId, + payments = payments + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CommitChangeRoomRequestBody) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( changeReferenceId = changeReferenceId, - payments = payments, + payments = payments ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSession.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSession.kt index dbf7f30ec7..6e599c7ea2 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSession.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSession.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.CompletePaymentSessionLinks import com.expediagroup.sdk.rapid.models.TraderInformation import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The payment session response. @@ -56,7 +54,7 @@ data class CompletePaymentSession( val links: CompletePaymentSessionLinks? = null, @JsonProperty("trader_information") @field:Valid - val traderInformation: TraderInformation? = null, + val traderInformation: TraderInformation? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class CompletePaymentSession( class Builder( private var itineraryId: kotlin.String? = null, private var links: CompletePaymentSessionLinks? = null, - private var traderInformation: TraderInformation? = null, + private var traderInformation: TraderInformation? = null ) { fun itineraryId(itineraryId: kotlin.String?) = apply { this.itineraryId = itineraryId } @@ -75,11 +73,34 @@ data class CompletePaymentSession( fun traderInformation(traderInformation: TraderInformation?) = apply { this.traderInformation = traderInformation } fun build(): CompletePaymentSession { - return CompletePaymentSession( - itineraryId = itineraryId, - links = links, - traderInformation = traderInformation, - ) + val instance = + CompletePaymentSession( + itineraryId = itineraryId, + links = links, + traderInformation = traderInformation + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CompletePaymentSession) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class CompletePaymentSession( Builder( itineraryId = itineraryId, links = links, - traderInformation = traderInformation, + traderInformation = traderInformation ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSessionLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSessionLinks.kt index 3638ff9a81..902acc7512 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSessionLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CompletePaymentSessionLinks.kt @@ -25,22 +25,20 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.DeleteHeldBookingOperationLink import com.expediagroup.sdk.rapid.operations.GetReservationByItineraryIdOperationLink import com.expediagroup.sdk.rapid.operations.PutResumeBookingOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to retrieve a booking, resume a held booking, or cancel a held booking. @@ -58,7 +56,7 @@ data class CompletePaymentSessionLinks( val resume: PutResumeBookingOperationLink? = null, @JsonProperty("cancel") @field:Valid - val cancel: DeleteHeldBookingOperationLink? = null, + val cancel: DeleteHeldBookingOperationLink? = null ) { companion object { @JvmStatic @@ -68,7 +66,7 @@ data class CompletePaymentSessionLinks( class Builder( private var retrieve: GetReservationByItineraryIdOperationLink? = null, private var resume: PutResumeBookingOperationLink? = null, - private var cancel: DeleteHeldBookingOperationLink? = null, + private var cancel: DeleteHeldBookingOperationLink? = null ) { fun retrieve(retrieve: GetReservationByItineraryIdOperationLink?) = apply { this.retrieve = retrieve } @@ -77,11 +75,34 @@ data class CompletePaymentSessionLinks( fun cancel(cancel: DeleteHeldBookingOperationLink?) = apply { this.cancel = cancel } fun build(): CompletePaymentSessionLinks { - return CompletePaymentSessionLinks( - retrieve = retrieve, - resume = resume, - cancel = cancel, - ) + val instance = + CompletePaymentSessionLinks( + retrieve = retrieve, + resume = resume, + cancel = cancel + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CompletePaymentSessionLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -89,6 +110,6 @@ data class CompletePaymentSessionLinks( Builder( retrieve = retrieve, resume = resume, - cancel = cancel, + cancel = cancel ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ConfirmationId.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ConfirmationId.kt index 16c43585e9..72aec68631 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ConfirmationId.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ConfirmationId.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The confirmation ids. @@ -51,7 +49,7 @@ data class ConfirmationId( // The property confirmation id. @JsonProperty("property") @field:Valid - val `property`: kotlin.String? = null, + val `property`: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class ConfirmationId( class Builder( private var expedia: kotlin.String? = null, - private var `property`: kotlin.String? = null, + private var `property`: kotlin.String? = null ) { fun expedia(expedia: kotlin.String?) = apply { this.expedia = expedia } fun `property`(`property`: kotlin.String?) = apply { this.`property` = `property` } fun build(): ConfirmationId { - return ConfirmationId( - expedia = expedia, - `property` = `property`, - ) + val instance = + ConfirmationId( + expedia = expedia, + `property` = `property` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ConfirmationId) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( expedia = expedia, - `property` = `property`, + `property` = `property` ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Conversations.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Conversations.kt index fbc7b6cb79..28e44d30eb 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Conversations.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Conversations.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Details about initiating conversations. @@ -47,7 +45,7 @@ data class Conversations( // Contains urls for links to initiate conversations via EPS. @JsonProperty("links") @field:Valid - val links: kotlin.collections.Map? = null, + val links: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -55,19 +53,42 @@ data class Conversations( } class Builder( - private var links: kotlin.collections.Map? = null, + private var links: kotlin.collections.Map? = null ) { fun links(links: kotlin.collections.Map?) = apply { this.links = links } fun build(): Conversations { - return Conversations( - links = links, - ) + val instance = + Conversations( + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Conversations) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Coordinates.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Coordinates.kt index 7bb0374f41..16b7d147fe 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Coordinates.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Coordinates.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The coordinates of the property. @@ -51,7 +49,7 @@ data class Coordinates( // The longitude of the property. @JsonProperty("longitude") @field:Valid - val longitude: java.math.BigDecimal? = null, + val longitude: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Coordinates( class Builder( private var latitude: java.math.BigDecimal? = null, - private var longitude: java.math.BigDecimal? = null, + private var longitude: java.math.BigDecimal? = null ) { fun latitude(latitude: java.math.BigDecimal?) = apply { this.latitude = latitude } fun longitude(longitude: java.math.BigDecimal?) = apply { this.longitude = longitude } fun build(): Coordinates { - return Coordinates( - latitude = latitude, - longitude = longitude, - ) + val instance = + Coordinates( + latitude = latitude, + longitude = longitude + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Coordinates) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( latitude = latitude, - longitude = longitude, + longitude = longitude ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CoordinatesRegion.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CoordinatesRegion.kt index f6db1280ba..df8da32ad0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CoordinatesRegion.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CoordinatesRegion.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BoundingPolygon import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -56,7 +54,7 @@ data class CoordinatesRegion( val centerLatitude: java.math.BigDecimal? = null, @JsonProperty("bounding_polygon") @field:Valid - val boundingPolygon: BoundingPolygon? = null, + val boundingPolygon: BoundingPolygon? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class CoordinatesRegion( class Builder( private var centerLongitude: java.math.BigDecimal? = null, private var centerLatitude: java.math.BigDecimal? = null, - private var boundingPolygon: BoundingPolygon? = null, + private var boundingPolygon: BoundingPolygon? = null ) { fun centerLongitude(centerLongitude: java.math.BigDecimal?) = apply { this.centerLongitude = centerLongitude } @@ -75,11 +73,34 @@ data class CoordinatesRegion( fun boundingPolygon(boundingPolygon: BoundingPolygon?) = apply { this.boundingPolygon = boundingPolygon } fun build(): CoordinatesRegion { - return CoordinatesRegion( - centerLongitude = centerLongitude, - centerLatitude = centerLatitude, - boundingPolygon = boundingPolygon, - ) + val instance = + CoordinatesRegion( + centerLongitude = centerLongitude, + centerLatitude = centerLatitude, + boundingPolygon = boundingPolygon + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CoordinatesRegion) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class CoordinatesRegion( Builder( centerLongitude = centerLongitude, centerLatitude = centerLatitude, - boundingPolygon = boundingPolygon, + boundingPolygon = boundingPolygon ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequest.kt index 6cdca3e4e9..2269231c33 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequest.kt @@ -25,22 +25,21 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.CreateItineraryRequestInvoicing import com.expediagroup.sdk.rapid.models.CreateItineraryRequestRoom import com.expediagroup.sdk.rapid.models.PaymentRequest import com.expediagroup.sdk.rapid.models.PhoneRequest import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -58,16 +57,19 @@ import javax.validation.constraints.Size data class CreateItineraryRequest( // Email address for the customer. Must adhere to standard RFC 822 email format. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("email") + @field:NotNull @field:Valid val email: kotlin.String, @JsonProperty("phone") + @field:NotNull @field:Valid val phone: PhoneRequest, @JsonProperty("rooms") + @field:NotNull @field:Valid val rooms: kotlin.collections .List< - CreateItineraryRequestRoom, + CreateItineraryRequestRoom >, // Your unique reference value. This field supports from 3 to a maximum of 28 characters and is required to be unique (if provided). Entering special characters (\"<\", \">\", \"(\", \")\", and \"&\") in this field will result in the request being rejected. @JsonProperty("affiliate_reference_id") @@ -95,7 +97,7 @@ data class CreateItineraryRequest( val travelerHandlingInstructions: kotlin.String? = null, @JsonProperty("invoicing") @field:Valid - val invoicing: CreateItineraryRequestInvoicing? = null, + val invoicing: CreateItineraryRequestInvoicing? = null ) { companion object { @JvmStatic @@ -112,7 +114,7 @@ data class CreateItineraryRequest( private var affiliateMetadata: kotlin.String? = null, private var taxRegistrationNumber: kotlin.String? = null, private var travelerHandlingInstructions: kotlin.String? = null, - private var invoicing: CreateItineraryRequestInvoicing? = null, + private var invoicing: CreateItineraryRequestInvoicing? = null ) { fun email(email: kotlin.String) = apply { this.email = email } @@ -130,39 +132,45 @@ data class CreateItineraryRequest( fun taxRegistrationNumber(taxRegistrationNumber: kotlin.String?) = apply { this.taxRegistrationNumber = taxRegistrationNumber } - fun travelerHandlingInstructions(travelerHandlingInstructions: kotlin.String?) = - apply { - this.travelerHandlingInstructions = travelerHandlingInstructions - } + fun travelerHandlingInstructions(travelerHandlingInstructions: kotlin.String?) = apply { this.travelerHandlingInstructions = travelerHandlingInstructions } fun invoicing(invoicing: CreateItineraryRequestInvoicing?) = apply { this.invoicing = invoicing } fun build(): CreateItineraryRequest { - // Check required params - validateNullity() - return CreateItineraryRequest( - email = email!!, - phone = phone!!, - rooms = rooms!!, - affiliateReferenceId = affiliateReferenceId, - hold = hold, - payments = payments, - affiliateMetadata = affiliateMetadata, - taxRegistrationNumber = taxRegistrationNumber, - travelerHandlingInstructions = travelerHandlingInstructions, - invoicing = invoicing, - ) + val instance = + CreateItineraryRequest( + email = email!!, + phone = phone!!, + rooms = rooms!!, + affiliateReferenceId = affiliateReferenceId, + hold = hold, + payments = payments, + affiliateMetadata = affiliateMetadata, + taxRegistrationNumber = taxRegistrationNumber, + travelerHandlingInstructions = travelerHandlingInstructions, + invoicing = invoicing + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (email == null) { - throw NullPointerException("Required parameter email is missing") - } - if (phone == null) { - throw NullPointerException("Required parameter phone is missing") - } - if (rooms == null) { - throw NullPointerException("Required parameter rooms is missing") + private fun validate(instance: CreateItineraryRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -178,6 +186,6 @@ data class CreateItineraryRequest( affiliateMetadata = affiliateMetadata, taxRegistrationNumber = taxRegistrationNumber, travelerHandlingInstructions = travelerHandlingInstructions, - invoicing = invoicing, + invoicing = invoicing ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestInvoicing.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestInvoicing.kt index 998e545185..13dd45cef3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestInvoicing.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestInvoicing.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Address1 import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * To be included if invoicing is requested. @@ -61,7 +59,7 @@ data class CreateItineraryRequestInvoicing( // Email address to send invoices @JsonProperty("email") @field:Valid - val email: kotlin.String? = null, + val email: kotlin.String? = null ) { companion object { @JvmStatic @@ -72,7 +70,7 @@ data class CreateItineraryRequestInvoicing( private var companyName: kotlin.String? = null, private var companyAddress: Address1? = null, private var pointOfSaleDisplay: kotlin.String? = null, - private var email: kotlin.String? = null, + private var email: kotlin.String? = null ) { fun companyName(companyName: kotlin.String?) = apply { this.companyName = companyName } @@ -83,12 +81,35 @@ data class CreateItineraryRequestInvoicing( fun email(email: kotlin.String?) = apply { this.email = email } fun build(): CreateItineraryRequestInvoicing { - return CreateItineraryRequestInvoicing( - companyName = companyName, - companyAddress = companyAddress, - pointOfSaleDisplay = pointOfSaleDisplay, - email = email, - ) + val instance = + CreateItineraryRequestInvoicing( + companyName = companyName, + companyAddress = companyAddress, + pointOfSaleDisplay = pointOfSaleDisplay, + email = email + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CreateItineraryRequestInvoicing) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -97,6 +118,6 @@ data class CreateItineraryRequestInvoicing( companyName = companyName, companyAddress = companyAddress, pointOfSaleDisplay = pointOfSaleDisplay, - email = email, + email = email ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestRoom.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestRoom.kt index 5c0bfd5125..605c1163bb 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestRoom.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreateItineraryRequestRoom.kt @@ -25,19 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Loyalty import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -51,10 +50,12 @@ import javax.validation.constraints.Size data class CreateItineraryRequestRoom( // First name of room guest. Max 60 characters. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("given_name") + @field:NotNull @field:Valid val givenName: kotlin.String, // Last name of room guest. Max 60 characters. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("family_name") + @field:NotNull @field:Valid val familyName: kotlin.String, // Specify if the guest would prefer a smoking room. This field is only a request and the property is not guaranteed to honor it, it will not override any non-smoking policies by the hotel. @@ -71,7 +72,7 @@ data class CreateItineraryRequestRoom( val loyaltyId: kotlin.String? = null, @JsonProperty("loyalty") @field:Valid - val loyalty: Loyalty? = null, + val loyalty: Loyalty? = null ) { companion object { @JvmStatic @@ -84,7 +85,7 @@ data class CreateItineraryRequestRoom( private var smoking: kotlin.Boolean? = null, private var specialRequest: kotlin.String? = null, private var loyaltyId: kotlin.String? = null, - private var loyalty: Loyalty? = null, + private var loyalty: Loyalty? = null ) { fun givenName(givenName: kotlin.String) = apply { this.givenName = givenName } @@ -99,24 +100,36 @@ data class CreateItineraryRequestRoom( fun loyalty(loyalty: Loyalty?) = apply { this.loyalty = loyalty } fun build(): CreateItineraryRequestRoom { - // Check required params - validateNullity() - return CreateItineraryRequestRoom( - givenName = givenName!!, - familyName = familyName!!, - smoking = smoking, - specialRequest = specialRequest, - loyaltyId = loyaltyId, - loyalty = loyalty, - ) + val instance = + CreateItineraryRequestRoom( + givenName = givenName!!, + familyName = familyName!!, + smoking = smoking, + specialRequest = specialRequest, + loyaltyId = loyaltyId, + loyalty = loyalty + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (givenName == null) { - throw NullPointerException("Required parameter givenName is missing") - } - if (familyName == null) { - throw NullPointerException("Required parameter familyName is missing") + private fun validate(instance: CreateItineraryRequestRoom) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -128,6 +141,6 @@ data class CreateItineraryRequestRoom( smoking = smoking, specialRequest = specialRequest, loyaltyId = loyaltyId, - loyalty = loyalty, + loyalty = loyalty ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCard.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCard.kt index be466bde04..52667119a5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCard.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCard.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.CardOption import com.expediagroup.sdk.rapid.models.CreditCardMerchant import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -56,7 +54,7 @@ data class CreditCard( // Display name of payment option. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class CreditCard( class Builder( private var cardOptions: kotlin.collections.List? = null, private var merchant: CreditCardMerchant? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun cardOptions(cardOptions: kotlin.collections.List?) = apply { this.cardOptions = cardOptions } @@ -75,11 +73,34 @@ data class CreditCard( fun name(name: kotlin.String?) = apply { this.name = name } fun build(): CreditCard { - return CreditCard( - cardOptions = cardOptions, - merchant = merchant, - name = name, - ) + val instance = + CreditCard( + cardOptions = cardOptions, + merchant = merchant, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CreditCard) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class CreditCard( Builder( cardOptions = cardOptions, merchant = merchant, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCardMerchant.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCardMerchant.kt index 286750cd34..0a42e0d3b4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCardMerchant.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/CreditCardMerchant.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -46,7 +44,7 @@ data class CreditCardMerchant( // Name of the merchant to use during 3rd party authorization for PSD2. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class CreditCardMerchant( } class Builder( - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } fun build(): CreditCardMerchant { - return CreditCardMerchant( - name = name, - ) + val instance = + CreditCardMerchant( + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CreditCardMerchant) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Dates.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Dates.kt index 943462bce4..555175ff18 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Dates.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Dates.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Dates about the property. @@ -51,7 +49,7 @@ data class Dates( // The UTC date the property’s content was updated by EPS, in ISO 8601 format. @JsonProperty("updated") @field:Valid - val updated: kotlin.String? = null, + val updated: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Dates( class Builder( private var added: kotlin.String? = null, - private var updated: kotlin.String? = null, + private var updated: kotlin.String? = null ) { fun added(added: kotlin.String?) = apply { this.added = added } fun updated(updated: kotlin.String?) = apply { this.updated = updated } fun build(): Dates { - return Dates( - added = added, - updated = updated, - ) + val instance = + Dates( + added = added, + updated = updated + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Dates) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( added = added, - updated = updated, + updated = updated ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Day.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Day.kt index 4b629674cf..8e1f17c92c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Day.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Day.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.StayConstraints import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -65,7 +63,7 @@ data class Day( val checkout: kotlin.String? = null, @JsonProperty("stay_constraints") @field:Valid - val stayConstraints: StayConstraints? = null, + val stayConstraints: StayConstraints? = null ) { companion object { @JvmStatic @@ -77,7 +75,7 @@ data class Day( private var available: kotlin.Boolean? = null, private var checkin: kotlin.String? = null, private var checkout: kotlin.String? = null, - private var stayConstraints: StayConstraints? = null, + private var stayConstraints: StayConstraints? = null ) { fun date(date: java.time.LocalDate?) = apply { this.date = date } @@ -90,13 +88,36 @@ data class Day( fun stayConstraints(stayConstraints: StayConstraints?) = apply { this.stayConstraints = stayConstraints } fun build(): Day { - return Day( - date = date, - available = available, - checkin = checkin, - checkout = checkout, - stayConstraints = stayConstraints, - ) + val instance = + Day( + date = date, + available = available, + checkin = checkin, + checkout = checkout, + stayConstraints = stayConstraints + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Day) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -106,6 +127,6 @@ data class Day( available = available, checkin = checkin, checkout = checkout, - stayConstraints = stayConstraints, + stayConstraints = stayConstraints ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deal.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deal.kt index c3261699f8..2f90708b46 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deal.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deal.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The deal that applies to this rate. @@ -51,7 +49,7 @@ data class Deal( // The description for the deal. @JsonProperty("description") @field:Valid - val description: kotlin.String? = null, + val description: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Deal( class Builder( private var id: kotlin.String? = null, - private var description: kotlin.String? = null, + private var description: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun description(description: kotlin.String?) = apply { this.description = description } fun build(): Deal { - return Deal( - id = id, - description = description, - ) + val instance = + Deal( + id = id, + description = description + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Deal) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - description = description, + description = description ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deposit.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deposit.kt index c032ca829c..eceae1aaad 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deposit.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Deposit.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A deposit policy associated with the rate. @@ -56,7 +54,7 @@ data class Deposit( // The currency for the deposit amount. @JsonProperty("currency") @field:Valid - val currency: kotlin.String? = null, + val currency: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Deposit( class Builder( private var `value`: kotlin.String? = null, private var due: kotlin.String? = null, - private var currency: kotlin.String? = null, + private var currency: kotlin.String? = null ) { fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } @@ -75,11 +73,34 @@ data class Deposit( fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun build(): Deposit { - return Deposit( - `value` = `value`, - due = due, - currency = currency, - ) + val instance = + Deposit( + `value` = `value`, + due = due, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Deposit) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Deposit( Builder( `value` = `value`, due = due, - currency = currency, + currency = currency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DepositItinerary.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DepositItinerary.kt index 6239846053..47194e5566 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DepositItinerary.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DepositItinerary.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The deposit policy associated with the itinerary. @@ -56,7 +54,7 @@ data class DepositItinerary( // The due date/time of the deposit. @JsonProperty("due") @field:Valid - val due: kotlin.String? = null, + val due: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class DepositItinerary( class Builder( private var currency: kotlin.String? = null, private var `value`: kotlin.String? = null, - private var due: kotlin.String? = null, + private var due: kotlin.String? = null ) { fun currency(currency: kotlin.String?) = apply { this.currency = currency } @@ -75,11 +73,34 @@ data class DepositItinerary( fun due(due: kotlin.String?) = apply { this.due = due } fun build(): DepositItinerary { - return DepositItinerary( - currency = currency, - `value` = `value`, - due = due, - ) + val instance = + DepositItinerary( + currency = currency, + `value` = `value`, + due = due + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DepositItinerary) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class DepositItinerary( Builder( currency = currency, `value` = `value`, - due = due, + due = due ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Descriptions.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Descriptions.kt index 61d5bc7a9d..549c46e9ae 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Descriptions.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Descriptions.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Descriptions of a property. @@ -91,7 +89,7 @@ data class Descriptions( // A general description of a vacation rental property. @JsonProperty("general") @field:Valid - val general: kotlin.String? = null, + val general: kotlin.String? = null ) { companion object { @JvmStatic @@ -108,7 +106,7 @@ data class Descriptions( private var attractions: kotlin.String? = null, private var location: kotlin.String? = null, private var headline: kotlin.String? = null, - private var general: kotlin.String? = null, + private var general: kotlin.String? = null ) { fun amenities(amenities: kotlin.String?) = apply { this.amenities = amenities } @@ -131,18 +129,41 @@ data class Descriptions( fun general(general: kotlin.String?) = apply { this.general = general } fun build(): Descriptions { - return Descriptions( - amenities = amenities, - dining = dining, - renovations = renovations, - nationalRatings = nationalRatings, - businessAmenities = businessAmenities, - rooms = rooms, - attractions = attractions, - location = location, - headline = headline, - general = general, - ) + val instance = + Descriptions( + amenities = amenities, + dining = dining, + renovations = renovations, + nationalRatings = nationalRatings, + businessAmenities = businessAmenities, + rooms = rooms, + attractions = attractions, + location = location, + headline = headline, + general = general + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Descriptions) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -157,6 +178,6 @@ data class Descriptions( attractions = attractions, location = location, headline = headline, - general = general, + general = general ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DescriptionsRoom.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DescriptionsRoom.kt index 664e523e90..9c96906789 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DescriptionsRoom.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/DescriptionsRoom.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Descriptions of a room. @@ -46,7 +44,7 @@ data class DescriptionsRoom( // Provides an overview of a room. @JsonProperty("overview") @field:Valid - val overview: kotlin.String? = null, + val overview: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class DescriptionsRoom( } class Builder( - private var overview: kotlin.String? = null, + private var overview: kotlin.String? = null ) { fun overview(overview: kotlin.String?) = apply { this.overview = overview } fun build(): DescriptionsRoom { - return DescriptionsRoom( - overview = overview, - ) + val instance = + DescriptionsRoom( + overview = overview + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DescriptionsRoom) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - overview = overview, + overview = overview ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EnhancedHouseRules.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EnhancedHouseRules.kt index c442e71f33..b9074727fe 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EnhancedHouseRules.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EnhancedHouseRules.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -51,7 +49,7 @@ data class EnhancedHouseRules( // List of strings detailing further information about the rule. @JsonProperty("additional_information") @field:Valid - val additionalInformation: kotlin.collections.List? = null, + val additionalInformation: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -60,26 +58,46 @@ data class EnhancedHouseRules( class Builder( private var rule: kotlin.String? = null, - private var additionalInformation: kotlin.collections.List? = null, + private var additionalInformation: kotlin.collections.List? = null ) { fun rule(rule: kotlin.String?) = apply { this.rule = rule } - fun additionalInformation(additionalInformation: kotlin.collections.List?) = - apply { - this.additionalInformation = additionalInformation - } + fun additionalInformation(additionalInformation: kotlin.collections.List?) = apply { this.additionalInformation = additionalInformation } fun build(): EnhancedHouseRules { - return EnhancedHouseRules( - rule = rule, - additionalInformation = additionalInformation, - ) + val instance = + EnhancedHouseRules( + rule = rule, + additionalInformation = additionalInformation + ) + + validate(instance) + + return instance + } + + private fun validate(instance: EnhancedHouseRules) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( rule = rule, - additionalInformation = additionalInformation, + additionalInformation = additionalInformation ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Error.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Error.kt index 1c0bd508a4..3c1122038f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Error.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Error.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.ErrorIndividual import com.expediagroup.sdk.rapid.models.Field import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The overall class of error that occured. @@ -63,7 +61,7 @@ data class Error( // An array of all the actual errors that occured. @JsonProperty("errors") @field:Valid - val errors: kotlin.collections.List? = null, + val errors: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -74,7 +72,7 @@ data class Error( private var type: kotlin.String? = null, private var message: kotlin.String? = null, private var fields: kotlin.collections.List? = null, - private var errors: kotlin.collections.List? = null, + private var errors: kotlin.collections.List? = null ) { fun type(type: kotlin.String?) = apply { this.type = type } @@ -85,12 +83,35 @@ data class Error( fun errors(errors: kotlin.collections.List?) = apply { this.errors = errors } fun build(): Error { - return Error( - type = type, - message = message, - fields = fields, - errors = errors, - ) + val instance = + Error( + type = type, + message = message, + fields = fields, + errors = errors + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Error) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -99,6 +120,6 @@ data class Error( type = type, message = message, fields = fields, - errors = errors, + errors = errors ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ErrorIndividual.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ErrorIndividual.kt index ff2826a4b4..31bcbd967c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ErrorIndividual.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ErrorIndividual.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Field import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual error. @@ -57,7 +55,7 @@ data class ErrorIndividual( // Details about the specific fields that had an error. @JsonProperty("fields") @field:Valid - val fields: kotlin.collections.List? = null, + val fields: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -67,7 +65,7 @@ data class ErrorIndividual( class Builder( private var type: kotlin.String? = null, private var message: kotlin.String? = null, - private var fields: kotlin.collections.List? = null, + private var fields: kotlin.collections.List? = null ) { fun type(type: kotlin.String?) = apply { this.type = type } @@ -76,11 +74,34 @@ data class ErrorIndividual( fun fields(fields: kotlin.collections.List?) = apply { this.fields = fields } fun build(): ErrorIndividual { - return ErrorIndividual( - type = type, - message = message, - fields = fields, - ) + val instance = + ErrorIndividual( + type = type, + message = message, + fields = fields + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ErrorIndividual) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -88,6 +109,6 @@ data class ErrorIndividual( Builder( type = type, message = message, - fields = fields, + fields = fields ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Essential.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Essential.kt index 1204d9f8ee..41f12ef769 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Essential.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Essential.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Image1 import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -62,7 +60,7 @@ data class Essential( // An array of images needed for the essential item. @JsonProperty("images") @field:Valid - val images: kotlin.collections.List? = null, + val images: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -73,24 +71,46 @@ data class Essential( private var name: kotlin.String? = null, private var instructions: kotlin.String? = null, private var additionalInfo: kotlin.collections.Map? = null, - private var images: kotlin.collections.List? = null, + private var images: kotlin.collections.List? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } fun instructions(instructions: kotlin.String?) = apply { this.instructions = instructions } - fun additionalInfo(additionalInfo: kotlin.collections.Map?) = - apply { this.additionalInfo = additionalInfo } + fun additionalInfo(additionalInfo: kotlin.collections.Map?) = apply { this.additionalInfo = additionalInfo } fun images(images: kotlin.collections.List?) = apply { this.images = images } fun build(): Essential { - return Essential( - name = name, - instructions = instructions, - additionalInfo = additionalInfo, - images = images, - ) + val instance = + Essential( + name = name, + instructions = instructions, + additionalInfo = additionalInfo, + images = images + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Essential) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -99,6 +119,6 @@ data class Essential( name = name, instructions = instructions, additionalInfo = additionalInfo, - images = images, + images = images ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EssentialInformation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EssentialInformation.kt index 47b8f73d0b..5af761a149 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EssentialInformation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/EssentialInformation.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Essential import com.expediagroup.sdk.rapid.models.SupplyContact import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Essential information, including the supply contact information and any other essential information. @@ -56,7 +54,7 @@ data class EssentialInformation( // The date and time when new essential information is available for retrieval, in extended ISO 8601 format, with ±hh:mm timezone offset. @JsonProperty("update_available_date") @field:Valid - val updateAvailableDate: kotlin.String? = null, + val updateAvailableDate: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class EssentialInformation( class Builder( private var contact: SupplyContact? = null, private var essentials: kotlin.collections.List? = null, - private var updateAvailableDate: kotlin.String? = null, + private var updateAvailableDate: kotlin.String? = null ) { fun contact(contact: SupplyContact?) = apply { this.contact = contact } @@ -75,11 +73,34 @@ data class EssentialInformation( fun updateAvailableDate(updateAvailableDate: kotlin.String?) = apply { this.updateAvailableDate = updateAvailableDate } fun build(): EssentialInformation { - return EssentialInformation( - contact = contact, - essentials = essentials, - updateAvailableDate = updateAvailableDate, - ) + val instance = + EssentialInformation( + contact = contact, + essentials = essentials, + updateAvailableDate = updateAvailableDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: EssentialInformation) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class EssentialInformation( Builder( contact = contact, essentials = essentials, - updateAvailableDate = updateAvailableDate, + updateAvailableDate = updateAvailableDate ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Fees.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Fees.kt index cbc7a833a1..6fd952db3a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Fees.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Fees.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information related to a property's fees. @@ -51,7 +49,7 @@ data class Fees( // Describes additional optional fees for items such as breakfast, wifi, parking, pets etc. @JsonProperty("optional") @field:Valid - val optional: kotlin.String? = null, + val optional: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Fees( class Builder( private var mandatory: kotlin.String? = null, - private var optional: kotlin.String? = null, + private var optional: kotlin.String? = null ) { fun mandatory(mandatory: kotlin.String?) = apply { this.mandatory = mandatory } fun optional(optional: kotlin.String?) = apply { this.optional = optional } fun build(): Fees { - return Fees( - mandatory = mandatory, - optional = optional, - ) + val instance = + Fees( + mandatory = mandatory, + optional = optional + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Fees) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( mandatory = mandatory, - optional = optional, + optional = optional ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/FeesPricingInformation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/FeesPricingInformation.kt index 42c784cea0..f8b32ba4b4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/FeesPricingInformation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/FeesPricingInformation.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.ChargeCalculated import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The fees collected by the property. The values for each type of fee are the total for that type. Mandatory fees are collected by the property at check-in or check-out. Resort fees are charged for amenities and extras and collected by the property at check-in or check-out. Mandatory taxes are taxes collected by the property at check-in or check-out. @@ -54,7 +52,7 @@ data class FeesPricingInformation( val resortFee: ChargeCalculated? = null, @JsonProperty("mandatory_tax") @field:Valid - val mandatoryTax: ChargeCalculated? = null, + val mandatoryTax: ChargeCalculated? = null ) { companion object { @JvmStatic @@ -64,7 +62,7 @@ data class FeesPricingInformation( class Builder( private var mandatoryFee: ChargeCalculated? = null, private var resortFee: ChargeCalculated? = null, - private var mandatoryTax: ChargeCalculated? = null, + private var mandatoryTax: ChargeCalculated? = null ) { fun mandatoryFee(mandatoryFee: ChargeCalculated?) = apply { this.mandatoryFee = mandatoryFee } @@ -73,11 +71,34 @@ data class FeesPricingInformation( fun mandatoryTax(mandatoryTax: ChargeCalculated?) = apply { this.mandatoryTax = mandatoryTax } fun build(): FeesPricingInformation { - return FeesPricingInformation( - mandatoryFee = mandatoryFee, - resortFee = resortFee, - mandatoryTax = mandatoryTax, - ) + val instance = + FeesPricingInformation( + mandatoryFee = mandatoryFee, + resortFee = resortFee, + mandatoryTax = mandatoryTax + ) + + validate(instance) + + return instance + } + + private fun validate(instance: FeesPricingInformation) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -85,6 +106,6 @@ data class FeesPricingInformation( Builder( mandatoryFee = mandatoryFee, resortFee = resortFee, - mandatoryTax = mandatoryTax, + mandatoryTax = mandatoryTax ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Field.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Field.kt index bebda8c31c..70a94fc70b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Field.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Field.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual field that had an error. @@ -56,7 +54,7 @@ data class Field( // The value of the field that had an error. @JsonProperty("value") @field:Valid - val `value`: kotlin.String? = null, + val `value`: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Field( class Builder( private var name: kotlin.String? = null, private var type: kotlin.String? = null, - private var `value`: kotlin.String? = null, + private var `value`: kotlin.String? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } @@ -75,11 +73,34 @@ data class Field( fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } fun build(): Field { - return Field( - name = name, - type = type, - `value` = `value`, - ) + val instance = + Field( + name = name, + type = type, + `value` = `value` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Field) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Field( Builder( name = name, type = type, - `value` = `value`, + `value` = `value` ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Frequency.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Frequency.kt index ceda44d28a..39be7e7f20 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Frequency.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Frequency.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -56,5 +56,5 @@ enum class Frequency(val value: kotlin.String) { ROUND_TRIP("round_trip"), @JsonProperty("one_way") - ONE_WAY("one_way"), + ONE_WAY("one_way") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestRating.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestRating.kt index c3af0c99db..167756b7ee 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestRating.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestRating.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Rating information provided by guests who stayed at this property. @@ -101,7 +99,7 @@ data class GuestRating( // The percent of guests who recommend staying at this property. @JsonProperty("recommendation_percent") @field:Valid - val recommendationPercent: kotlin.String? = null, + val recommendationPercent: kotlin.String? = null ) { companion object { @JvmStatic @@ -120,7 +118,7 @@ data class GuestRating( private var quality: kotlin.String? = null, private var `value`: kotlin.String? = null, private var amenities: kotlin.String? = null, - private var recommendationPercent: kotlin.String? = null, + private var recommendationPercent: kotlin.String? = null ) { fun count(count: java.math.BigDecimal?) = apply { this.count = count } @@ -147,20 +145,43 @@ data class GuestRating( fun recommendationPercent(recommendationPercent: kotlin.String?) = apply { this.recommendationPercent = recommendationPercent } fun build(): GuestRating { - return GuestRating( - count = count, - overall = overall, - cleanliness = cleanliness, - service = service, - comfort = comfort, - condition = condition, - location = location, - neighborhood = neighborhood, - quality = quality, - `value` = `value`, - amenities = amenities, - recommendationPercent = recommendationPercent, - ) + val instance = + GuestRating( + count = count, + overall = overall, + cleanliness = cleanliness, + service = service, + comfort = comfort, + condition = condition, + location = location, + neighborhood = neighborhood, + quality = quality, + `value` = `value`, + amenities = amenities, + recommendationPercent = recommendationPercent + ) + + validate(instance) + + return instance + } + + private fun validate(instance: GuestRating) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -177,6 +198,6 @@ data class GuestRating( quality = quality, `value` = `value`, amenities = amenities, - recommendationPercent = recommendationPercent, + recommendationPercent = recommendationPercent ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviews.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviews.kt index 017bab8a59..abbca21644 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviews.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviews.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.GuestReviewsVerified import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A property's guest reviews. @@ -46,7 +44,7 @@ import javax.validation.constraints.Size data class GuestReviews( @JsonProperty("verified") @field:Valid - val verified: GuestReviewsVerified? = null, + val verified: GuestReviewsVerified? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class GuestReviews( } class Builder( - private var verified: GuestReviewsVerified? = null, + private var verified: GuestReviewsVerified? = null ) { fun verified(verified: GuestReviewsVerified?) = apply { this.verified = verified } fun build(): GuestReviews { - return GuestReviews( - verified = verified, - ) + val instance = + GuestReviews( + verified = verified + ) + + validate(instance) + + return instance + } + + private fun validate(instance: GuestReviews) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - verified = verified, + verified = verified ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviewsVerified.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviewsVerified.kt index 494609a7e1..7c418c4aa0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviewsVerified.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestReviewsVerified.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Review import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A property's verified guest reviews. @@ -47,7 +45,7 @@ data class GuestReviewsVerified( // A collection of the guest reviews which have been verified, in order, starting with the newest. @JsonProperty("recent") @field:Valid - val recent: kotlin.collections.List? = null, + val recent: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -55,19 +53,42 @@ data class GuestReviewsVerified( } class Builder( - private var recent: kotlin.collections.List? = null, + private var recent: kotlin.collections.List? = null ) { fun recent(recent: kotlin.collections.List?) = apply { this.recent = recent } fun build(): GuestReviewsVerified { - return GuestReviewsVerified( - recent = recent, - ) + val instance = + GuestReviewsVerified( + recent = recent + ) + + validate(instance) + + return instance + } + + private fun validate(instance: GuestReviewsVerified) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - recent = recent, + recent = recent ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image.kt index e795087416..6da1a6ce89 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual image. See our [image categories reference](https://developers.expediagroup.com/docs/rapid/lodging/content/content-reference-lists) for current known caption and category values. @@ -62,7 +60,7 @@ data class Image( // Contains urls for all of the image sizes available. Sizes may include: 70 px, 200px, 350 px, and 1,000 px @JsonProperty("links") @field:Valid - val links: kotlin.collections.Map? = null, + val links: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -73,7 +71,7 @@ data class Image( private var heroImage: kotlin.Boolean? = null, private var category: java.math.BigDecimal? = null, private var caption: kotlin.String? = null, - private var links: kotlin.collections.Map? = null, + private var links: kotlin.collections.Map? = null ) { fun heroImage(heroImage: kotlin.Boolean?) = apply { this.heroImage = heroImage } @@ -84,12 +82,35 @@ data class Image( fun links(links: kotlin.collections.Map?) = apply { this.links = links } fun build(): Image { - return Image( - heroImage = heroImage, - category = category, - caption = caption, - links = links, - ) + val instance = + Image( + heroImage = heroImage, + category = category, + caption = caption, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Image) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -98,6 +119,6 @@ data class Image( heroImage = heroImage, category = category, caption = caption, - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image1.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image1.kt index 89ff00e7d5..ec822ae30e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image1.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Image1.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -56,7 +54,7 @@ data class Image1( // The height of the image. @JsonProperty("height") @field:Valid - val height: kotlin.String? = null, + val height: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Image1( class Builder( private var url: kotlin.String? = null, private var width: kotlin.String? = null, - private var height: kotlin.String? = null, + private var height: kotlin.String? = null ) { fun url(url: kotlin.String?) = apply { this.url = url } @@ -75,11 +73,34 @@ data class Image1( fun height(height: kotlin.String?) = apply { this.height = height } fun build(): Image1 { - return Image1( - url = url, - width = width, - height = height, - ) + val instance = + Image1( + url = url, + width = width, + height = height + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Image1) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Image1( Builder( url = url, width = width, - height = height, + height = height ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Itinerary.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Itinerary.kt index 3ce64b5dda..2be04a2a91 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Itinerary.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Itinerary.kt @@ -25,11 +25,12 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Adjustment import com.expediagroup.sdk.rapid.models.BillingContact import com.expediagroup.sdk.rapid.models.Conversations @@ -41,12 +42,9 @@ import com.expediagroup.sdk.rapid.models.RoomHistoryItem import com.expediagroup.sdk.rapid.models.RoomItinerary import com.expediagroup.sdk.rapid.models.TraderInformation import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The itinerary object. @@ -126,7 +124,7 @@ data class Itinerary( // An array of rooms each containing an array of room history events. @JsonProperty("room_history") @field:Valid - val roomHistory: kotlin.collections.List>? = null, + val roomHistory: kotlin.collections.List>? = null ) { companion object { @JvmStatic @@ -150,7 +148,7 @@ data class Itinerary( private var essentialInformation: EssentialInformation? = null, private var travelPurpose: Itinerary.TravelPurpose? = null, private var itineraryHistory: kotlin.collections.List? = null, - private var roomHistory: kotlin.collections.List>? = null, + private var roomHistory: kotlin.collections.List>? = null ) { fun itineraryId(itineraryId: kotlin.String?) = apply { this.itineraryId = itineraryId } @@ -182,32 +180,53 @@ data class Itinerary( fun travelPurpose(travelPurpose: Itinerary.TravelPurpose?) = apply { this.travelPurpose = travelPurpose } - fun itineraryHistory(itineraryHistory: kotlin.collections.List?) = - apply { this.itineraryHistory = itineraryHistory } + fun itineraryHistory(itineraryHistory: kotlin.collections.List?) = apply { this.itineraryHistory = itineraryHistory } - fun roomHistory(roomHistory: kotlin.collections.List>?) = - apply { this.roomHistory = roomHistory } + fun roomHistory(roomHistory: kotlin.collections.List>?) = apply { this.roomHistory = roomHistory } fun build(): Itinerary { - return Itinerary( - itineraryId = itineraryId, - propertyId = propertyId, - links = links, - email = email, - phone = phone, - rooms = rooms, - billingContact = billingContact, - adjustment = adjustment, - creationDateTime = creationDateTime, - affiliateReferenceId = affiliateReferenceId, - affiliateMetadata = affiliateMetadata, - conversations = conversations, - traderInformation = traderInformation, - essentialInformation = essentialInformation, - travelPurpose = travelPurpose, - itineraryHistory = itineraryHistory, - roomHistory = roomHistory, - ) + val instance = + Itinerary( + itineraryId = itineraryId, + propertyId = propertyId, + links = links, + email = email, + phone = phone, + rooms = rooms, + billingContact = billingContact, + adjustment = adjustment, + creationDateTime = creationDateTime, + affiliateReferenceId = affiliateReferenceId, + affiliateMetadata = affiliateMetadata, + conversations = conversations, + traderInformation = traderInformation, + essentialInformation = essentialInformation, + travelPurpose = travelPurpose, + itineraryHistory = itineraryHistory, + roomHistory = roomHistory + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Itinerary) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -229,7 +248,7 @@ data class Itinerary( essentialInformation = essentialInformation, travelPurpose = travelPurpose, itineraryHistory = itineraryHistory, - roomHistory = roomHistory, + roomHistory = roomHistory ) /** @@ -244,6 +263,6 @@ data class Itinerary( BUSINESS("business"), @JsonProperty("unspecified") - UNSPECIFIED("unspecified"), + UNSPECIFIED("unspecified") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreation.kt index 45063921f9..57b849fb26 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreation.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.ItineraryCreationLinks import com.expediagroup.sdk.rapid.models.TraderInformation import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The book response. @@ -61,7 +59,7 @@ data class ItineraryCreation( val encodedChallengeConfig: kotlin.String? = null, @JsonProperty("trader_information") @field:Valid - val traderInformation: TraderInformation? = null, + val traderInformation: TraderInformation? = null ) { companion object { @JvmStatic @@ -72,7 +70,7 @@ data class ItineraryCreation( private var itineraryId: kotlin.String? = null, private var links: ItineraryCreationLinks? = null, private var encodedChallengeConfig: kotlin.String? = null, - private var traderInformation: TraderInformation? = null, + private var traderInformation: TraderInformation? = null ) { fun itineraryId(itineraryId: kotlin.String?) = apply { this.itineraryId = itineraryId } @@ -83,12 +81,35 @@ data class ItineraryCreation( fun traderInformation(traderInformation: TraderInformation?) = apply { this.traderInformation = traderInformation } fun build(): ItineraryCreation { - return ItineraryCreation( - itineraryId = itineraryId, - links = links, - encodedChallengeConfig = encodedChallengeConfig, - traderInformation = traderInformation, - ) + val instance = + ItineraryCreation( + itineraryId = itineraryId, + links = links, + encodedChallengeConfig = encodedChallengeConfig, + traderInformation = traderInformation + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ItineraryCreation) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -97,6 +118,6 @@ data class ItineraryCreation( itineraryId = itineraryId, links = links, encodedChallengeConfig = encodedChallengeConfig, - traderInformation = traderInformation, + traderInformation = traderInformation ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreationLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreationLinks.kt index 13daefc3d7..3f0783876a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreationLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryCreationLinks.kt @@ -25,23 +25,21 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.DeleteHeldBookingOperationLink import com.expediagroup.sdk.rapid.operations.GetReservationByItineraryIdOperationLink import com.expediagroup.sdk.rapid.operations.PutCompletePaymentSessionOperationLink import com.expediagroup.sdk.rapid.operations.PutResumeBookingOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to retrieve a booking, resume a held booking, cancel a held booking, or complete a payment session if a challenge is used. @@ -63,7 +61,7 @@ data class ItineraryCreationLinks( val completePaymentSession: PutCompletePaymentSessionOperationLink? = null, @JsonProperty("cancel") @field:Valid - val cancel: DeleteHeldBookingOperationLink? = null, + val cancel: DeleteHeldBookingOperationLink? = null ) { companion object { @JvmStatic @@ -74,26 +72,46 @@ data class ItineraryCreationLinks( private var retrieve: GetReservationByItineraryIdOperationLink? = null, private var resume: PutResumeBookingOperationLink? = null, private var completePaymentSession: PutCompletePaymentSessionOperationLink? = null, - private var cancel: DeleteHeldBookingOperationLink? = null, + private var cancel: DeleteHeldBookingOperationLink? = null ) { fun retrieve(retrieve: GetReservationByItineraryIdOperationLink?) = apply { this.retrieve = retrieve } fun resume(resume: PutResumeBookingOperationLink?) = apply { this.resume = resume } - fun completePaymentSession(completePaymentSession: PutCompletePaymentSessionOperationLink?) = - apply { - this.completePaymentSession = completePaymentSession - } + fun completePaymentSession(completePaymentSession: PutCompletePaymentSessionOperationLink?) = apply { this.completePaymentSession = completePaymentSession } fun cancel(cancel: DeleteHeldBookingOperationLink?) = apply { this.cancel = cancel } fun build(): ItineraryCreationLinks { - return ItineraryCreationLinks( - retrieve = retrieve, - resume = resume, - completePaymentSession = completePaymentSession, - cancel = cancel, - ) + val instance = + ItineraryCreationLinks( + retrieve = retrieve, + resume = resume, + completePaymentSession = completePaymentSession, + cancel = cancel + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ItineraryCreationLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -102,6 +120,6 @@ data class ItineraryCreationLinks( retrieve = retrieve, resume = resume, completePaymentSession = completePaymentSession, - cancel = cancel, + cancel = cancel ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryHistoryItem.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryHistoryItem.kt index d12daa4e3a..c734cff09a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryHistoryItem.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryHistoryItem.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amount import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An itinerary history change event, representing a charge or refund made to the itinerary and not a specific room. @@ -64,7 +62,7 @@ data class ItineraryHistoryItem( // An agent user id number associated with a modification. @JsonProperty("agent_id") @field:Valid - val agentId: kotlin.Int? = null, + val agentId: kotlin.Int? = null ) { companion object { @JvmStatic @@ -76,7 +74,7 @@ data class ItineraryHistoryItem( private var eventTimestamp: kotlin.String? = null, private var eventType: ItineraryHistoryItem.EventType? = null, private var amount: Amount? = null, - private var agentId: kotlin.Int? = null, + private var agentId: kotlin.Int? = null ) { fun historyId(historyId: kotlin.String?) = apply { this.historyId = historyId } @@ -89,13 +87,36 @@ data class ItineraryHistoryItem( fun agentId(agentId: kotlin.Int?) = apply { this.agentId = agentId } fun build(): ItineraryHistoryItem { - return ItineraryHistoryItem( - historyId = historyId, - eventTimestamp = eventTimestamp, - eventType = eventType, - amount = amount, - agentId = agentId, - ) + val instance = + ItineraryHistoryItem( + historyId = historyId, + eventTimestamp = eventTimestamp, + eventType = eventType, + amount = amount, + agentId = agentId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ItineraryHistoryItem) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -105,7 +126,7 @@ data class ItineraryHistoryItem( eventTimestamp = eventTimestamp, eventType = eventType, amount = amount, - agentId = agentId, + agentId = agentId ) /** @@ -117,6 +138,6 @@ data class ItineraryHistoryItem( ADJUSTMENT("adjustment"), @JsonProperty("coupon") - COUPON("coupon"), + COUPON("coupon") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryLinks.kt index 4e9223bf8d..0522778044 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ItineraryLinks.kt @@ -25,21 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.DeleteHeldBookingOperationLink import com.expediagroup.sdk.rapid.operations.PutResumeBookingOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to resume or cancel a held booking. This is only included for held bookings. @@ -57,7 +55,7 @@ data class ItineraryLinks( val cancel: DeleteHeldBookingOperationLink? = null, @JsonProperty("non_vat_expedia_invoice") @field:Valid - val nonVatExpediaInvoice: Link? = null, + val nonVatExpediaInvoice: Link? = null ) { companion object { @JvmStatic @@ -67,7 +65,7 @@ data class ItineraryLinks( class Builder( private var resume: PutResumeBookingOperationLink? = null, private var cancel: DeleteHeldBookingOperationLink? = null, - private var nonVatExpediaInvoice: Link? = null, + private var nonVatExpediaInvoice: Link? = null ) { fun resume(resume: PutResumeBookingOperationLink?) = apply { this.resume = resume } @@ -76,11 +74,34 @@ data class ItineraryLinks( fun nonVatExpediaInvoice(nonVatExpediaInvoice: Link?) = apply { this.nonVatExpediaInvoice = nonVatExpediaInvoice } fun build(): ItineraryLinks { - return ItineraryLinks( - resume = resume, - cancel = cancel, - nonVatExpediaInvoice = nonVatExpediaInvoice, - ) + val instance = + ItineraryLinks( + resume = resume, + cancel = cancel, + nonVatExpediaInvoice = nonVatExpediaInvoice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ItineraryLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -88,6 +109,6 @@ data class ItineraryLinks( Builder( resume = resume, cancel = cancel, - nonVatExpediaInvoice = nonVatExpediaInvoice, + nonVatExpediaInvoice = nonVatExpediaInvoice ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link.kt index ef885a0cdb..61a680c328 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual link. @@ -56,7 +54,7 @@ open class Link( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - open val expires: kotlin.String? = null, + open val expires: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ open class Link( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { fun method(method: kotlin.String?) = apply { this.method = method } @@ -75,11 +73,34 @@ open class Link( fun expires(expires: kotlin.String?) = apply { this.expires = expires } fun build(): Link { - return Link( - method = method, - href = href, - expires = expires, - ) + val instance = + Link( + method = method, + href = href, + expires = expires + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Link) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ open class Link( Builder( method = method, href = href, - expires = expires, + expires = expires ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Localized.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Localized.kt index eb2f2063a8..9806f20e36 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Localized.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Localized.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.GetPropertyContentOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Container for localized address information. @@ -49,7 +47,7 @@ data class Localized( // Keyed by the language, a map of links to the property’s localized address(es) based on the primary language(s) spoken in the property’s country. Only languages supported by the Rapid API are provided. @JsonProperty("links") @field:Valid - val links: kotlin.collections.Map? = null, + val links: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -57,19 +55,42 @@ data class Localized( } class Builder( - private var links: kotlin.collections.Map? = null, + private var links: kotlin.collections.Map? = null ) { fun links(links: kotlin.collections.Map?) = apply { this.links = links } fun build(): Localized { - return Localized( - links = links, - ) + val instance = + Localized( + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Localized) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Location.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Location.kt index 44bf7a3d46..00d05dd0cf 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Location.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Location.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Coordinates import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The property's location information. @@ -55,7 +53,7 @@ data class Location( // When this field is true, the `obfuscated_coordinates` must be used to display approximate location instead of the precise location of `coordinates`. @JsonProperty("obfuscation_required") @field:Valid - val obfuscationRequired: kotlin.Boolean? = null, + val obfuscationRequired: kotlin.Boolean? = null ) { companion object { @JvmStatic @@ -65,7 +63,7 @@ data class Location( class Builder( private var coordinates: Coordinates? = null, private var obfuscatedCoordinates: Coordinates? = null, - private var obfuscationRequired: kotlin.Boolean? = null, + private var obfuscationRequired: kotlin.Boolean? = null ) { fun coordinates(coordinates: Coordinates?) = apply { this.coordinates = coordinates } @@ -74,11 +72,34 @@ data class Location( fun obfuscationRequired(obfuscationRequired: kotlin.Boolean?) = apply { this.obfuscationRequired = obfuscationRequired } fun build(): Location { - return Location( - coordinates = coordinates, - obfuscatedCoordinates = obfuscatedCoordinates, - obfuscationRequired = obfuscationRequired, - ) + val instance = + Location( + coordinates = coordinates, + obfuscatedCoordinates = obfuscatedCoordinates, + obfuscationRequired = obfuscationRequired + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Location) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -86,6 +107,6 @@ data class Location( Builder( coordinates = coordinates, obfuscatedCoordinates = obfuscatedCoordinates, - obfuscationRequired = obfuscationRequired, + obfuscationRequired = obfuscationRequired ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Loyalty.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Loyalty.kt index 16e5484d51..bfc32c8b21 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Loyalty.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Loyalty.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A loyalty object for a loyalty program. @@ -51,7 +49,7 @@ data class Loyalty( // The identifier for the loyalty program. @JsonProperty("program_id") @field:Valid - val programId: kotlin.String? = null, + val programId: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Loyalty( class Builder( private var memberId: kotlin.String? = null, - private var programId: kotlin.String? = null, + private var programId: kotlin.String? = null ) { fun memberId(memberId: kotlin.String?) = apply { this.memberId = memberId } fun programId(programId: kotlin.String?) = apply { this.programId = programId } fun build(): Loyalty { - return Loyalty( - memberId = memberId, - programId = programId, - ) + val instance = + Loyalty( + memberId = memberId, + programId = programId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Loyalty) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( memberId = memberId, - programId = programId, + programId = programId ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ManagementResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ManagementResponse.kt index a74f066ae5..1533995bfe 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ManagementResponse.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ManagementResponse.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A reply from the property management to the review left by the traveler. @@ -51,7 +49,7 @@ data class ManagementResponse( // When this management response was made, in ISO 8601 format. @JsonProperty("date") @field:Valid - val date: kotlin.String? = null, + val date: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class ManagementResponse( class Builder( private var text: kotlin.String? = null, - private var date: kotlin.String? = null, + private var date: kotlin.String? = null ) { fun text(text: kotlin.String?) = apply { this.text = text } fun date(date: kotlin.String?) = apply { this.date = date } fun build(): ManagementResponse { - return ManagementResponse( - text = text, - date = date, - ) + val instance = + ManagementResponse( + text = text, + date = date + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ManagementResponse) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( text = text, - date = date, + date = date ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MarketingFeeIncentive.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MarketingFeeIncentive.kt index 5b98bf7722..f1ea02c1e0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MarketingFeeIncentive.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MarketingFeeIncentive.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An object representing one incentive source and the stay dates relevant to that particular incentive. @@ -56,7 +54,7 @@ data class MarketingFeeIncentive( // The last stay date with the incentive applied in ISO 8601 format. @JsonProperty("end") @field:Valid - val end: kotlin.String? = null, + val end: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class MarketingFeeIncentive( class Builder( private var source: kotlin.String? = null, private var start: kotlin.String? = null, - private var end: kotlin.String? = null, + private var end: kotlin.String? = null ) { fun source(source: kotlin.String?) = apply { this.source = source } @@ -75,11 +73,34 @@ data class MarketingFeeIncentive( fun end(end: kotlin.String?) = apply { this.end = end } fun build(): MarketingFeeIncentive { - return MarketingFeeIncentive( - source = source, - start = start, - end = end, - ) + val instance = + MarketingFeeIncentive( + source = source, + start = start, + end = end + ) + + validate(instance) + + return instance + } + + private fun validate(instance: MarketingFeeIncentive) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class MarketingFeeIncentive( Builder( source = source, start = start, - end = end, + end = end ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MaxAllowed.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MaxAllowed.kt index 19a66c10b3..70de9d0b35 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MaxAllowed.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MaxAllowed.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Maximum occupancy counts. @@ -56,7 +54,7 @@ data class MaxAllowed( // Maximum number of adults allowed. @JsonProperty("adults") @field:Valid - val adults: java.math.BigDecimal? = null, + val adults: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class MaxAllowed( class Builder( private var total: java.math.BigDecimal? = null, private var children: java.math.BigDecimal? = null, - private var adults: java.math.BigDecimal? = null, + private var adults: java.math.BigDecimal? = null ) { fun total(total: java.math.BigDecimal?) = apply { this.total = total } @@ -75,11 +73,34 @@ data class MaxAllowed( fun adults(adults: java.math.BigDecimal?) = apply { this.adults = adults } fun build(): MaxAllowed { - return MaxAllowed( - total = total, - children = children, - adults = adults, - ) + val instance = + MaxAllowed( + total = total, + children = children, + adults = adults + ) + + validate(instance) + + return instance + } + + private fun validate(instance: MaxAllowed) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class MaxAllowed( Builder( total = total, children = children, - adults = adults, + adults = adults ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MerchantOfRecord.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MerchantOfRecord.kt index 186da8a3ce..b867e0d383 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MerchantOfRecord.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MerchantOfRecord.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -41,5 +41,5 @@ enum class MerchantOfRecord(val value: kotlin.String) { EXPEDIA("expedia"), @JsonProperty("property") - PROPERTY("property"), + PROPERTY("property") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygon.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygon.kt index e569c8c8a0..8e117c7fad 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygon.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygon.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BoundingPolygon import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -47,8 +45,7 @@ data class MultiPolygon( // An array of multiple polygon(s) that combine to make a full [MultiPolygon](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.7) in geojson format. @JsonProperty("coordinates") @field:Valid - val coordinates: - kotlin.collections.List>>>? = null, + val coordinates: kotlin.collections.List>>>? = null ) : BoundingPolygon { @JsonProperty("type") override val type: kotlin.String = "MULTIPOLYGON" @@ -59,23 +56,46 @@ data class MultiPolygon( } class Builder( - private var coordinates: - kotlin.collections.List>>>? = null, + private var coordinates: kotlin.collections.List>>>? = null ) { - fun coordinates( - coordinates: - kotlin.collections.List>>>?, - ) = apply { this.coordinates = coordinates } + fun coordinates(coordinates: kotlin.collections.List>>>?) = + apply { + this.coordinates = + coordinates + } fun build(): MultiPolygon { - return MultiPolygon( - coordinates = coordinates, - ) + val instance = + MultiPolygon( + coordinates = coordinates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: MultiPolygon) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - coordinates = coordinates, + coordinates = coordinates ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygonAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygonAllOf.kt index 29a252f698..7423402dde 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygonAllOf.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/MultiPolygonAllOf.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -46,8 +44,7 @@ data class MultiPolygonAllOf( // An array of multiple polygon(s) that combine to make a full [MultiPolygon](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.7) in geojson format. @JsonProperty("coordinates") @field:Valid - val coordinates: - kotlin.collections.List>>>? = null, + val coordinates: kotlin.collections.List>>>? = null ) { companion object { @JvmStatic @@ -55,23 +52,46 @@ data class MultiPolygonAllOf( } class Builder( - private var coordinates: - kotlin.collections.List>>>? = null, + private var coordinates: kotlin.collections.List>>>? = null ) { - fun coordinates( - coordinates: - kotlin.collections.List>>>?, - ) = apply { this.coordinates = coordinates } + fun coordinates(coordinates: kotlin.collections.List>>>?) = + apply { + this.coordinates = + coordinates + } fun build(): MultiPolygonAllOf { - return MultiPolygonAllOf( - coordinates = coordinates, - ) + val instance = + MultiPolygonAllOf( + coordinates = coordinates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: MultiPolygonAllOf) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - coordinates = coordinates, + coordinates = coordinates ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightCharge.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightCharge.kt index f385bcffb2..ce254f2b8d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightCharge.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightCharge.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.NightChargeType import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -56,7 +54,7 @@ data class NightCharge( // Currency of the amount object. @JsonProperty("currency") @field:Valid - val currency: kotlin.String? = null, + val currency: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class NightCharge( class Builder( private var type: NightChargeType? = null, private var `value`: kotlin.String? = null, - private var currency: kotlin.String? = null, + private var currency: kotlin.String? = null ) { fun type(type: NightChargeType?) = apply { this.type = type } @@ -75,11 +73,34 @@ data class NightCharge( fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun build(): NightCharge { - return NightCharge( - type = type, - `value` = `value`, - currency = currency, - ) + val instance = + NightCharge( + type = type, + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: NightCharge) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class NightCharge( Builder( type = type, `value` = `value`, - currency = currency, + currency = currency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightChargeType.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightChargeType.kt index 92d5439d86..2f31fa0555 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightChargeType.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NightChargeType.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -59,5 +59,5 @@ enum class NightChargeType(val value: kotlin.String) { RECOVERY_CHARGES_AND_FEES("recovery_charges_and_fees"), @JsonProperty("traveler_service_fee") - TRAVELER_SERVICE_FEE("traveler_service_fee"), + TRAVELER_SERVICE_FEE("traveler_service_fee") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NonrefundableDateRange.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NonrefundableDateRange.kt index 01ea0465cd..72d849222c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NonrefundableDateRange.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/NonrefundableDateRange.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -51,7 +49,7 @@ data class NonrefundableDateRange( // End date of nonrefundable date range in ISO 8601 format. @JsonProperty("end") @field:Valid - val end: kotlin.String? = null, + val end: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class NonrefundableDateRange( class Builder( private var start: kotlin.String? = null, - private var end: kotlin.String? = null, + private var end: kotlin.String? = null ) { fun start(start: kotlin.String?) = apply { this.start = start } fun end(end: kotlin.String?) = apply { this.end = end } fun build(): NonrefundableDateRange { - return NonrefundableDateRange( - start = start, - end = end, - ) + val instance = + NonrefundableDateRange( + start = start, + end = end + ) + + validate(instance) + + return instance + } + + private fun validate(instance: NonrefundableDateRange) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( start = start, - end = end, + end = end ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Notification.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Notification.kt index 9eafaa7152..4a563d5823 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Notification.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Notification.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A notification. @@ -76,7 +74,7 @@ data class Notification( // The Affiliate Reference ID of the affected booking @JsonProperty("affiliate_reference_id") @field:Valid - val affiliateReferenceId: kotlin.String? = null, + val affiliateReferenceId: kotlin.String? = null ) { companion object { @JvmStatic @@ -90,7 +88,7 @@ data class Notification( private var itineraryId: kotlin.String? = null, private var email: kotlin.String? = null, private var message: kotlin.String? = null, - private var affiliateReferenceId: kotlin.String? = null, + private var affiliateReferenceId: kotlin.String? = null ) { fun eventId(eventId: kotlin.String?) = apply { this.eventId = eventId } @@ -107,15 +105,38 @@ data class Notification( fun affiliateReferenceId(affiliateReferenceId: kotlin.String?) = apply { this.affiliateReferenceId = affiliateReferenceId } fun build(): Notification { - return Notification( - eventId = eventId, - eventType = eventType, - eventTime = eventTime, - itineraryId = itineraryId, - email = email, - message = message, - affiliateReferenceId = affiliateReferenceId, - ) + val instance = + Notification( + eventId = eventId, + eventType = eventType, + eventTime = eventTime, + itineraryId = itineraryId, + email = email, + message = message, + affiliateReferenceId = affiliateReferenceId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Notification) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -127,6 +148,6 @@ data class Notification( itineraryId = itineraryId, email = email, message = message, - affiliateReferenceId = affiliateReferenceId, + affiliateReferenceId = affiliateReferenceId ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Occupancy.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Occupancy.kt index bb86b46098..2f3cd395c6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Occupancy.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Occupancy.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.CategoryAge import com.expediagroup.sdk.rapid.models.MaxAllowed import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Occupancy information. @@ -52,7 +50,7 @@ data class Occupancy( // Map of the age categories used to determine the maximum children and adult occupancy. @JsonProperty("age_categories") @field:Valid - val ageCategories: kotlin.collections.Map? = null, + val ageCategories: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -61,23 +59,46 @@ data class Occupancy( class Builder( private var maxAllowed: MaxAllowed? = null, - private var ageCategories: kotlin.collections.Map? = null, + private var ageCategories: kotlin.collections.Map? = null ) { fun maxAllowed(maxAllowed: MaxAllowed?) = apply { this.maxAllowed = maxAllowed } fun ageCategories(ageCategories: kotlin.collections.Map?) = apply { this.ageCategories = ageCategories } fun build(): Occupancy { - return Occupancy( - maxAllowed = maxAllowed, - ageCategories = ageCategories, - ) + val instance = + Occupancy( + maxAllowed = maxAllowed, + ageCategories = ageCategories + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Occupancy) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( maxAllowed = maxAllowed, - ageCategories = ageCategories, + ageCategories = ageCategories ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OfferType.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OfferType.kt index 7b648508cf..5ee5486aa0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OfferType.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OfferType.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -50,5 +50,5 @@ enum class OfferType(val value: kotlin.String) { FREE("free"), @JsonProperty("voucher") - VOUCHER("voucher"), + VOUCHER("voucher") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OnsitePayments.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OnsitePayments.kt index 2c52ce522d..915655cf9e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OnsitePayments.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/OnsitePayments.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.PaymentType import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The property’s accepted forms of payments when onsite. See our [onsite payment types reference](https://developers.expediagroup.com/docs/rapid/lodging/content/content-reference-lists) for current known payment type ID and name values. @@ -52,7 +50,7 @@ data class OnsitePayments( // The types of payments accepted at the property. @JsonProperty("types") @field:Valid - val types: kotlin.collections.Map? = null, + val types: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -61,23 +59,46 @@ data class OnsitePayments( class Builder( private var currency: kotlin.String? = null, - private var types: kotlin.collections.Map? = null, + private var types: kotlin.collections.Map? = null ) { fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun types(types: kotlin.collections.Map?) = apply { this.types = types } fun build(): OnsitePayments { - return OnsitePayments( - currency = currency, - types = types, - ) + val instance = + OnsitePayments( + currency = currency, + types = types + ) + + validate(instance) + + return instance + } + + private fun validate(instance: OnsitePayments) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( currency = currency, - types = types, + types = types ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentOption.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentOption.kt index af0692176e..9bae41b1dc 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentOption.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentOption.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.AffiliateCollect import com.expediagroup.sdk.rapid.models.CreditCard import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The payment option response. @@ -51,7 +49,7 @@ data class PaymentOption( val affiliateCollect: AffiliateCollect? = null, @JsonProperty("credit_card") @field:Valid - val creditCard: CreditCard? = null, + val creditCard: CreditCard? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class PaymentOption( class Builder( private var affiliateCollect: AffiliateCollect? = null, - private var creditCard: CreditCard? = null, + private var creditCard: CreditCard? = null ) { fun affiliateCollect(affiliateCollect: AffiliateCollect?) = apply { this.affiliateCollect = affiliateCollect } fun creditCard(creditCard: CreditCard?) = apply { this.creditCard = creditCard } fun build(): PaymentOption { - return PaymentOption( - affiliateCollect = affiliateCollect, - creditCard = creditCard, - ) + val instance = + PaymentOption( + affiliateCollect = affiliateCollect, + creditCard = creditCard + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentOption) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( affiliateCollect = affiliateCollect, - creditCard = creditCard, + creditCard = creditCard ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequest.kt index f45c818a42..b079288a36 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequest.kt @@ -25,20 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BillingContactRequest import com.expediagroup.sdk.rapid.models.ThirdPartyAuthRequest import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -54,8 +53,10 @@ import javax.validation.constraints.Size data class PaymentRequest( // Identifier for the type of payment. If affiliate_collect, card information is not required as EPS will not be processing the payment. However, billing contact information is still required. @JsonProperty("type") + @field:NotNull val type: PaymentRequest.Type, @JsonProperty("billing_contact") + @field:NotNull @field:Valid val billingContact: BillingContactRequest, // Card number. Required for credit card transactions. @@ -80,7 +81,7 @@ data class PaymentRequest( // Date the payment account was enrolled in the cardholder's account with the merchant, in ISO 8601 format (YYYY-MM-DD). @JsonProperty("enrollment_date") @field:Valid - val enrollmentDate: kotlin.String? = null, + val enrollmentDate: kotlin.String? = null ) { companion object { @JvmStatic @@ -95,7 +96,7 @@ data class PaymentRequest( private var expirationMonth: kotlin.String? = null, private var expirationYear: kotlin.String? = null, private var thirdPartyAuthentication: ThirdPartyAuthRequest? = null, - private var enrollmentDate: kotlin.String? = null, + private var enrollmentDate: kotlin.String? = null ) { fun type(type: PaymentRequest.Type) = apply { this.type = type } @@ -109,34 +110,43 @@ data class PaymentRequest( fun expirationYear(expirationYear: kotlin.String?) = apply { this.expirationYear = expirationYear } - fun thirdPartyAuthentication(thirdPartyAuthentication: ThirdPartyAuthRequest?) = - apply { - this.thirdPartyAuthentication = thirdPartyAuthentication - } + fun thirdPartyAuthentication(thirdPartyAuthentication: ThirdPartyAuthRequest?) = apply { this.thirdPartyAuthentication = thirdPartyAuthentication } fun enrollmentDate(enrollmentDate: kotlin.String?) = apply { this.enrollmentDate = enrollmentDate } fun build(): PaymentRequest { - // Check required params - validateNullity() - return PaymentRequest( - type = type!!, - billingContact = billingContact!!, - number = number, - securityCode = securityCode, - expirationMonth = expirationMonth, - expirationYear = expirationYear, - thirdPartyAuthentication = thirdPartyAuthentication, - enrollmentDate = enrollmentDate, - ) + val instance = + PaymentRequest( + type = type!!, + billingContact = billingContact!!, + number = number, + securityCode = securityCode, + expirationMonth = expirationMonth, + expirationYear = expirationYear, + thirdPartyAuthentication = thirdPartyAuthentication, + enrollmentDate = enrollmentDate + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (type == null) { - throw NullPointerException("Required parameter type is missing") - } - if (billingContact == null) { - throw NullPointerException("Required parameter billingContact is missing") + private fun validate(instance: PaymentRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -150,7 +160,7 @@ data class PaymentRequest( expirationMonth = expirationMonth, expirationYear = expirationYear, thirdPartyAuthentication = thirdPartyAuthentication, - enrollmentDate = enrollmentDate, + enrollmentDate = enrollmentDate ) /** @@ -168,6 +178,6 @@ data class PaymentRequest( VIRTUAL_CARD("virtual_card"), @JsonProperty("affiliate_collect") - AFFILIATE_COLLECT("affiliate_collect"), + AFFILIATE_COLLECT("affiliate_collect") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequestWithPhone.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequestWithPhone.kt index 5b4036fded..239a3a0735 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequestWithPhone.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentRequestWithPhone.kt @@ -25,20 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BillingContactRequestWithPhone import com.expediagroup.sdk.rapid.models.ThirdPartyAuthRequest import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -54,8 +53,10 @@ import javax.validation.constraints.Size data class PaymentRequestWithPhone( // Identifier for the type of payment. If affiliate_collect, cardholder information is not required as EPS will not be processing the payment. @JsonProperty("type") + @field:NotNull val type: PaymentRequestWithPhone.Type, @JsonProperty("billing_contact") + @field:NotNull @field:Valid val billingContact: BillingContactRequestWithPhone, // Card number. Required for credit card transactions. @@ -80,7 +81,7 @@ data class PaymentRequestWithPhone( // Date the payment account was enrolled in the cardholder's account with the merchant, in ISO 8601 format (YYYY-MM-DD). @JsonProperty("enrollment_date") @field:Valid - val enrollmentDate: kotlin.String? = null, + val enrollmentDate: kotlin.String? = null ) { companion object { @JvmStatic @@ -95,7 +96,7 @@ data class PaymentRequestWithPhone( private var expirationMonth: kotlin.String? = null, private var expirationYear: kotlin.String? = null, private var thirdPartyAuthentication: ThirdPartyAuthRequest? = null, - private var enrollmentDate: kotlin.String? = null, + private var enrollmentDate: kotlin.String? = null ) { fun type(type: PaymentRequestWithPhone.Type) = apply { this.type = type } @@ -109,34 +110,43 @@ data class PaymentRequestWithPhone( fun expirationYear(expirationYear: kotlin.String?) = apply { this.expirationYear = expirationYear } - fun thirdPartyAuthentication(thirdPartyAuthentication: ThirdPartyAuthRequest?) = - apply { - this.thirdPartyAuthentication = thirdPartyAuthentication - } + fun thirdPartyAuthentication(thirdPartyAuthentication: ThirdPartyAuthRequest?) = apply { this.thirdPartyAuthentication = thirdPartyAuthentication } fun enrollmentDate(enrollmentDate: kotlin.String?) = apply { this.enrollmentDate = enrollmentDate } fun build(): PaymentRequestWithPhone { - // Check required params - validateNullity() - return PaymentRequestWithPhone( - type = type!!, - billingContact = billingContact!!, - number = number, - securityCode = securityCode, - expirationMonth = expirationMonth, - expirationYear = expirationYear, - thirdPartyAuthentication = thirdPartyAuthentication, - enrollmentDate = enrollmentDate, - ) + val instance = + PaymentRequestWithPhone( + type = type!!, + billingContact = billingContact!!, + number = number, + securityCode = securityCode, + expirationMonth = expirationMonth, + expirationYear = expirationYear, + thirdPartyAuthentication = thirdPartyAuthentication, + enrollmentDate = enrollmentDate + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (type == null) { - throw NullPointerException("Required parameter type is missing") - } - if (billingContact == null) { - throw NullPointerException("Required parameter billingContact is missing") + private fun validate(instance: PaymentRequestWithPhone) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -150,7 +160,7 @@ data class PaymentRequestWithPhone( expirationMonth = expirationMonth, expirationYear = expirationYear, thirdPartyAuthentication = thirdPartyAuthentication, - enrollmentDate = enrollmentDate, + enrollmentDate = enrollmentDate ) /** @@ -168,6 +178,6 @@ data class PaymentRequestWithPhone( VIRTUAL_CARD("virtual_card"), @JsonProperty("affiliate_collect") - AFFILIATE_COLLECT("affiliate_collect"), + AFFILIATE_COLLECT("affiliate_collect") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessions.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessions.kt index b0e1d851b9..69e653868e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessions.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessions.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.PaymentSessionsLinks import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The payment registration response. @@ -56,7 +54,7 @@ data class PaymentSessions( val encodedInitConfig: kotlin.String? = null, @JsonProperty("links") @field:Valid - val links: PaymentSessionsLinks? = null, + val links: PaymentSessionsLinks? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class PaymentSessions( class Builder( private var paymentSessionId: kotlin.String? = null, private var encodedInitConfig: kotlin.String? = null, - private var links: PaymentSessionsLinks? = null, + private var links: PaymentSessionsLinks? = null ) { fun paymentSessionId(paymentSessionId: kotlin.String?) = apply { this.paymentSessionId = paymentSessionId } @@ -75,11 +73,34 @@ data class PaymentSessions( fun links(links: PaymentSessionsLinks?) = apply { this.links = links } fun build(): PaymentSessions { - return PaymentSessions( - paymentSessionId = paymentSessionId, - encodedInitConfig = encodedInitConfig, - links = links, - ) + val instance = + PaymentSessions( + paymentSessionId = paymentSessionId, + encodedInitConfig = encodedInitConfig, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentSessions) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class PaymentSessions( Builder( paymentSessionId = paymentSessionId, encodedInitConfig = encodedInitConfig, - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsLinks.kt index a4eb647cd4..a30db1a4a6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsLinks.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.PostItineraryOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to create a booking. @@ -48,7 +46,7 @@ import javax.validation.constraints.Size data class PaymentSessionsLinks( @JsonProperty("book") @field:Valid - val book: PostItineraryOperationLink? = null, + val book: PostItineraryOperationLink? = null ) { companion object { @JvmStatic @@ -56,19 +54,42 @@ data class PaymentSessionsLinks( } class Builder( - private var book: PostItineraryOperationLink? = null, + private var book: PostItineraryOperationLink? = null ) { fun book(book: PostItineraryOperationLink?) = apply { this.book = book } fun build(): PaymentSessionsLinks { - return PaymentSessionsLinks( - book = book, - ) + val instance = + PaymentSessionsLinks( + book = book + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentSessionsLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - book = book, + book = book ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequest.kt index 251ab4e4f8..6dcfd28e8e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequest.kt @@ -25,20 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.PaymentRequest import com.expediagroup.sdk.rapid.models.PaymentSessionsRequestCustomerAccountDetails import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -53,32 +52,39 @@ import javax.validation.constraints.Size data class PaymentSessionsRequest( // The version of the EgPayments.js library. @JsonProperty("version") + @field:NotNull @field:Valid val version: kotlin.String, // The customer's browser accept header that was used in the booking request. @JsonProperty("browser_accept_header") + @field:NotNull @field:Valid val browserAcceptHeader: kotlin.String, // Encoded browser metadata, provided by the EgPayments.js library. @JsonProperty("encoded_browser_metadata") + @field:NotNull @field:Valid val encodedBrowserMetadata: kotlin.String, // The preferred window size that needs to be displayed to the customer. Following are the possible values of this field: * `extra_small`: 250 x 400 * `small`: 390 x 400 * `medium`: 600 x 400 * `large`: 500 x 600 * `full_screen`: Full screen @JsonProperty("preferred_challenge_window_size") + @field:NotNull val preferredChallengeWindowSize: PaymentSessionsRequest.PreferredChallengeWindowSize, // Fully qualified URL of merchant website or customer care site. @JsonProperty("merchant_url") + @field:NotNull @field:Valid val merchantUrl: kotlin.String, @JsonProperty("customer_account_details") + @field:NotNull @field:Valid val customerAccountDetails: PaymentSessionsRequestCustomerAccountDetails, @JsonProperty("payments") + @field:NotNull @field:Valid val payments: kotlin.collections .List< - PaymentRequest, - >, + PaymentRequest + > ) { companion object { @JvmStatic @@ -92,7 +98,7 @@ data class PaymentSessionsRequest( private var preferredChallengeWindowSize: PaymentSessionsRequest.PreferredChallengeWindowSize? = null, private var merchantUrl: kotlin.String? = null, private var customerAccountDetails: PaymentSessionsRequestCustomerAccountDetails? = null, - private var payments: kotlin.collections.List? = null, + private var payments: kotlin.collections.List? = null ) { fun version(version: kotlin.String) = apply { this.version = version } @@ -102,53 +108,48 @@ data class PaymentSessionsRequest( fun preferredChallengeWindowSize(preferredChallengeWindowSize: PaymentSessionsRequest.PreferredChallengeWindowSize) = apply { - this.preferredChallengeWindowSize = preferredChallengeWindowSize + this.preferredChallengeWindowSize = + preferredChallengeWindowSize } fun merchantUrl(merchantUrl: kotlin.String) = apply { this.merchantUrl = merchantUrl } - fun customerAccountDetails(customerAccountDetails: PaymentSessionsRequestCustomerAccountDetails) = - apply { - this.customerAccountDetails = customerAccountDetails - } + fun customerAccountDetails(customerAccountDetails: PaymentSessionsRequestCustomerAccountDetails) = apply { this.customerAccountDetails = customerAccountDetails } fun payments(payments: kotlin.collections.List) = apply { this.payments = payments } fun build(): PaymentSessionsRequest { - // Check required params - validateNullity() - return PaymentSessionsRequest( - version = version!!, - browserAcceptHeader = browserAcceptHeader!!, - encodedBrowserMetadata = encodedBrowserMetadata!!, - preferredChallengeWindowSize = preferredChallengeWindowSize!!, - merchantUrl = merchantUrl!!, - customerAccountDetails = customerAccountDetails!!, - payments = payments!!, - ) + val instance = + PaymentSessionsRequest( + version = version!!, + browserAcceptHeader = browserAcceptHeader!!, + encodedBrowserMetadata = encodedBrowserMetadata!!, + preferredChallengeWindowSize = preferredChallengeWindowSize!!, + merchantUrl = merchantUrl!!, + customerAccountDetails = customerAccountDetails!!, + payments = payments!! + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (version == null) { - throw NullPointerException("Required parameter version is missing") - } - if (browserAcceptHeader == null) { - throw NullPointerException("Required parameter browserAcceptHeader is missing") - } - if (encodedBrowserMetadata == null) { - throw NullPointerException("Required parameter encodedBrowserMetadata is missing") - } - if (preferredChallengeWindowSize == null) { - throw NullPointerException("Required parameter preferredChallengeWindowSize is missing") - } - if (merchantUrl == null) { - throw NullPointerException("Required parameter merchantUrl is missing") - } - if (customerAccountDetails == null) { - throw NullPointerException("Required parameter customerAccountDetails is missing") - } - if (payments == null) { - throw NullPointerException("Required parameter payments is missing") + private fun validate(instance: PaymentSessionsRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -161,7 +162,7 @@ data class PaymentSessionsRequest( preferredChallengeWindowSize = preferredChallengeWindowSize!!, merchantUrl = merchantUrl!!, customerAccountDetails = customerAccountDetails!!, - payments = payments!!, + payments = payments!! ) /** @@ -182,6 +183,6 @@ data class PaymentSessionsRequest( LARGE("large"), @JsonProperty("full_screen") - FULL_SCREEN("full_screen"), + FULL_SCREEN("full_screen") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequestCustomerAccountDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequestCustomerAccountDetails.kt index aac5a0908f..4cc68c3d13 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequestCustomerAccountDetails.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentSessionsRequestCustomerAccountDetails.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -75,7 +73,7 @@ data class PaymentSessionsRequestCustomerAccountDetails( // Number of purchases with this cardholder's account during the previous six months. @JsonProperty("account_purchases") @field:Valid - val accountPurchases: java.math.BigDecimal? = null, + val accountPurchases: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -89,13 +87,11 @@ data class PaymentSessionsRequestCustomerAccountDetails( private var changeDate: kotlin.String? = null, private var passwordChangeDate: kotlin.String? = null, private var addCardAttempts: java.math.BigDecimal? = null, - private var accountPurchases: java.math.BigDecimal? = null, + private var accountPurchases: java.math.BigDecimal? = null ) { - fun authenticationMethod(authenticationMethod: PaymentSessionsRequestCustomerAccountDetails.AuthenticationMethod?) = - apply { this.authenticationMethod = authenticationMethod } + fun authenticationMethod(authenticationMethod: PaymentSessionsRequestCustomerAccountDetails.AuthenticationMethod?) = apply { this.authenticationMethod = authenticationMethod } - fun authenticationTimestamp(authenticationTimestamp: kotlin.String?) = - apply { this.authenticationTimestamp = authenticationTimestamp } + fun authenticationTimestamp(authenticationTimestamp: kotlin.String?) = apply { this.authenticationTimestamp = authenticationTimestamp } fun createDate(createDate: kotlin.String?) = apply { this.createDate = createDate } @@ -108,15 +104,38 @@ data class PaymentSessionsRequestCustomerAccountDetails( fun accountPurchases(accountPurchases: java.math.BigDecimal?) = apply { this.accountPurchases = accountPurchases } fun build(): PaymentSessionsRequestCustomerAccountDetails { - return PaymentSessionsRequestCustomerAccountDetails( - authenticationMethod = authenticationMethod, - authenticationTimestamp = authenticationTimestamp, - createDate = createDate, - changeDate = changeDate, - passwordChangeDate = passwordChangeDate, - addCardAttempts = addCardAttempts, - accountPurchases = accountPurchases, - ) + val instance = + PaymentSessionsRequestCustomerAccountDetails( + authenticationMethod = authenticationMethod, + authenticationTimestamp = authenticationTimestamp, + createDate = createDate, + changeDate = changeDate, + passwordChangeDate = passwordChangeDate, + addCardAttempts = addCardAttempts, + accountPurchases = accountPurchases + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentSessionsRequestCustomerAccountDetails) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -128,7 +147,7 @@ data class PaymentSessionsRequestCustomerAccountDetails( changeDate = changeDate, passwordChangeDate = passwordChangeDate, addCardAttempts = addCardAttempts, - accountPurchases = accountPurchases, + accountPurchases = accountPurchases ) /** @@ -152,6 +171,6 @@ data class PaymentSessionsRequestCustomerAccountDetails( THIRD_PARTY_AUTHENTICATION("third_party_authentication"), @JsonProperty("fido_authentication") - FIDO_AUTHENTICATION("fido_authentication"), + FIDO_AUTHENTICATION("fido_authentication") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentType.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentType.kt index a63dea784f..7fe08b6559 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentType.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PaymentType.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual payment type. @@ -51,7 +49,7 @@ data class PaymentType( // The name of the payment type. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class PaymentType( class Builder( private var id: kotlin.String? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun name(name: kotlin.String?) = apply { this.name = name } fun build(): PaymentType { - return PaymentType( - id = id, - name = name, - ) + val instance = + PaymentType( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentType) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Phone.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Phone.kt index 1eb7a9ee13..40aa64f375 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Phone.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Phone.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The entire phone number must be represented across the three fields in this object. @@ -56,7 +54,7 @@ data class Phone( // The remaining digits of the phone number. @JsonProperty("number") @field:Valid - val number: kotlin.String? = null, + val number: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Phone( class Builder( private var countryCode: kotlin.String? = null, private var areaCode: kotlin.String? = null, - private var number: kotlin.String? = null, + private var number: kotlin.String? = null ) { fun countryCode(countryCode: kotlin.String?) = apply { this.countryCode = countryCode } @@ -75,11 +73,34 @@ data class Phone( fun number(number: kotlin.String?) = apply { this.number = number } fun build(): Phone { - return Phone( - countryCode = countryCode, - areaCode = areaCode, - number = number, - ) + val instance = + Phone( + countryCode = countryCode, + areaCode = areaCode, + number = number + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Phone) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Phone( Builder( countryCode = countryCode, areaCode = areaCode, - number = number, + number = number ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PhoneRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PhoneRequest.kt index 856c4731bb..2ef28295e8 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PhoneRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PhoneRequest.kt @@ -25,18 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * The entire phone number must be represented across the three fields in this object. The entire phone number should not exceed 25 characters. @@ -47,16 +46,18 @@ import javax.validation.constraints.Size data class PhoneRequest( // The numerical portion of the country code from the phone number. Do not include the leading '+' character. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("country_code") + @field:NotNull @field:Valid val countryCode: kotlin.String, // The remaining digits of the phone number. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("number") + @field:NotNull @field:Valid val number: kotlin.String, // The area code of the phone number. Special characters (\"<\", \">\", \"(\", \")\", and \"&\") entered in this field will be re-encoded. @JsonProperty("area_code") @field:Valid - val areaCode: kotlin.String? = null, + val areaCode: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +67,7 @@ data class PhoneRequest( class Builder( private var countryCode: kotlin.String? = null, private var number: kotlin.String? = null, - private var areaCode: kotlin.String? = null, + private var areaCode: kotlin.String? = null ) { fun countryCode(countryCode: kotlin.String) = apply { this.countryCode = countryCode } @@ -75,21 +76,33 @@ data class PhoneRequest( fun areaCode(areaCode: kotlin.String?) = apply { this.areaCode = areaCode } fun build(): PhoneRequest { - // Check required params - validateNullity() - return PhoneRequest( - countryCode = countryCode!!, - number = number!!, - areaCode = areaCode, - ) + val instance = + PhoneRequest( + countryCode = countryCode!!, + number = number!!, + areaCode = areaCode + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (countryCode == null) { - throw NullPointerException("Required parameter countryCode is missing") - } - if (number == null) { - throw NullPointerException("Required parameter number is missing") + private fun validate(instance: PhoneRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -98,6 +111,6 @@ data class PhoneRequest( Builder( countryCode = countryCode!!, number = number!!, - areaCode = areaCode, + areaCode = areaCode ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Policies.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Policies.kt index f389a73a6b..d395713f42 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Policies.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Policies.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information about property policies that guests need to be aware of. @@ -46,7 +44,7 @@ data class Policies( // Description of information that may be helpful when planning a trip to this property. @JsonProperty("know_before_you_go") @field:Valid - val knowBeforeYouGo: kotlin.String? = null, + val knowBeforeYouGo: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class Policies( } class Builder( - private var knowBeforeYouGo: kotlin.String? = null, + private var knowBeforeYouGo: kotlin.String? = null ) { fun knowBeforeYouGo(knowBeforeYouGo: kotlin.String?) = apply { this.knowBeforeYouGo = knowBeforeYouGo } fun build(): Policies { - return Policies( - knowBeforeYouGo = knowBeforeYouGo, - ) + val instance = + Policies( + knowBeforeYouGo = knowBeforeYouGo + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Policies) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - knowBeforeYouGo = knowBeforeYouGo, + knowBeforeYouGo = knowBeforeYouGo ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Polygon.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Polygon.kt index 91a748cd04..845615ac13 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Polygon.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Polygon.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.BoundingPolygon import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -47,7 +45,7 @@ data class Polygon( // An array of linear ring coordinate arrays that combine to make up a single [Polygon](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6) in geojson format. If there is more than one linear ring at this level, the first is the outer boundary and the remaining linear rings are interior rings or holes. @JsonProperty("coordinates") @field:Valid - val coordinates: kotlin.collections.List>>? = null, + val coordinates: kotlin.collections.List>>? = null ) : BoundingPolygon { @JsonProperty("type") override val type: kotlin.String = "POLYGON" @@ -58,20 +56,42 @@ data class Polygon( } class Builder( - private var coordinates: kotlin.collections.List>>? = null, + private var coordinates: kotlin.collections.List>>? = null ) { - fun coordinates(coordinates: kotlin.collections.List>>?) = - apply { this.coordinates = coordinates } + fun coordinates(coordinates: kotlin.collections.List>>?) = apply { this.coordinates = coordinates } fun build(): Polygon { - return Polygon( - coordinates = coordinates, - ) + val instance = + Polygon( + coordinates = coordinates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Polygon) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - coordinates = coordinates, + coordinates = coordinates ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PolygonAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PolygonAllOf.kt index 41b0926403..1381166af6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PolygonAllOf.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PolygonAllOf.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -46,7 +44,7 @@ data class PolygonAllOf( // An array of linear ring coordinate arrays that combine to make up a single [Polygon](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6) in geojson format. If there is more than one linear ring at this level, the first is the outer boundary and the remaining linear rings are interior rings or holes. @JsonProperty("coordinates") @field:Valid - val coordinates: kotlin.collections.List>>? = null, + val coordinates: kotlin.collections.List>>? = null ) { companion object { @JvmStatic @@ -54,20 +52,42 @@ data class PolygonAllOf( } class Builder( - private var coordinates: kotlin.collections.List>>? = null, + private var coordinates: kotlin.collections.List>>? = null ) { - fun coordinates(coordinates: kotlin.collections.List>>?) = - apply { this.coordinates = coordinates } + fun coordinates(coordinates: kotlin.collections.List>>?) = apply { this.coordinates = coordinates } fun build(): PolygonAllOf { - return PolygonAllOf( - coordinates = coordinates, - ) + val instance = + PolygonAllOf( + coordinates = coordinates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PolygonAllOf) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - coordinates = coordinates, + coordinates = coordinates ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Preferred.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Preferred.kt index d0217472ab..84d1509f30 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Preferred.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Preferred.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The preferred airport of the property. @@ -46,7 +44,7 @@ data class Preferred( // The airport's IATA code. @JsonProperty("iata_airport_code") @field:Valid - val iataAirportCode: kotlin.String? = null, + val iataAirportCode: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class Preferred( } class Builder( - private var iataAirportCode: kotlin.String? = null, + private var iataAirportCode: kotlin.String? = null ) { fun iataAirportCode(iataAirportCode: kotlin.String?) = apply { this.iataAirportCode = iataAirportCode } fun build(): Preferred { - return Preferred( - iataAirportCode = iataAirportCode, - ) + val instance = + Preferred( + iataAirportCode = iataAirportCode + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Preferred) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - iataAirportCode = iataAirportCode, + iataAirportCode = iataAirportCode ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PricingInformation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PricingInformation.kt index 2a585d75ff..e101676d63 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PricingInformation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PricingInformation.kt @@ -25,22 +25,20 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.FeesPricingInformation import com.expediagroup.sdk.rapid.models.NightCharge import com.expediagroup.sdk.rapid.models.Stay import com.expediagroup.sdk.rapid.models.Totals import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The pricing information object. @@ -63,7 +61,7 @@ data class PricingInformation( val totals: Totals? = null, @JsonProperty("fees") @field:Valid - val fees: FeesPricingInformation? = null, + val fees: FeesPricingInformation? = null ) { companion object { @JvmStatic @@ -74,7 +72,7 @@ data class PricingInformation( private var nightly: kotlin.collections.List>? = null, private var stay: kotlin.collections.List? = null, private var totals: Totals? = null, - private var fees: FeesPricingInformation? = null, + private var fees: FeesPricingInformation? = null ) { fun nightly(nightly: kotlin.collections.List>?) = apply { this.nightly = nightly } @@ -85,12 +83,35 @@ data class PricingInformation( fun fees(fees: FeesPricingInformation?) = apply { this.fees = fees } fun build(): PricingInformation { - return PricingInformation( - nightly = nightly, - stay = stay, - totals = totals, - fees = fees, - ) + val instance = + PricingInformation( + nightly = nightly, + stay = stay, + totals = totals, + fees = fees + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PricingInformation) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -99,6 +120,6 @@ data class PricingInformation( nightly = nightly, stay = stay, totals = totals, - fees = fees, + fees = fees ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Promotions.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Promotions.kt index d6578d9842..f384f03218 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Promotions.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Promotions.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Deal import com.expediagroup.sdk.rapid.models.ValueAdd import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Available promotions that apply to this rate. @@ -52,7 +50,7 @@ data class Promotions( val valueAdds: kotlin.collections.Map? = null, @JsonProperty("deal") @field:Valid - val deal: Deal? = null, + val deal: Deal? = null ) { companion object { @JvmStatic @@ -61,23 +59,46 @@ data class Promotions( class Builder( private var valueAdds: kotlin.collections.Map? = null, - private var deal: Deal? = null, + private var deal: Deal? = null ) { fun valueAdds(valueAdds: kotlin.collections.Map?) = apply { this.valueAdds = valueAdds } fun deal(deal: Deal?) = apply { this.deal = deal } fun build(): Promotions { - return Promotions( - valueAdds = valueAdds, - deal = deal, - ) + val instance = + Promotions( + valueAdds = valueAdds, + deal = deal + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Promotions) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( valueAdds = valueAdds, - deal = deal, + deal = deal ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PromotionsItinerary.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PromotionsItinerary.kt index 05287407b4..22a4c90ada 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PromotionsItinerary.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PromotionsItinerary.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.ValueAdd import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Promotions that apply to the booked room. @@ -47,7 +45,7 @@ data class PromotionsItinerary( // Promotions provided by the property that add value to the stay, but don’t affect the booking price (i.e., ski lift tickets or premium wifi). @JsonProperty("value_adds") @field:Valid - val valueAdds: kotlin.collections.Map? = null, + val valueAdds: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -55,19 +53,42 @@ data class PromotionsItinerary( } class Builder( - private var valueAdds: kotlin.collections.Map? = null, + private var valueAdds: kotlin.collections.Map? = null ) { fun valueAdds(valueAdds: kotlin.collections.Map?) = apply { this.valueAdds = valueAdds } fun build(): PromotionsItinerary { - return PromotionsItinerary( - valueAdds = valueAdds, - ) + val instance = + PromotionsItinerary( + valueAdds = valueAdds + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PromotionsItinerary) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - valueAdds = valueAdds, + valueAdds = valueAdds ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertiesGeoJsonRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertiesGeoJsonRequest.kt index 45fee75db8..6acb2c8070 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertiesGeoJsonRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertiesGeoJsonRequest.kt @@ -25,18 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * GeoJSON geometry @@ -46,15 +45,17 @@ import javax.validation.constraints.Size data class PropertiesGeoJsonRequest( // The geometry type. The only supported type is `Polygon` @JsonProperty("type") + @field:NotNull @field:Valid val type: kotlin.String, // An array of linear ring coordinate arrays that combine to make up a single [Polygon](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6) in geojson format. If there is more than one linear ring at this level, the first is the outer boundary and the remaining linear rings are interior rings or holes. @JsonProperty("coordinates") + @field:NotNull @field:Valid val coordinates: kotlin.collections .List< - kotlin.collections.List>, - >, + kotlin.collections.List> + > ) { companion object { @JvmStatic @@ -63,30 +64,39 @@ data class PropertiesGeoJsonRequest( class Builder( private var type: kotlin.String? = null, - private var coordinates: kotlin.collections.List>>? = null, + private var coordinates: kotlin.collections.List>>? = null ) { fun type(type: kotlin.String) = apply { this.type = type } - fun coordinates(coordinates: kotlin.collections.List>>) = - apply { - this.coordinates = coordinates - } + fun coordinates(coordinates: kotlin.collections.List>>) = apply { this.coordinates = coordinates } fun build(): PropertiesGeoJsonRequest { - // Check required params - validateNullity() - return PropertiesGeoJsonRequest( - type = type!!, - coordinates = coordinates!!, - ) + val instance = + PropertiesGeoJsonRequest( + type = type!!, + coordinates = coordinates!! + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (type == null) { - throw NullPointerException("Required parameter type is missing") - } - if (coordinates == null) { - throw NullPointerException("Required parameter coordinates is missing") + private fun validate(instance: PropertiesGeoJsonRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -94,6 +104,6 @@ data class PropertiesGeoJsonRequest( fun toBuilder() = Builder( type = type!!, - coordinates = coordinates!!, + coordinates = coordinates!! ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Property.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Property.kt index 4ec1e971c2..7a160e2bab 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Property.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Property.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -35,12 +35,6 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonSubTypes import com.fasterxml.jackson.annotation.JsonSubTypes.Type import com.fasterxml.jackson.annotation.JsonTypeInfo -import org.hibernate.validator.constraints.Length -import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size /** * @@ -52,7 +46,7 @@ import javax.validation.constraints.Size @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "status", visible = true) @JsonSubTypes( Type(value = PropertyAvailability::class, name = "available"), - Type(value = PropertyUnavailability::class, name = "partially_unavailable"), + Type(value = PropertyUnavailability::class, name = "partially_unavailable") ) interface Property { // Expedia property ID. @@ -73,6 +67,6 @@ interface Property { AVAILABLE("available"), @JsonProperty("partially_unavailable") - PARTIALLY_UNAVAILABLE("partially_unavailable"), + PARTIALLY_UNAVAILABLE("partially_unavailable") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailability.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailability.kt index e4e293c37c..4da645ac6e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailability.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailability.kt @@ -25,21 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Property import com.expediagroup.sdk.rapid.models.PropertyAvailabilityLinks import com.expediagroup.sdk.rapid.models.RoomAvailability import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -61,7 +59,7 @@ data class PropertyAvailability( val rooms: kotlin.collections.List? = null, @JsonProperty("links") @field:Valid - val links: PropertyAvailabilityLinks? = null, + val links: PropertyAvailabilityLinks? = null ) : Property { @JsonProperty("status") override val status: Property.Status = Property.Status.AVAILABLE @@ -75,7 +73,7 @@ data class PropertyAvailability( private var propertyId: kotlin.String? = null, private var score: java.math.BigDecimal? = null, private var rooms: kotlin.collections.List? = null, - private var links: PropertyAvailabilityLinks? = null, + private var links: PropertyAvailabilityLinks? = null ) { fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } @@ -86,12 +84,35 @@ data class PropertyAvailability( fun links(links: PropertyAvailabilityLinks?) = apply { this.links = links } fun build(): PropertyAvailability { - return PropertyAvailability( - propertyId = propertyId, - score = score, - rooms = rooms, - links = links, - ) + val instance = + PropertyAvailability( + propertyId = propertyId, + score = score, + rooms = rooms, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyAvailability) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -100,6 +121,6 @@ data class PropertyAvailability( propertyId = propertyId, score = score, rooms = rooms, - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityAllOf.kt index 2f76f13c92..41a3c3fbff 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityAllOf.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityAllOf.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.PropertyAvailabilityLinks import com.expediagroup.sdk.rapid.models.RoomAvailability import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The rooms and rates for a property. @@ -52,7 +50,7 @@ data class PropertyAvailabilityAllOf( val rooms: kotlin.collections.List? = null, @JsonProperty("links") @field:Valid - val links: PropertyAvailabilityLinks? = null, + val links: PropertyAvailabilityLinks? = null ) { companion object { @JvmStatic @@ -61,23 +59,46 @@ data class PropertyAvailabilityAllOf( class Builder( private var rooms: kotlin.collections.List? = null, - private var links: PropertyAvailabilityLinks? = null, + private var links: PropertyAvailabilityLinks? = null ) { fun rooms(rooms: kotlin.collections.List?) = apply { this.rooms = rooms } fun links(links: PropertyAvailabilityLinks?) = apply { this.links = links } fun build(): PropertyAvailabilityAllOf { - return PropertyAvailabilityAllOf( - rooms = rooms, - links = links, - ) + val instance = + PropertyAvailabilityAllOf( + rooms = rooms, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyAvailabilityAllOf) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( rooms = rooms, - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityLinks.kt index 7bff5042dd..faea21f59d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyAvailabilityLinks.kt @@ -25,21 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperationLink import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to request additional rates. Note that the recommendations feature has been retired and will return an error if the link is followed. @@ -53,7 +51,7 @@ data class PropertyAvailabilityLinks( val additionalRates: GetAdditionalAvailabilityOperationLink? = null, @JsonProperty("recommendations") @field:Valid - val recommendations: GetAvailabilityOperationLink? = null, + val recommendations: GetAvailabilityOperationLink? = null ) { companion object { @JvmStatic @@ -62,23 +60,46 @@ data class PropertyAvailabilityLinks( class Builder( private var additionalRates: GetAdditionalAvailabilityOperationLink? = null, - private var recommendations: GetAvailabilityOperationLink? = null, + private var recommendations: GetAvailabilityOperationLink? = null ) { fun additionalRates(additionalRates: GetAdditionalAvailabilityOperationLink?) = apply { this.additionalRates = additionalRates } fun recommendations(recommendations: GetAvailabilityOperationLink?) = apply { this.recommendations = recommendations } fun build(): PropertyAvailabilityLinks { - return PropertyAvailabilityLinks( - additionalRates = additionalRates, - recommendations = recommendations, - ) + val instance = + PropertyAvailabilityLinks( + additionalRates = additionalRates, + recommendations = recommendations + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyAvailabilityLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( additionalRates = additionalRates, - recommendations = recommendations, + recommendations = recommendations ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyCalendarAvailability.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyCalendarAvailability.kt index dd0db9c593..2c7c4eec40 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyCalendarAvailability.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyCalendarAvailability.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Day import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -51,7 +49,7 @@ data class PropertyCalendarAvailability( val propertyId: kotlin.String? = null, @JsonProperty("days") @field:Valid - val days: kotlin.collections.List? = null, + val days: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class PropertyCalendarAvailability( class Builder( private var propertyId: kotlin.String? = null, - private var days: kotlin.collections.List? = null, + private var days: kotlin.collections.List? = null ) { fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } fun days(days: kotlin.collections.List?) = apply { this.days = days } fun build(): PropertyCalendarAvailability { - return PropertyCalendarAvailability( - propertyId = propertyId, - days = days, - ) + val instance = + PropertyCalendarAvailability( + propertyId = propertyId, + days = days + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyCalendarAvailability) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( propertyId = propertyId, - days = days, + days = days ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyContent.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyContent.kt index 026196ea59..33cb9643ab 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyContent.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyContent.kt @@ -25,11 +25,12 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Address import com.expediagroup.sdk.rapid.models.AllInclusive import com.expediagroup.sdk.rapid.models.Amenity @@ -56,12 +57,9 @@ import com.expediagroup.sdk.rapid.models.Statistic import com.expediagroup.sdk.rapid.models.Theme import com.expediagroup.sdk.rapid.models.VacationRentalDetails import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual property object in the map of property objects. @@ -99,6 +97,7 @@ import javax.validation.constraints.Size * @param paymentRegistrationRecommended Boolean value indicating if a property may require payment registration to process payments, even when using the property_collect Business Model. If true, then a property may not be successfully bookable without registering payments first. * @param vacationRentalDetails * @param supplySource The supply source of the property. + * @param registryNumber The property's registry number required by some jurisdictions. */ data class PropertyContent( // Unique Expedia property ID. @@ -219,6 +218,10 @@ data class PropertyContent( @JsonProperty("supply_source") @field:Valid val supplySource: kotlin.String? = null, + // The property's registry number required by some jurisdictions. + @JsonProperty("registry_number") + @field:Valid + val registryNumber: kotlin.String? = null ) { companion object { @JvmStatic @@ -260,6 +263,7 @@ data class PropertyContent( private var paymentRegistrationRecommended: kotlin.Boolean? = null, private var vacationRentalDetails: VacationRentalDetails? = null, private var supplySource: kotlin.String? = null, + private var registryNumber: kotlin.String? = null ) { fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } @@ -319,60 +323,79 @@ data class PropertyContent( fun brand(brand: Brand?) = apply { this.brand = brand } - fun spokenLanguages(spokenLanguages: kotlin.collections.Map?) = - apply { - this.spokenLanguages = spokenLanguages - } + fun spokenLanguages(spokenLanguages: kotlin.collections.Map?) = apply { this.spokenLanguages = spokenLanguages } fun multiUnit(multiUnit: kotlin.Boolean?) = apply { this.multiUnit = multiUnit } - fun paymentRegistrationRecommended(paymentRegistrationRecommended: kotlin.Boolean?) = - apply { - this.paymentRegistrationRecommended = paymentRegistrationRecommended - } + fun paymentRegistrationRecommended(paymentRegistrationRecommended: kotlin.Boolean?) = apply { this.paymentRegistrationRecommended = paymentRegistrationRecommended } - fun vacationRentalDetails(vacationRentalDetails: VacationRentalDetails?) = - apply { this.vacationRentalDetails = vacationRentalDetails } + fun vacationRentalDetails(vacationRentalDetails: VacationRentalDetails?) = apply { this.vacationRentalDetails = vacationRentalDetails } fun supplySource(supplySource: kotlin.String?) = apply { this.supplySource = supplySource } + fun registryNumber(registryNumber: kotlin.String?) = apply { this.registryNumber = registryNumber } + fun build(): PropertyContent { - return PropertyContent( - propertyId = propertyId, - name = name, - address = address, - ratings = ratings, - location = location, - phone = phone, - fax = fax, - category = category, - businessModel = businessModel, - rank = rank, - checkin = checkin, - checkout = checkout, - fees = fees, - policies = policies, - attributes = attributes, - amenities = amenities, - images = images, - onsitePayments = onsitePayments, - rooms = rooms, - rates = rates, - dates = dates, - descriptions = descriptions, - statistics = statistics, - airports = airports, - themes = themes, - allInclusive = allInclusive, - taxId = taxId, - chain = chain, - brand = brand, - spokenLanguages = spokenLanguages, - multiUnit = multiUnit, - paymentRegistrationRecommended = paymentRegistrationRecommended, - vacationRentalDetails = vacationRentalDetails, - supplySource = supplySource, - ) + val instance = + PropertyContent( + propertyId = propertyId, + name = name, + address = address, + ratings = ratings, + location = location, + phone = phone, + fax = fax, + category = category, + businessModel = businessModel, + rank = rank, + checkin = checkin, + checkout = checkout, + fees = fees, + policies = policies, + attributes = attributes, + amenities = amenities, + images = images, + onsitePayments = onsitePayments, + rooms = rooms, + rates = rates, + dates = dates, + descriptions = descriptions, + statistics = statistics, + airports = airports, + themes = themes, + allInclusive = allInclusive, + taxId = taxId, + chain = chain, + brand = brand, + spokenLanguages = spokenLanguages, + multiUnit = multiUnit, + paymentRegistrationRecommended = paymentRegistrationRecommended, + vacationRentalDetails = vacationRentalDetails, + supplySource = supplySource, + registryNumber = registryNumber + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyContent) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -412,5 +435,6 @@ data class PropertyContent( paymentRegistrationRecommended = paymentRegistrationRecommended, vacationRentalDetails = vacationRentalDetails, supplySource = supplySource, + registryNumber = registryNumber ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyGeography.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyGeography.kt index eb9b9ecb84..547011c84a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyGeography.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyGeography.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A property object. @@ -46,7 +44,7 @@ data class PropertyGeography( // Unique Expedia property ID. @JsonProperty("property_id") @field:Valid - val propertyId: kotlin.String? = null, + val propertyId: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class PropertyGeography( } class Builder( - private var propertyId: kotlin.String? = null, + private var propertyId: kotlin.String? = null ) { fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } fun build(): PropertyGeography { - return PropertyGeography( - propertyId = propertyId, - ) + val instance = + PropertyGeography( + propertyId = propertyId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyGeography) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - propertyId = propertyId, + propertyId = propertyId ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyInactive.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyInactive.kt index 3a7c68ae3c..d9151bd2d4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyInactive.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyInactive.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -46,7 +44,7 @@ data class PropertyInactive( // The property id of the inactive property @JsonProperty("property_id") @field:Valid - val propertyId: kotlin.String? = null, + val propertyId: kotlin.String? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class PropertyInactive( } class Builder( - private var propertyId: kotlin.String? = null, + private var propertyId: kotlin.String? = null ) { fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } fun build(): PropertyInactive { - return PropertyInactive( - propertyId = propertyId, - ) + val instance = + PropertyInactive( + propertyId = propertyId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyInactive) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - propertyId = propertyId, + propertyId = propertyId ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManager.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManager.kt index 06f7a99c0c..3bafc1fa6e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManager.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManager.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.PropertyManagerLinks import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information about the property manager. @@ -51,7 +49,7 @@ data class PropertyManager( val name: kotlin.String? = null, @JsonProperty("links") @field:Valid - val links: PropertyManagerLinks? = null, + val links: PropertyManagerLinks? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class PropertyManager( class Builder( private var name: kotlin.String? = null, - private var links: PropertyManagerLinks? = null, + private var links: PropertyManagerLinks? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } fun links(links: PropertyManagerLinks?) = apply { this.links = links } fun build(): PropertyManager { - return PropertyManager( - name = name, - links = links, - ) + val instance = + PropertyManager( + name = name, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyManager) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( name = name, - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManagerLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManagerLinks.kt index 4437caf508..fcf65f0545 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManagerLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyManagerLinks.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including link to get image of the property manager. @@ -46,7 +44,7 @@ import javax.validation.constraints.Size data class PropertyManagerLinks( @JsonProperty("image") @field:Valid - val image: Link? = null, + val image: Link? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class PropertyManagerLinks( } class Builder( - private var image: Link? = null, + private var image: Link? = null ) { fun image(image: Link?) = apply { this.image = image } fun build(): PropertyManagerLinks { - return PropertyManagerLinks( - image = image, - ) + val instance = + PropertyManagerLinks( + image = image + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyManagerLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - image = image, + image = image ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyRating.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyRating.kt index d0917e136b..f57ac7aacc 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyRating.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyRating.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information about the property's rating. @@ -51,7 +49,7 @@ data class PropertyRating( // Returns a value of either \"Star\" or \"Alternate\". Star indicates the rating is provided by the property’s local star rating authority. Alternate indicates that the rating is an Expedia-assigned value; an official rating was not available. @JsonProperty("type") @field:Valid - val type: kotlin.String? = null, + val type: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class PropertyRating( class Builder( private var rating: kotlin.String? = null, - private var type: kotlin.String? = null, + private var type: kotlin.String? = null ) { fun rating(rating: kotlin.String?) = apply { this.rating = rating } fun type(type: kotlin.String?) = apply { this.type = type } fun build(): PropertyRating { - return PropertyRating( - rating = rating, - type = type, - ) + val instance = + PropertyRating( + rating = rating, + type = type + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyRating) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( rating = rating, - type = type, + type = type ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailability.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailability.kt index 122c250839..38d3ad38c2 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailability.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailability.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Property import com.expediagroup.sdk.rapid.models.UnavailableReason import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -55,7 +53,7 @@ data class PropertyUnavailability( override val score: java.math.BigDecimal? = null, @JsonProperty("unavailable_reason") @field:Valid - val unavailableReason: UnavailableReason? = null, + val unavailableReason: UnavailableReason? = null ) : Property { @JsonProperty("status") override val status: Property.Status = Property.Status.PARTIALLY_UNAVAILABLE @@ -68,7 +66,7 @@ data class PropertyUnavailability( class Builder( private var propertyId: kotlin.String? = null, private var score: java.math.BigDecimal? = null, - private var unavailableReason: UnavailableReason? = null, + private var unavailableReason: UnavailableReason? = null ) { fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } @@ -77,11 +75,34 @@ data class PropertyUnavailability( fun unavailableReason(unavailableReason: UnavailableReason?) = apply { this.unavailableReason = unavailableReason } fun build(): PropertyUnavailability { - return PropertyUnavailability( - propertyId = propertyId, - score = score, - unavailableReason = unavailableReason, - ) + val instance = + PropertyUnavailability( + propertyId = propertyId, + score = score, + unavailableReason = unavailableReason + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyUnavailability) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -89,6 +110,6 @@ data class PropertyUnavailability( Builder( propertyId = propertyId, score = score, - unavailableReason = unavailableReason, + unavailableReason = unavailableReason ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailabilityAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailabilityAllOf.kt index 440b1a9b3a..934f1e6cd1 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailabilityAllOf.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PropertyUnavailabilityAllOf.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.UnavailableReason import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Response with a property that has no available rates for the given request parameters, but `include=unavailable_reason` was requested. @@ -46,7 +44,7 @@ import javax.validation.constraints.Size data class PropertyUnavailabilityAllOf( @JsonProperty("unavailable_reason") @field:Valid - val unavailableReason: UnavailableReason? = null, + val unavailableReason: UnavailableReason? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class PropertyUnavailabilityAllOf( } class Builder( - private var unavailableReason: UnavailableReason? = null, + private var unavailableReason: UnavailableReason? = null ) { fun unavailableReason(unavailableReason: UnavailableReason?) = apply { this.unavailableReason = unavailableReason } fun build(): PropertyUnavailabilityAllOf { - return PropertyUnavailabilityAllOf( - unavailableReason = unavailableReason, - ) + val instance = + PropertyUnavailabilityAllOf( + unavailableReason = unavailableReason + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyUnavailabilityAllOf) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - unavailableReason = unavailableReason, + unavailableReason = unavailableReason ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Rate.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Rate.kt index 3f698aba11..99e2329d33 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Rate.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Rate.kt @@ -25,11 +25,12 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amenity import com.expediagroup.sdk.rapid.models.Amount import com.expediagroup.sdk.rapid.models.BedGroupAvailability @@ -44,12 +45,9 @@ import com.expediagroup.sdk.rapid.models.RateLinks import com.expediagroup.sdk.rapid.models.SaleScenario import com.expediagroup.sdk.rapid.models.Status import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A rate. @@ -137,7 +135,7 @@ data class Rate( // Array of deposits for the rate. @JsonProperty("deposits") @field:Valid - val deposits: kotlin.collections.List? = null, + val deposits: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -162,7 +160,7 @@ data class Rate( private var promotions: Promotions? = null, private var cardOnFileLimit: Amount? = null, private var refundableDamageDeposit: Amount? = null, - private var deposits: kotlin.collections.List? = null, + private var deposits: kotlin.collections.List? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -186,20 +184,11 @@ data class Rate( fun cancelPenalties(cancelPenalties: kotlin.collections.List?) = apply { this.cancelPenalties = cancelPenalties } - fun nonrefundableDateRanges(nonrefundableDateRanges: kotlin.collections.List?) = - apply { - this.nonrefundableDateRanges = nonrefundableDateRanges - } + fun nonrefundableDateRanges(nonrefundableDateRanges: kotlin.collections.List?) = apply { this.nonrefundableDateRanges = nonrefundableDateRanges } - fun marketingFeeIncentives(marketingFeeIncentives: kotlin.collections.List?) = - apply { - this.marketingFeeIncentives = marketingFeeIncentives - } + fun marketingFeeIncentives(marketingFeeIncentives: kotlin.collections.List?) = apply { this.marketingFeeIncentives = marketingFeeIncentives } - fun occupancyPricing(occupancyPricing: kotlin.collections.Map?) = - apply { - this.occupancyPricing = occupancyPricing - } + fun occupancyPricing(occupancyPricing: kotlin.collections.Map?) = apply { this.occupancyPricing = occupancyPricing } fun promotions(promotions: Promotions?) = apply { this.promotions = promotions } @@ -210,26 +199,49 @@ data class Rate( fun deposits(deposits: kotlin.collections.List?) = apply { this.deposits = deposits } fun build(): Rate { - return Rate( - id = id, - status = status, - availableRooms = availableRooms, - refundable = refundable, - memberDealAvailable = memberDealAvailable, - saleScenario = saleScenario, - merchantOfRecord = merchantOfRecord, - amenities = amenities, - links = links, - bedGroups = bedGroups, - cancelPenalties = cancelPenalties, - nonrefundableDateRanges = nonrefundableDateRanges, - marketingFeeIncentives = marketingFeeIncentives, - occupancyPricing = occupancyPricing, - promotions = promotions, - cardOnFileLimit = cardOnFileLimit, - refundableDamageDeposit = refundableDamageDeposit, - deposits = deposits, - ) + val instance = + Rate( + id = id, + status = status, + availableRooms = availableRooms, + refundable = refundable, + memberDealAvailable = memberDealAvailable, + saleScenario = saleScenario, + merchantOfRecord = merchantOfRecord, + amenities = amenities, + links = links, + bedGroups = bedGroups, + cancelPenalties = cancelPenalties, + nonrefundableDateRanges = nonrefundableDateRanges, + marketingFeeIncentives = marketingFeeIncentives, + occupancyPricing = occupancyPricing, + promotions = promotions, + cardOnFileLimit = cardOnFileLimit, + refundableDamageDeposit = refundableDamageDeposit, + deposits = deposits + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Rate) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -252,6 +264,6 @@ data class Rate( promotions = promotions, cardOnFileLimit = cardOnFileLimit, refundableDamageDeposit = refundableDamageDeposit, - deposits = deposits, + deposits = deposits ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateContent.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateContent.kt index 669671eb17..b1cfa0a962 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateContent.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateContent.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amenity import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual rate. @@ -57,7 +55,7 @@ data class RateContent( // A text description of any special offers for this rate. @JsonProperty("special_offer_description") @field:Valid - val specialOfferDescription: kotlin.String? = null, + val specialOfferDescription: kotlin.String? = null ) { companion object { @JvmStatic @@ -67,21 +65,43 @@ data class RateContent( class Builder( private var id: kotlin.String? = null, private var amenities: kotlin.collections.Map? = null, - private var specialOfferDescription: kotlin.String? = null, + private var specialOfferDescription: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun amenities(amenities: kotlin.collections.Map?) = apply { this.amenities = amenities } - fun specialOfferDescription(specialOfferDescription: kotlin.String?) = - apply { this.specialOfferDescription = specialOfferDescription } + fun specialOfferDescription(specialOfferDescription: kotlin.String?) = apply { this.specialOfferDescription = specialOfferDescription } fun build(): RateContent { - return RateContent( - id = id, - amenities = amenities, - specialOfferDescription = specialOfferDescription, - ) + val instance = + RateContent( + id = id, + amenities = amenities, + specialOfferDescription = specialOfferDescription + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateContent) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -89,6 +109,6 @@ data class RateContent( Builder( id = id, amenities = amenities, - specialOfferDescription = specialOfferDescription, + specialOfferDescription = specialOfferDescription ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateHistory.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateHistory.kt index fd8309dc6f..f9a6d25ba5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateHistory.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateHistory.kt @@ -25,22 +25,20 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.CancelPenalty import com.expediagroup.sdk.rapid.models.DepositItinerary import com.expediagroup.sdk.rapid.models.PricingInformation import com.expediagroup.sdk.rapid.models.PromotionsItinerary import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The rate information associated with the itinerary. @@ -67,7 +65,7 @@ data class RateHistory( val deposits: kotlin.collections.List? = null, @JsonProperty("pricing") @field:Valid - val pricing: PricingInformation? = null, + val pricing: PricingInformation? = null ) { companion object { @JvmStatic @@ -79,7 +77,7 @@ data class RateHistory( private var promotions: PromotionsItinerary? = null, private var cancelPenalties: kotlin.collections.List? = null, private var deposits: kotlin.collections.List? = null, - private var pricing: PricingInformation? = null, + private var pricing: PricingInformation? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -92,13 +90,36 @@ data class RateHistory( fun pricing(pricing: PricingInformation?) = apply { this.pricing = pricing } fun build(): RateHistory { - return RateHistory( - id = id, - promotions = promotions, - cancelPenalties = cancelPenalties, - deposits = deposits, - pricing = pricing, - ) + val instance = + RateHistory( + id = id, + promotions = promotions, + cancelPenalties = cancelPenalties, + deposits = deposits, + pricing = pricing + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateHistory) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -108,6 +129,6 @@ data class RateHistory( promotions = promotions, cancelPenalties = cancelPenalties, deposits = deposits, - pricing = pricing, + pricing = pricing ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateItinerary.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateItinerary.kt index 870de4a0e1..43d13bcdc4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateItinerary.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateItinerary.kt @@ -25,11 +25,12 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amount import com.expediagroup.sdk.rapid.models.CancelPenalty import com.expediagroup.sdk.rapid.models.CancelRefund @@ -39,12 +40,9 @@ import com.expediagroup.sdk.rapid.models.NonrefundableDateRange import com.expediagroup.sdk.rapid.models.PricingInformation import com.expediagroup.sdk.rapid.models.PromotionsItinerary import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The rate information associated with the itinerary. @@ -101,7 +99,7 @@ data class RateItinerary( val refundableDamageDeposit: Amount? = null, @JsonProperty("pricing") @field:Valid - val pricing: PricingInformation? = null, + val pricing: PricingInformation? = null ) { companion object { @JvmStatic @@ -120,7 +118,7 @@ data class RateItinerary( private var deposits: kotlin.collections.List? = null, private var cardOnFileLimit: Amount? = null, private var refundableDamageDeposit: Amount? = null, - private var pricing: PricingInformation? = null, + private var pricing: PricingInformation? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -136,10 +134,7 @@ data class RateItinerary( fun cancelPenalties(cancelPenalties: kotlin.collections.List?) = apply { this.cancelPenalties = cancelPenalties } - fun nonrefundableDateRanges(nonrefundableDateRanges: kotlin.collections.List?) = - apply { - this.nonrefundableDateRanges = nonrefundableDateRanges - } + fun nonrefundableDateRanges(nonrefundableDateRanges: kotlin.collections.List?) = apply { this.nonrefundableDateRanges = nonrefundableDateRanges } fun deposits(deposits: kotlin.collections.List?) = apply { this.deposits = deposits } @@ -150,20 +145,43 @@ data class RateItinerary( fun pricing(pricing: PricingInformation?) = apply { this.pricing = pricing } fun build(): RateItinerary { - return RateItinerary( - id = id, - merchantOfRecord = merchantOfRecord, - refundable = refundable, - cancelRefund = cancelRefund, - amenities = amenities, - promotions = promotions, - cancelPenalties = cancelPenalties, - nonrefundableDateRanges = nonrefundableDateRanges, - deposits = deposits, - cardOnFileLimit = cardOnFileLimit, - refundableDamageDeposit = refundableDamageDeposit, - pricing = pricing, - ) + val instance = + RateItinerary( + id = id, + merchantOfRecord = merchantOfRecord, + refundable = refundable, + cancelRefund = cancelRefund, + amenities = amenities, + promotions = promotions, + cancelPenalties = cancelPenalties, + nonrefundableDateRanges = nonrefundableDateRanges, + deposits = deposits, + cardOnFileLimit = cardOnFileLimit, + refundableDamageDeposit = refundableDamageDeposit, + pricing = pricing + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateItinerary) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -180,6 +198,6 @@ data class RateItinerary( deposits = deposits, cardOnFileLimit = cardOnFileLimit, refundableDamageDeposit = refundableDamageDeposit, - pricing = pricing, + pricing = pricing ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateLinks.kt index 9e67ce8b4a..29c33e4890 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RateLinks.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.GetPaymentOptionsOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including a link to request payment options. @@ -48,7 +46,7 @@ import javax.validation.constraints.Size data class RateLinks( @JsonProperty("payment_options") @field:Valid - val paymentOptions: GetPaymentOptionsOperationLink? = null, + val paymentOptions: GetPaymentOptionsOperationLink? = null ) { companion object { @JvmStatic @@ -56,19 +54,42 @@ data class RateLinks( } class Builder( - private var paymentOptions: GetPaymentOptionsOperationLink? = null, + private var paymentOptions: GetPaymentOptionsOperationLink? = null ) { fun paymentOptions(paymentOptions: GetPaymentOptionsOperationLink?) = apply { this.paymentOptions = paymentOptions } fun build(): RateLinks { - return RateLinks( - paymentOptions = paymentOptions, - ) + val instance = + RateLinks( + paymentOptions = paymentOptions + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - paymentOptions = paymentOptions, + paymentOptions = paymentOptions ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ratings.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ratings.kt index 8d3ccf9fe5..0ccb0195f5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ratings.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Ratings.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.GuestRating import com.expediagroup.sdk.rapid.models.PropertyRating import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Various types of ratings for this property. @@ -51,7 +49,7 @@ data class Ratings( val `property`: PropertyRating? = null, @JsonProperty("guest") @field:Valid - val guest: GuestRating? = null, + val guest: GuestRating? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Ratings( class Builder( private var `property`: PropertyRating? = null, - private var guest: GuestRating? = null, + private var guest: GuestRating? = null ) { fun `property`(`property`: PropertyRating?) = apply { this.`property` = `property` } fun guest(guest: GuestRating?) = apply { this.guest = guest } fun build(): Ratings { - return Ratings( - `property` = `property`, - guest = guest, - ) + val instance = + Ratings( + `property` = `property`, + guest = guest + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Ratings) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( `property` = `property`, - guest = guest, + guest = guest ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Region.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Region.kt index 868615421a..a96698e13c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Region.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Region.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Ancestors import com.expediagroup.sdk.rapid.models.CoordinatesRegion import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -127,7 +125,7 @@ data class Region( // A list of regional tags. @JsonProperty("tags") @field:Valid - val tags: kotlin.collections.List? = null, + val tags: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -151,7 +149,7 @@ data class Region( private var propertyIds: kotlin.collections.List? = null, private var propertyIdsExpanded: kotlin.collections.List? = null, private var categories: kotlin.collections.List? = null, - private var tags: kotlin.collections.List? = null, + private var tags: kotlin.collections.List? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -173,49 +171,63 @@ data class Region( fun coordinates(coordinates: CoordinatesRegion?) = apply { this.coordinates = coordinates } - fun associations(associations: kotlin.collections.Map>?) = - apply { - this.associations = associations - } + fun associations(associations: kotlin.collections.Map>?) = apply { this.associations = associations } fun ancestors(ancestors: kotlin.collections.List?) = apply { this.ancestors = ancestors } - fun descendants(descendants: kotlin.collections.Map>?) = - apply { - this.descendants = descendants - } + fun descendants(descendants: kotlin.collections.Map>?) = apply { this.descendants = descendants } fun propertyIds(propertyIds: kotlin.collections.List?) = apply { this.propertyIds = propertyIds } - fun propertyIdsExpanded(propertyIdsExpanded: kotlin.collections.List?) = - apply { - this.propertyIdsExpanded = propertyIdsExpanded - } + fun propertyIdsExpanded(propertyIdsExpanded: kotlin.collections.List?) = apply { this.propertyIdsExpanded = propertyIdsExpanded } fun categories(categories: kotlin.collections.List?) = apply { this.categories = categories } fun tags(tags: kotlin.collections.List?) = apply { this.tags = tags } fun build(): Region { - return Region( - id = id, - type = type, - name = name, - nameFull = nameFull, - descriptor = descriptor, - iataAirportCode = iataAirportCode, - iataAirportMetroCode = iataAirportMetroCode, - countryCode = countryCode, - countrySubdivisionCode = countrySubdivisionCode, - coordinates = coordinates, - associations = associations, - ancestors = ancestors, - descendants = descendants, - propertyIds = propertyIds, - propertyIdsExpanded = propertyIdsExpanded, - categories = categories, - tags = tags, - ) + val instance = + Region( + id = id, + type = type, + name = name, + nameFull = nameFull, + descriptor = descriptor, + iataAirportCode = iataAirportCode, + iataAirportMetroCode = iataAirportMetroCode, + countryCode = countryCode, + countrySubdivisionCode = countrySubdivisionCode, + coordinates = coordinates, + associations = associations, + ancestors = ancestors, + descendants = descendants, + propertyIds = propertyIds, + propertyIdsExpanded = propertyIdsExpanded, + categories = categories, + tags = tags + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Region) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -237,6 +249,6 @@ data class Region( propertyIds = propertyIds, propertyIdsExpanded = propertyIdsExpanded, categories = categories, - tags = tags, + tags = tags ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreement.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreement.kt index 05dc295b19..b24d779573 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreement.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreement.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.RentalAgreementLinks import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Information about a vacation rentals rental agreement. @@ -46,7 +44,7 @@ import javax.validation.constraints.Size data class RentalAgreement( @JsonProperty("links") @field:Valid - val links: RentalAgreementLinks? = null, + val links: RentalAgreementLinks? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class RentalAgreement( } class Builder( - private var links: RentalAgreementLinks? = null, + private var links: RentalAgreementLinks? = null ) { fun links(links: RentalAgreementLinks?) = apply { this.links = links } fun build(): RentalAgreement { - return RentalAgreement( - links = links, - ) + val instance = + RentalAgreement( + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RentalAgreement) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreementLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreementLinks.kt index b7174293a0..e5e842e2ba 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreementLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RentalAgreementLinks.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including link to get the rental agreement. @@ -46,7 +44,7 @@ import javax.validation.constraints.Size data class RentalAgreementLinks( @JsonProperty("rental_agreement") @field:Valid - val rentalAgreement: Link? = null, + val rentalAgreement: Link? = null ) { companion object { @JvmStatic @@ -54,19 +52,42 @@ data class RentalAgreementLinks( } class Builder( - private var rentalAgreement: Link? = null, + private var rentalAgreement: Link? = null ) { fun rentalAgreement(rentalAgreement: Link?) = apply { this.rentalAgreement = rentalAgreement } fun build(): RentalAgreementLinks { - return RentalAgreementLinks( - rentalAgreement = rentalAgreement, - ) + val instance = + RentalAgreementLinks( + rentalAgreement = rentalAgreement + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RentalAgreementLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( - rentalAgreement = rentalAgreement, + rentalAgreement = rentalAgreement ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Review.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Review.kt index e796718821..1ca6d8423a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Review.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Review.kt @@ -25,21 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.ManagementResponse import com.expediagroup.sdk.rapid.models.TravelCompanion import com.expediagroup.sdk.rapid.models.TripReason import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A review object for a property. @@ -92,7 +90,7 @@ data class Review( // A collection of the management responses to this review. @JsonProperty("management_responses") @field:Valid - val managementResponses: kotlin.collections.List? = null, + val managementResponses: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -109,7 +107,7 @@ data class Review( private var tripReason: TripReason? = null, private var travelCompanion: TravelCompanion? = null, private var text: kotlin.String? = null, - private var managementResponses: kotlin.collections.List? = null, + private var managementResponses: kotlin.collections.List? = null ) { fun verificationSource(verificationSource: kotlin.String?) = apply { this.verificationSource = verificationSource } @@ -129,24 +127,44 @@ data class Review( fun text(text: kotlin.String?) = apply { this.text = text } - fun managementResponses(managementResponses: kotlin.collections.List?) = - apply { - this.managementResponses = managementResponses - } + fun managementResponses(managementResponses: kotlin.collections.List?) = apply { this.managementResponses = managementResponses } fun build(): Review { - return Review( - verificationSource = verificationSource, - title = title, - dateSubmitted = dateSubmitted, - rating = rating, - reviewerName = reviewerName, - stayDate = stayDate, - tripReason = tripReason, - travelCompanion = travelCompanion, - text = text, - managementResponses = managementResponses, - ) + val instance = + Review( + verificationSource = verificationSource, + title = title, + dateSubmitted = dateSubmitted, + rating = rating, + reviewerName = reviewerName, + stayDate = stayDate, + tripReason = tripReason, + travelCompanion = travelCompanion, + text = text, + managementResponses = managementResponses + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Review) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -161,6 +179,6 @@ data class Review( tripReason = tripReason, travelCompanion = travelCompanion, text = text, - managementResponses = managementResponses, + managementResponses = managementResponses ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomAvailability.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomAvailability.kt index c3cde8895e..51c584d5b3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomAvailability.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomAvailability.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Rate import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The room information. @@ -57,7 +55,7 @@ data class RoomAvailability( // Array of objects containing rate information. @JsonProperty("rates") @field:Valid - val rates: kotlin.collections.List? = null, + val rates: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -67,7 +65,7 @@ data class RoomAvailability( class Builder( private var id: kotlin.String? = null, private var roomName: kotlin.String? = null, - private var rates: kotlin.collections.List? = null, + private var rates: kotlin.collections.List? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -76,11 +74,34 @@ data class RoomAvailability( fun rates(rates: kotlin.collections.List?) = apply { this.rates = rates } fun build(): RoomAvailability { - return RoomAvailability( - id = id, - roomName = roomName, - rates = rates, - ) + val instance = + RoomAvailability( + id = id, + roomName = roomName, + rates = rates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomAvailability) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -88,6 +109,6 @@ data class RoomAvailability( Builder( id = id, roomName = roomName, - rates = rates, + rates = rates ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomContent.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomContent.kt index 4e8a54fd96..961a048351 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomContent.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomContent.kt @@ -25,11 +25,12 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amenity import com.expediagroup.sdk.rapid.models.Area import com.expediagroup.sdk.rapid.models.BedGroup @@ -38,12 +39,9 @@ import com.expediagroup.sdk.rapid.models.Image import com.expediagroup.sdk.rapid.models.Occupancy import com.expediagroup.sdk.rapid.models.View import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual room. @@ -90,7 +88,7 @@ data class RoomContent( val views: kotlin.collections.Map? = null, @JsonProperty("occupancy") @field:Valid - val occupancy: Occupancy? = null, + val occupancy: Occupancy? = null ) { companion object { @JvmStatic @@ -106,7 +104,7 @@ data class RoomContent( private var bedGroups: kotlin.collections.Map? = null, private var area: Area? = null, private var views: kotlin.collections.Map? = null, - private var occupancy: Occupancy? = null, + private var occupancy: Occupancy? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -127,17 +125,40 @@ data class RoomContent( fun occupancy(occupancy: Occupancy?) = apply { this.occupancy = occupancy } fun build(): RoomContent { - return RoomContent( - id = id, - name = name, - descriptions = descriptions, - amenities = amenities, - images = images, - bedGroups = bedGroups, - area = area, - views = views, - occupancy = occupancy, - ) + val instance = + RoomContent( + id = id, + name = name, + descriptions = descriptions, + amenities = amenities, + images = images, + bedGroups = bedGroups, + area = area, + views = views, + occupancy = occupancy + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomContent) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -151,6 +172,6 @@ data class RoomContent( bedGroups = bedGroups, area = area, views = views, - occupancy = occupancy, + occupancy = occupancy ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomHistoryItem.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomHistoryItem.kt index 1471b3feb0..a9a35913b4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomHistoryItem.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomHistoryItem.kt @@ -25,29 +25,27 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Charge import com.expediagroup.sdk.rapid.models.ConfirmationId import com.expediagroup.sdk.rapid.models.RateHistory import com.expediagroup.sdk.rapid.models.StatusItinerary import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A room history event, representing a change made to a specific room. * @param historyId Room history id for particular change. * @param eventTimestamp Date and time in UTC of the change event, in extended ISO 8601 format. - * @param eventType Type type of event associated with this history item such as modified or canceled. - * @param eventSource The source of the event. If `voyager_agent`, `agent_id` will be supplied. + * @param eventType Type of event associated with this history item such as modified or canceled. If the booking is marked as a no-show by the property/supplier, the value of event_type is `canceled` when the `include` request parameter is `history`. However, it is `canceled_no_show` when the `include` request parameter is `history_v2`. + * @param eventSource The source of the event. If `voyager_agent`, `agent_id` will be supplied. If the event source is property/supplier, the value of event_source is `other` when the `include` request parameter is `history`. However, it is `supplier` when the `include` request parameter is `history_v2`. * @param changeReferenceId Optional identifier provided during changes via Rapid. * @param agentId An agent user id number associated with a modification. * @param roomId The room id. @@ -77,10 +75,10 @@ data class RoomHistoryItem( @JsonProperty("event_timestamp") @field:Valid val eventTimestamp: kotlin.String? = null, - // Type type of event associated with this history item such as modified or canceled. + // Type of event associated with this history item such as modified or canceled. If the booking is marked as a no-show by the property/supplier, the value of event_type is `canceled` when the `include` request parameter is `history`. However, it is `canceled_no_show` when the `include` request parameter is `history_v2`. @JsonProperty("event_type") val eventType: RoomHistoryItem.EventType? = null, - // The source of the event. If `voyager_agent`, `agent_id` will be supplied. + // The source of the event. If `voyager_agent`, `agent_id` will be supplied. If the event source is property/supplier, the value of event_source is `other` when the `include` request parameter is `history`. However, it is `supplier` when the `include` request parameter is `history_v2`. @JsonProperty("event_source") val eventSource: RoomHistoryItem.EventSource? = null, // Optional identifier provided during changes via Rapid. @@ -152,7 +150,7 @@ data class RoomHistoryItem( val penalty: Charge? = null, @JsonProperty("rate") @field:Valid - val rate: RateHistory? = null, + val rate: RateHistory? = null ) { companion object { @JvmStatic @@ -182,7 +180,7 @@ data class RoomHistoryItem( private var amountCharged: Charge? = null, private var amountRefunded: Charge? = null, private var penalty: Charge? = null, - private var rate: RateHistory? = null, + private var rate: RateHistory? = null ) { fun historyId(historyId: kotlin.String?) = apply { this.historyId = historyId } @@ -231,31 +229,54 @@ data class RoomHistoryItem( fun rate(rate: RateHistory?) = apply { this.rate = rate } fun build(): RoomHistoryItem { - return RoomHistoryItem( - historyId = historyId, - eventTimestamp = eventTimestamp, - eventType = eventType, - eventSource = eventSource, - changeReferenceId = changeReferenceId, - agentId = agentId, - roomId = roomId, - confirmationId = confirmationId, - bedGroupId = bedGroupId, - checkin = checkin, - checkout = checkout, - numberOfAdults = numberOfAdults, - childAges = childAges, - givenName = givenName, - familyName = familyName, - status = status, - specialRequest = specialRequest, - smoking = smoking, - loyaltyId = loyaltyId, - amountCharged = amountCharged, - amountRefunded = amountRefunded, - penalty = penalty, - rate = rate, - ) + val instance = + RoomHistoryItem( + historyId = historyId, + eventTimestamp = eventTimestamp, + eventType = eventType, + eventSource = eventSource, + changeReferenceId = changeReferenceId, + agentId = agentId, + roomId = roomId, + confirmationId = confirmationId, + bedGroupId = bedGroupId, + checkin = checkin, + checkout = checkout, + numberOfAdults = numberOfAdults, + childAges = childAges, + givenName = givenName, + familyName = familyName, + status = status, + specialRequest = specialRequest, + smoking = smoking, + loyaltyId = loyaltyId, + amountCharged = amountCharged, + amountRefunded = amountRefunded, + penalty = penalty, + rate = rate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomHistoryItem) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -283,12 +304,12 @@ data class RoomHistoryItem( amountCharged = amountCharged, amountRefunded = amountRefunded, penalty = penalty, - rate = rate, + rate = rate ) /** - * Type type of event associated with this history item such as modified or canceled. - * Values: CREATED,MODIFIED,CANCELED + * Type of event associated with this history item such as modified or canceled. If the booking is marked as a no-show by the property/supplier, the value of event_type is `canceled` when the `include` request parameter is `history`. However, it is `canceled_no_show` when the `include` request parameter is `history_v2`. + * Values: CREATED,MODIFIED,CANCELED,CANCELED_NO_SHOW */ enum class EventType(val value: kotlin.String) { @JsonProperty("created") @@ -299,11 +320,14 @@ data class RoomHistoryItem( @JsonProperty("canceled") CANCELED("canceled"), + + @JsonProperty("canceled_no_show") + CANCELED_NO_SHOW("canceled_no_show") } /** - * The source of the event. If `voyager_agent`, `agent_id` will be supplied. - * Values: RAPID_API,VOYAGER_AGENT,OTHER + * The source of the event. If `voyager_agent`, `agent_id` will be supplied. If the event source is property/supplier, the value of event_source is `other` when the `include` request parameter is `history`. However, it is `supplier` when the `include` request parameter is `history_v2`. + * Values: RAPID_API,VOYAGER_AGENT,OTHER,SUPPLIER */ enum class EventSource(val value: kotlin.String) { @JsonProperty("rapid_api") @@ -314,5 +338,8 @@ data class RoomHistoryItem( @JsonProperty("other") OTHER("other"), + + @JsonProperty("supplier") + SUPPLIER("supplier") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItinerary.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItinerary.kt index a4c61549ca..05110e69f5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItinerary.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItinerary.kt @@ -25,23 +25,21 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.ConfirmationId import com.expediagroup.sdk.rapid.models.Loyalty import com.expediagroup.sdk.rapid.models.RateItinerary import com.expediagroup.sdk.rapid.models.RoomItineraryLinks import com.expediagroup.sdk.rapid.models.StatusItinerary import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The room information. @@ -121,7 +119,7 @@ data class RoomItinerary( val rate: RateItinerary? = null, @JsonProperty("links") @field:Valid - val links: RoomItineraryLinks? = null, + val links: RoomItineraryLinks? = null ) { companion object { @JvmStatic @@ -144,7 +142,7 @@ data class RoomItinerary( private var loyaltyId: kotlin.String? = null, private var loyalty: Loyalty? = null, private var rate: RateItinerary? = null, - private var links: RoomItineraryLinks? = null, + private var links: RoomItineraryLinks? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -179,24 +177,47 @@ data class RoomItinerary( fun links(links: RoomItineraryLinks?) = apply { this.links = links } fun build(): RoomItinerary { - return RoomItinerary( - id = id, - confirmationId = confirmationId, - bedGroupId = bedGroupId, - checkin = checkin, - checkout = checkout, - numberOfAdults = numberOfAdults, - childAges = childAges, - givenName = givenName, - familyName = familyName, - status = status, - specialRequest = specialRequest, - smoking = smoking, - loyaltyId = loyaltyId, - loyalty = loyalty, - rate = rate, - links = links, - ) + val instance = + RoomItinerary( + id = id, + confirmationId = confirmationId, + bedGroupId = bedGroupId, + checkin = checkin, + checkout = checkout, + numberOfAdults = numberOfAdults, + childAges = childAges, + givenName = givenName, + familyName = familyName, + status = status, + specialRequest = specialRequest, + smoking = smoking, + loyaltyId = loyaltyId, + loyalty = loyalty, + rate = rate, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomItinerary) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -217,6 +238,6 @@ data class RoomItinerary( loyaltyId = loyaltyId, loyalty = loyalty, rate = rate, - links = links, + links = links ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItineraryLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItineraryLinks.kt index ec8dece1cf..1515dcd10a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItineraryLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomItineraryLinks.kt @@ -25,22 +25,20 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.ChangeRoomDetailsOperationLink import com.expediagroup.sdk.rapid.operations.DeleteRoomOperationLink import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links - * `cancel` - Cancel the booking for this room * `change` - A PUT call to modify the details of the booking for this room (soft change) * `shop_for_change` - Shop for rates to evaluate for possible rebooking. This shop call will show the estimated financial impact of the change.
    Current parameters supported in shop for change: `checkin`, `checkout`, `occupancy` See: [additional rates](#get-/properties/-property_id-/availability) @@ -58,7 +56,7 @@ data class RoomItineraryLinks( val change: ChangeRoomDetailsOperationLink? = null, @JsonProperty("shop_for_change") @field:Valid - val shopForChange: GetAdditionalAvailabilityOperationLink? = null, + val shopForChange: GetAdditionalAvailabilityOperationLink? = null ) { companion object { @JvmStatic @@ -68,7 +66,7 @@ data class RoomItineraryLinks( class Builder( private var cancel: DeleteRoomOperationLink? = null, private var change: ChangeRoomDetailsOperationLink? = null, - private var shopForChange: GetAdditionalAvailabilityOperationLink? = null, + private var shopForChange: GetAdditionalAvailabilityOperationLink? = null ) { fun cancel(cancel: DeleteRoomOperationLink?) = apply { this.cancel = cancel } @@ -77,11 +75,34 @@ data class RoomItineraryLinks( fun shopForChange(shopForChange: GetAdditionalAvailabilityOperationLink?) = apply { this.shopForChange = shopForChange } fun build(): RoomItineraryLinks { - return RoomItineraryLinks( - cancel = cancel, - change = change, - shopForChange = shopForChange, - ) + val instance = + RoomItineraryLinks( + cancel = cancel, + change = change, + shopForChange = shopForChange + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomItineraryLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -89,6 +110,6 @@ data class RoomItineraryLinks( Builder( cancel = cancel, change = change, - shopForChange = shopForChange, + shopForChange = shopForChange ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheck.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheck.kt index 6a62c8f415..5b23a0d247 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheck.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheck.kt @@ -25,11 +25,12 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amount import com.expediagroup.sdk.rapid.models.Charge import com.expediagroup.sdk.rapid.models.Deposit @@ -38,12 +39,9 @@ import com.expediagroup.sdk.rapid.models.RoomPriceCheckLinks import com.expediagroup.sdk.rapid.models.StatusPriceCheck import com.expediagroup.sdk.rapid.models.TraderInformation import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The price check response. @@ -90,7 +88,7 @@ data class RoomPriceCheck( val penalty: Charge? = null, @JsonProperty("trader_information") @field:Valid - val traderInformation: TraderInformation? = null, + val traderInformation: TraderInformation? = null ) { companion object { @JvmStatic @@ -107,14 +105,11 @@ data class RoomPriceCheck( private var refund: Charge? = null, private var amountOwed: Charge? = null, private var penalty: Charge? = null, - private var traderInformation: TraderInformation? = null, + private var traderInformation: TraderInformation? = null ) { fun status(status: StatusPriceCheck?) = apply { this.status = status } - fun occupancyPricing(occupancyPricing: kotlin.collections.Map?) = - apply { - this.occupancyPricing = occupancyPricing - } + fun occupancyPricing(occupancyPricing: kotlin.collections.Map?) = apply { this.occupancyPricing = occupancyPricing } fun links(links: RoomPriceCheckLinks?) = apply { this.links = links } @@ -133,18 +128,41 @@ data class RoomPriceCheck( fun traderInformation(traderInformation: TraderInformation?) = apply { this.traderInformation = traderInformation } fun build(): RoomPriceCheck { - return RoomPriceCheck( - status = status, - occupancyPricing = occupancyPricing, - links = links, - cardOnFileLimit = cardOnFileLimit, - refundableDamageDeposit = refundableDamageDeposit, - deposits = deposits, - refund = refund, - amountOwed = amountOwed, - penalty = penalty, - traderInformation = traderInformation, - ) + val instance = + RoomPriceCheck( + status = status, + occupancyPricing = occupancyPricing, + links = links, + cardOnFileLimit = cardOnFileLimit, + refundableDamageDeposit = refundableDamageDeposit, + deposits = deposits, + refund = refund, + amountOwed = amountOwed, + penalty = penalty, + traderInformation = traderInformation + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomPriceCheck) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -159,6 +177,6 @@ data class RoomPriceCheck( refund = refund, amountOwed = amountOwed, penalty = penalty, - traderInformation = traderInformation, + traderInformation = traderInformation ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheckLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheckLinks.kt index 476fd43e83..cafe9cd4a3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheckLinks.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/RoomPriceCheckLinks.kt @@ -25,23 +25,21 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Link import com.expediagroup.sdk.rapid.operations.CommitChangeOperationLink import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperationLink import com.expediagroup.sdk.rapid.operations.PostItineraryOperationLink import com.expediagroup.sdk.rapid.operations.PostPaymentSessionsOperationLink import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A map of links, including links to continue booking this rate or to shop for additional rates. If this rate is still available for booking then a book link will be present if PSD2 is not a requirement for you or a payment_session link will be present if PSD2 is a requirement for you. @@ -63,7 +61,7 @@ data class RoomPriceCheckLinks( val paymentSession: PostPaymentSessionsOperationLink? = null, @JsonProperty("additional_rates") @field:Valid - val additionalRates: GetAdditionalAvailabilityOperationLink? = null, + val additionalRates: GetAdditionalAvailabilityOperationLink? = null ) { companion object { @JvmStatic @@ -74,7 +72,7 @@ data class RoomPriceCheckLinks( private var book: PostItineraryOperationLink? = null, private var commit: CommitChangeOperationLink? = null, private var paymentSession: PostPaymentSessionsOperationLink? = null, - private var additionalRates: GetAdditionalAvailabilityOperationLink? = null, + private var additionalRates: GetAdditionalAvailabilityOperationLink? = null ) { fun book(book: PostItineraryOperationLink?) = apply { this.book = book } @@ -85,12 +83,35 @@ data class RoomPriceCheckLinks( fun additionalRates(additionalRates: GetAdditionalAvailabilityOperationLink?) = apply { this.additionalRates = additionalRates } fun build(): RoomPriceCheckLinks { - return RoomPriceCheckLinks( - book = book, - commit = commit, - paymentSession = paymentSession, - additionalRates = additionalRates, - ) + val instance = + RoomPriceCheckLinks( + book = book, + commit = commit, + paymentSession = paymentSession, + additionalRates = additionalRates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomPriceCheckLinks) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -99,6 +120,6 @@ data class RoomPriceCheckLinks( book = book, commit = commit, paymentSession = paymentSession, - additionalRates = additionalRates, + additionalRates = additionalRates ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SaleScenario.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SaleScenario.kt index c6829e3ca6..6e2b65232f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SaleScenario.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SaleScenario.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Provides the special scenarios that need to be taken into account when using this rate. @@ -66,7 +64,7 @@ data class SaleScenario( // If true, this rate has an associated mobile promotion which can be advertised as a special mobile only deal. This will only be present when `include=sale_scenario.mobile_promotion` is passed as a request parameter. @JsonProperty("mobile_promotion") @field:Valid - val mobilePromotion: kotlin.Boolean? = null, + val mobilePromotion: kotlin.Boolean? = null ) { companion object { @JvmStatic @@ -78,7 +76,7 @@ data class SaleScenario( private var member: kotlin.Boolean? = null, private var corporate: kotlin.Boolean? = null, private var distribution: kotlin.Boolean? = null, - private var mobilePromotion: kotlin.Boolean? = null, + private var mobilePromotion: kotlin.Boolean? = null ) { fun `package`(`package`: kotlin.Boolean?) = apply { this.`package` = `package` } @@ -91,13 +89,36 @@ data class SaleScenario( fun mobilePromotion(mobilePromotion: kotlin.Boolean?) = apply { this.mobilePromotion = mobilePromotion } fun build(): SaleScenario { - return SaleScenario( - `package` = `package`, - member = member, - corporate = corporate, - distribution = distribution, - mobilePromotion = mobilePromotion, - ) + val instance = + SaleScenario( + `package` = `package`, + member = member, + corporate = corporate, + distribution = distribution, + mobilePromotion = mobilePromotion + ) + + validate(instance) + + return instance + } + + private fun validate(instance: SaleScenario) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -107,6 +128,6 @@ data class SaleScenario( member = member, corporate = corporate, distribution = distribution, - mobilePromotion = mobilePromotion, + mobilePromotion = mobilePromotion ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SpokenLanguage.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SpokenLanguage.kt index acc43e6d26..efddfaefb3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SpokenLanguage.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SpokenLanguage.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual spoken language. @@ -51,7 +49,7 @@ data class SpokenLanguage( // Spoken language name. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class SpokenLanguage( class Builder( private var id: kotlin.String? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun name(name: kotlin.String?) = apply { this.name = name } fun build(): SpokenLanguage { - return SpokenLanguage( - id = id, - name = name, - ) + val instance = + SpokenLanguage( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: SpokenLanguage) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Statistic.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Statistic.kt index f2176fb074..8bd58e02ee 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Statistic.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Statistic.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual statistic. @@ -56,7 +54,7 @@ data class Statistic( // Statistic value. @JsonProperty("value") @field:Valid - val `value`: kotlin.String? = null, + val `value`: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Statistic( class Builder( private var id: kotlin.String? = null, private var name: kotlin.String? = null, - private var `value`: kotlin.String? = null, + private var `value`: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -75,11 +73,34 @@ data class Statistic( fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } fun build(): Statistic { - return Statistic( - id = id, - name = name, - `value` = `value`, - ) + val instance = + Statistic( + id = id, + name = name, + `value` = `value` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Statistic) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Statistic( Builder( id = id, name = name, - `value` = `value`, + `value` = `value` ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Status.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Status.kt index 3733231e60..3985f54b94 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Status.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Status.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -44,5 +44,5 @@ enum class Status(val value: kotlin.String) { PRICE_CHANGED("price_changed"), @JsonProperty("sold_out") - SOLD_OUT("sold_out"), + SOLD_OUT("sold_out") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusItinerary.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusItinerary.kt index bc02fe5735..fc383ac15b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusItinerary.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusItinerary.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -44,5 +44,5 @@ enum class StatusItinerary(val value: kotlin.String) { BOOKED("booked"), @JsonProperty("canceled") - CANCELED("canceled"), + CANCELED("canceled") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusPriceCheck.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusPriceCheck.kt index a76d7ba743..5aa441fe47 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusPriceCheck.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StatusPriceCheck.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -44,5 +44,5 @@ enum class StatusPriceCheck(val value: kotlin.String) { PRICE_CHANGED("price_changed"), @JsonProperty("sold_out") - SOLD_OUT("sold_out"), + SOLD_OUT("sold_out") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Stay.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Stay.kt index 7f8411a378..bc7627aa6d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Stay.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Stay.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.StayType import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * @@ -56,7 +54,7 @@ data class Stay( // Currency of the amount object. @JsonProperty("currency") @field:Valid - val currency: kotlin.String? = null, + val currency: kotlin.String? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class Stay( class Builder( private var type: StayType? = null, private var `value`: kotlin.String? = null, - private var currency: kotlin.String? = null, + private var currency: kotlin.String? = null ) { fun type(type: StayType?) = apply { this.type = type } @@ -75,11 +73,34 @@ data class Stay( fun currency(currency: kotlin.String?) = apply { this.currency = currency } fun build(): Stay { - return Stay( - type = type, - `value` = `value`, - currency = currency, - ) + val instance = + Stay( + type = type, + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Stay) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class Stay( Builder( type = type, `value` = `value`, - currency = currency, + currency = currency ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayConstraints.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayConstraints.kt index 8b53bb2f4c..d4724fe58e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayConstraints.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayConstraints.kt @@ -25,18 +25,15 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length -import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Validation /** * @@ -49,7 +46,7 @@ data class StayConstraints( val minStay: kotlin.Int? = null, // The maximum number of days for a stay. @JsonProperty("max_stay") - val maxStay: kotlin.Int? = null, + val maxStay: kotlin.Int? = null ) { companion object { @JvmStatic @@ -58,23 +55,46 @@ data class StayConstraints( class Builder( private var minStay: kotlin.Int? = null, - private var maxStay: kotlin.Int? = null, + private var maxStay: kotlin.Int? = null ) { fun minStay(minStay: kotlin.Int?) = apply { this.minStay = minStay } fun maxStay(maxStay: kotlin.Int?) = apply { this.maxStay = maxStay } fun build(): StayConstraints { - return StayConstraints( - minStay = minStay, - maxStay = maxStay, - ) + val instance = + StayConstraints( + minStay = minStay, + maxStay = maxStay + ) + + validate(instance) + + return instance + } + + private fun validate(instance: StayConstraints) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( minStay = minStay, - maxStay = maxStay, + maxStay = maxStay ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayType.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayType.kt index 36eb5af7c5..9e5aa3f377 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayType.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/StayType.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -59,5 +59,5 @@ enum class StayType(val value: kotlin.String) { RECOVERY_CHARGES_AND_FEES("recovery_charges_and_fees"), @JsonProperty("traveler_service_fee") - TRAVELER_SERVICE_FEE("traveler_service_fee"), + TRAVELER_SERVICE_FEE("traveler_service_fee") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SupplyContact.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SupplyContact.kt index d9deae5267..aff814a620 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SupplyContact.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SupplyContact.kt @@ -25,20 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Address1 import com.expediagroup.sdk.rapid.models.Phone import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The supply contact information. Note that full details may not be displayed until a short time prior to checkin. @@ -61,7 +59,7 @@ data class SupplyContact( val email: kotlin.String? = null, @JsonProperty("address") @field:Valid - val address: Address1? = null, + val address: Address1? = null ) { companion object { @JvmStatic @@ -72,7 +70,7 @@ data class SupplyContact( private var name: kotlin.String? = null, private var phone: Phone? = null, private var email: kotlin.String? = null, - private var address: Address1? = null, + private var address: Address1? = null ) { fun name(name: kotlin.String?) = apply { this.name = name } @@ -83,12 +81,35 @@ data class SupplyContact( fun address(address: Address1?) = apply { this.address = address } fun build(): SupplyContact { - return SupplyContact( - name = name, - phone = phone, - email = email, - address = address, - ) + val instance = + SupplyContact( + name = name, + phone = phone, + email = email, + address = address + ) + + validate(instance) + + return instance + } + + private fun validate(instance: SupplyContact) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -97,6 +118,6 @@ data class SupplyContact( name = name, phone = phone, email = email, - address = address, + address = address ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TestNotificationRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TestNotificationRequest.kt index cc28a43804..e94f4f7393 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TestNotificationRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TestNotificationRequest.kt @@ -25,18 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -45,8 +44,9 @@ import javax.validation.constraints.Size data class TestNotificationRequest( // The event type for which the test notification is requested. @JsonProperty("event_type") + @field:NotNull @field:Valid - val eventType: kotlin.String, + val eventType: kotlin.String ) { companion object { @JvmStatic @@ -54,27 +54,42 @@ data class TestNotificationRequest( } class Builder( - private var eventType: kotlin.String? = null, + private var eventType: kotlin.String? = null ) { fun eventType(eventType: kotlin.String) = apply { this.eventType = eventType } fun build(): TestNotificationRequest { - // Check required params - validateNullity() - return TestNotificationRequest( - eventType = eventType!!, - ) + val instance = + TestNotificationRequest( + eventType = eventType!! + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (eventType == null) { - throw NullPointerException("Required parameter eventType is missing") + private fun validate(instance: TestNotificationRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } fun toBuilder() = Builder( - eventType = eventType!!, + eventType = eventType!! ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Theme.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Theme.kt index 681782ab51..647d5df40e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Theme.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Theme.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual theme. @@ -51,7 +49,7 @@ data class Theme( // Theme name. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class Theme( class Builder( private var id: kotlin.String? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun name(name: kotlin.String?) = apply { this.name = name } fun build(): Theme { - return Theme( - id = id, - name = name, - ) + val instance = + Theme( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Theme) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ThirdPartyAuthRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ThirdPartyAuthRequest.kt index 690b053423..2516023e92 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ThirdPartyAuthRequest.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ThirdPartyAuthRequest.kt @@ -25,18 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @@ -53,18 +52,22 @@ import javax.validation.constraints.Size data class ThirdPartyAuthRequest( // Cryptographic element used to indicate Authentication was successfully performed @JsonProperty("cavv") + @field:NotNull @field:Valid val cavv: kotlin.String, // Electronic Commerce Indicator. The ECI is used in payer authentication to indicate the level of security used when the cardholder provided payment information to the merchant. Its value corresponds to the authentication result and the characteristics of the merchant checkout process. Each card network, e.g., Visa, MasterCard, JCB, has specific rules around the appropriate values and use of the ECI. @JsonProperty("eci") + @field:NotNull @field:Valid val eci: kotlin.String, // Indicates what version of 3DS was used to authenticate the user. @JsonProperty("three_ds_version") + @field:NotNull @field:Valid val threeDsVersion: kotlin.String, // Directory Server Transaction Id. Returned during authentication and is used as an additional parameter to validate that transaction was authenticated. @JsonProperty("ds_transaction_id") + @field:NotNull @field:Valid val dsTransactionId: kotlin.String, // set only if PAResStatus value is received in the authentication response @@ -86,7 +89,7 @@ data class ThirdPartyAuthRequest( // Only received for Mastercard transactions, else can be null. 0 - Non-SecureCode transaction, bypassed by the Merchant 1 - Merchant-Only SecureCode transaction 2 - Fully authenticated SecureCode transaction @JsonProperty("ucaf_indicator") @field:Valid - val ucafIndicator: kotlin.String? = null, + val ucafIndicator: kotlin.String? = null ) { companion object { @JvmStatic @@ -102,7 +105,7 @@ data class ThirdPartyAuthRequest( private var veResStatus: kotlin.String? = null, private var xid: kotlin.String? = null, private var cavvAlgorithm: kotlin.String? = null, - private var ucafIndicator: kotlin.String? = null, + private var ucafIndicator: kotlin.String? = null ) { fun cavv(cavv: kotlin.String) = apply { this.cavv = cavv } @@ -123,33 +126,39 @@ data class ThirdPartyAuthRequest( fun ucafIndicator(ucafIndicator: kotlin.String?) = apply { this.ucafIndicator = ucafIndicator } fun build(): ThirdPartyAuthRequest { - // Check required params - validateNullity() - return ThirdPartyAuthRequest( - cavv = cavv!!, - eci = eci!!, - threeDsVersion = threeDsVersion!!, - dsTransactionId = dsTransactionId!!, - paResStatus = paResStatus, - veResStatus = veResStatus, - xid = xid, - cavvAlgorithm = cavvAlgorithm, - ucafIndicator = ucafIndicator, - ) + val instance = + ThirdPartyAuthRequest( + cavv = cavv!!, + eci = eci!!, + threeDsVersion = threeDsVersion!!, + dsTransactionId = dsTransactionId!!, + paResStatus = paResStatus, + veResStatus = veResStatus, + xid = xid, + cavvAlgorithm = cavvAlgorithm, + ucafIndicator = ucafIndicator + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (cavv == null) { - throw NullPointerException("Required parameter cavv is missing") - } - if (eci == null) { - throw NullPointerException("Required parameter eci is missing") - } - if (threeDsVersion == null) { - throw NullPointerException("Required parameter threeDsVersion is missing") - } - if (dsTransactionId == null) { - throw NullPointerException("Required parameter dsTransactionId is missing") + private fun validate(instance: ThirdPartyAuthRequest) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -164,6 +173,6 @@ data class ThirdPartyAuthRequest( veResStatus = veResStatus, xid = xid, cavvAlgorithm = cavvAlgorithm, - ucafIndicator = ucafIndicator, + ucafIndicator = ucafIndicator ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Totals.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Totals.kt index bd8a92ce49..58c4367680 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Totals.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Totals.kt @@ -25,19 +25,17 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Charge import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The total price of charges, given various criteria. * `inclusive` - provides the total price including taxes and fees. This does not include property collected fees such as resort, mandatory taxes, and mandatory fees. * `exclusive` - provides the total price excluding taxes and fees. * `property_inclusive` - provides the total price including taxes, fees, and property collected fees such as resort, mandatory taxes, and mandatory fees. * `inclusive_strikethrough` - provides the tax `inclusive` total price with any property funded discounts added back. Can be used to merchandise the savings due to a discount. * `strikethrough` - provides the tax `exclusive` total price with any property funded discounts added back. Can be used to merchandise the savings due to a discount. * `property_inclusive_strikethrough` - provides the tax, fees, and property collected fees `inclusive` total price with any property funded discounts added back. Can be used to merchandise the savings due to a discount. * `marketing_fee` - provides the potential owed earnings per transaction. * `gross_profit` - provides the estimated gross profit per transaction. * `minimum_selling_price` - provides the minimum selling price. * `property_fees` - provides the total of the fees collected by the property. @@ -82,7 +80,7 @@ data class Totals( val minimumSellingPrice: Charge? = null, @JsonProperty("property_fees") @field:Valid - val propertyFees: Charge? = null, + val propertyFees: Charge? = null ) { companion object { @JvmStatic @@ -99,7 +97,7 @@ data class Totals( private var marketingFee: Charge? = null, private var grossProfit: Charge? = null, private var minimumSellingPrice: Charge? = null, - private var propertyFees: Charge? = null, + private var propertyFees: Charge? = null ) { fun inclusive(inclusive: Charge?) = apply { this.inclusive = inclusive } @@ -111,10 +109,7 @@ data class Totals( fun strikethrough(strikethrough: Charge?) = apply { this.strikethrough = strikethrough } - fun propertyInclusiveStrikethrough(propertyInclusiveStrikethrough: Charge?) = - apply { - this.propertyInclusiveStrikethrough = propertyInclusiveStrikethrough - } + fun propertyInclusiveStrikethrough(propertyInclusiveStrikethrough: Charge?) = apply { this.propertyInclusiveStrikethrough = propertyInclusiveStrikethrough } fun marketingFee(marketingFee: Charge?) = apply { this.marketingFee = marketingFee } @@ -125,18 +120,41 @@ data class Totals( fun propertyFees(propertyFees: Charge?) = apply { this.propertyFees = propertyFees } fun build(): Totals { - return Totals( - inclusive = inclusive, - exclusive = exclusive, - propertyInclusive = propertyInclusive, - inclusiveStrikethrough = inclusiveStrikethrough, - strikethrough = strikethrough, - propertyInclusiveStrikethrough = propertyInclusiveStrikethrough, - marketingFee = marketingFee, - grossProfit = grossProfit, - minimumSellingPrice = minimumSellingPrice, - propertyFees = propertyFees, - ) + val instance = + Totals( + inclusive = inclusive, + exclusive = exclusive, + propertyInclusive = propertyInclusive, + inclusiveStrikethrough = inclusiveStrikethrough, + strikethrough = strikethrough, + propertyInclusiveStrikethrough = propertyInclusiveStrikethrough, + marketingFee = marketingFee, + grossProfit = grossProfit, + minimumSellingPrice = minimumSellingPrice, + propertyFees = propertyFees + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Totals) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -151,6 +169,6 @@ data class Totals( marketingFee = marketingFee, grossProfit = grossProfit, minimumSellingPrice = minimumSellingPrice, - propertyFees = propertyFees, + propertyFees = propertyFees ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderAddress.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderAddress.kt index db426a0a9b..3d00711b08 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderAddress.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderAddress.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * The trader address. @@ -76,7 +74,7 @@ data class TraderAddress( // Customer's country code, in two-letter ISO 3166-1 alpha-2 format. @JsonProperty("country_code") @field:Valid - val countryCode: kotlin.String? = null, + val countryCode: kotlin.String? = null ) { companion object { @JvmStatic @@ -90,7 +88,7 @@ data class TraderAddress( private var city: kotlin.String? = null, private var stateProvinceCode: kotlin.String? = null, private var postalCode: kotlin.String? = null, - private var countryCode: kotlin.String? = null, + private var countryCode: kotlin.String? = null ) { fun line1(line1: kotlin.String?) = apply { this.line1 = line1 } @@ -107,15 +105,38 @@ data class TraderAddress( fun countryCode(countryCode: kotlin.String?) = apply { this.countryCode = countryCode } fun build(): TraderAddress { - return TraderAddress( - line1 = line1, - line2 = line2, - line3 = line3, - city = city, - stateProvinceCode = stateProvinceCode, - postalCode = postalCode, - countryCode = countryCode, - ) + val instance = + TraderAddress( + line1 = line1, + line2 = line2, + line3 = line3, + city = city, + stateProvinceCode = stateProvinceCode, + postalCode = postalCode, + countryCode = countryCode + ) + + validate(instance) + + return instance + } + + private fun validate(instance: TraderAddress) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -127,6 +148,6 @@ data class TraderAddress( city = city, stateProvinceCode = stateProvinceCode, postalCode = postalCode, - countryCode = countryCode, + countryCode = countryCode ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderDetailsInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderDetailsInner.kt index 9e0d92621b..d2ff0e80f6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderDetailsInner.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderDetailsInner.kt @@ -25,21 +25,20 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.TraderAddress import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonSetter import com.fasterxml.jackson.annotation.Nulls -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * Information of the professional entity that sells the property inventory or related services. @@ -57,6 +56,7 @@ data class TraderDetailsInner( // The trader contact message. @JsonProperty("contact_message") @JsonSetter(nulls = Nulls.AS_EMPTY) + @field:NotNull @field:Valid val contactMessage: kotlin.String? = "", // The trader name. @@ -89,7 +89,7 @@ data class TraderDetailsInner( // The trader phone number. @JsonProperty("phone") @field:Valid - val phone: kotlin.String? = null, + val phone: kotlin.String? = null ) { companion object { @JvmStatic @@ -105,7 +105,7 @@ data class TraderDetailsInner( private var selfCertification: kotlin.Boolean? = null, private var rightToWithdrawMessage: kotlin.String? = null, private var email: kotlin.String? = null, - private var phone: kotlin.String? = null, + private var phone: kotlin.String? = null ) { fun contactMessage(contactMessage: kotlin.String) = apply { this.contactMessage = contactMessage } @@ -126,24 +126,39 @@ data class TraderDetailsInner( fun phone(phone: kotlin.String?) = apply { this.phone = phone } fun build(): TraderDetailsInner { - // Check required params - validateNullity() - return TraderDetailsInner( - contactMessage = contactMessage!!, - name = name, - address = address, - businessRegisterName = businessRegisterName, - businessRegisterNumber = businessRegisterNumber, - selfCertification = selfCertification, - rightToWithdrawMessage = rightToWithdrawMessage, - email = email, - phone = phone, - ) + val instance = + TraderDetailsInner( + contactMessage = contactMessage!!, + name = name, + address = address, + businessRegisterName = businessRegisterName, + businessRegisterNumber = businessRegisterNumber, + selfCertification = selfCertification, + rightToWithdrawMessage = rightToWithdrawMessage, + email = email, + phone = phone + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (contactMessage == null) { - throw NullPointerException("Required parameter contactMessage is missing") + private fun validate(instance: TraderDetailsInner) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -158,6 +173,6 @@ data class TraderDetailsInner( selfCertification = selfCertification, rightToWithdrawMessage = rightToWithdrawMessage, email = email, - phone = phone, + phone = phone ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderInformation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderInformation.kt index 8c7cc5000d..b53e53f0c8 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderInformation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TraderInformation.kt @@ -25,19 +25,18 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.TraderDetailsInner import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * The professional entity or entities that sells the property inventory or related services. @@ -47,12 +46,13 @@ import javax.validation.constraints.Size data class TraderInformation( // The url linking to the full text terms and conditions. @JsonProperty("terms_and_conditions") + @field:NotNull @field:Valid val termsAndConditions: kotlin.String, // An array of traders. @JsonProperty("traders") @field:Valid - val traders: kotlin.collections.List? = null, + val traders: kotlin.collections.List? = null ) { companion object { @JvmStatic @@ -61,24 +61,39 @@ data class TraderInformation( class Builder( private var termsAndConditions: kotlin.String? = null, - private var traders: kotlin.collections.List? = null, + private var traders: kotlin.collections.List? = null ) { fun termsAndConditions(termsAndConditions: kotlin.String) = apply { this.termsAndConditions = termsAndConditions } fun traders(traders: kotlin.collections.List?) = apply { this.traders = traders } fun build(): TraderInformation { - // Check required params - validateNullity() - return TraderInformation( - termsAndConditions = termsAndConditions!!, - traders = traders, - ) + val instance = + TraderInformation( + termsAndConditions = termsAndConditions!!, + traders = traders + ) + + validate(instance) + + return instance } - private fun validateNullity() { - if (termsAndConditions == null) { - throw NullPointerException("Required parameter termsAndConditions is missing") + private fun validate(instance: TraderInformation) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -86,6 +101,6 @@ data class TraderInformation( fun toBuilder() = Builder( termsAndConditions = termsAndConditions!!, - traders = traders, + traders = traders ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TravelCompanion.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TravelCompanion.kt index 9ce390fbb1..67f1f1d398 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TravelCompanion.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TravelCompanion.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -53,5 +53,5 @@ enum class TravelCompanion(val value: kotlin.String) { FRIENDS("friends"), @JsonProperty("pet") - PET("pet"), + PET("pet") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TripReason.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TripReason.kt index 8c58081885..5e33329264 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TripReason.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/TripReason.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models @@ -47,5 +47,5 @@ enum class TripReason(val value: kotlin.String) { FRIENDS_AND_FAMILY("friends_and_family"), @JsonProperty("business_and_leisure") - BUSINESS_AND_LEISURE("business_and_leisure"), + BUSINESS_AND_LEISURE("business_and_leisure") } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnavailableReason.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnavailableReason.kt index 2a85380b60..f33abda24c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnavailableReason.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnavailableReason.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An unavailable reason that suggests ways that the request could be modified to locate available rooms and rates. @@ -50,7 +48,7 @@ data class UnavailableReason( // An associated value that provides helpful information for some codes. Not present for all codes. @JsonProperty("data") @field:Valid - val `data`: kotlin.String? = null, + val `data`: kotlin.String? = null ) { companion object { @JvmStatic @@ -59,24 +57,47 @@ data class UnavailableReason( class Builder( private var code: UnavailableReason.Code? = null, - private var `data`: kotlin.String? = null, + private var `data`: kotlin.String? = null ) { fun code(code: UnavailableReason.Code?) = apply { this.code = code } fun `data`(`data`: kotlin.String?) = apply { this.`data` = `data` } fun build(): UnavailableReason { - return UnavailableReason( - code = code, - `data` = `data`, - ) + val instance = + UnavailableReason( + code = code, + `data` = `data` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: UnavailableReason) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( code = code, - `data` = `data`, + `data` = `data` ) /** @@ -133,6 +154,6 @@ data class UnavailableReason( PARTIAL_INVENTORY_AVAILABLE("partial_inventory_available"), @JsonProperty("no_inventory_available") - NO_INVENTORY_AVAILABLE("no_inventory_available"), + NO_INVENTORY_AVAILABLE("no_inventory_available") } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnitConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnitConfiguration.kt index 64a6da2223..2e3a980d43 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnitConfiguration.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/UnitConfiguration.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * A room configuration. @@ -56,7 +54,7 @@ data class UnitConfiguration( // The number of beds of this size. @JsonProperty("quantity") @field:Valid - val quantity: kotlin.Int? = null, + val quantity: kotlin.Int? = null ) { companion object { @JvmStatic @@ -66,7 +64,7 @@ data class UnitConfiguration( class Builder( private var type: kotlin.String? = null, private var description: kotlin.String? = null, - private var quantity: kotlin.Int? = null, + private var quantity: kotlin.Int? = null ) { fun type(type: kotlin.String?) = apply { this.type = type } @@ -75,11 +73,34 @@ data class UnitConfiguration( fun quantity(quantity: kotlin.Int?) = apply { this.quantity = quantity } fun build(): UnitConfiguration { - return UnitConfiguration( - type = type, - description = description, - quantity = quantity, - ) + val instance = + UnitConfiguration( + type = type, + description = description, + quantity = quantity + ) + + validate(instance) + + return instance + } + + private fun validate(instance: UnitConfiguration) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -87,6 +108,6 @@ data class UnitConfiguration( Builder( type = type, description = description, - quantity = quantity, + quantity = quantity ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/VacationRentalDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/VacationRentalDetails.kt index e204f9f8ec..022cbe3b38 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/VacationRentalDetails.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/VacationRentalDetails.kt @@ -25,23 +25,21 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.Amenity import com.expediagroup.sdk.rapid.models.EnhancedHouseRules import com.expediagroup.sdk.rapid.models.PropertyManager import com.expediagroup.sdk.rapid.models.RentalAgreement import com.expediagroup.sdk.rapid.models.UnitConfiguration import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * Details for vacation rental properties. @@ -118,7 +116,7 @@ data class VacationRentalDetails( // A free text description that could contain significantly unstructured information that could impact the booking and should be displayed to customers. This field could contain html break tags `
    ` that may make display challenging. @JsonProperty("free_text") @field:Valid - val freeText: kotlin.String? = null, + val freeText: kotlin.String? = null ) { companion object { @JvmStatic @@ -140,7 +138,7 @@ data class VacationRentalDetails( private var listingUnit: kotlin.String? = null, private var ipmName: kotlin.String? = null, private var unitConfigurations: kotlin.collections.Map>? = null, - private var freeText: kotlin.String? = null, + private var freeText: kotlin.String? = null ) { fun registryNumber(registryNumber: kotlin.String?) = apply { this.registryNumber = registryNumber } @@ -152,10 +150,7 @@ data class VacationRentalDetails( fun houseRules(houseRules: kotlin.collections.List?) = apply { this.houseRules = houseRules } - fun enhancedHouseRules(enhancedHouseRules: kotlin.collections.Map?) = - apply { - this.enhancedHouseRules = enhancedHouseRules - } + fun enhancedHouseRules(enhancedHouseRules: kotlin.collections.Map?) = apply { this.enhancedHouseRules = enhancedHouseRules } fun amenities(amenities: Amenity?) = apply { this.amenities = amenities } @@ -171,31 +166,51 @@ data class VacationRentalDetails( fun ipmName(ipmName: kotlin.String?) = apply { this.ipmName = ipmName } - fun unitConfigurations(unitConfigurations: kotlin.collections.Map>?) = - apply { - this.unitConfigurations = unitConfigurations - } + fun unitConfigurations(unitConfigurations: kotlin.collections.Map>?) = apply { this.unitConfigurations = unitConfigurations } fun freeText(freeText: kotlin.String?) = apply { this.freeText = freeText } fun build(): VacationRentalDetails { - return VacationRentalDetails( - registryNumber = registryNumber, - privateHost = privateHost, - propertyManager = propertyManager, - rentalAgreement = rentalAgreement, - houseRules = houseRules, - enhancedHouseRules = enhancedHouseRules, - amenities = amenities, - vrboSrpId = vrboSrpId, - listingId = listingId, - listingNumber = listingNumber, - listingSource = listingSource, - listingUnit = listingUnit, - ipmName = ipmName, - unitConfigurations = unitConfigurations, - freeText = freeText, - ) + val instance = + VacationRentalDetails( + registryNumber = registryNumber, + privateHost = privateHost, + propertyManager = propertyManager, + rentalAgreement = rentalAgreement, + houseRules = houseRules, + enhancedHouseRules = enhancedHouseRules, + amenities = amenities, + vrboSrpId = vrboSrpId, + listingId = listingId, + listingNumber = listingNumber, + listingSource = listingSource, + listingUnit = listingUnit, + ipmName = ipmName, + unitConfigurations = unitConfigurations, + freeText = freeText + ) + + validate(instance) + + return instance + } + + private fun validate(instance: VacationRentalDetails) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -215,6 +230,6 @@ data class VacationRentalDetails( listingUnit = listingUnit, ipmName = ipmName, unitConfigurations = unitConfigurations, - freeText = freeText, + freeText = freeText ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ValueAdd.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ValueAdd.kt index a53a443249..b02d8ead34 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ValueAdd.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ValueAdd.kt @@ -25,21 +25,19 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.rapid.models.CategoryValueAdd import com.expediagroup.sdk.rapid.models.Frequency import com.expediagroup.sdk.rapid.models.OfferType import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual value add. @@ -71,7 +69,7 @@ data class ValueAdd( // Indicates how many guests the value add promotion applies to. @JsonProperty("person_count") @field:Valid - val personCount: java.math.BigDecimal? = null, + val personCount: java.math.BigDecimal? = null ) { companion object { @JvmStatic @@ -84,7 +82,7 @@ data class ValueAdd( private var category: CategoryValueAdd? = null, private var offerType: OfferType? = null, private var frequency: Frequency? = null, - private var personCount: java.math.BigDecimal? = null, + private var personCount: java.math.BigDecimal? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } @@ -99,14 +97,37 @@ data class ValueAdd( fun personCount(personCount: java.math.BigDecimal?) = apply { this.personCount = personCount } fun build(): ValueAdd { - return ValueAdd( - id = id, - description = description, - category = category, - offerType = offerType, - frequency = frequency, - personCount = personCount, - ) + val instance = + ValueAdd( + id = id, + description = description, + category = category, + offerType = offerType, + frequency = frequency, + personCount = personCount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ValueAdd) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -117,6 +138,6 @@ data class ValueAdd( category = category, offerType = offerType, frequency = frequency, - personCount = personCount, + personCount = personCount ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/View.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/View.kt index 8c73566bb5..4ea3eed19a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/View.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/View.kt @@ -25,18 +25,16 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty -import org.hibernate.validator.constraints.Length +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size +import javax.validation.Validation /** * An individual view. @@ -51,7 +49,7 @@ data class View( // View name. @JsonProperty("name") @field:Valid - val name: kotlin.String? = null, + val name: kotlin.String? = null ) { companion object { @JvmStatic @@ -60,23 +58,46 @@ data class View( class Builder( private var id: kotlin.String? = null, - private var name: kotlin.String? = null, + private var name: kotlin.String? = null ) { fun id(id: kotlin.String?) = apply { this.id = id } fun name(name: kotlin.String?) = apply { this.name = name } fun build(): View { - return View( - id = id, - name = name, - ) + val instance = + View( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: View) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(instance) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } fun toBuilder() = Builder( id = id, - name = name, + name = name ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/ApiException.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/ApiException.kt index 503bab3783..f533fb1b43 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/ApiException.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/ApiException.kt @@ -25,7 +25,7 @@ "ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", - "UnusedImport", + "UnusedImport" ) package com.expediagroup.sdk.rapid.models.exception @@ -42,20 +42,18 @@ import kotlinx.coroutines.runBlocking internal open class HttpStatusCodeRange( private val statusCode: String, - val getException: (HttpResponse) -> ExpediaGroupApiException, + val getException: (HttpResponse) -> ExpediaGroupApiException ) : Comparable { - open fun matches(statusCode: String): Boolean = - if (isRangeDefinition()) this.statusCode.first() == statusCode.first() else this.statusCode == statusCode + open fun matches(statusCode: String): Boolean = if (isRangeDefinition()) this.statusCode.first() == statusCode.first() else this.statusCode == statusCode open fun isRangeDefinition(): Boolean = statusCode.matches(Regex("^[1-5]XX$")) - override fun compareTo(other: HttpStatusCodeRange): Int = - (if (this.isRangeDefinition()) 1 else 0).compareTo(if (other.isRangeDefinition()) 1 else 0) + override fun compareTo(other: HttpStatusCodeRange): Int = (if (this.isRangeDefinition()) 1 else 0).compareTo(if (other.isRangeDefinition()) 1 else 0) } internal object DefaultHttpStatusCodeRange : HttpStatusCodeRange( "DefaultHttpStatusCodeRange", - { ExpediaGroupServiceDefaultErrorException(it.status.value, runBlocking { it.bodyAsText() }, it.request.headers.getTransactionId()) }, + { ExpediaGroupServiceDefaultErrorException(it.status.value, runBlocking { it.bodyAsText() }, it.request.headers.getTransactionId()) } ) { override fun matches(statusCode: String): Boolean = true @@ -69,770 +67,372 @@ internal object ErrorObjectMapper { Pair( "changeRoomDetails", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "commitChange", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "409", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "410", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("409") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("410") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "deleteHeldBooking", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "deleteRoom", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getAdditionalAvailability", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getAvailability", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getBookingReceipt", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getCalendarAvailability", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getChainReference", listOf( - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getInactiveProperties", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "410", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("410") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getPaymentOptions", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getPropertyCatalogFile", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getPropertyContent", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "410", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("410") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getPropertyContentFile", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getPropertyGuestReviews", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getRegion", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getRegions", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "410", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("410") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getReservation", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "getReservationByItineraryId", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "postGeography", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "postItinerary", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "409", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "410", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("409") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("410") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "postPaymentSessions", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "priceCheck", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "putCompletePaymentSession", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "putResumeBooking", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "401", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "403", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "404", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "426", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "429", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "500", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - HttpStatusCodeRange( - "503", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("426") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "requestTestNotification", listOf( - HttpStatusCodeRange( - "400", - ) { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, - DefaultHttpStatusCodeRange, - ), + HttpStatusCodeRange("400") { ExpediaGroupApiErrorException(it.status.value, fetchErrorObject(it) as Error, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) ), Pair( "requestUndeliveredNotifications", listOf( - DefaultHttpStatusCodeRange, - ), - ), + DefaultHttpStatusCodeRange + ) + ) ) fun process( httpResponse: HttpResponse, - operationId: String, + operationId: String ): ExpediaGroupApiException = - httpStatusCodeRanges.getOrDefault(operationId, defaultHttpStatusCodeRanges).filter { - it.matches(httpResponse.status.value.toString()) - }.min().getException(httpResponse) + httpStatusCodeRanges.getOrDefault(operationId, defaultHttpStatusCodeRanges).filter { it.matches(httpResponse.status.value.toString()) }.min().getException(httpResponse) private inline fun fetchErrorObject(httpResponse: HttpResponse): T = runBlocking { runCatching { httpResponse.body() - }.getOrElse { - throw ExpediaGroupServiceDefaultErrorException( - httpResponse.status.value, - httpResponse.bodyAsText(), - httpResponse.request.headers.getTransactionId(), - ) - } + }.getOrElse { throw ExpediaGroupServiceDefaultErrorException(httpResponse.status.value, httpResponse.bodyAsText(), httpResponse.request.headers.getTransactionId()) } } } -class ExpediaGroupApiErrorException(code: Int, override val errorObject: Error, transactionId: String?) : ExpediaGroupApiException( - code, - errorObject, - transactionId, -) +class ExpediaGroupApiErrorException(code: Int, override val errorObject: Error, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolation.kt deleted file mode 100644 index cefb71e2e2..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/exception/PropertyConstraintViolation.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2022 Expedia, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * 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 - -/** - * An entity to represent a constraint violation of a property. - * - * @property name The name of the constraint-violated field - * @property path The path of the constraint-violated field - * @property message The constraint violation message - */ -data class PropertyConstraintViolation( - val name: String, - val path: String, - val message: String, -) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperation.kt index 27cfd4daf7..6e85290a0e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperation.kt @@ -27,42 +27,39 @@ import org.apache.commons.text.StringSubstitutor class ChangeRoomDetailsOperation private constructor( params: ChangeRoomDetailsOperationParams?, requestBody: ChangeRoomDetailsRequest?, - link: ChangeRoomDetailsOperationLink?, + link: ChangeRoomDetailsOperationLink? ) : Operation< - ChangeRoomDetailsRequest, + ChangeRoomDetailsRequest >( url(params, link, "/v3/itineraries/{itinerary_id}/rooms/{room_id}"), "PUT", "changeRoomDetails", requestBody, - params, + params ) { - @Deprecated( - "Switch order of arguments", - ReplaceWith("Operation(params: ChangeRoomDetailsOperationParams, requestBody: ChangeRoomDetailsRequest?)"), - ) + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: ChangeRoomDetailsOperationParams, requestBody: ChangeRoomDetailsRequest?)")) constructor( requestBody: ChangeRoomDetailsRequest?, - params: ChangeRoomDetailsOperationParams, + params: ChangeRoomDetailsOperationParams ) : this(params, requestBody) constructor( params: ChangeRoomDetailsOperationParams, - requestBody: ChangeRoomDetailsRequest?, + requestBody: ChangeRoomDetailsRequest? ) : this( params, requestBody, - null, + null ) constructor( link: ChangeRoomDetailsOperationLink, context: ChangeRoomDetailsOperationContext, - requestBody: ChangeRoomDetailsRequest?, + requestBody: ChangeRoomDetailsRequest? ) : this( ChangeRoomDetailsOperationParams(context), requestBody, - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationContext.kt index c983259658..5090b83691 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationContext.kt @@ -29,7 +29,7 @@ data class ChangeRoomDetailsOperationContext( val customerSessionId: kotlin.String? = null, val test: ChangeRoomDetailsOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class ChangeRoomDetailsOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: ChangeRoomDetailsOperationParams.Test? = null, + @JsonProperty("Test") private var test: ChangeRoomDetailsOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class ChangeRoomDetailsOperationContext( return ChangeRoomDetailsOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class ChangeRoomDetailsOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class ChangeRoomDetailsOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationLink.kt index 1c0c68f285..823e71ab0b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationLink.kt @@ -32,7 +32,7 @@ data class ChangeRoomDetailsOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class ChangeRoomDetailsOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): ChangeRoomDetailsOperationLink { - return ChangeRoomDetailsOperationLink( + fun build(): ChangeRoomDetailsOperationLink = + ChangeRoomDetailsOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationParams.kt index 6171762e0b..7bfa1b39a1 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/ChangeRoomDetailsOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -32,13 +37,22 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = ChangeRoomDetailsOperationParams.Builder::class) data class ChangeRoomDetailsOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val roomId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: ChangeRoomDetailsOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -54,7 +68,7 @@ data class ChangeRoomDetailsOperationParams null, test: ChangeRoomDetailsOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( itineraryId = itineraryId, roomId = roomId, @@ -62,22 +76,22 @@ data class ChangeRoomDetailsOperationParams customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: ChangeRoomDetailsOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), + UNKNOWN_INTERNAL_ERROR("unknown_internal_error") } class Builder( @@ -86,7 +100,7 @@ data class ChangeRoomDetailsOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: ChangeRoomDetailsOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -119,30 +133,36 @@ data class ChangeRoomDetailsOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): ChangeRoomDetailsOperationParams { - validateNullity() - - return ChangeRoomDetailsOperationParams( - itineraryId = itineraryId!!, - roomId = roomId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + ChangeRoomDetailsOperationParams( + itineraryId = itineraryId!!, + roomId = roomId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (roomId == null) { - throw NullPointerException("Required parameter roomId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: ChangeRoomDetailsOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -154,11 +174,11 @@ data class ChangeRoomDetailsOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -169,18 +189,16 @@ data class ChangeRoomDetailsOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } @@ -188,5 +206,4 @@ data class ChangeRoomDetailsOperationParams put("room_id", roomId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperation.kt index f76020f917..dbfb5676a4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperation.kt @@ -27,42 +27,39 @@ import org.apache.commons.text.StringSubstitutor class CommitChangeOperation private constructor( params: CommitChangeOperationParams?, requestBody: CommitChangeRoomRequestBody?, - link: CommitChangeOperationLink?, + link: CommitChangeOperationLink? ) : Operation< - CommitChangeRoomRequestBody, + CommitChangeRoomRequestBody >( url(params, link, "/v3/itineraries/{itinerary_id}/rooms/{room_id}/pricing"), "PUT", "commitChange", requestBody, - params, + params ) { - @Deprecated( - "Switch order of arguments", - ReplaceWith("Operation(params: CommitChangeOperationParams, requestBody: CommitChangeRoomRequestBody?)"), - ) + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: CommitChangeOperationParams, requestBody: CommitChangeRoomRequestBody?)")) constructor( requestBody: CommitChangeRoomRequestBody?, - params: CommitChangeOperationParams, + params: CommitChangeOperationParams ) : this(params, requestBody) constructor( params: CommitChangeOperationParams, - requestBody: CommitChangeRoomRequestBody?, + requestBody: CommitChangeRoomRequestBody? ) : this( params, requestBody, - null, + null ) constructor( link: CommitChangeOperationLink, context: CommitChangeOperationContext, - requestBody: CommitChangeRoomRequestBody?, + requestBody: CommitChangeRoomRequestBody? ) : this( CommitChangeOperationParams(context), requestBody, - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationContext.kt index ee84f92f5e..7e50ce18f7 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationContext.kt @@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize /** - * @property 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. + * @property 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. * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. * @property test The change call has a test header that can be used to return set responses with the following keywords:
    * `standard` - Requires valid test booking. * `service_unavailable` * `unknown_internal_error` */ @@ -29,7 +29,7 @@ data class CommitChangeOperationContext( val customerSessionId: kotlin.String? = null, val test: CommitChangeOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,10 +39,10 @@ data class CommitChangeOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: CommitChangeOperationParams.Test? = null, + @JsonProperty("Test") private var test: CommitChangeOperationParams.Test? = null ) { /** - * @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. */ fun customerIp(customerIp: kotlin.String) = apply { this.customerIp = customerIp } @@ -62,7 +62,7 @@ data class CommitChangeOperationContext( return CommitChangeOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class CommitChangeOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class CommitChangeOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationLink.kt index 9ce775eeee..da9d89770b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationLink.kt @@ -32,7 +32,7 @@ data class CommitChangeOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class CommitChangeOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): CommitChangeOperationLink { - return CommitChangeOperationLink( + fun build(): CommitChangeOperationLink = + CommitChangeOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationParams.kt index 67bb9dc2d9..97214d1cd5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/CommitChangeOperationParams.kt @@ -16,15 +16,20 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    * @property roomId Room ID of a property.
    - * @property 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. + * @property 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. * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. * @property test The change call has a test header that can be used to return set responses with the following keywords:
    * `standard` - Requires valid test booking. * `service_unavailable` * `unknown_internal_error` * @property 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. @@ -32,13 +37,22 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = CommitChangeOperationParams.Builder::class) data class CommitChangeOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val roomId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: CommitChangeOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -54,7 +68,7 @@ data class CommitChangeOperationParams null, test: CommitChangeOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( itineraryId = itineraryId, roomId = roomId, @@ -62,22 +76,22 @@ data class CommitChangeOperationParams customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: CommitChangeOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), + UNKNOWN_INTERNAL_ERROR("unknown_internal_error") } class Builder( @@ -86,7 +100,7 @@ data class CommitChangeOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: CommitChangeOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -99,7 +113,7 @@ data class CommitChangeOperationParams fun roomId(roomId: kotlin.String) = apply { this.roomId = roomId } /** - * @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. */ fun customerIp(customerIp: kotlin.String) = apply { this.customerIp = customerIp } @@ -119,30 +133,36 @@ data class CommitChangeOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): CommitChangeOperationParams { - validateNullity() - - return CommitChangeOperationParams( - itineraryId = itineraryId!!, - roomId = roomId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + CommitChangeOperationParams( + itineraryId = itineraryId!!, + roomId = roomId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (roomId == null) { - throw NullPointerException("Required parameter roomId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: CommitChangeOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -154,11 +174,11 @@ data class CommitChangeOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -169,18 +189,16 @@ data class CommitChangeOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } @@ -188,5 +206,4 @@ data class CommitChangeOperationParams put("room_id", roomId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperation.kt index da9201597d..34f01a0d4f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class DeleteHeldBookingOperation private constructor( params: DeleteHeldBookingOperationParams?, - link: DeleteHeldBookingOperationLink?, + link: DeleteHeldBookingOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/itineraries/{itinerary_id}"), "DELETE", "deleteHeldBooking", null, - params, + params ) { constructor( - params: DeleteHeldBookingOperationParams, + params: DeleteHeldBookingOperationParams ) : this( params, - null, + null ) constructor( link: DeleteHeldBookingOperationLink, - context: DeleteHeldBookingOperationContext, + context: DeleteHeldBookingOperationContext ) : this( DeleteHeldBookingOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationContext.kt index 5bdea12552..3010c3440d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationContext.kt @@ -29,7 +29,7 @@ data class DeleteHeldBookingOperationContext( val customerSessionId: kotlin.String? = null, val test: DeleteHeldBookingOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class DeleteHeldBookingOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: DeleteHeldBookingOperationParams.Test? = null, + @JsonProperty("Test") private var test: DeleteHeldBookingOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class DeleteHeldBookingOperationContext( return DeleteHeldBookingOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class DeleteHeldBookingOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class DeleteHeldBookingOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationLink.kt index 78aff4b0a3..52030271e5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationLink.kt @@ -32,7 +32,7 @@ data class DeleteHeldBookingOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class DeleteHeldBookingOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): DeleteHeldBookingOperationLink { - return DeleteHeldBookingOperationLink( + fun build(): DeleteHeldBookingOperationLink = + DeleteHeldBookingOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationParams.kt index 6ed5f61e2a..609ec032f3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteHeldBookingOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -31,12 +36,19 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = DeleteHeldBookingOperationParams.Builder::class) data class DeleteHeldBookingOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: DeleteHeldBookingOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -51,30 +63,30 @@ data class DeleteHeldBookingOperationParams null, test: DeleteHeldBookingOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( itineraryId = itineraryId, customerIp = customerIp, customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: DeleteHeldBookingOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), INTERNAL_SERVER_ERROR("internal_server_error"), - POST_STAY_CANCEL("post_stay_cancel"), + POST_STAY_CANCEL("post_stay_cancel") } class Builder( @@ -82,7 +94,7 @@ data class DeleteHeldBookingOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: DeleteHeldBookingOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -110,26 +122,35 @@ data class DeleteHeldBookingOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): DeleteHeldBookingOperationParams { - validateNullity() - - return DeleteHeldBookingOperationParams( - itineraryId = itineraryId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + DeleteHeldBookingOperationParams( + itineraryId = itineraryId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: DeleteHeldBookingOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -140,11 +161,11 @@ data class DeleteHeldBookingOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -155,21 +176,18 @@ data class DeleteHeldBookingOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperation.kt index 33194b206e..51c7fb377e 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class DeleteRoomOperation private constructor( params: DeleteRoomOperationParams?, - link: DeleteRoomOperationLink?, + link: DeleteRoomOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/itineraries/{itinerary_id}/rooms/{room_id}"), "DELETE", "deleteRoom", null, - params, + params ) { constructor( - params: DeleteRoomOperationParams, + params: DeleteRoomOperationParams ) : this( params, - null, + null ) constructor( link: DeleteRoomOperationLink, - context: DeleteRoomOperationContext, + context: DeleteRoomOperationContext ) : this( DeleteRoomOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationContext.kt index 896ee72bba..a20ba542f4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationContext.kt @@ -29,7 +29,7 @@ data class DeleteRoomOperationContext( val customerSessionId: kotlin.String? = null, val test: DeleteRoomOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class DeleteRoomOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: DeleteRoomOperationParams.Test? = null, + @JsonProperty("Test") private var test: DeleteRoomOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class DeleteRoomOperationContext( return DeleteRoomOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class DeleteRoomOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class DeleteRoomOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationLink.kt index 0b0137f95e..37f0d30ea6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationLink.kt @@ -32,7 +32,7 @@ data class DeleteRoomOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class DeleteRoomOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): DeleteRoomOperationLink { - return DeleteRoomOperationLink( + fun build(): DeleteRoomOperationLink = + DeleteRoomOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationParams.kt index a6506654d4..440adfcef8 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/DeleteRoomOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -32,13 +37,22 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = DeleteRoomOperationParams.Builder::class) data class DeleteRoomOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val roomId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: DeleteRoomOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -54,7 +68,7 @@ data class DeleteRoomOperationParams null, test: DeleteRoomOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( itineraryId = itineraryId, roomId = roomId, @@ -62,23 +76,23 @@ data class DeleteRoomOperationParams customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: DeleteRoomOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), - POST_STAY_CANCEL("post_stay_cancel"), + POST_STAY_CANCEL("post_stay_cancel") } class Builder( @@ -87,7 +101,7 @@ data class DeleteRoomOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: DeleteRoomOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -120,30 +134,36 @@ data class DeleteRoomOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): DeleteRoomOperationParams { - validateNullity() - - return DeleteRoomOperationParams( - itineraryId = itineraryId!!, - roomId = roomId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + DeleteRoomOperationParams( + itineraryId = itineraryId!!, + roomId = roomId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (roomId == null) { - throw NullPointerException("Required parameter roomId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: DeleteRoomOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -155,11 +175,11 @@ data class DeleteRoomOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -170,18 +190,16 @@ data class DeleteRoomOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } @@ -189,5 +207,4 @@ data class DeleteRoomOperationParams put("room_id", roomId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperation.kt index 3d3a16ba00..48ee1554da 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class GetAdditionalAvailabilityOperation private constructor( params: GetAdditionalAvailabilityOperationParams?, - link: GetAdditionalAvailabilityOperationLink?, + link: GetAdditionalAvailabilityOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/properties/{property_id}/availability"), "GET", "getAdditionalAvailability", null, - params, + params ) { constructor( - params: GetAdditionalAvailabilityOperationParams, + params: GetAdditionalAvailabilityOperationParams ) : this( params, - null, + null ) constructor( link: GetAdditionalAvailabilityOperationLink, - context: GetAdditionalAvailabilityOperationContext?, + context: GetAdditionalAvailabilityOperationContext? ) : this( GetAdditionalAvailabilityOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationContext.kt index 8d48b7eb54..b4a8e90e04 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationContext.kt @@ -30,7 +30,7 @@ data class GetAdditionalAvailabilityOperationContext( val customerSessionId: kotlin.String? = null, val test: GetAdditionalAvailabilityOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -40,7 +40,7 @@ data class GetAdditionalAvailabilityOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: GetAdditionalAvailabilityOperationParams.Test? = null, + @JsonProperty("Test") private var test: GetAdditionalAvailabilityOperationParams.Test? = null ) { /** * @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. @@ -63,7 +63,7 @@ data class GetAdditionalAvailabilityOperationContext( return GetAdditionalAvailabilityOperationContext( customerIp = customerIp, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -71,8 +71,8 @@ data class GetAdditionalAvailabilityOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp?.also { put("Customer-Ip", customerIp) } @@ -83,5 +83,4 @@ data class GetAdditionalAvailabilityOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationLink.kt index bea0405e7c..fcda1a7d9f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationLink.kt @@ -32,7 +32,7 @@ data class GetAdditionalAvailabilityOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class GetAdditionalAvailabilityOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): GetAdditionalAvailabilityOperationLink { - return GetAdditionalAvailabilityOperationLink( + fun build(): GetAdditionalAvailabilityOperationLink = + GetAdditionalAvailabilityOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationParams.kt index 754912febb..11e8c900fa 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdditionalAvailabilityOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property propertyId Expedia Property ID.
    @@ -40,31 +45,42 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = GetAdditionalAvailabilityOperationParams.Builder::class) data class GetAdditionalAvailabilityOperationParams internal constructor( + @field:NotNull + @field:Valid val propertyId: kotlin.String? = null, + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: GetAdditionalAvailabilityOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, + @field:Valid val checkin: kotlin.String? = null, + @field:Valid val checkout: kotlin.String? = null, val exclusion: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Exclusion, + GetAdditionalAvailabilityOperationParams.Exclusion >? = null, val filter: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Filter, + GetAdditionalAvailabilityOperationParams.Filter >? = null, val include: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Include, + GetAdditionalAvailabilityOperationParams.Include >? = null, + @field:Valid val occupancy: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, val rateOption: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.RateOption, + GetAdditionalAvailabilityOperationParams.RateOption >? = null, + @field:Valid val salesChannel: kotlin.String? = null, + @field:Valid val currency: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -86,29 +102,29 @@ data class GetAdditionalAvailabilityOperationParams 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 ) : this( propertyId = propertyId, customerIp = customerIp, @@ -124,53 +140,53 @@ data class GetAdditionalAvailabilityOperationParams rateOption = rateOption, salesChannel = salesChannel, currency = currency, - dummy = Unit, + dummy = Unit ) constructor(context: GetAdditionalAvailabilityOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), NO_AVAILABILITY("no_availability"), - FORBIDDEN("forbidden"), + FORBIDDEN("forbidden") } enum class Exclusion( - val value: kotlin.String, + val value: kotlin.String ) { REFUNDABLE_DAMAGE_DEPOSIT("refundable_damage_deposit"), - CARD_ON_FILE("card_on_file"), + CARD_ON_FILE("card_on_file") } enum class Filter( - val value: kotlin.String, + val value: kotlin.String ) { REFUNDABLE("refundable"), EXPEDIA_COLLECT("expedia_collect"), - PROPERTY_COLLECT("property_collect"), + PROPERTY_COLLECT("property_collect") } enum class Include( - val value: kotlin.String, + val value: kotlin.String ) { - SALE_SCENARIO_PERIOD_MOBILE_PROMOTION("sale_scenario.mobile_promotion"), + SALE_SCENARIO_PERIOD_MOBILE_PROMOTION("sale_scenario.mobile_promotion") } enum class RateOption( - val value: kotlin.String, + val value: kotlin.String ) { MEMBER("member"), NET_RATES("net_rates"), - CROSS_SELL("cross_sell"), + CROSS_SELL("cross_sell") } class Builder( @@ -182,22 +198,22 @@ data class GetAdditionalAvailabilityOperationParams @JsonProperty("checkin") private var checkin: kotlin.String? = null, @JsonProperty("checkout") private var checkout: kotlin.String? = null, @JsonProperty("exclusion") private var exclusion: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Exclusion, + GetAdditionalAvailabilityOperationParams.Exclusion >? = null, @JsonProperty("filter") private var filter: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Filter, + GetAdditionalAvailabilityOperationParams.Filter >? = null, @JsonProperty("include") private var include: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Include, + GetAdditionalAvailabilityOperationParams.Include >? = null, @JsonProperty("occupancy") private var occupancy: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("rate_option") private var rateOption: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.RateOption, + GetAdditionalAvailabilityOperationParams.RateOption >? = null, @JsonProperty("sales_channel") private var salesChannel: kotlin.String? = null, - @JsonProperty("currency") private var currency: kotlin.String? = null, + @JsonProperty("currency") private var currency: kotlin.String? = null ) { /** * @param propertyId Expedia Property ID.
    @@ -239,8 +255,8 @@ data class GetAdditionalAvailabilityOperationParams */ fun exclusion( exclusion: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Exclusion, - >, + GetAdditionalAvailabilityOperationParams.Exclusion + > ) = apply { this.exclusion = exclusion } /** @@ -248,8 +264,8 @@ data class GetAdditionalAvailabilityOperationParams */ fun filter( filter: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Filter, - >, + GetAdditionalAvailabilityOperationParams.Filter + > ) = apply { this.filter = filter } /** @@ -257,8 +273,8 @@ data class GetAdditionalAvailabilityOperationParams */ fun include( include: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.Include, - >, + GetAdditionalAvailabilityOperationParams.Include + > ) = apply { this.include = include } /** @@ -266,8 +282,8 @@ data class GetAdditionalAvailabilityOperationParams */ fun occupancy( occupancy: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.occupancy = occupancy } /** @@ -275,8 +291,8 @@ data class GetAdditionalAvailabilityOperationParams */ fun rateOption( rateOption: kotlin.collections.List< - GetAdditionalAvailabilityOperationParams.RateOption, - >, + GetAdditionalAvailabilityOperationParams.RateOption + > ) = apply { this.rateOption = rateOption } /** @@ -290,32 +306,44 @@ data class GetAdditionalAvailabilityOperationParams fun currency(currency: kotlin.String) = apply { this.currency = currency } fun build(): GetAdditionalAvailabilityOperationParams { - validateNullity() - - return GetAdditionalAvailabilityOperationParams( - propertyId = propertyId!!, - customerIp = customerIp, - customerSessionId = customerSessionId, - test = test, - token = token!!, - checkin = checkin, - checkout = checkout, - exclusion = exclusion, - filter = filter, - include = include, - occupancy = occupancy, - rateOption = rateOption, - salesChannel = salesChannel, - currency = currency, - ) + val params = + GetAdditionalAvailabilityOperationParams( + propertyId = propertyId!!, + customerIp = customerIp, + customerSessionId = customerSessionId, + test = test, + token = token!!, + checkin = checkin, + checkout = checkout, + exclusion = exclusion, + filter = filter, + include = include, + occupancy = occupancy, + rateOption = rateOption, + salesChannel = salesChannel, + currency = currency + ) + + validate(params) + + return params } - private fun validateNullity() { - if (propertyId == null) { - throw NullPointerException("Required parameter propertyId is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: GetAdditionalAvailabilityOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -335,11 +363,11 @@ data class GetAdditionalAvailabilityOperationParams occupancy = occupancy, rateOption = rateOption, salesChannel = salesChannel, - currency = currency, + currency = currency ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -351,10 +379,9 @@ data class GetAdditionalAvailabilityOperationParams } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } @@ -386,13 +413,11 @@ data class GetAdditionalAvailabilityOperationParams append("currency", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { propertyId?.also { put("property_id", propertyId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperation.kt index 7fb62dc56a..8f3be7f60b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperation.kt @@ -24,34 +24,32 @@ import com.expediagroup.sdk.core.model.Operation */ class GetAvailabilityOperation private constructor( params: GetAvailabilityOperationParams?, - link: GetAvailabilityOperationLink?, + link: GetAvailabilityOperationLink? ) : Operation< - Nothing, + Nothing >( url(null, link, "/v3/properties/availability"), "GET", "getAvailability", null, - params, + params ) { constructor( - params: GetAvailabilityOperationParams, + params: GetAvailabilityOperationParams ) : this( params, - null, + null ) constructor( link: GetAvailabilityOperationLink, - context: GetAvailabilityOperationContext?, + context: GetAvailabilityOperationContext? ) : this( GetAvailabilityOperationParams(context), - link, + link ) companion object : LinkableOperation { - override fun pathPattern(): String { - return "/v3/properties/availability" - } + override fun pathPattern(): String = "/v3/properties/availability" } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationContext.kt index 6b929ac658..e0e7496b4f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationContext.kt @@ -30,7 +30,7 @@ data class GetAvailabilityOperationContext( val customerSessionId: kotlin.String? = null, val test: GetAvailabilityOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -40,7 +40,7 @@ data class GetAvailabilityOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: GetAvailabilityOperationParams.Test? = null, + @JsonProperty("Test") private var test: GetAvailabilityOperationParams.Test? = null ) { /** * @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. @@ -63,7 +63,7 @@ data class GetAvailabilityOperationContext( return GetAvailabilityOperationContext( customerIp = customerIp, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -71,8 +71,8 @@ data class GetAvailabilityOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp?.also { put("Customer-Ip", customerIp) } @@ -83,5 +83,4 @@ data class GetAvailabilityOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationLink.kt index fd04b6f61b..a104b143d6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationLink.kt @@ -32,7 +32,7 @@ data class GetAvailabilityOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class GetAvailabilityOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): GetAvailabilityOperationLink { - return GetAvailabilityOperationLink( + fun build(): GetAvailabilityOperationLink = + GetAvailabilityOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationParams.kt index 6aa3db1437..7ed938e50b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAvailabilityOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property 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. @@ -42,51 +47,78 @@ import io.ktor.http.Parameters * @property 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. * @property travelPurpose This parameter is to specify the travel purpose of the booking. This may impact available rate plans, pricing, or tax calculations. * `leisure` * `business` * @property 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. - * @property 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. * @property 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. + * @property 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. * @property 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. */ @JsonDeserialize(builder = GetAvailabilityOperationParams.Builder::class) data class GetAvailabilityOperationParams internal constructor( + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: GetAvailabilityOperationParams.Test? = null, + @field:NotNull + @field:Valid val checkin: kotlin.String? = null, + @field:NotNull + @field:Valid val checkout: kotlin.String? = null, + @field:NotNull + @field:Valid val currency: kotlin.String? = null, + @field:NotNull + @field:Valid val countryCode: kotlin.String? = null, + @field:NotNull + @field:Valid val language: kotlin.String? = null, + @field:NotNull + @field:Valid val occupancy: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:NotNull + @field:Valid val propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:NotNull + @field:Valid val ratePlanCount: java.math.BigDecimal? = null, + @field:NotNull + @field:Valid val salesChannel: kotlin.String? = null, + @field:NotNull + @field:Valid val salesEnvironment: kotlin.String? = null, + @field:Valid val amenityCategory: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, val exclusion: kotlin.collections.List< - GetAvailabilityOperationParams.Exclusion, + GetAvailabilityOperationParams.Exclusion >? = null, val filter: kotlin.collections.List< - GetAvailabilityOperationParams.Filter, + GetAvailabilityOperationParams.Filter >? = null, val include: kotlin.collections.List< - GetAvailabilityOperationParams.Include, + GetAvailabilityOperationParams.Include >? = null, val rateOption: kotlin.collections.List< - GetAvailabilityOperationParams.RateOption, + GetAvailabilityOperationParams.RateOption >? = null, val travelPurpose: GetAvailabilityOperationParams.TravelPurpose? = null, + @field:Valid val billingTerms: kotlin.String? = null, - val paymentTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid + val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -107,44 +139,44 @@ data class GetAvailabilityOperationParams 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, salesEnvironment: kotlin.String, 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 ) : this( customerIp = customerIp, customerSessionId = customerSessionId, @@ -166,63 +198,63 @@ data class GetAvailabilityOperationParams rateOption = rateOption, travelPurpose = travelPurpose, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, platformName = platformName, - dummy = Unit, + dummy = Unit ) constructor(context: GetAvailabilityOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), + UNKNOWN_INTERNAL_ERROR("unknown_internal_error") } enum class Exclusion( - val value: kotlin.String, + val value: kotlin.String ) { REFUNDABLE_DAMAGE_DEPOSIT("refundable_damage_deposit"), - CARD_ON_FILE("card_on_file"), + CARD_ON_FILE("card_on_file") } enum class Filter( - val value: kotlin.String, + val value: kotlin.String ) { REFUNDABLE("refundable"), EXPEDIA_COLLECT("expedia_collect"), - PROPERTY_COLLECT("property_collect"), + PROPERTY_COLLECT("property_collect") } enum class Include( - val value: kotlin.String, + val value: kotlin.String ) { UNAVAILABLE_REASON("unavailable_reason"), SALE_SCENARIO_PERIOD_MOBILE_PROMOTION("sale_scenario.mobile_promotion"), - ROOMS_PERIOD_RATES_PERIOD_MARKETING_FEE_INCENTIVES("rooms.rates.marketing_fee_incentives"), + ROOMS_PERIOD_RATES_PERIOD_MARKETING_FEE_INCENTIVES("rooms.rates.marketing_fee_incentives") } enum class RateOption( - val value: kotlin.String, + val value: kotlin.String ) { MEMBER("member"), NET_RATES("net_rates"), - CROSS_SELL("cross_sell"), + CROSS_SELL("cross_sell") } enum class TravelPurpose( - val value: kotlin.String, + val value: kotlin.String ) { LEISURE("leisure"), - BUSINESS("business"), + BUSINESS("business") } class Builder( @@ -235,34 +267,34 @@ data class GetAvailabilityOperationParams @JsonProperty("country_code") private var countryCode: kotlin.String? = null, @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("occupancy") private var occupancy: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("property_id") private var propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("rate_plan_count") private var ratePlanCount: java.math.BigDecimal? = null, @JsonProperty("sales_channel") private var salesChannel: kotlin.String? = null, @JsonProperty("sales_environment") private var salesEnvironment: kotlin.String? = null, @JsonProperty("amenity_category") private var amenityCategory: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("exclusion") private var exclusion: kotlin.collections.List< - GetAvailabilityOperationParams.Exclusion, + GetAvailabilityOperationParams.Exclusion >? = null, @JsonProperty("filter") private var filter: kotlin.collections.List< - GetAvailabilityOperationParams.Filter, + GetAvailabilityOperationParams.Filter >? = null, @JsonProperty("include") private var include: kotlin.collections.List< - GetAvailabilityOperationParams.Include, + GetAvailabilityOperationParams.Include >? = null, @JsonProperty("rate_option") private var rateOption: kotlin.collections.List< - GetAvailabilityOperationParams.RateOption, + GetAvailabilityOperationParams.RateOption >? = null, @JsonProperty("travel_purpose") private var travelPurpose: GetAvailabilityOperationParams.TravelPurpose? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, - @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @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. @@ -309,8 +341,8 @@ data class GetAvailabilityOperationParams */ fun occupancy( occupancy: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.occupancy = occupancy } /** @@ -318,8 +350,8 @@ data class GetAvailabilityOperationParams */ fun propertyId( propertyId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.propertyId = propertyId } /** @@ -342,8 +374,8 @@ data class GetAvailabilityOperationParams */ fun amenityCategory( amenityCategory: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.amenityCategory = amenityCategory } /** @@ -351,8 +383,8 @@ data class GetAvailabilityOperationParams */ fun exclusion( exclusion: kotlin.collections.List< - GetAvailabilityOperationParams.Exclusion, - >, + GetAvailabilityOperationParams.Exclusion + > ) = apply { this.exclusion = exclusion } /** @@ -360,8 +392,8 @@ data class GetAvailabilityOperationParams */ fun filter( filter: kotlin.collections.List< - GetAvailabilityOperationParams.Filter, - >, + GetAvailabilityOperationParams.Filter + > ) = apply { this.filter = filter } /** @@ -369,8 +401,8 @@ data class GetAvailabilityOperationParams */ fun include( include: kotlin.collections.List< - GetAvailabilityOperationParams.Include, - >, + GetAvailabilityOperationParams.Include + > ) = apply { this.include = include } /** @@ -378,8 +410,8 @@ data class GetAvailabilityOperationParams */ fun rateOption( rateOption: kotlin.collections.List< - GetAvailabilityOperationParams.RateOption, - >, + GetAvailabilityOperationParams.RateOption + > ) = apply { this.rateOption = rateOption } /** @@ -393,14 +425,14 @@ data class GetAvailabilityOperationParams fun billingTerms(billingTerms: kotlin.String) = apply { this.billingTerms = billingTerms } /** - * @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. + * @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. */ - fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } + fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } /** - * @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. + * @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. */ - fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } + fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } /** * @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. @@ -408,65 +440,53 @@ data class GetAvailabilityOperationParams fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetAvailabilityOperationParams { - validateNullity() - - return GetAvailabilityOperationParams( - customerIp = customerIp, - customerSessionId = customerSessionId, - test = test, - checkin = checkin!!, - checkout = checkout!!, - currency = currency!!, - countryCode = countryCode!!, - language = language!!, - occupancy = occupancy!!, - propertyId = propertyId!!, - ratePlanCount = ratePlanCount!!, - salesChannel = salesChannel!!, - salesEnvironment = salesEnvironment!!, - amenityCategory = amenityCategory, - exclusion = exclusion, - filter = filter, - include = include, - rateOption = rateOption, - travelPurpose = travelPurpose, - billingTerms = billingTerms, - paymentTerms = paymentTerms, - partnerPointOfSale = partnerPointOfSale, - platformName = platformName, - ) + val params = + GetAvailabilityOperationParams( + customerIp = customerIp, + customerSessionId = customerSessionId, + test = test, + checkin = checkin!!, + checkout = checkout!!, + currency = currency!!, + countryCode = countryCode!!, + language = language!!, + occupancy = occupancy!!, + propertyId = propertyId!!, + ratePlanCount = ratePlanCount!!, + salesChannel = salesChannel!!, + salesEnvironment = salesEnvironment!!, + amenityCategory = amenityCategory, + exclusion = exclusion, + filter = filter, + include = include, + rateOption = rateOption, + travelPurpose = travelPurpose, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (checkin == null) { - throw NullPointerException("Required parameter checkin is missing") - } - if (checkout == null) { - throw NullPointerException("Required parameter checkout is missing") - } - if (currency == null) { - throw NullPointerException("Required parameter currency is missing") - } - if (countryCode == null) { - throw NullPointerException("Required parameter countryCode is missing") - } - if (language == null) { - throw NullPointerException("Required parameter language is missing") - } - if (occupancy == null) { - throw NullPointerException("Required parameter occupancy is missing") - } - if (propertyId == null) { - throw NullPointerException("Required parameter propertyId is missing") - } - if (ratePlanCount == null) { - throw NullPointerException("Required parameter ratePlanCount is missing") - } - if (salesChannel == null) { - throw NullPointerException("Required parameter salesChannel is missing") - } - if (salesEnvironment == null) { - throw NullPointerException("Required parameter salesEnvironment is missing") + private fun validate(params: GetAvailabilityOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -493,13 +513,13 @@ data class GetAvailabilityOperationParams rateOption = rateOption, travelPurpose = travelPurpose, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -511,10 +531,9 @@ data class GetAvailabilityOperationParams } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { checkin?.let { append("checkin", it) } @@ -566,20 +585,18 @@ data class GetAvailabilityOperationParams billingTerms?.let { append("billing_terms", it) } - paymentTerms?.let { - append("payment_terms", it) - } partnerPointOfSale?.let { append("partner_point_of_sale", it) } + paymentTerms?.let { + append("payment_terms", it) + } platformName?.let { append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperation.kt index 6d7585ca3f..ed8547b441 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperation.kt @@ -24,15 +24,15 @@ import org.apache.commons.text.StringSubstitutor * @property params [GetBookingReceiptOperationParams] */ class GetBookingReceiptOperation( - params: GetBookingReceiptOperationParams, + params: GetBookingReceiptOperationParams ) : Operation< - Nothing, + Nothing >( url(params), "GET", "getBookingReceipt", null, - params, + params ) { companion object { fun url(params: GetBookingReceiptOperationParams): String { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationParams.kt index 4e7e9af6ab..810ebf2845 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This path variable will be provided as part of the link. This specifies which itinerary the booking receipt request pertains to. @@ -31,15 +36,22 @@ import io.ktor.http.Parameters */ @JsonDeserialize(builder = GetBookingReceiptOperationParams.Builder::class) data class GetBookingReceiptOperationParams( + @field:NotNull + @field:Valid val itineraryId: kotlin.String, + @field:NotNull + @field:Valid val customerIp: kotlin.String, + @field:Valid val customerSessionId: kotlin.String? = null, val test: GetBookingReceiptOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String, val branding: GetBookingReceiptOperationParams.Branding? = - null, + null ) : OperationParams { companion object { @@ -48,18 +60,18 @@ data class GetBookingReceiptOperationParams( } enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - INTERNAL_SERVER_ERROR("internal_server_error"), + INTERNAL_SERVER_ERROR("internal_server_error") } enum class Branding( - val value: kotlin.String, + val value: kotlin.String ) { EXPEDIA_GROUP("expedia_group"), - UNBRANDED("unbranded"), + UNBRANDED("unbranded") } class Builder( @@ -68,7 +80,7 @@ data class GetBookingReceiptOperationParams( @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: GetBookingReceiptOperationParams.Test? = null, @JsonProperty("token") private var token: kotlin.String? = null, - @JsonProperty("branding") private var branding: GetBookingReceiptOperationParams.Branding? = null, + @JsonProperty("branding") private var branding: GetBookingReceiptOperationParams.Branding? = null ) { /** * @param itineraryId This path variable will be provided as part of the link. This specifies which itinerary the booking receipt request pertains to. @@ -101,27 +113,36 @@ data class GetBookingReceiptOperationParams( fun branding(branding: GetBookingReceiptOperationParams.Branding) = apply { this.branding = branding } fun build(): GetBookingReceiptOperationParams { - validateNullity() - - return GetBookingReceiptOperationParams( - itineraryId = itineraryId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - branding = branding, - ) + val params = + GetBookingReceiptOperationParams( + itineraryId = itineraryId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!!, + branding = branding + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: GetBookingReceiptOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -133,11 +154,11 @@ data class GetBookingReceiptOperationParams( customerSessionId = customerSessionId, test = test, token = token, - branding = branding, + branding = branding ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -149,10 +170,9 @@ data class GetBookingReceiptOperationParams( } append("Accept", "application/pdf") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } @@ -160,13 +180,11 @@ data class GetBookingReceiptOperationParams( append("branding", it.value) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperation.kt index 7aa9484840..5f8912de60 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetCalendarAvailabilityOperationParams] */ class GetCalendarAvailabilityOperation( - params: GetCalendarAvailabilityOperationParams, + params: GetCalendarAvailabilityOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/calendars/availability", "GET", "getCalendarAvailability", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationParams.kt index 6621e497c7..3e694f6012 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationParams.kt @@ -16,13 +16,18 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** - * @property test Shop calls have a test header that can be used to return set responses with the following keywords:
    * `standard` * `service_unavailable` * `unknown_internal_error` + * @property test Shop calls have a test header that can be used to return set responses with the following keywords: * `standard` * `service_unavailable` * `unknown_internal_error` * @property propertyId The ID of the property you want to search for. You can provide 1 to 250 property_id parameters. * @property startDate The first day of availability information to be returned, in ISO 8601 format (YYYY-MM-DD), up to 500 days in the future from the current date. * @property endDate The last day of availability information to be returned, in ISO 8601 format (YYYY-MM-DD). This must be 365 days or less from the start_date. @@ -31,11 +36,17 @@ import io.ktor.http.Parameters data class GetCalendarAvailabilityOperationParams( val test: GetCalendarAvailabilityOperationParams.Test? = null, + @field:NotNull + @field:Valid val propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >, + @field:NotNull + @field:Valid val startDate: java.time.LocalDate, - val endDate: java.time.LocalDate, + @field:NotNull + @field:Valid + val endDate: java.time.LocalDate ) : OperationParams { companion object { @@ -44,23 +55,23 @@ data class GetCalendarAvailabilityOperationParams( } enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), + UNKNOWN_INTERNAL_ERROR("unknown_internal_error") } class Builder( @JsonProperty("Test") private var test: GetCalendarAvailabilityOperationParams.Test? = null, @JsonProperty("property_id") private var propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("start_date") private var startDate: java.time.LocalDate? = null, - @JsonProperty("end_date") private var endDate: java.time.LocalDate? = null, + @JsonProperty("end_date") private var endDate: java.time.LocalDate? = null ) { /** - * @param test Shop calls have a test header that can be used to return set responses with the following keywords:
    * `standard` * `service_unavailable` * `unknown_internal_error` + * @param test Shop calls have a test header that can be used to return set responses with the following keywords: * `standard` * `service_unavailable` * `unknown_internal_error` */ fun test(test: GetCalendarAvailabilityOperationParams.Test) = apply { this.test = test } @@ -69,8 +80,8 @@ data class GetCalendarAvailabilityOperationParams( */ fun propertyId( propertyId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.propertyId = propertyId } /** @@ -84,25 +95,34 @@ data class GetCalendarAvailabilityOperationParams( fun endDate(endDate: java.time.LocalDate) = apply { this.endDate = endDate } fun build(): GetCalendarAvailabilityOperationParams { - validateNullity() - - return GetCalendarAvailabilityOperationParams( - test = test, - propertyId = propertyId!!, - startDate = startDate!!, - endDate = endDate!!, - ) + val params = + GetCalendarAvailabilityOperationParams( + test = test, + propertyId = propertyId!!, + startDate = startDate!!, + endDate = endDate!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (propertyId == null) { - throw NullPointerException("Required parameter propertyId is missing") - } - if (startDate == null) { - throw NullPointerException("Required parameter startDate is missing") - } - if (endDate == null) { - throw NullPointerException("Required parameter endDate is missing") + private fun validate(params: GetCalendarAvailabilityOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -112,20 +132,19 @@ data class GetCalendarAvailabilityOperationParams( test = test, propertyId = propertyId, startDate = startDate, - endDate = endDate, + endDate = endDate ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { test?.let { append("Test", it.value) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { propertyId?.let { appendAll("property_id", it) } @@ -136,10 +155,8 @@ data class GetCalendarAvailabilityOperationParams( append("end_date", it.toString()) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperation.kt index 4ada0e12fb..a2160aff29 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetChainReferenceOperationParams] */ class GetChainReferenceOperation( - params: GetChainReferenceOperationParams, + params: GetChainReferenceOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/chains", "GET", "getChainReference", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationParams.kt index 0d9734ed46..8ba687217b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationParams.kt @@ -16,10 +16,14 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -30,16 +34,21 @@ import io.ktor.http.Parameters */ @JsonDeserialize(builder = GetChainReferenceOperationParams.Builder::class) data class GetChainReferenceOperationParams( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = - null, + null ) : OperationParams { companion object { @@ -52,7 +61,7 @@ data class GetChainReferenceOperationParams( @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -80,13 +89,36 @@ data class GetChainReferenceOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetChainReferenceOperationParams { - return GetChainReferenceOperationParams( - customerSessionId = customerSessionId, - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - ) + val params = + GetChainReferenceOperationParams( + customerSessionId = customerSessionId, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params + } + + private fun validate(params: GetChainReferenceOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -96,20 +128,19 @@ data class GetChainReferenceOperationParams( billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { billingTerms?.let { append("billing_terms", it) } @@ -123,10 +154,8 @@ data class GetChainReferenceOperationParams( append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperation.kt index 4842a496fc..6b02911c98 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetInactivePropertiesOperationParams] */ class GetInactivePropertiesOperation( - params: GetInactivePropertiesOperationParams, + params: GetInactivePropertiesOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/properties/inactive", "GET", "getInactiveProperties", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationParams.kt index 55dc407e5a..986484a3fb 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationParams.kt @@ -16,36 +16,47 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. * @property since Required on initial call, not accepted on subsequent paging links provided in response header.
    The earliest date that a property became inactive to include in the results. ISO 8601 format (YYYY-MM-DD) * @property token Only used for requesting additional pages of data. Provided by the `next` URL in the `Link` response header. * @property 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. - * @property 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. * @property 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. + * @property 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. * @property 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. */ @JsonDeserialize(builder = GetInactivePropertiesOperationParams.Builder::class) data class GetInactivePropertiesOperationParams( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:Valid val since: kotlin.String? = null, + @field:Valid val token: kotlin.String? = null, + @field:Valid val billingTerms: kotlin.String? = null, - val paymentTerms: kotlin.String? = - null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, - val platformName: kotlin.String? = + @field:Valid + val paymentTerms: kotlin.String? = null, + @field:Valid + val platformName: kotlin.String? = + null ) : OperationParams { companion object { @@ -58,9 +69,9 @@ data class GetInactivePropertiesOperationParams( @JsonProperty("since") private var since: kotlin.String? = null, @JsonProperty("token") private var token: kotlin.String? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, - @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -83,14 +94,14 @@ data class GetInactivePropertiesOperationParams( fun billingTerms(billingTerms: kotlin.String) = apply { this.billingTerms = billingTerms } /** - * @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. + * @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. */ - fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } + fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } /** - * @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. + * @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. */ - fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } + fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } /** * @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. @@ -98,15 +109,38 @@ data class GetInactivePropertiesOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetInactivePropertiesOperationParams { - return GetInactivePropertiesOperationParams( - customerSessionId = customerSessionId, - since = since, - token = token, - billingTerms = billingTerms, - paymentTerms = paymentTerms, - partnerPointOfSale = partnerPointOfSale, - platformName = platformName, - ) + val params = + GetInactivePropertiesOperationParams( + customerSessionId = customerSessionId, + since = since, + token = token, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params + } + + private fun validate(params: GetInactivePropertiesOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -116,22 +150,21 @@ data class GetInactivePropertiesOperationParams( since = since, token = token, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { since?.let { append("since", it) } @@ -141,20 +174,18 @@ data class GetInactivePropertiesOperationParams( billingTerms?.let { append("billing_terms", it) } - paymentTerms?.let { - append("payment_terms", it) - } partnerPointOfSale?.let { append("partner_point_of_sale", it) } + paymentTerms?.let { + append("payment_terms", it) + } platformName?.let { append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperation.kt index 93806d1cf7..be81d6436d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class GetPaymentOptionsOperation private constructor( params: GetPaymentOptionsOperationParams?, - link: GetPaymentOptionsOperationLink?, + link: GetPaymentOptionsOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/properties/{property_id}/payment-options"), "GET", "getPaymentOptions", null, - params, + params ) { constructor( - params: GetPaymentOptionsOperationParams, + params: GetPaymentOptionsOperationParams ) : this( params, - null, + null ) constructor( link: GetPaymentOptionsOperationLink, - context: GetPaymentOptionsOperationContext?, + context: GetPaymentOptionsOperationContext? ) : this( GetPaymentOptionsOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationContext.kt index 5ec2bb2eed..2f1c2a07aa 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationContext.kt @@ -27,7 +27,7 @@ data class GetPaymentOptionsOperationContext( val customerIp: kotlin.String? = null, val customerSessionId: kotlin.String? = - null, + null ) { companion object { @JvmStatic @@ -36,7 +36,7 @@ data class GetPaymentOptionsOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, - @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, + @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null ) { /** * @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. @@ -53,7 +53,7 @@ data class GetPaymentOptionsOperationContext( return GetPaymentOptionsOperationContext( customerIp = customerIp, - customerSessionId = customerSessionId, + customerSessionId = customerSessionId ) } @@ -61,8 +61,8 @@ data class GetPaymentOptionsOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp?.also { put("Customer-Ip", customerIp) } @@ -70,5 +70,4 @@ data class GetPaymentOptionsOperationContext( put("Customer-Session-Id", customerSessionId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationLink.kt index 7fc3485f0c..7fde799240 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationLink.kt @@ -32,7 +32,7 @@ data class GetPaymentOptionsOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class GetPaymentOptionsOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): GetPaymentOptionsOperationLink { - return GetPaymentOptionsOperationLink( + fun build(): GetPaymentOptionsOperationLink = + GetPaymentOptionsOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationParams.kt index 119cf243ee..c4228cfd11 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPaymentOptionsOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property propertyId Expedia Property ID.
    @@ -30,11 +35,17 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = GetPaymentOptionsOperationParams.Builder::class) data class GetPaymentOptionsOperationParams internal constructor( + @field:NotNull + @field:Valid val propertyId: kotlin.String? = null, + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -48,26 +59,26 @@ data class GetPaymentOptionsOperationParams null, customerSessionId: kotlin.String? = null, - token: kotlin.String, + token: kotlin.String ) : this( propertyId = propertyId, customerIp = customerIp, customerSessionId = customerSessionId, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: GetPaymentOptionsOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, - dummy = Unit, + dummy = Unit ) class Builder( @JsonProperty("property_id") private var propertyId: kotlin.String? = null, @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param propertyId Expedia Property ID.
    @@ -90,22 +101,34 @@ data class GetPaymentOptionsOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): GetPaymentOptionsOperationParams { - validateNullity() - - return GetPaymentOptionsOperationParams( - propertyId = propertyId!!, - customerIp = customerIp, - customerSessionId = customerSessionId, - token = token!!, - ) + val params = + GetPaymentOptionsOperationParams( + propertyId = propertyId!!, + customerIp = customerIp, + customerSessionId = customerSessionId, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (propertyId == null) { - throw NullPointerException("Required parameter propertyId is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: GetPaymentOptionsOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -115,11 +138,11 @@ data class GetPaymentOptionsOperationParams propertyId = propertyId, customerIp = customerIp, customerSessionId = customerSessionId, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -128,21 +151,18 @@ data class GetPaymentOptionsOperationParams } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { propertyId?.also { put("property_id", propertyId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperation.kt index f9de6fcdf4..0ecb036a42 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetPropertyCatalogFileOperationParams] */ class GetPropertyCatalogFileOperation( - params: GetPropertyCatalogFileOperationParams, + params: GetPropertyCatalogFileOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/files/properties/catalog", "GET", "getPropertyCatalogFile", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationParams.kt index dc6d72f362..db0ebac63b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationParams.kt @@ -16,34 +16,48 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @property supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @property 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. - * @property 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. * @property 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. + * @property 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. * @property 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. */ @JsonDeserialize(builder = GetPropertyCatalogFileOperationParams.Builder::class) data class GetPropertyCatalogFileOperationParams( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val language: kotlin.String, + @field:NotNull + @field:Valid val supplySource: kotlin.String, + @field:Valid val billingTerms: kotlin.String? = null, - val paymentTerms: kotlin.String? = - null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, - val platformName: kotlin.String? = + @field:Valid + val paymentTerms: kotlin.String? = null, + @field:Valid + val platformName: kotlin.String? = + null ) : OperationParams { companion object { @@ -56,9 +70,9 @@ data class GetPropertyCatalogFileOperationParams( @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, - @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -81,14 +95,14 @@ data class GetPropertyCatalogFileOperationParams( fun billingTerms(billingTerms: kotlin.String) = apply { this.billingTerms = billingTerms } /** - * @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. + * @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. */ - fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } + fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } /** - * @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. + * @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. */ - fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } + fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } /** * @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. @@ -96,25 +110,37 @@ data class GetPropertyCatalogFileOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetPropertyCatalogFileOperationParams { - validateNullity() - - return GetPropertyCatalogFileOperationParams( - customerSessionId = customerSessionId, - language = language!!, - supplySource = supplySource!!, - billingTerms = billingTerms, - paymentTerms = paymentTerms, - partnerPointOfSale = partnerPointOfSale, - platformName = platformName, - ) + val params = + GetPropertyCatalogFileOperationParams( + customerSessionId = customerSessionId, + language = language!!, + supplySource = supplySource!!, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (language == null) { - throw NullPointerException("Required parameter language is missing") - } - if (supplySource == null) { - throw NullPointerException("Required parameter supplySource is missing") + private fun validate(params: GetPropertyCatalogFileOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -125,22 +151,21 @@ data class GetPropertyCatalogFileOperationParams( language = language, supplySource = supplySource, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { language?.let { append("language", it) } @@ -150,20 +175,18 @@ data class GetPropertyCatalogFileOperationParams( billingTerms?.let { append("billing_terms", it) } - paymentTerms?.let { - append("payment_terms", it) - } partnerPointOfSale?.let { append("partner_point_of_sale", it) } + paymentTerms?.let { + append("payment_terms", it) + } platformName?.let { append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperation.kt index 129abe666d..7ef8366fbc 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetPropertyContentFileOperationParams] */ class GetPropertyContentFileOperation( - params: GetPropertyContentFileOperationParams, + params: GetPropertyContentFileOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/files/properties/content", "GET", "getPropertyContentFile", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationParams.kt index c90e7fd0b5..ef516ca966 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationParams.kt @@ -16,34 +16,48 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. - * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @property supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @property 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. - * @property 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. * @property 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. + * @property 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. * @property 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. */ @JsonDeserialize(builder = GetPropertyContentFileOperationParams.Builder::class) data class GetPropertyContentFileOperationParams( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val language: kotlin.String, + @field:NotNull + @field:Valid val supplySource: kotlin.String, + @field:Valid val billingTerms: kotlin.String? = null, - val paymentTerms: kotlin.String? = - null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, - val platformName: kotlin.String? = + @field:Valid + val paymentTerms: kotlin.String? = null, + @field:Valid + val platformName: kotlin.String? = + null ) : OperationParams { companion object { @@ -56,9 +70,9 @@ data class GetPropertyContentFileOperationParams( @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, - @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -66,7 +80,7 @@ data class GetPropertyContentFileOperationParams( fun customerSessionId(customerSessionId: kotlin.String) = apply { this.customerSessionId = customerSessionId } /** - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) */ fun language(language: kotlin.String) = apply { this.language = language } @@ -81,14 +95,14 @@ data class GetPropertyContentFileOperationParams( fun billingTerms(billingTerms: kotlin.String) = apply { this.billingTerms = billingTerms } /** - * @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. + * @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. */ - fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } + fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } /** - * @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. + * @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. */ - fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } + fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } /** * @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. @@ -96,25 +110,37 @@ data class GetPropertyContentFileOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetPropertyContentFileOperationParams { - validateNullity() - - return GetPropertyContentFileOperationParams( - customerSessionId = customerSessionId, - language = language!!, - supplySource = supplySource!!, - billingTerms = billingTerms, - paymentTerms = paymentTerms, - partnerPointOfSale = partnerPointOfSale, - platformName = platformName, - ) + val params = + GetPropertyContentFileOperationParams( + customerSessionId = customerSessionId, + language = language!!, + supplySource = supplySource!!, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (language == null) { - throw NullPointerException("Required parameter language is missing") - } - if (supplySource == null) { - throw NullPointerException("Required parameter supplySource is missing") + private fun validate(params: GetPropertyContentFileOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -125,22 +151,21 @@ data class GetPropertyContentFileOperationParams( language = language, supplySource = supplySource, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { language?.let { append("language", it) } @@ -150,20 +175,18 @@ data class GetPropertyContentFileOperationParams( billingTerms?.let { append("billing_terms", it) } - paymentTerms?.let { - append("payment_terms", it) - } partnerPointOfSale?.let { append("partner_point_of_sale", it) } + paymentTerms?.let { + append("payment_terms", it) + } platformName?.let { append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperation.kt index cc06ca5499..aac33b8224 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperation.kt @@ -24,34 +24,32 @@ import com.expediagroup.sdk.core.model.Operation */ class GetPropertyContentOperation private constructor( params: GetPropertyContentOperationParams?, - link: GetPropertyContentOperationLink?, + link: GetPropertyContentOperationLink? ) : Operation< - Nothing, + Nothing >( url(null, link, "/v3/properties/content"), "GET", "getPropertyContent", null, - params, + params ) { constructor( - params: GetPropertyContentOperationParams, + params: GetPropertyContentOperationParams ) : this( params, - null, + null ) constructor( link: GetPropertyContentOperationLink, - context: GetPropertyContentOperationContext?, + context: GetPropertyContentOperationContext? ) : this( GetPropertyContentOperationParams(context), - link, + link ) companion object : LinkableOperation { - override fun pathPattern(): String { - return "/v3/properties/content" - } + override fun pathPattern(): String = "/v3/properties/content" } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationContext.kt index c65b430a3c..aa752c1208 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationContext.kt @@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize @JsonDeserialize(builder = GetPropertyContentOperationParams.Builder::class) data class GetPropertyContentOperationContext( val customerSessionId: kotlin.String? = - null, + null ) { companion object { @JvmStatic @@ -32,7 +32,7 @@ data class GetPropertyContentOperationContext( } class Builder( - @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, + @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -43,7 +43,7 @@ data class GetPropertyContentOperationContext( validateNullity() return GetPropertyContentOperationContext( - customerSessionId = customerSessionId, + customerSessionId = customerSessionId ) } @@ -51,11 +51,10 @@ data class GetPropertyContentOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerSessionId?.also { put("Customer-Session-Id", customerSessionId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationLink.kt index 9bcae0af83..4a6b6bc392 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationLink.kt @@ -32,7 +32,7 @@ data class GetPropertyContentOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class GetPropertyContentOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): GetPropertyContentOperationLink { - return GetPropertyContentOperationLink( + fun build(): GetPropertyContentOperationLink = + GetPropertyContentOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationParams.kt index 28f191dacf..b49c5c251a 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentOperationParams.kt @@ -16,14 +16,19 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. - * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/)
    Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @property supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @property allInclusive Search to include properties that have the requested `all_inclusive` values equal to true. If this parameter is not supplied, all `all_inclusive` scenarios are included. This parameter can be supplied multiple times with different values, which will include properties that match any of the requested scenarios. * `all_rate_plans` - Return properties where `all_inclusive.all_rate_plans` is true. * `some_rate_plans` = Return properties where `all_inclusive.some_rate_plans` is true. * @property amenityId The ID of the amenity you want to search for. This parameter can be supplied multiple times with different values, which will include properties that match any of the requested amenity IDs. This is currently only capable of searching for property level amenities. Room and rate level amenities cannot be searched on. @@ -52,57 +57,84 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = GetPropertyContentOperationParams.Builder::class) data class GetPropertyContentOperationParams internal constructor( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val language: kotlin.String? = null, + @field:NotNull + @field:Valid val supplySource: kotlin.String? = null, + @field:Valid val allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, val businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, + @field:Valid val categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val dateAddedEnd: kotlin.String? = null, + @field:Valid val dateAddedStart: kotlin.String? = null, + @field:Valid val dateUpdatedEnd: kotlin.String? = null, + @field:Valid val dateUpdatedStart: kotlin.String? = null, + @field:Valid val include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val multiUnit: kotlin.Boolean? = null, + @field:Valid val propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val propertyRatingMax: kotlin.String? = null, + @field:Valid val propertyRatingMin: kotlin.String? = null, + @field:Valid val spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -116,39 +148,39 @@ data class GetPropertyContentOperationParams language: kotlin.String, supplySource: kotlin.String, allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, dateAddedEnd: kotlin.String? = @@ -160,13 +192,13 @@ data class GetPropertyContentOperationParams dateUpdatedStart: kotlin.String? = null, include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, multiUnit: kotlin.Boolean? = null, propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, propertyRatingMax: kotlin.String? = @@ -174,7 +206,7 @@ data class GetPropertyContentOperationParams propertyRatingMin: kotlin.String? = null, spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, billingTerms: kotlin.String? = @@ -184,7 +216,7 @@ data class GetPropertyContentOperationParams paymentTerms: kotlin.String? = null, platformName: kotlin.String? = - null, + null ) : this( customerSessionId = customerSessionId, language = language, @@ -212,19 +244,19 @@ data class GetPropertyContentOperationParams partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, platformName = platformName, - dummy = Unit, + dummy = Unit ) constructor(context: GetPropertyContentOperationContext?) : this( customerSessionId = context?.customerSessionId, - dummy = Unit, + dummy = Unit ) enum class BusinessModel( - val value: kotlin.String, + val value: kotlin.String ) { EXPEDIA_COLLECT("expedia_collect"), - PROPERTY_COLLECT("property_collect"), + PROPERTY_COLLECT("property_collect") } class Builder( @@ -232,52 +264,52 @@ data class GetPropertyContentOperationParams @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, @JsonProperty("all_inclusive") private var allInclusive: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("amenity_id") private var amenityId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("attribute_id") private var attributeId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("brand_id") private var brandId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("business_model") private var businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, + GetPropertyContentOperationParams.BusinessModel >? = null, @JsonProperty("category_id") private var categoryId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("category_id_exclude") private var categoryIdExclude: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("chain_id") private var chainId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("country_code") private var countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("date_added_end") private var dateAddedEnd: kotlin.String? = null, @JsonProperty("date_added_start") private var dateAddedStart: kotlin.String? = null, @JsonProperty("date_updated_end") private var dateUpdatedEnd: kotlin.String? = null, @JsonProperty("date_updated_start") private var dateUpdatedStart: kotlin.String? = null, @JsonProperty("include") private var include: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("multi_unit") private var multiUnit: kotlin.Boolean? = null, @JsonProperty("property_id") private var propertyId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("property_rating_max") private var propertyRatingMax: kotlin.String? = null, @JsonProperty("property_rating_min") private var propertyRatingMin: kotlin.String? = null, @JsonProperty("spoken_language_id") private var spokenLanguageId: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -285,7 +317,7 @@ data class GetPropertyContentOperationParams fun customerSessionId(customerSessionId: kotlin.String) = apply { this.customerSessionId = customerSessionId } /** - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/)
    Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) */ fun language(language: kotlin.String) = apply { this.language = language } @@ -299,8 +331,8 @@ data class GetPropertyContentOperationParams */ fun allInclusive( allInclusive: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.allInclusive = allInclusive } /** @@ -308,8 +340,8 @@ data class GetPropertyContentOperationParams */ fun amenityId( amenityId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.amenityId = amenityId } /** @@ -317,8 +349,8 @@ data class GetPropertyContentOperationParams */ fun attributeId( attributeId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.attributeId = attributeId } /** @@ -326,8 +358,8 @@ data class GetPropertyContentOperationParams */ fun brandId( brandId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.brandId = brandId } /** @@ -335,8 +367,8 @@ data class GetPropertyContentOperationParams */ fun businessModel( businessModel: kotlin.collections.List< - GetPropertyContentOperationParams.BusinessModel, - >, + GetPropertyContentOperationParams.BusinessModel + > ) = apply { this.businessModel = businessModel } /** @@ -344,8 +376,8 @@ data class GetPropertyContentOperationParams */ fun categoryId( categoryId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.categoryId = categoryId } /** @@ -353,8 +385,8 @@ data class GetPropertyContentOperationParams */ fun categoryIdExclude( categoryIdExclude: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.categoryIdExclude = categoryIdExclude } /** @@ -362,8 +394,8 @@ data class GetPropertyContentOperationParams */ fun chainId( chainId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.chainId = chainId } /** @@ -371,8 +403,8 @@ data class GetPropertyContentOperationParams */ fun countryCode( countryCode: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.countryCode = countryCode } /** @@ -400,8 +432,8 @@ data class GetPropertyContentOperationParams */ fun include( include: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.include = include } /** @@ -414,8 +446,8 @@ data class GetPropertyContentOperationParams */ fun propertyId( propertyId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.propertyId = propertyId } /** @@ -433,8 +465,8 @@ data class GetPropertyContentOperationParams */ fun spokenLanguageId( spokenLanguageId: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.spokenLanguageId = spokenLanguageId } /** @@ -458,44 +490,56 @@ data class GetPropertyContentOperationParams fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetPropertyContentOperationParams { - validateNullity() - - return GetPropertyContentOperationParams( - customerSessionId = customerSessionId, - language = language!!, - supplySource = supplySource!!, - allInclusive = allInclusive, - amenityId = amenityId, - attributeId = attributeId, - brandId = brandId, - businessModel = businessModel, - categoryId = categoryId, - categoryIdExclude = categoryIdExclude, - chainId = chainId, - countryCode = countryCode, - dateAddedEnd = dateAddedEnd, - dateAddedStart = dateAddedStart, - dateUpdatedEnd = dateUpdatedEnd, - dateUpdatedStart = dateUpdatedStart, - include = include, - multiUnit = multiUnit, - propertyId = propertyId, - propertyRatingMax = propertyRatingMax, - propertyRatingMin = propertyRatingMin, - spokenLanguageId = spokenLanguageId, - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - ) + val params = + GetPropertyContentOperationParams( + customerSessionId = customerSessionId, + language = language!!, + supplySource = supplySource!!, + allInclusive = allInclusive, + amenityId = amenityId, + attributeId = attributeId, + brandId = brandId, + businessModel = businessModel, + categoryId = categoryId, + categoryIdExclude = categoryIdExclude, + chainId = chainId, + countryCode = countryCode, + dateAddedEnd = dateAddedEnd, + dateAddedStart = dateAddedStart, + dateUpdatedEnd = dateUpdatedEnd, + dateUpdatedStart = dateUpdatedStart, + include = include, + multiUnit = multiUnit, + propertyId = propertyId, + propertyRatingMax = propertyRatingMax, + propertyRatingMin = propertyRatingMin, + spokenLanguageId = spokenLanguageId, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (language == null) { - throw NullPointerException("Required parameter language is missing") - } - if (supplySource == null) { - throw NullPointerException("Required parameter supplySource is missing") + private fun validate(params: GetPropertyContentOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -527,20 +571,19 @@ data class GetPropertyContentOperationParams billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { language?.let { append("language", it) } @@ -617,10 +660,8 @@ data class GetPropertyContentOperationParams append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperation.kt index 7d0ba21fa2..215fa58342 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperation.kt @@ -24,15 +24,15 @@ import org.apache.commons.text.StringSubstitutor * @property params [GetPropertyGuestReviewsOperationParams] */ class GetPropertyGuestReviewsOperation( - params: GetPropertyGuestReviewsOperationParams, + params: GetPropertyGuestReviewsOperationParams ) : Operation< - Nothing, + Nothing >( url(params), "GET", "getPropertyGuestReviews", null, - params, + params ) { companion object { fun url(params: GetPropertyGuestReviewsOperationParams): String { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationParams.kt index db5ec9263e..2ad991a1b3 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationParams.kt @@ -16,44 +16,58 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** - * @property propertyId Expedia Property ID.
    + * @property propertyId Expedia Property ID. * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. - * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @property filter Single filter value. Send multiple instances of this parameter to request multiple filters. * `language` - Filters reviews to only those that match the specified `language` parameter value. Without this filter, the matching language will be preferred, but other language results can be returned. Specifying this filter could produce an error when there are no matching results. * @property tripReason Desired reason provided for the reviewer's trip that you wish to display. This parameter can be supplied multiple times with different values, which will include reviews that match any of the requested trip reasons. * @property 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. - * @property 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. * @property 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. + * @property 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. * @property 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. */ @JsonDeserialize(builder = GetPropertyGuestReviewsOperationParams.Builder::class) data class GetPropertyGuestReviewsOperationParams( + @field:NotNull + @field:Valid val propertyId: kotlin.String, + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val language: kotlin.String, val filter: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.Filter, + GetPropertyGuestReviewsOperationParams.Filter >? = null, val tripReason: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.TripReason, + GetPropertyGuestReviewsOperationParams.TripReason >? = null, + @field:Valid val billingTerms: kotlin.String? = null, - val paymentTerms: kotlin.String? = - null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, - val platformName: kotlin.String? = + @field:Valid + val paymentTerms: kotlin.String? = null, + @field:Valid + val platformName: kotlin.String? = + null ) : OperationParams { companion object { @@ -62,18 +76,18 @@ data class GetPropertyGuestReviewsOperationParams( } enum class Filter( - val value: kotlin.String, + val value: kotlin.String ) { - LANGUAGE("language"), + LANGUAGE("language") } enum class TripReason( - val value: kotlin.String, + val value: kotlin.String ) { BUSINESS("business"), LEISURE("leisure"), FRIENDS_AND_FAMILY("friends_and_family"), - BUSINESS_AND_LEISURE("business_and_leisure"), + BUSINESS_AND_LEISURE("business_and_leisure") } class Builder( @@ -81,18 +95,18 @@ data class GetPropertyGuestReviewsOperationParams( @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("filter") private var filter: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.Filter, + GetPropertyGuestReviewsOperationParams.Filter >? = null, @JsonProperty("trip_reason") private var tripReason: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.TripReason, + GetPropertyGuestReviewsOperationParams.TripReason >? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, - @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** - * @param propertyId Expedia Property ID.
    + * @param propertyId Expedia Property ID. */ fun propertyId(propertyId: kotlin.String) = apply { this.propertyId = propertyId } @@ -102,7 +116,7 @@ data class GetPropertyGuestReviewsOperationParams( fun customerSessionId(customerSessionId: kotlin.String) = apply { this.customerSessionId = customerSessionId } /** - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) */ fun language(language: kotlin.String) = apply { this.language = language } @@ -111,8 +125,8 @@ data class GetPropertyGuestReviewsOperationParams( */ fun filter( filter: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.Filter, - >, + GetPropertyGuestReviewsOperationParams.Filter + > ) = apply { this.filter = filter } /** @@ -120,8 +134,8 @@ data class GetPropertyGuestReviewsOperationParams( */ fun tripReason( tripReason: kotlin.collections.List< - GetPropertyGuestReviewsOperationParams.TripReason, - >, + GetPropertyGuestReviewsOperationParams.TripReason + > ) = apply { this.tripReason = tripReason } /** @@ -130,14 +144,14 @@ data class GetPropertyGuestReviewsOperationParams( fun billingTerms(billingTerms: kotlin.String) = apply { this.billingTerms = billingTerms } /** - * @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. + * @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. */ - fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } + fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } /** - * @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. + * @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. */ - fun partnerPointOfSale(partnerPointOfSale: kotlin.String) = apply { this.partnerPointOfSale = partnerPointOfSale } + fun paymentTerms(paymentTerms: kotlin.String) = apply { this.paymentTerms = paymentTerms } /** * @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. @@ -145,27 +159,39 @@ data class GetPropertyGuestReviewsOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetPropertyGuestReviewsOperationParams { - validateNullity() - - return GetPropertyGuestReviewsOperationParams( - propertyId = propertyId!!, - customerSessionId = customerSessionId, - language = language!!, - filter = filter, - tripReason = tripReason, - billingTerms = billingTerms, - paymentTerms = paymentTerms, - partnerPointOfSale = partnerPointOfSale, - platformName = platformName, - ) + val params = + GetPropertyGuestReviewsOperationParams( + propertyId = propertyId!!, + customerSessionId = customerSessionId, + language = language!!, + filter = filter, + tripReason = tripReason, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (propertyId == null) { - throw NullPointerException("Required parameter propertyId is missing") - } - if (language == null) { - throw NullPointerException("Required parameter language is missing") + private fun validate(params: GetPropertyGuestReviewsOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -178,22 +204,21 @@ data class GetPropertyGuestReviewsOperationParams( filter = filter, tripReason = tripReason, billingTerms = billingTerms, - paymentTerms = paymentTerms, partnerPointOfSale = partnerPointOfSale, - platformName = platformName, + paymentTerms = paymentTerms, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { language?.let { append("language", it) } @@ -206,23 +231,21 @@ data class GetPropertyGuestReviewsOperationParams( billingTerms?.let { append("billing_terms", it) } - paymentTerms?.let { - append("payment_terms", it) - } partnerPointOfSale?.let { append("partner_point_of_sale", it) } + paymentTerms?.let { + append("payment_terms", it) + } platformName?.let { append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { propertyId?.also { put("property_id", propertyId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperation.kt index 26c4d516c9..5eccfbaf80 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperation.kt @@ -24,15 +24,15 @@ import org.apache.commons.text.StringSubstitutor * @property params [GetRegionOperationParams] */ class GetRegionOperation( - params: GetRegionOperationParams, + params: GetRegionOperationParams ) : Operation< - Nothing, + Nothing >( url(params), "GET", "getRegion", null, - params, + params ) { companion object { fun url(params: GetRegionOperationParams): String { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationParams.kt index 7d454f4053..366b5dcd7c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationParams.kt @@ -16,41 +16,57 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property regionId ID of the region to retrieve. * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @property include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The value must be lower case. * details - Include the metadata, coordinates and full hierarchy of the region. * property_ids - Include the list of property IDs within the bounding polygon of the region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of the region and property IDs from the surrounding area if minimal properties are within the region. + * @property supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @property 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. * @property 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. * @property 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. * @property 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. - * @property supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. */ @JsonDeserialize(builder = GetRegionOperationParams.Builder::class) data class GetRegionOperationParams( + @field:NotNull + @field:Valid val regionId: kotlin.String, + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val language: kotlin.String, + @field:NotNull val include: kotlin.collections.List< - GetRegionOperationParams.Include, + GetRegionOperationParams.Include >, + @field:Valid + val supplySource: kotlin.String? = + null, + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = - null, - val supplySource: kotlin.String? = - null, + null ) : OperationParams { companion object { @@ -59,11 +75,11 @@ data class GetRegionOperationParams( } enum class Include( - val value: kotlin.String, + val value: kotlin.String ) { DETAILS("details"), PROPERTY_IDS("property_ids"), - PROPERTY_IDS_EXPANDED("property_ids_expanded"), + PROPERTY_IDS_EXPANDED("property_ids_expanded") } class Builder( @@ -71,13 +87,13 @@ data class GetRegionOperationParams( @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("include") private var include: kotlin.collections.List< - GetRegionOperationParams.Include, + GetRegionOperationParams.Include >? = null, + @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, - @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param regionId ID of the region to retrieve. @@ -99,10 +115,15 @@ data class GetRegionOperationParams( */ fun include( include: kotlin.collections.List< - GetRegionOperationParams.Include, - >, + GetRegionOperationParams.Include + > ) = apply { this.include = include } + /** + * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + */ + fun supplySource(supplySource: kotlin.String) = apply { this.supplySource = supplySource } + /** * @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. */ @@ -123,36 +144,40 @@ data class GetRegionOperationParams( */ fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } - /** - * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. - */ - fun supplySource(supplySource: kotlin.String) = apply { this.supplySource = supplySource } - fun build(): GetRegionOperationParams { - validateNullity() - - return GetRegionOperationParams( - regionId = regionId!!, - customerSessionId = customerSessionId, - language = language!!, - include = include!!, - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - supplySource = supplySource, - ) + val params = + GetRegionOperationParams( + regionId = regionId!!, + customerSessionId = customerSessionId, + language = language!!, + include = include!!, + supplySource = supplySource, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (regionId == null) { - throw NullPointerException("Required parameter regionId is missing") - } - if (language == null) { - throw NullPointerException("Required parameter language is missing") - } - if (include == null) { - throw NullPointerException("Required parameter include is missing") + private fun validate(params: GetRegionOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -163,30 +188,32 @@ data class GetRegionOperationParams( customerSessionId = customerSessionId, language = language, include = include, + supplySource = supplySource, billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, - supplySource = supplySource, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { language?.let { append("language", it) } include?.let { appendAll("include", it.map { it.value }) } + supplySource?.let { + append("supply_source", it) + } billingTerms?.let { append("billing_terms", it) } @@ -199,17 +226,12 @@ data class GetRegionOperationParams( platformName?.let { append("platform_name", it) } - supplySource?.let { - append("supply_source", it) - } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { regionId?.also { put("region_id", regionId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperation.kt index cbfccb01f8..7eab9a5363 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetRegionsOperationParams] */ class GetRegionsOperation( - params: GetRegionsOperationParams, + params: GetRegionsOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/regions", "GET", "getRegions", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationParams.kt index 08625e96b7..243877aaa4 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationParams.kt @@ -16,15 +16,20 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. - * @property include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. - * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @property include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. + * @property language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) * @property ancestorId Search for regions whose ancestors include the requested ancestor region ID. Refer to the list of [top level regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists). * @property area Filter the results to regions that intersect with a specified area.

    The area may be defined in one of two ways: * radius,region_id * radius,latitude,longitude Radius combined with region id would search an area that extends the number of kilometers out from the boundaries of the region in all directions.
    Radius combined with a single point, specified by a latitude, longitude pair would search an area in a circle with the specified radius and the point as the center.
    Radius should be specified in non-negative whole kilometers, decimals will return an error. A radius of 0 is allowed.
    When specifying the area parameter, there will be a limit of 100 results, which can be narrowed further by the limit parameter.
    Due to the number of results, unless `point_of_interest` is specified as the only type, regions of type `point_of_interest` will not be included in a request that filters to an area.

    An example use case would be searching for the closest 3 airports within 50 kilometers of a specified point.
    `&type=airport&limit=3&area=50,37.227924,-93.310036` * @property countryCode Filter the results to a specified ISO 3166-1 alpha-2 country code. For more information see: [https://www.iso.org/obp/ui/#search/code/](https://www.iso.org/obp/ui/#search/code/) @@ -40,42 +45,58 @@ import io.ktor.http.Parameters */ @JsonDeserialize(builder = GetRegionsOperationParams.Builder::class) data class GetRegionsOperationParams( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull val include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >, + @field:NotNull + @field:Valid val language: kotlin.String, + @field:Valid val ancestorId: kotlin.String? = null, + @field:Valid val area: kotlin.String? = null, + @field:Valid val countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val iataLocationCode: kotlin.String? = null, + @field:Valid val limit: java.math.BigDecimal? = null, + @field:Valid val supplySource: kotlin.String? = null, + @field:Valid val type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = - null, + null ) : OperationParams { companion object { @@ -84,38 +105,38 @@ data class GetRegionsOperationParams( } enum class Include( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), DETAILS("details"), PROPERTY_IDS("property_ids"), - PROPERTY_IDS_EXPANDED("property_ids_expanded"), + PROPERTY_IDS_EXPANDED("property_ids_expanded") } class Builder( @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("include") private var include: kotlin.collections.List< - GetRegionsOperationParams.Include, + GetRegionsOperationParams.Include >? = null, @JsonProperty("language") private var language: kotlin.String? = null, @JsonProperty("ancestor_id") private var ancestorId: kotlin.String? = null, @JsonProperty("area") private var area: kotlin.String? = null, @JsonProperty("country_code") private var countryCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("country_subdivision_code") private var countrySubdivisionCode: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("iata_location_code") private var iataLocationCode: kotlin.String? = null, @JsonProperty("limit") private var limit: java.math.BigDecimal? = null, @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, @JsonProperty("type") private var type: kotlin.collections.List< - kotlin.String, + kotlin.String >? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -123,16 +144,16 @@ data class GetRegionsOperationParams( fun customerSessionId(customerSessionId: kotlin.String) = apply { this.customerSessionId = customerSessionId } /** - * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. + * @param include Options for which content to return in the response. This parameter can be supplied multiple times with different values. The standard and details options cannot be requested together. The value must be lower case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. */ fun include( include: kotlin.collections.List< - GetRegionsOperationParams.Include, - >, + GetRegionsOperationParams.Include + > ) = apply { this.include = include } /** - * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * @param language Desired language for the response as a subset of BCP47 format that only uses hyphenated pairs of two-digit language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes.

    Reference: * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) */ fun language(language: kotlin.String) = apply { this.language = language } @@ -151,8 +172,8 @@ data class GetRegionsOperationParams( */ fun countryCode( countryCode: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.countryCode = countryCode } /** @@ -160,8 +181,8 @@ data class GetRegionsOperationParams( */ fun countrySubdivisionCode( countrySubdivisionCode: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.countrySubdivisionCode = countrySubdivisionCode } /** @@ -184,8 +205,8 @@ data class GetRegionsOperationParams( */ fun type( type: kotlin.collections.List< - kotlin.String, - >, + kotlin.String + > ) = apply { this.type = type } /** @@ -209,33 +230,45 @@ data class GetRegionsOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): GetRegionsOperationParams { - validateNullity() + val params = + GetRegionsOperationParams( + customerSessionId = customerSessionId, + include = include!!, + language = language!!, + ancestorId = ancestorId, + area = area, + countryCode = countryCode, + countrySubdivisionCode = countrySubdivisionCode, + iataLocationCode = iataLocationCode, + limit = limit, + supplySource = supplySource, + type = type, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) - return GetRegionsOperationParams( - customerSessionId = customerSessionId, - include = include!!, - language = language!!, - ancestorId = ancestorId, - area = area, - countryCode = countryCode, - countrySubdivisionCode = countrySubdivisionCode, - iataLocationCode = iataLocationCode, - limit = limit, - supplySource = supplySource, - type = type, - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - ) + return params } - private fun validateNullity() { - if (include == null) { - throw NullPointerException("Required parameter include is missing") - } - if (language == null) { - throw NullPointerException("Required parameter language is missing") + private fun validate(params: GetRegionsOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -256,20 +289,19 @@ data class GetRegionsOperationParams( billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { include?.let { appendAll("include", it.map { it.value }) } @@ -313,10 +345,8 @@ data class GetRegionsOperationParams( append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperation.kt index 04679a3e00..c0a1ce1bc6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class GetReservationByItineraryIdOperation private constructor( params: GetReservationByItineraryIdOperationParams?, - link: GetReservationByItineraryIdOperationLink?, + link: GetReservationByItineraryIdOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/itineraries/{itinerary_id}"), "GET", "getReservationByItineraryId", null, - params, + params ) { constructor( - params: GetReservationByItineraryIdOperationParams, + params: GetReservationByItineraryIdOperationParams ) : this( params, - null, + null ) constructor( link: GetReservationByItineraryIdOperationLink, - context: GetReservationByItineraryIdOperationContext, + context: GetReservationByItineraryIdOperationContext ) : this( GetReservationByItineraryIdOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationContext.kt index 06bab2f05c..a57d393397 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationContext.kt @@ -29,7 +29,7 @@ data class GetReservationByItineraryIdOperationContext( val customerSessionId: kotlin.String? = null, val test: GetReservationByItineraryIdOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class GetReservationByItineraryIdOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: GetReservationByItineraryIdOperationParams.Test? = null, + @JsonProperty("Test") private var test: GetReservationByItineraryIdOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class GetReservationByItineraryIdOperationContext( return GetReservationByItineraryIdOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class GetReservationByItineraryIdOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class GetReservationByItineraryIdOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationLink.kt index 9f28bbd8d7..488cb077db 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationLink.kt @@ -32,7 +32,7 @@ data class GetReservationByItineraryIdOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class GetReservationByItineraryIdOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): GetReservationByItineraryIdOperationLink { - return GetReservationByItineraryIdOperationLink( + fun build(): GetReservationByItineraryIdOperationLink = + GetReservationByItineraryIdOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationParams.kt index 98b14c74b0..e6a0efc21f 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationByItineraryIdOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -28,21 +33,28 @@ import io.ktor.http.Parameters * @property test The retrieve call has a test header that can be used to return set responses. Passing standard in the Test header will retrieve a test booking, and passing any of the errors listed below will return a stubbed error response that you can use to test your error handling code. Additionally, refer to the Test Request documentation for more details on how these header values are used. * `standard` - Requires valid test booking. * `service_unavailable` * `internal_server_error` * @property 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. * @property email Email associated with the booking. Special characters in the local part or domain should be encoded. (Email is required if the token is not provided the request)
    - * @property include Options for which information to return in the response. The value must be lower case. * history - Include itinerary history, showing details of the changes made to this itinerary + * @property include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. */ @JsonDeserialize(builder = GetReservationByItineraryIdOperationParams.Builder::class) data class GetReservationByItineraryIdOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: GetReservationByItineraryIdOperationParams.Test? = null, + @field:Valid val token: kotlin.String? = null, + @field:Valid val email: kotlin.String? = null, val include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, + GetReservationByItineraryIdOperationParams.Include >? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -62,9 +74,9 @@ data class GetReservationByItineraryIdOperationParams email: kotlin.String? = null, include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, + GetReservationByItineraryIdOperationParams.Include >? = - null, + null ) : this( itineraryId = itineraryId, customerIp = customerIp, @@ -73,28 +85,28 @@ data class GetReservationByItineraryIdOperationParams token = token, email = email, include = include, - dummy = Unit, + dummy = Unit ) constructor(context: GetReservationByItineraryIdOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - INTERNAL_SERVER_ERROR("internal_server_error"), + INTERNAL_SERVER_ERROR("internal_server_error") } enum class Include( - val value: kotlin.String, + val value: kotlin.String ) { - HISTORY("history"), + HISTORY("history") } class Builder( @@ -105,8 +117,8 @@ data class GetReservationByItineraryIdOperationParams @JsonProperty("token") private var token: kotlin.String? = null, @JsonProperty("email") private var email: kotlin.String? = null, @JsonProperty("include") private var include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, - >? = null, + GetReservationByItineraryIdOperationParams.Include + >? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -139,34 +151,46 @@ data class GetReservationByItineraryIdOperationParams fun email(email: kotlin.String) = apply { this.email = email } /** - * @param include Options for which information to return in the response. The value must be lower case. * history - Include itinerary history, showing details of the changes made to this itinerary + * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. */ fun include( include: kotlin.collections.List< - GetReservationByItineraryIdOperationParams.Include, - >, + GetReservationByItineraryIdOperationParams.Include + > ) = apply { this.include = include } fun build(): GetReservationByItineraryIdOperationParams { - validateNullity() - - return GetReservationByItineraryIdOperationParams( - itineraryId = itineraryId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token, - email = email, - include = include, - ) + val params = + GetReservationByItineraryIdOperationParams( + itineraryId = itineraryId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token, + email = email, + include = include + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") + private fun validate(params: GetReservationByItineraryIdOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -179,11 +203,11 @@ data class GetReservationByItineraryIdOperationParams test = test, token = token, email = email, - include = include, + include = include ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -195,10 +219,9 @@ data class GetReservationByItineraryIdOperationParams } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } @@ -209,13 +232,11 @@ data class GetReservationByItineraryIdOperationParams appendAll("include", it.map { it.value }) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperation.kt index 802a639cfd..f056dba2f0 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [GetReservationOperationParams] */ class GetReservationOperation( - params: GetReservationOperationParams, + params: GetReservationOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/itineraries", "GET", "getReservation", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationParams.kt index 6998139faf..162841069c 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property 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. @@ -27,21 +32,28 @@ import io.ktor.http.Parameters * @property test The retrieve call has a test header that can be used to return set responses with the following keywords:
    * `standard` - Requires valid test booking. * `service_unavailable` * `internal_server_error` * @property affiliateReferenceId The affilliate reference id value. This field supports a maximum of 28 characters. * @property email Email associated with the booking. Special characters in the local part or domain should be encoded.
    - * @property include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary + * @property include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. */ @JsonDeserialize(builder = GetReservationOperationParams.Builder::class) data class GetReservationOperationParams( + @field:NotNull + @field:Valid val customerIp: kotlin.String, + @field:Valid val customerSessionId: kotlin.String? = null, val test: GetReservationOperationParams.Test? = null, + @field:NotNull + @field:Valid val affiliateReferenceId: kotlin.String, + @field:NotNull + @field:Valid val email: kotlin.String, val include: kotlin.collections.List< - GetReservationOperationParams.Include, + GetReservationOperationParams.Include >? = - null, + null ) : OperationParams { companion object { @@ -50,17 +62,17 @@ data class GetReservationOperationParams( } enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - INTERNAL_SERVER_ERROR("internal_server_error"), + INTERNAL_SERVER_ERROR("internal_server_error") } enum class Include( - val value: kotlin.String, + val value: kotlin.String ) { - HISTORY("history"), + HISTORY("history") } class Builder( @@ -70,8 +82,8 @@ data class GetReservationOperationParams( @JsonProperty("affiliate_reference_id") private var affiliateReferenceId: kotlin.String? = null, @JsonProperty("email") private var email: kotlin.String? = null, @JsonProperty("include") private var include: kotlin.collections.List< - GetReservationOperationParams.Include, - >? = null, + GetReservationOperationParams.Include + >? = null ) { /** * @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. @@ -99,36 +111,45 @@ data class GetReservationOperationParams( fun email(email: kotlin.String) = apply { this.email = email } /** - * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary + * @param include Options for which information to return in the response. The value must be lower case. * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. */ fun include( include: kotlin.collections.List< - GetReservationOperationParams.Include, - >, + GetReservationOperationParams.Include + > ) = apply { this.include = include } fun build(): GetReservationOperationParams { - validateNullity() - - return GetReservationOperationParams( - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - affiliateReferenceId = affiliateReferenceId!!, - email = email!!, - include = include, - ) + val params = + GetReservationOperationParams( + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + affiliateReferenceId = affiliateReferenceId!!, + email = email!!, + include = include + ) + + validate(params) + + return params } - private fun validateNullity() { - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (affiliateReferenceId == null) { - throw NullPointerException("Required parameter affiliateReferenceId is missing") - } - if (email == null) { - throw NullPointerException("Required parameter email is missing") + private fun validate(params: GetReservationOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -140,11 +161,11 @@ data class GetReservationOperationParams( test = test, affiliateReferenceId = affiliateReferenceId, email = email, - include = include, + include = include ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -156,10 +177,9 @@ data class GetReservationOperationParams( } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { affiliateReferenceId?.let { append("affiliate_reference_id", it) } @@ -170,10 +190,8 @@ data class GetReservationOperationParams( appendAll("include", it.map { it.value }) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/LinkableOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/LinkableOperation.kt index 66086ffe6c..f2be54a1d6 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/LinkableOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/LinkableOperation.kt @@ -26,7 +26,7 @@ interface LinkableOperation { fun url( params: OperationParams?, link: Link?, - url: String, + url: String ): String { val pathParams = params?.getPathParams() diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperation.kt index a108572777..14177bc40b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperation.kt @@ -25,22 +25,19 @@ import com.expediagroup.sdk.rapid.models.PropertiesGeoJsonRequest */ class PostGeographyOperation( params: PostGeographyOperationParams, - requestBody: PropertiesGeoJsonRequest?, + requestBody: PropertiesGeoJsonRequest? ) : Operation< - PropertiesGeoJsonRequest, + PropertiesGeoJsonRequest >( "/v3/properties/geography", "POST", "postGeography", requestBody, - params, + params ) { - @Deprecated( - "Switch order of arguments", - ReplaceWith("Operation(params: PostGeographyOperationParams, requestBody: PropertiesGeoJsonRequest?)"), - ) + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: PostGeographyOperationParams, requestBody: PropertiesGeoJsonRequest?)")) constructor( requestBody: PropertiesGeoJsonRequest?, - params: PostGeographyOperationParams, + params: PostGeographyOperationParams ) : this(params, requestBody) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationParams.kt index 984297bfa9..1fead8a141 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationParams.kt @@ -16,35 +16,48 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. * @property include Options for which content to return in the response. The value must be lower case. * property_ids - Include the property IDs. + * @property supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. * @property 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. * @property 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. * @property 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. * @property 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. - * @property supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. */ @JsonDeserialize(builder = PostGeographyOperationParams.Builder::class) data class PostGeographyOperationParams( + @field:Valid val customerSessionId: kotlin.String? = null, + @field:NotNull + @field:Valid val include: kotlin.String, + @field:NotNull + @field:Valid + val supplySource: kotlin.String, + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = - null, - val supplySource: kotlin.String? = - null, + null ) : OperationParams { companion object { @@ -55,11 +68,11 @@ data class PostGeographyOperationParams( class Builder( @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("include") private var include: kotlin.String? = null, + @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, - @JsonProperty("supply_source") private var supplySource: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. @@ -71,6 +84,11 @@ data class PostGeographyOperationParams( */ fun include(include: kotlin.String) = apply { this.include = include } + /** + * @param supplySource Options for which supply source you would like returned in the content response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + */ + fun supplySource(supplySource: kotlin.String) = apply { this.supplySource = supplySource } + /** * @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. */ @@ -91,28 +109,38 @@ data class PostGeographyOperationParams( */ fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } - /** - * @param supplySource Options for which supply source you would like returned in the geography response. This parameter may only be supplied once and will return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. - */ - fun supplySource(supplySource: kotlin.String) = apply { this.supplySource = supplySource } - fun build(): PostGeographyOperationParams { - validateNullity() - - return PostGeographyOperationParams( - customerSessionId = customerSessionId, - include = include!!, - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - supplySource = supplySource, - ) + val params = + PostGeographyOperationParams( + customerSessionId = customerSessionId, + include = include!!, + supplySource = supplySource!!, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (include == null) { - throw NullPointerException("Required parameter include is missing") + private fun validate(params: PostGeographyOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -121,27 +149,29 @@ data class PostGeographyOperationParams( Builder( customerSessionId = customerSessionId, include = include, + supplySource = supplySource, billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, - supplySource = supplySource, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerSessionId?.let { append("Customer-Session-Id", it) } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { include?.let { append("include", it) } + supplySource?.let { + append("supply_source", it) + } billingTerms?.let { append("billing_terms", it) } @@ -154,14 +184,9 @@ data class PostGeographyOperationParams( platformName?.let { append("platform_name", it) } - supplySource?.let { - append("supply_source", it) - } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperation.kt index 26d96bb3ef..5b9a75e080 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperation.kt @@ -26,47 +26,42 @@ import com.expediagroup.sdk.rapid.models.CreateItineraryRequest class PostItineraryOperation private constructor( params: PostItineraryOperationParams?, requestBody: CreateItineraryRequest?, - link: PostItineraryOperationLink?, + link: PostItineraryOperationLink? ) : Operation< - CreateItineraryRequest, + CreateItineraryRequest >( url(null, link, "/v3/itineraries"), "POST", "postItinerary", requestBody, - params, + params ) { - @Deprecated( - "Switch order of arguments", - ReplaceWith("Operation(params: PostItineraryOperationParams, requestBody: CreateItineraryRequest?)"), - ) + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: PostItineraryOperationParams, requestBody: CreateItineraryRequest?)")) constructor( requestBody: CreateItineraryRequest?, - params: PostItineraryOperationParams, + params: PostItineraryOperationParams ) : this(params, requestBody) constructor( params: PostItineraryOperationParams, - requestBody: CreateItineraryRequest?, + requestBody: CreateItineraryRequest? ) : this( params, requestBody, - null, + null ) constructor( link: PostItineraryOperationLink, context: PostItineraryOperationContext, - requestBody: CreateItineraryRequest?, + requestBody: CreateItineraryRequest? ) : this( PostItineraryOperationParams(context), requestBody, - link, + link ) companion object : LinkableOperation { - override fun pathPattern(): String { - return "/v3/itineraries" - } + override fun pathPattern(): String = "/v3/itineraries" } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationContext.kt index e595a6aedc..70203bc9e2 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationContext.kt @@ -29,7 +29,7 @@ data class PostItineraryOperationContext( val customerSessionId: kotlin.String? = null, val test: PostItineraryOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class PostItineraryOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: PostItineraryOperationParams.Test? = null, + @JsonProperty("Test") private var test: PostItineraryOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class PostItineraryOperationContext( return PostItineraryOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class PostItineraryOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class PostItineraryOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationLink.kt index 81a990d140..9e11bf0147 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationLink.kt @@ -32,7 +32,7 @@ data class PostItineraryOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class PostItineraryOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): PostItineraryOperationLink { - return PostItineraryOperationLink( + fun build(): PostItineraryOperationLink = + PostItineraryOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationParams.kt index 847db21b6c..dd4e3c92e1 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostItineraryOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property 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. @@ -30,11 +35,16 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = PostItineraryOperationParams.Builder::class) data class PostItineraryOperationParams internal constructor( + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: PostItineraryOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -48,38 +58,38 @@ data class PostItineraryOperationParams null, test: PostItineraryOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( customerIp = customerIp, customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: PostItineraryOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), INTERNAL_SERVER_ERROR("internal_server_error"), PRICE_MISMATCH("price_mismatch"), CC_DECLINED("cc_declined"), - ROOMS_UNAVAILABLE("rooms_unavailable"), + ROOMS_UNAVAILABLE("rooms_unavailable") } class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: PostItineraryOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @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. @@ -102,22 +112,34 @@ data class PostItineraryOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): PostItineraryOperationParams { - validateNullity() - - return PostItineraryOperationParams( - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + PostItineraryOperationParams( + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: PostItineraryOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -127,11 +149,11 @@ data class PostItineraryOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -142,18 +164,15 @@ data class PostItineraryOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperation.kt index 5ca30b1488..0d6c3075b8 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperation.kt @@ -26,47 +26,42 @@ import com.expediagroup.sdk.rapid.models.PaymentSessionsRequest class PostPaymentSessionsOperation private constructor( params: PostPaymentSessionsOperationParams?, requestBody: PaymentSessionsRequest?, - link: PostPaymentSessionsOperationLink?, + link: PostPaymentSessionsOperationLink? ) : Operation< - PaymentSessionsRequest, + PaymentSessionsRequest >( url(null, link, "/v3/payment-sessions"), "POST", "postPaymentSessions", requestBody, - params, + params ) { - @Deprecated( - "Switch order of arguments", - ReplaceWith("Operation(params: PostPaymentSessionsOperationParams, requestBody: PaymentSessionsRequest?)"), - ) + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: PostPaymentSessionsOperationParams, requestBody: PaymentSessionsRequest?)")) constructor( requestBody: PaymentSessionsRequest?, - params: PostPaymentSessionsOperationParams, + params: PostPaymentSessionsOperationParams ) : this(params, requestBody) constructor( params: PostPaymentSessionsOperationParams, - requestBody: PaymentSessionsRequest?, + requestBody: PaymentSessionsRequest? ) : this( params, requestBody, - null, + null ) constructor( link: PostPaymentSessionsOperationLink, context: PostPaymentSessionsOperationContext, - requestBody: PaymentSessionsRequest?, + requestBody: PaymentSessionsRequest? ) : this( PostPaymentSessionsOperationParams(context), requestBody, - link, + link ) companion object : LinkableOperation { - override fun pathPattern(): String { - return "/v3/payment-sessions" - } + override fun pathPattern(): String = "/v3/payment-sessions" } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationContext.kt index 353d2594f5..acac2ee847 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationContext.kt @@ -29,7 +29,7 @@ data class PostPaymentSessionsOperationContext( val customerSessionId: kotlin.String? = null, val test: PostPaymentSessionsOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class PostPaymentSessionsOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: PostPaymentSessionsOperationParams.Test? = null, + @JsonProperty("Test") private var test: PostPaymentSessionsOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class PostPaymentSessionsOperationContext( return PostPaymentSessionsOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class PostPaymentSessionsOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class PostPaymentSessionsOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationLink.kt index 5cdda00d75..e30e661b49 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationLink.kt @@ -32,7 +32,7 @@ data class PostPaymentSessionsOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class PostPaymentSessionsOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): PostPaymentSessionsOperationLink { - return PostPaymentSessionsOperationLink( + fun build(): PostPaymentSessionsOperationLink = + PostPaymentSessionsOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationParams.kt index ceb46a907e..0ab2b08411 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostPaymentSessionsOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property 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. @@ -30,11 +35,16 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = PostPaymentSessionsOperationParams.Builder::class) data class PostPaymentSessionsOperationParams internal constructor( + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: PostPaymentSessionsOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -48,35 +58,35 @@ data class PostPaymentSessionsOperationParams null, test: PostPaymentSessionsOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( customerIp = customerIp, customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: PostPaymentSessionsOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - INTERNAL_SERVER_ERROR("internal_server_error"), + INTERNAL_SERVER_ERROR("internal_server_error") } class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: PostPaymentSessionsOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @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. @@ -99,22 +109,34 @@ data class PostPaymentSessionsOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): PostPaymentSessionsOperationParams { - validateNullity() - - return PostPaymentSessionsOperationParams( - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + PostPaymentSessionsOperationParams( + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: PostPaymentSessionsOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -124,11 +146,11 @@ data class PostPaymentSessionsOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -139,18 +161,15 @@ data class PostPaymentSessionsOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperation.kt index b4804df6d2..9efff5f2ea 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class PriceCheckOperation private constructor( params: PriceCheckOperationParams?, - link: PriceCheckOperationLink?, + link: PriceCheckOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/properties/{property_id}/rooms/{room_id}/rates/{rate_id}"), "GET", "priceCheck", null, - params, + params ) { constructor( - params: PriceCheckOperationParams, + params: PriceCheckOperationParams ) : this( params, - null, + null ) constructor( link: PriceCheckOperationLink, - context: PriceCheckOperationContext?, + context: PriceCheckOperationContext? ) : this( PriceCheckOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationContext.kt index fc77261590..7de9716e40 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationContext.kt @@ -30,7 +30,7 @@ data class PriceCheckOperationContext( val customerSessionId: kotlin.String? = null, val test: PriceCheckOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -40,7 +40,7 @@ data class PriceCheckOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: PriceCheckOperationParams.Test? = null, + @JsonProperty("Test") private var test: PriceCheckOperationParams.Test? = null ) { /** * @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. @@ -63,7 +63,7 @@ data class PriceCheckOperationContext( return PriceCheckOperationContext( customerIp = customerIp, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -71,8 +71,8 @@ data class PriceCheckOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp?.also { put("Customer-Ip", customerIp) } @@ -83,5 +83,4 @@ data class PriceCheckOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationLink.kt index d6aca101b6..bd69be4098 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationLink.kt @@ -32,7 +32,7 @@ data class PriceCheckOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class PriceCheckOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): PriceCheckOperationLink { - return PriceCheckOperationLink( + fun build(): PriceCheckOperationLink = + PriceCheckOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationParams.kt index 7347da9660..0451ce128d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PriceCheckOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property propertyId Expedia Property ID.
    @@ -33,14 +38,24 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = PriceCheckOperationParams.Builder::class) data class PriceCheckOperationParams internal constructor( + @field:NotNull + @field:Valid val propertyId: kotlin.String? = null, + @field:NotNull + @field:Valid val roomId: kotlin.String? = null, + @field:NotNull + @field:Valid val rateId: kotlin.String? = null, + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: PriceCheckOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -58,7 +73,7 @@ data class PriceCheckOperationParams null, test: PriceCheckOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( propertyId = propertyId, roomId = roomId, @@ -67,24 +82,24 @@ data class PriceCheckOperationParams customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: PriceCheckOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { AVAILABLE("available"), PRICE_CHANGED("price_changed"), SOLD_OUT("sold_out"), SERVICE_UNAVAILABLE("service_unavailable"), - UNKNOWN_INTERNAL_ERROR("unknown_internal_error"), + UNKNOWN_INTERNAL_ERROR("unknown_internal_error") } class Builder( @@ -94,7 +109,7 @@ data class PriceCheckOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: PriceCheckOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param propertyId Expedia Property ID.
    @@ -132,31 +147,37 @@ data class PriceCheckOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): PriceCheckOperationParams { - validateNullity() - - return PriceCheckOperationParams( - propertyId = propertyId!!, - roomId = roomId!!, - rateId = rateId!!, - customerIp = customerIp, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + PriceCheckOperationParams( + propertyId = propertyId!!, + roomId = roomId!!, + rateId = rateId!!, + customerIp = customerIp, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (propertyId == null) { - throw NullPointerException("Required parameter propertyId is missing") - } - if (roomId == null) { - throw NullPointerException("Required parameter roomId is missing") - } - if (rateId == null) { - throw NullPointerException("Required parameter rateId is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: PriceCheckOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -169,11 +190,11 @@ data class PriceCheckOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -185,18 +206,16 @@ data class PriceCheckOperationParams } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { propertyId?.also { put("property_id", propertyId) } @@ -207,5 +226,4 @@ data class PriceCheckOperationParams put("rate_id", rateId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperation.kt index ba49b86d62..62e133608b 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class PutCompletePaymentSessionOperation private constructor( params: PutCompletePaymentSessionOperationParams?, - link: PutCompletePaymentSessionOperationLink?, + link: PutCompletePaymentSessionOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/itineraries/{itinerary_id}/payment-sessions"), "PUT", "putCompletePaymentSession", null, - params, + params ) { constructor( - params: PutCompletePaymentSessionOperationParams, + params: PutCompletePaymentSessionOperationParams ) : this( params, - null, + null ) constructor( link: PutCompletePaymentSessionOperationLink, - context: PutCompletePaymentSessionOperationContext, + context: PutCompletePaymentSessionOperationContext ) : this( PutCompletePaymentSessionOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationContext.kt index 2c83190da8..2f0d936662 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationContext.kt @@ -29,7 +29,7 @@ data class PutCompletePaymentSessionOperationContext( val customerSessionId: kotlin.String? = null, val test: PutCompletePaymentSessionOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class PutCompletePaymentSessionOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: PutCompletePaymentSessionOperationParams.Test? = null, + @JsonProperty("Test") private var test: PutCompletePaymentSessionOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class PutCompletePaymentSessionOperationContext( return PutCompletePaymentSessionOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class PutCompletePaymentSessionOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class PutCompletePaymentSessionOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationLink.kt index 5504028718..c13410ba11 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationLink.kt @@ -32,7 +32,7 @@ data class PutCompletePaymentSessionOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class PutCompletePaymentSessionOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): PutCompletePaymentSessionOperationLink { - return PutCompletePaymentSessionOperationLink( + fun build(): PutCompletePaymentSessionOperationLink = + PutCompletePaymentSessionOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationParams.kt index e342bdeada..f4ad24a7a5 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutCompletePaymentSessionOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -31,12 +36,19 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = PutCompletePaymentSessionOperationParams.Builder::class) data class PutCompletePaymentSessionOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: PutCompletePaymentSessionOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -51,29 +63,29 @@ data class PutCompletePaymentSessionOperationParams null, test: PutCompletePaymentSessionOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( itineraryId = itineraryId, customerIp = customerIp, customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: PutCompletePaymentSessionOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - INTERNAL_SERVER_ERROR("internal_server_error"), + INTERNAL_SERVER_ERROR("internal_server_error") } class Builder( @@ -81,7 +93,7 @@ data class PutCompletePaymentSessionOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: PutCompletePaymentSessionOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -109,26 +121,35 @@ data class PutCompletePaymentSessionOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): PutCompletePaymentSessionOperationParams { - validateNullity() - - return PutCompletePaymentSessionOperationParams( - itineraryId = itineraryId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + PutCompletePaymentSessionOperationParams( + itineraryId = itineraryId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: PutCompletePaymentSessionOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -139,11 +160,11 @@ data class PutCompletePaymentSessionOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -155,21 +176,18 @@ data class PutCompletePaymentSessionOperationParams } append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperation.kt index 9de9541010..b712ef0b6d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperation.kt @@ -25,29 +25,29 @@ import org.apache.commons.text.StringSubstitutor */ class PutResumeBookingOperation private constructor( params: PutResumeBookingOperationParams?, - link: PutResumeBookingOperationLink?, + link: PutResumeBookingOperationLink? ) : Operation< - Nothing, + Nothing >( url(params, link, "/v3/itineraries/{itinerary_id}"), "PUT", "putResumeBooking", null, - params, + params ) { constructor( - params: PutResumeBookingOperationParams, + params: PutResumeBookingOperationParams ) : this( params, - null, + null ) constructor( link: PutResumeBookingOperationLink, - context: PutResumeBookingOperationContext, + context: PutResumeBookingOperationContext ) : this( PutResumeBookingOperationParams(context), - link, + link ) companion object : LinkableOperation { diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationContext.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationContext.kt index 5554f5add3..9bc157bbbc 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationContext.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationContext.kt @@ -29,7 +29,7 @@ data class PutResumeBookingOperationContext( val customerSessionId: kotlin.String? = null, val test: PutResumeBookingOperationParams.Test? = - null, + null ) { companion object { @JvmStatic @@ -39,7 +39,7 @@ data class PutResumeBookingOperationContext( class Builder( @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, - @JsonProperty("Test") private var test: PutResumeBookingOperationParams.Test? = null, + @JsonProperty("Test") private var test: PutResumeBookingOperationParams.Test? = null ) { /** * @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. @@ -62,7 +62,7 @@ data class PutResumeBookingOperationContext( return PutResumeBookingOperationContext( customerIp = customerIp!!, customerSessionId = customerSessionId, - test = test, + test = test ) } @@ -73,8 +73,8 @@ data class PutResumeBookingOperationContext( } } - fun getHeaders(): Map { - return buildMap { + fun getHeaders(): Map = + buildMap { customerIp.also { put("Customer-Ip", customerIp) } @@ -85,5 +85,4 @@ data class PutResumeBookingOperationContext( put("Test", test.value) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationLink.kt index 5cb9eb04fe..6728361c14 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationLink.kt @@ -32,7 +32,7 @@ data class PutResumeBookingOperationLink( // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. @JsonProperty("expires") @field:Valid - override val expires: kotlin.String? = null, + override val expires: kotlin.String? = null ) : Link(method, href, expires) { companion object { @JvmStatic @@ -42,14 +42,13 @@ data class PutResumeBookingOperationLink( class Builder( private var method: kotlin.String? = null, private var href: kotlin.String? = null, - private var expires: kotlin.String? = null, + private var expires: kotlin.String? = null ) { - fun build(): PutResumeBookingOperationLink { - return PutResumeBookingOperationLink( + fun build(): PutResumeBookingOperationLink = + PutResumeBookingOperationLink( method = method, href = href, - expires = expires, + expires = expires ) - } } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationParams.kt index b4811c2d34..9fa3fa241d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PutResumeBookingOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -31,12 +36,19 @@ import io.ktor.http.Parameters @JsonDeserialize(builder = PutResumeBookingOperationParams.Builder::class) data class PutResumeBookingOperationParams internal constructor( + @field:NotNull + @field:Valid val itineraryId: kotlin.String? = null, + @field:NotNull + @field:Valid val customerIp: kotlin.String? = null, + @field:Valid val customerSessionId: kotlin.String? = null, val test: PutResumeBookingOperationParams.Test? = null, + @field:NotNull + @field:Valid val token: kotlin.String? = null, - private val dummy: Unit, + private val dummy: Unit ) : OperationParams { companion object { @@ -51,29 +63,29 @@ data class PutResumeBookingOperationParams null, test: PutResumeBookingOperationParams.Test? = null, - token: kotlin.String, + token: kotlin.String ) : this( itineraryId = itineraryId, customerIp = customerIp, customerSessionId = customerSessionId, test = test, token = token, - dummy = Unit, + dummy = Unit ) constructor(context: PutResumeBookingOperationContext?) : this( customerIp = context?.customerIp, customerSessionId = context?.customerSessionId, test = context?.test, - dummy = Unit, + dummy = Unit ) enum class Test( - val value: kotlin.String, + val value: kotlin.String ) { STANDARD("standard"), SERVICE_UNAVAILABLE("service_unavailable"), - INTERNAL_SERVER_ERROR("internal_server_error"), + INTERNAL_SERVER_ERROR("internal_server_error") } class Builder( @@ -81,7 +93,7 @@ data class PutResumeBookingOperationParams @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, @JsonProperty("Test") private var test: PutResumeBookingOperationParams.Test? = null, - @JsonProperty("token") private var token: kotlin.String? = null, + @JsonProperty("token") private var token: kotlin.String? = null ) { /** * @param itineraryId This parameter is used only to prefix the token value - no ID value is used.
    @@ -109,26 +121,35 @@ data class PutResumeBookingOperationParams fun token(token: kotlin.String) = apply { this.token = token } fun build(): PutResumeBookingOperationParams { - validateNullity() - - return PutResumeBookingOperationParams( - itineraryId = itineraryId!!, - customerIp = customerIp!!, - customerSessionId = customerSessionId, - test = test, - token = token!!, - ) + val params = + PutResumeBookingOperationParams( + itineraryId = itineraryId!!, + customerIp = customerIp!!, + customerSessionId = customerSessionId, + test = test, + token = token!! + ) + + validate(params) + + return params } - private fun validateNullity() { - if (itineraryId == null) { - throw NullPointerException("Required parameter itineraryId is missing") - } - if (customerIp == null) { - throw NullPointerException("Required parameter customerIp is missing") - } - if (token == null) { - throw NullPointerException("Required parameter token is missing") + private fun validate(params: PutResumeBookingOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -139,11 +160,11 @@ data class PutResumeBookingOperationParams customerIp = customerIp, customerSessionId = customerSessionId, test = test, - token = token, + token = token ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { customerIp?.let { append("Customer-Ip", it) } @@ -154,21 +175,18 @@ data class PutResumeBookingOperationParams append("Test", it.value) } } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { token?.let { append("token", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { itineraryId?.also { put("itinerary_id", itineraryId) } } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperation.kt index b63e89a2ff..b0b9622a28 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperation.kt @@ -25,22 +25,19 @@ import com.expediagroup.sdk.rapid.models.TestNotificationRequest */ class RequestTestNotificationOperation( params: RequestTestNotificationOperationParams, - requestBody: TestNotificationRequest?, + requestBody: TestNotificationRequest? ) : Operation< - TestNotificationRequest, + TestNotificationRequest >( "/v3/notifications", "POST", "requestTestNotification", requestBody, - params, + params ) { - @Deprecated( - "Switch order of arguments", - ReplaceWith("Operation(params: RequestTestNotificationOperationParams, requestBody: TestNotificationRequest?)"), - ) + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: RequestTestNotificationOperationParams, requestBody: TestNotificationRequest?)")) constructor( requestBody: TestNotificationRequest?, - params: RequestTestNotificationOperationParams, + params: RequestTestNotificationOperationParams ) : this(params, requestBody) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationParams.kt index 010cb20621..1ed514b3c8 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationParams.kt @@ -16,10 +16,14 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation /** * @property 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. @@ -29,14 +33,18 @@ import io.ktor.http.Parameters */ @JsonDeserialize(builder = RequestTestNotificationOperationParams.Builder::class) data class RequestTestNotificationOperationParams( + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = - null, + null ) : OperationParams { companion object { @@ -48,7 +56,7 @@ data class RequestTestNotificationOperationParams( @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @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. @@ -71,17 +79,35 @@ data class RequestTestNotificationOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): RequestTestNotificationOperationParams { - validateNullity() - - return RequestTestNotificationOperationParams( - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - ) + val params = + RequestTestNotificationOperationParams( + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { + private fun validate(params: RequestTestNotificationOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) + } } } @@ -90,16 +116,15 @@ data class RequestTestNotificationOperationParams( billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { billingTerms?.let { append("billing_terms", it) } @@ -113,10 +138,8 @@ data class RequestTestNotificationOperationParams( append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperation.kt index 885eddb600..e8b1d88020 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperation.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperation.kt @@ -23,13 +23,13 @@ import com.expediagroup.sdk.core.model.Operation * @property params [RequestUndeliveredNotificationsOperationParams] */ class RequestUndeliveredNotificationsOperation( - params: RequestUndeliveredNotificationsOperationParams, + params: RequestUndeliveredNotificationsOperationParams ) : Operation< - Nothing, + Nothing >( "/v3/notifications", "GET", "requestUndeliveredNotifications", null, - params, + params ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationLink.kt index fe0e79fd73..dfd4edb11d 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationLink.kt @@ -13,3 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationParams.kt index fae289078c..28e8a23d74 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationParams.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationParams.kt @@ -16,10 +16,15 @@ package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull /** * @property undeliverable Undeliverable notifications are returned when this parameter is set to `true`. @@ -30,15 +35,21 @@ import io.ktor.http.Parameters */ @JsonDeserialize(builder = RequestUndeliveredNotificationsOperationParams.Builder::class) data class RequestUndeliveredNotificationsOperationParams( + @field:NotNull + @field:Valid val undeliverable: kotlin.Boolean, + @field:Valid val billingTerms: kotlin.String? = null, + @field:Valid val partnerPointOfSale: kotlin.String? = null, + @field:Valid val paymentTerms: kotlin.String? = null, + @field:Valid val platformName: kotlin.String? = - null, + null ) : OperationParams { companion object { @@ -51,7 +62,7 @@ data class RequestUndeliveredNotificationsOperationParams( @JsonProperty("billing_terms") private var billingTerms: kotlin.String? = null, @JsonProperty("partner_point_of_sale") private var partnerPointOfSale: kotlin.String? = null, @JsonProperty("payment_terms") private var paymentTerms: kotlin.String? = null, - @JsonProperty("platform_name") private var platformName: kotlin.String? = null, + @JsonProperty("platform_name") private var platformName: kotlin.String? = null ) { /** * @param undeliverable Undeliverable notifications are returned when this parameter is set to `true`. @@ -79,20 +90,35 @@ data class RequestUndeliveredNotificationsOperationParams( fun platformName(platformName: kotlin.String) = apply { this.platformName = platformName } fun build(): RequestUndeliveredNotificationsOperationParams { - validateNullity() - - return RequestUndeliveredNotificationsOperationParams( - undeliverable = undeliverable!!, - billingTerms = billingTerms, - partnerPointOfSale = partnerPointOfSale, - paymentTerms = paymentTerms, - platformName = platformName, - ) + val params = + RequestUndeliveredNotificationsOperationParams( + undeliverable = undeliverable!!, + billingTerms = billingTerms, + partnerPointOfSale = partnerPointOfSale, + paymentTerms = paymentTerms, + platformName = platformName + ) + + validate(params) + + return params } - private fun validateNullity() { - if (undeliverable == null) { - throw NullPointerException("Required parameter undeliverable is missing") + private fun validate(params: RequestUndeliveredNotificationsOperationParams) { + val validator = + Validation + .byDefaultProvider() + .configure() + .messageInterpolator(ParameterMessageInterpolator()) + .buildValidatorFactory() + .validator + + val violations = validator.validate(params) + + if (violations.isNotEmpty()) { + throw PropertyConstraintViolationException( + constraintViolations = violations.map { "${it.propertyPath}: ${it.message}" } + ) } } } @@ -103,17 +129,16 @@ data class RequestUndeliveredNotificationsOperationParams( billingTerms = billingTerms, partnerPointOfSale = partnerPointOfSale, paymentTerms = paymentTerms, - platformName = platformName, + platformName = platformName ) - override fun getHeaders(): Headers { - return Headers.build { + override fun getHeaders(): Headers = + Headers.build { append("Accept", "application/json") } - } - override fun getQueryParams(): Parameters { - return Parameters.build { + override fun getQueryParams(): Parameters = + Parameters.build { undeliverable?.let { append("undeliverable", it.toString()) } @@ -130,10 +155,8 @@ data class RequestUndeliveredNotificationsOperationParams( append("platform_name", it) } } - } - override fun getPathParams(): Map { - return buildMap { + override fun getPathParams(): Map = + buildMap { } - } } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/validation/PropertyConstraintsValidator.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/validation/PropertyConstraintsValidator.kt deleted file mode 100644 index cf33c2d9ab..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/validation/PropertyConstraintsValidator.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2022 Expedia, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * 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.validation - -import com.expediagroup.sdk.rapid.models.exception.PropertyConstraintViolation -import com.expediagroup.sdk.rapid.models.exception.PropertyConstraintViolationException -import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator -import java.util.stream.Collectors -import javax.validation.ConstraintViolation -import javax.validation.Validation - -internal object PropertyConstraintsValidator { - fun validateConstraints(obj: Any?) { - obj?.let { - Validation.byDefaultProvider() - .configure() - .messageInterpolator(ParameterMessageInterpolator()) - .buildValidatorFactory().use { factory -> - val violations = factory.validator.validate(obj) - if (violations.isNotEmpty()) { - throw PropertyConstraintViolationException( - "Some field constraints have been violated", - violations.stream().map { toConstraintViolation(it) }.collect(Collectors.toList()), - ) - } - } - } - } - - private fun toConstraintViolation(violation: ConstraintViolation<*>): PropertyConstraintViolation { - return PropertyConstraintViolation( - violation.propertyPath.iterator().next().name, - violation.propertyPath.toString(), - violation.message, - ) - } -} diff --git a/code/transformedSpecs.yaml b/code/transformedSpecs.yaml index 8bf37be9b6..8059a60935 100644 --- a/code/transformedSpecs.yaml +++ b/code/transformedSpecs.yaml @@ -65,11 +65,11 @@ paths: language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. - See [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) +

    Reference: -
    + * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) - Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) required: true schema: type: string @@ -257,9 +257,9 @@ paths: The ID of the chain you want to search for. These chain IDs can be positive and negative numbers. This - parameter can be supplied multiple times with different values, which will include properties that match any + parameter can be supplied multiple times with different values, which will include properties that match - of the requested chain IDs. + any of the requested chain IDs. schema: type: array items: @@ -279,9 +279,9 @@ paths: Search for properties with the requested country code, in ISO 3166-1 alpha-2 format. This parameter can be - supplied multiple times with different values, which will include properties that match any of the requested + supplied multiple times with different values, which will include properties that match any of the - country codes. + requested country codes. schema: type: array items: @@ -414,6 +414,8 @@ paths: value: - 1337 - 1 + Optional: + ? value - name: property_rating_max in: query description: > @@ -468,18 +470,18 @@ paths: in: query description: > This parameter is to specify the terms of how a resulting booking - should be billed. If this field is needed, + should be billed. If this field is - the value for this will be provided to you separately. + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > This parameter is to specify what point of sale is being used to - shop and book. If this field is needed, the + shop and book. If this field is needed, - value for this will be provided to you separately. + the value for this will be provided to you separately. schema: type: string - name: payment_terms @@ -903,6 +905,7 @@ paths: multi_unit: true payment_registration_recommended: false supply_source: expedia + registry_number: Property Registration Number 1234567890 Single Property VRBO Example: value: "4687248": @@ -1080,6 +1083,7 @@ paths: multi_unit: false payment_registration_recommended: false vacation_rental_details: + registry_number: Property Registration Number 1234567890 private_host: true property_manager: name: Scott Horton @@ -1207,6 +1211,7 @@ paths: equipped with 4 twin size beds. This home is not handicapped accessible!!!" supply_source: Vrbo + registry_number: Property Registration Number 1234567890 spoken_languages: en: id: en @@ -1547,6 +1552,7 @@ paths: multi_unit: true payment_registration_recommended: false supply_source: expedia + registry_number: Property Registration Number 1234567890 "67890": property_id: "67890" name: Test Property Name 2 @@ -1877,6 +1883,7 @@ paths: multi_unit: true payment_registration_recommended: true supply_source: expedia + registry_number: Property Registration Number 1234567890 "Multiple Properties With include name, and ratings": value: "12345": @@ -2209,13 +2216,15 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. Continue to pass the same + the first API call. Continue to pass the - value for each subsequent API call during the user's session, using a new value for every new customer session.
    + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Including this value greatly eases EPS's internal debugging process for issues with partner requests, + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: since @@ -2227,7 +2236,11 @@ paths: The earliest date that a property became inactive to include in the results. ISO 8601 format (YYYY-MM-DD) schema: type: string - example: 2023-05-01 + examples: + Initial: + value: 2023-09-20 + Paging: + ? value - name: token in: query description: > @@ -2235,32 +2248,31 @@ paths: `next` URL in the `Link` response header. schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m - name: billing_terms in: query description: > This parameter is to specify the terms of how a resulting booking - should be billed. If this field is needed, + should be billed. If this field is - the value for this will be provided to you separately. + needed, the value for this will be provided to you separately. schema: type: string - - name: payment_terms + - name: partner_point_of_sale in: query description: > - This parameter is to specify what terms should be used when being - paid for a resulting booking. If this + This parameter is to specify what point of sale is being used to + shop and book. If this field is needed, - field is needed, the value for this will be provided to you separately. + the value for this will be provided to you separately. schema: type: string - - name: partner_point_of_sale + - name: payment_terms in: query description: > - This parameter is to specify what point of sale is being used to - shop and book. If this field is needed, + This parameter is to specify what terms should be used when being + paid for a resulting booking. If this - the value for this will be provided to you separately. + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name @@ -2592,36 +2604,45 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + same value for each subsequent API call during the user's session, using a new value for every new customer - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. - schema: - type: string - - name: property_id - in: path - description: | - Expedia Property ID.
    - required: true + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it + + explicitly links together request paths for individual user's session. schema: type: string - example: "12345" - name: language in: query description: > Desired language for the response as a subset of BCP47 format that - only uses hyphenated pairs of two-digit language and country codes. - Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 - country codes. See - [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) + only uses hyphenated pairs of two-digit + + language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. +

    Reference: - Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) + + * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) required: true schema: type: string - example: en-US + examples: + English: + value: en-US + Japanese: + value: ja-JP + - name: property_id + in: path + description: Expedia Property ID. + required: true + schema: + type: string + example: 12345 - name: filter in: query description: > @@ -2674,32 +2695,36 @@ paths: in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - - name: payment_terms + - name: partner_point_of_sale in: query description: > - 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. + 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. schema: type: string - - name: partner_point_of_sale + - name: payment_terms in: query description: > - 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. + 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. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -3071,11 +3096,15 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: language @@ -3101,41 +3130,52 @@ paths: return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. - * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their + profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) + + for more information. required: true schema: type: string - example: vrbo + examples: + Standard: + value: expedia + VRBO: + value: vrbo - name: billing_terms in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - - name: payment_terms + - name: partner_point_of_sale in: query description: > - 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. + 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. schema: type: string - - name: partner_point_of_sale + - name: payment_terms in: query description: > - 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. + 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. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -3459,8 +3499,8 @@ paths:
    Example of a JSONL file with 2 properties: ``` - {"property_id":"12345","name":"Test Property Name","address":{"line_1":"123 Main St","line_2":"Apt A","city":"Springfield","state_province_code":"MO","state_province_name":"Missouri","postal_code":"65804","country_code":"US","obfuscation_required":false,"localized":{"links":{"es-ES":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345"},"fr-FR":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345"}}}},"ratings":{"property":{"rating":"3.5","type":"Star"},"guest":{"count":48382,"overall":"3.1","cleanliness":"4.2","service":"1.1","comfort":"4.3","condition":"1.6","location":"4.0","neighborhood":"3.4","quality":"3.4","value":"2.2","amenities":"1.4","recommendation_percent":"73%"}},"location":{"coordinates":{"latitude":37.15845,"longitude":-93.26838}},"phone":"1-417-862-0153","fax":"1-417-863-7249","category":{"id":"1","name":"Hotel"},"rank":42,"business_model":{"expedia_collect":true,"property_collect":false},"checkin":{"24_hour":"24-hour check-in","begin_time":"3:00 PM","end_time":"11:00 PM","instructions":"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />","special_instructions":"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.","min_age":18},"checkout":{"time":"11:00 AM"},"fees":{"mandatory":"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    ","optional":"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • "},"policies":{"know_before_you_go":"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • "},"attributes":{"general":{"2549":{"id":"2549","name":"No elevators"},"3357":{"id":"3357","name":"Caters to adults only"}},"pets":{"51":{"id":"51","name":"Pets allowed"},"2809":{"id":"2809","name":"Dogs only"},"3321":{"id":"3321","name":"Pet maximum weight in kg is - 24","value":24}}},"amenities":{"9":{"id":"9","name":"Fitness facilities"},"2820":{"id":"2820","name":"Number of indoor pools - 10","value":10}},"images":[{"caption":"Featured Image","hero_image":true,"category":3,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}}}],"onsite_payments":{"currency":"USD","types":{"171":{"id":"171","name":"American Express"}}},"rooms":{"224829":{"id":"224829","name":"Single Room","descriptions":{"overview":"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    "},"amenities":{"130":{"id":"130","name":"Refrigerator"},"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"}},"images":[{"hero_image":true,"category":21001,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}},"caption":"Guestroom"}],"bed_groups":{"37321":{"id":"37321","description":"1 King Bed","configuration":[{"type":"KingBed","size":"King","quantity":1}]}},"area":{"square_meters":20,"square_feet":215},"views":{"4146":{"id":"4146","name":"Courtyard view"}},"occupancy":{"max_allowed":{"total":5,"children":2,"adults":4},"age_categories":{"Adult":{"name":"Adult","minimum_age":9}}}}},"rates":{"333abc":{"id":"333abc","amenities":{"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"},"2104":{"id":"2104","name":"Full Breakfast"}},"special_offer_description":"Breakfast for 2 - Rate includes the following:\r\n
    • Accommodations as selected
    • \r\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \r\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\r\n"}},"dates":{"added":"1998-07-19T05:00:00.000Z","updated":"2018-03-22T07:23:14.000Z"},"descriptions":{"amenities":"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.","dining":"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.","renovations":"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    ","national_ratings":"For the benefit of our customers, we have provided a rating based on our rating system.","business_amenities":"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.","rooms":"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.","attractions":"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    ","location":"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.","headline":"Near National Museum of Natural Science","general":"General description"},"statistics":{"52":{"id":"52","name":"Total number of rooms - 820","value":"820"},"54":{"id":"54","name":"Number of floors - 38","value":"38"}},"airports":{"preferred":{"iata_airport_code":"SGF"}},"themes":{"2337":{"id":"2337","name":"Luxury Hotel"},"2341":{"id":"2341","name":"Spa Hotel"}},"all_inclusive":{"all_rate_plans":true,"some_rate_plans":false,"details":"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    "},"tax_id":"AB-012-987-1234-01","chain":{"id":"-6","name":"Hyatt Hotels"},"brand":{"id":"2209","name":"Hyatt Place"},"spoken_languages":{"vi":{"id":"vi","name":"Vietnamese"}},"multi_unit":true,"payment_registration_recommended":false,"vacation_rental_details": {"registry_number": "Property Registration Number 123456","private_host": "true","property_manager": {"name": "Victor","links": {"image": {"method": "GET","href": "https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg"}}},"rental_agreement": {"links": {"rental_agreement": {"method": "GET","href": "https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf"}}},"house_rules": ["Children welcome","No pets","No smoking","No parties or events"],"amenities": {"4296": {"id": "4296","name": "Furnished balcony or patio"},"2859": {"id": "2859","name": "Private pool"}},"vrbo_srp_id": "123.1234567.5678910","listing_id": "1234567","listing_number": "5678910","listing_source": "HOMEAWAY_US","listing_unit": "/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60"},"supply_source":"vrbo"} - {"property_id":"67890","name":"Test Property Name 2","address":{"line_1":"123 Main St","line_2":"Apt A","city":"Springfield","state_province_code":"MO","state_province_name":"Missouri","postal_code":"65804","country_code":"US","obfuscation_required":true,"localized":{"links":{"es-ES":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890"},"de-DE":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890"}}}},"ratings":{"property":{"rating":"3.5","type":"Star"},"guest":{"count":7651,"overall":"4.3","cleanliness":"4.2","service":"1.1","comfort":"4.3","condition":"1.6","location":"4.0","neighborhood":"3.4","quality":"3.4","value":"2.2","amenities":"1.4","recommendation_percent":"80%"}},"location":{"coordinates":{"latitude":37.15845,"longitude":-93.26838},"obfuscated_coordinates":{"latitude":28.339303,"longitude":-81.47791},"obfuscation_required":true},"phone":"1-417-862-0153","fax":"1-417-863-7249","category":{"id":"1","name":"Hotel"},"rank":42,"business_model":{"expedia_collect":true,"property_collect":true},"checkin":{"24_hour":"24-hour check-in","begin_time":"3:00 PM","end_time":"11:00 PM","instructions":"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />","special_instructions":"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.","min_age":18},"checkout":{"time":"11:00 AM"},"fees":{"mandatory":"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    ","optional":"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • "},"policies":{"know_before_you_go":"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • "},"attributes":{"general":{"2549":{"id":"2549","name":"No elevators"},"3357":{"id":"3357","name":"Caters to adults only"}},"pets":{"51":{"id":"51","name":"Pets allowed"},"2809":{"id":"2809","name":"Dogs only"},"3321":{"id":"3321","name":"Pet maximum weight in kg is - 24","value":24}}},"amenities":{"9":{"id":"9","name":"Fitness facilities"},"2820":{"id":"2820","name":"Number of indoor pools - 10","value":10}},"images":[{"caption":"Featured Image","hero_image":true,"category":3,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}}}],"onsite_payments":{"currency":"USD","types":{"171":{"id":"171","name":"American Express"}}},"rooms":{"224829":{"id":"224829","name":"Single Room","descriptions":{"overview":"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    "},"amenities":{"130":{"id":"130","name":"Refrigerator"},"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"}},"images":[{"hero_image":true,"category":21001,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}},"caption":"Guestroom"}],"bed_groups":{"37321":{"id":"37321","description":"1 King Bed","configuration":[{"type":"KingBed","size":"King","quantity":1}]}},"area":{"square_meters":17},"views":{"4134":{"id":"4134","name":"City view"}},"occupancy":{"max_allowed":{"total":3,"children":2,"adults":3},"age_categories":{"ChildAgeA":{"name":"ChildAgeA","minimum_age":3}}}}},"rates":{"333abc":{"id":"333abc","amenities":{"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"},"2104":{"id":"2104","name":"Full Breakfast"}},"special_offer_description":"Breakfast for 2 - Rate includes the following:\r\n
    • Accommodations as selected
    • \r\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \r\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\r\n"}},"dates":{"added":"1998-07-20T05:00:00.000Z","updated":"2018-03-22T13:33:17.000Z"},"descriptions":{"amenities":"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.","dining":"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.","renovations":"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    ","national_ratings":"For the benefit of our customers, we have provided a rating based on our rating system.","business_amenities":"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.","rooms":"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.","attractions":"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    ","location":"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.","headline":"Near National Museum of Natural Science","general":"General description"},"statistics":{"52":{"id":"52","name":"Total number of rooms - 820","value":"820"},"54":{"id":"54","name":"Number of floors - 38","value":"38"}},"airports":{"preferred":{"iata_airport_code":"SGF"}},"themes":{"2337":{"id":"2337","name":"Luxury Hotel"},"2341":{"id":"2341","name":"Spa Hotel"}},"all_inclusive":{"all_rate_plans":true,"some_rate_plans":false,"details":"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    "},"tax_id":"CD-012-987-1234-02","chain":{"id":"-5","name":"Hilton Worldwide"},"brand":{"id":"358","name":"Hampton Inn"},"spoken_languages":{"en":{"id":"en","name":"English"}},"multi_unit":true,"payment_registration_recommended":true,"vacation_rental_details":{"registry_number":"Property Registration Number 123456","private_host":"true","property_manager":{"name":"John Smith","links":{"image":{"method":"GET","href":"https://example.com/profile.jpg"}}},"rental_agreement":{"links":{"rental_agreement":{"method":"GET","href":"https:/example.com/rentalconditions.pdf"}}},"house_rules":["Children welcome","No pets","No smoking","No parties or events"],"amenities":{"2859":{"id":"2859","name":"Private pool"},"4296":{"id":"4296","name":"Furnished balcony or patio"}},"vrbo_srp_id":"123.1234567.5678910","listing_id":"1234567","listing_number":"5678910","listing_source":"HOMEAWAY_US","listing_unit":"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60"},"supply_source":"vrbo"} + {"property_id":"12345","name":"Test Property Name","address":{"line_1":"123 Main St","line_2":"Apt A","city":"Springfield","state_province_code":"MO","state_province_name":"Missouri","postal_code":"65804","country_code":"US","obfuscation_required":false,"localized":{"links":{"es-ES":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=12345"},"fr-FR":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=fr-FR&include=address&property_id=12345"}}}},"ratings":{"property":{"rating":"3.5","type":"Star"},"guest":{"count":48382,"overall":"3.1","cleanliness":"4.2","service":"1.1","comfort":"4.3","condition":"1.6","location":"4.0","neighborhood":"3.4","quality":"3.4","value":"2.2","amenities":"1.4","recommendation_percent":"73%"}},"location":{"coordinates":{"latitude":37.15845,"longitude":-93.26838}},"phone":"1-417-862-0153","fax":"1-417-863-7249","category":{"id":"1","name":"Hotel"},"rank":42,"business_model":{"expedia_collect":true,"property_collect":false},"checkin":{"24_hour":"24-hour check-in","begin_time":"3:00 PM","end_time":"11:00 PM","instructions":"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />","special_instructions":"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.","min_age":18},"checkout":{"time":"11:00 AM"},"fees":{"mandatory":"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    ","optional":"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • "},"policies":{"know_before_you_go":"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • "},"attributes":{"general":{"2549":{"id":"2549","name":"No elevators"},"3357":{"id":"3357","name":"Caters to adults only"}},"pets":{"51":{"id":"51","name":"Pets allowed"},"2809":{"id":"2809","name":"Dogs only"},"3321":{"id":"3321","name":"Pet maximum weight in kg is - 24","value":24}}},"amenities":{"9":{"id":"9","name":"Fitness facilities"},"2820":{"id":"2820","name":"Number of indoor pools - 10","value":10}},"images":[{"caption":"Featured Image","hero_image":true,"category":3,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}}}],"onsite_payments":{"currency":"USD","types":{"171":{"id":"171","name":"American Express"}}},"rooms":{"224829":{"id":"224829","name":"Single Room","descriptions":{"overview":"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    "},"amenities":{"130":{"id":"130","name":"Refrigerator"},"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"}},"images":[{"hero_image":true,"category":21001,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}},"caption":"Guestroom"}],"bed_groups":{"37321":{"id":"37321","description":"1 King Bed","configuration":[{"type":"KingBed","size":"King","quantity":1}]}},"area":{"square_meters":20,"square_feet":215},"views":{"4146":{"id":"4146","name":"Courtyard view"}},"occupancy":{"max_allowed":{"total":5,"children":2,"adults":4},"age_categories":{"Adult":{"name":"Adult","minimum_age":9}}}}},"rates":{"333abc":{"id":"333abc","amenities":{"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"},"2104":{"id":"2104","name":"Full Breakfast"}},"special_offer_description":"Breakfast for 2 - Rate includes the following:\r\n
    • Accommodations as selected
    • \r\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \r\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\r\n"}},"dates":{"added":"1998-07-19T05:00:00.000Z","updated":"2018-03-22T07:23:14.000Z"},"descriptions":{"amenities":"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.","dining":"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.","renovations":"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    ","national_ratings":"For the benefit of our customers, we have provided a rating based on our rating system.","business_amenities":"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.","rooms":"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.","attractions":"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    ","location":"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.","headline":"Near National Museum of Natural Science","general":"General description"},"statistics":{"52":{"id":"52","name":"Total number of rooms - 820","value":"820"},"54":{"id":"54","name":"Number of floors - 38","value":"38"}},"airports":{"preferred":{"iata_airport_code":"SGF"}},"themes":{"2337":{"id":"2337","name":"Luxury Hotel"},"2341":{"id":"2341","name":"Spa Hotel"}},"all_inclusive":{"all_rate_plans":true,"some_rate_plans":false,"details":"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    "},"tax_id":"AB-012-987-1234-01","chain":{"id":"-6","name":"Hyatt Hotels"},"brand":{"id":"2209","name":"Hyatt Place"},"spoken_languages":{"vi":{"id":"vi","name":"Vietnamese"}},"multi_unit":true,"payment_registration_recommended":false,"vacation_rental_details": {"registry_number": "Property Registration Number 123456","private_host": "true","property_manager": {"name": "Victor","links": {"image": {"method": "GET","href": "https://test-image/test/test/836f1097-fbcf-43b5-bc02-c8ff6658cb90.c1.jpg"}}},"rental_agreement": {"links": {"rental_agreement": {"method": "GET","href": "https://test-link.test.amazonaws.com/rentalconditions_property_d65e7eb5-4a7c-4a80-a8a3-171999f9f444.pdf"}}},"house_rules": ["Children welcome","No pets","No smoking","No parties or events"],"amenities": {"4296": {"id": "4296","name": "Furnished balcony or patio"},"2859": {"id": "2859","name": "Private pool"}},"vrbo_srp_id": "123.1234567.5678910","listing_id": "1234567","listing_number": "5678910","listing_source": "HOMEAWAY_US","listing_unit": "/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60"},"supply_source":"vrbo","registry_number":"Property Registration Number 123456"} + {"property_id":"67890","name":"Test Property Name 2","address":{"line_1":"123 Main St","line_2":"Apt A","city":"Springfield","state_province_code":"MO","state_province_name":"Missouri","postal_code":"65804","country_code":"US","obfuscation_required":true,"localized":{"links":{"es-ES":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=es-ES&include=address&property_id=67890"},"de-DE":{"method":"GET","href":"https://api.ean.com/v3/properties/content?language=de-DE&include=address&property_id=67890"}}}},"ratings":{"property":{"rating":"3.5","type":"Star"},"guest":{"count":7651,"overall":"4.3","cleanliness":"4.2","service":"1.1","comfort":"4.3","condition":"1.6","location":"4.0","neighborhood":"3.4","quality":"3.4","value":"2.2","amenities":"1.4","recommendation_percent":"80%"}},"location":{"coordinates":{"latitude":37.15845,"longitude":-93.26838},"obfuscated_coordinates":{"latitude":28.339303,"longitude":-81.47791},"obfuscation_required":true},"phone":"1-417-862-0153","fax":"1-417-863-7249","category":{"id":"1","name":"Hotel"},"rank":42,"business_model":{"expedia_collect":true,"property_collect":true},"checkin":{"24_hour":"24-hour check-in","begin_time":"3:00 PM","end_time":"11:00 PM","instructions":"Extra-person charges may apply and vary depending on hotel policy. <br />Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. <br />Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. <br />","special_instructions":"There is no front desk at this property. To make arrangements for check-in please contact the property ahead of time using the information on the booking confirmation.","min_age":18},"checkout":{"time":"11:00 AM"},"fees":{"mandatory":"

    You'll be asked to pay the following charges at the hotel:

    • Deposit: USD 50 per day
    • Resort fee: USD 29.12 per accommodation, per night
    The hotel resort fee includes:
    • Fitness center access
    • Internet access
    • Phone calls
    • Additional inclusions

    We have included all charges provided to us by the property. However, charges can vary, for example, based on length of stay or the room you book.

    ","optional":"Fee for in-room wireless Internet: USD 15 per hour (rates may vary)
  • Airport shuttle fee: USD 350 per vehicle (one way)
  • Rollaway bed fee: USD 175 per night
  • "},"policies":{"know_before_you_go":"Reservations are required for massage services and spa treatments. Reservations can be made by contacting the hotel prior to arrival, using the contact information on the booking confirmation.
  • Children 11 years old and younger stay free when occupying the parent or guardian's room, using existing bedding.
  • Only registered guests are allowed in the guestrooms.
  • Some facilities may have restricted access. Guests can contact the property for details using the contact information on the booking confirmation.
  • "},"attributes":{"general":{"2549":{"id":"2549","name":"No elevators"},"3357":{"id":"3357","name":"Caters to adults only"}},"pets":{"51":{"id":"51","name":"Pets allowed"},"2809":{"id":"2809","name":"Dogs only"},"3321":{"id":"3321","name":"Pet maximum weight in kg is - 24","value":24}}},"amenities":{"9":{"id":"9","name":"Fitness facilities"},"2820":{"id":"2820","name":"Number of indoor pools - 10","value":10}},"images":[{"caption":"Featured Image","hero_image":true,"category":3,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}}}],"onsite_payments":{"currency":"USD","types":{"171":{"id":"171","name":"American Express"}}},"rooms":{"224829":{"id":"224829","name":"Single Room","descriptions":{"overview":"2 Twin Beds
    269-sq-foot (25-sq-meter) room with mountain views

    Internet - Free WiFi
    Entertainment - Flat-screen TV with cable channels
    Food & Drink - Refrigerator, coffee/tea maker, room service, and free bottled water
    Sleep - Premium bedding
    Bathroom - Private bathroom, shower, bathrobes, and free toiletries
    Practical - Safe and desk; cribs/infant beds available on request
    Comfort - Climate-controlled air conditioning and daily housekeeping
    Non-Smoking
    "},"amenities":{"130":{"id":"130","name":"Refrigerator"},"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"}},"images":[{"hero_image":true,"category":21001,"links":{"70px":{"method":"GET","href":"https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg"}},"caption":"Guestroom"}],"bed_groups":{"37321":{"id":"37321","description":"1 King Bed","configuration":[{"type":"KingBed","size":"King","quantity":1}]}},"area":{"square_meters":17},"views":{"4134":{"id":"4134","name":"City view"}},"occupancy":{"max_allowed":{"total":3,"children":2,"adults":3},"age_categories":{"ChildAgeA":{"name":"ChildAgeA","minimum_age":3}}}}},"rates":{"333abc":{"id":"333abc","amenities":{"1234":{"id":"1234","name":"Test Amenity - 200","value":"200"},"2104":{"id":"2104","name":"Full Breakfast"}},"special_offer_description":"Breakfast for 2 - Rate includes the following:\r\n
    • Accommodations as selected
    • \r\n
    • Breakfast in hotel restaurant for up to 2 adults and children 12 years old and under registered in the same room
    • \r\n
    Must book this rate plan to receive benefits. Details provided at check-in. Taxes and gratuity may not be included. No refunds for any unused portion of offer. Offer subject to availability. Offer is not valid with groups/conventions and may not be combined with other promotional offers. Other restrictions and blackout dates may apply.\r\n"}},"dates":{"added":"1998-07-20T05:00:00.000Z","updated":"2018-03-22T13:33:17.000Z"},"descriptions":{"amenities":"Don't miss out on the many recreational opportunities, including an outdoor pool, a sauna, and a fitness center. Additional features at this hotel include complimentary wireless Internet access, concierge services, and an arcade/game room.","dining":"Grab a bite at one of the hotel's 3 restaurants, or stay in and take advantage of 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Buffet breakfasts are available daily for a fee.","renovations":"During renovations, the hotel will make every effort to minimize noise and disturbance. The property will be renovating from 08 May 2017 to 18 May 2017 (completion date subject to change). The following areas are affected:
    • Fitness facilities
    ","national_ratings":"For the benefit of our customers, we have provided a rating based on our rating system.","business_amenities":"Featured amenities include complimentary wired Internet access, a 24-hour business center, and limo/town car service. Event facilities at this hotel consist of a conference center and meeting rooms. Free self parking is available onsite.","rooms":"Make yourself at home in one of the 334 air-conditioned rooms featuring LCD televisions. Complimentary wired and wireless Internet access keeps you connected, and satellite programming provides entertainment. Private bathrooms with separate bathtubs and showers feature deep soaking bathtubs and complimentary toiletries. Conveniences include phones, as well as safes and desks.","attractions":"Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance.

    Distances are displayed to the nearest 0.1 mile and kilometer.

    Sogo Department Store - 0.7 km / 0.4 mi
    National Museum of Natural Science - 1.1 km / 0.7 mi
    Shr-Hwa International Tower - 1.4 km / 0.8 mi
    Shinkong Mitsukoshi Department Store - 1.5 km / 0.9 mi
    Taichung Metropolitan Opera House - 1.7 km / 1 mi
    Tiger City Mall - 1.8 km / 1.1 mi
    Maple Garden Park - 1.9 km / 1.2 mi
    National Museum of Fine Arts - 2.1 km / 1.3 mi
    Feng Chia University - 2.4 km / 1.5 mi
    Bao An Temple - 2.5 km / 1.6 mi
    Fengjia Night Market - 2.5 km / 1.6 mi
    Zhonghua Night Market - 2.7 km / 1.7 mi
    Chonglun Park - 2.9 km / 1.8 mi
    Wan He Temple - 2.9 km / 1.8 mi
    Chungyo Department Store - 3.1 km / 1.9 mi

    The nearest airports are:
    Taichung (RMQ) - 12 km / 7.5 mi
    Taipei (TPE-Taoyuan Intl.) - 118.3 km / 73.5 mi
    Taipei (TSA-Songshan) - 135.5 km / 84.2 mi

    ","location":"This 4-star hotel is within close proximity of Shr-Hwa International Tower and Shinkong Mitsukoshi Department Store. A stay at Tempus Hotel Taichung places you in the heart of Taichung, convenient to Sogo Department Store and National Museum of Natural Science.","headline":"Near National Museum of Natural Science","general":"General description"},"statistics":{"52":{"id":"52","name":"Total number of rooms - 820","value":"820"},"54":{"id":"54","name":"Number of floors - 38","value":"38"}},"airports":{"preferred":{"iata_airport_code":"SGF"}},"themes":{"2337":{"id":"2337","name":"Luxury Hotel"},"2341":{"id":"2341","name":"Spa Hotel"}},"all_inclusive":{"all_rate_plans":true,"some_rate_plans":false,"details":"

    This resort is all-inclusive. Onsite food and beverages are included in the room price (some restrictions may apply).

    Activities and facilities/equipment
    Land activities

    • Fitness facilities

    Lessons/classes/games
    • Pilates
    • Yoga

    Entertainment

    • Onsite entertainment and activities
    • Onsite live performances

    "},"tax_id":"CD-012-987-1234-02","chain":{"id":"-5","name":"Hilton Worldwide"},"brand":{"id":"358","name":"Hampton Inn"},"spoken_languages":{"en":{"id":"en","name":"English"}},"multi_unit":true,"payment_registration_recommended":true,"vacation_rental_details":{"registry_number":"Property Registration Number 123456","private_host":"true","property_manager":{"name":"John Smith","links":{"image":{"method":"GET","href":"https://example.com/profile.jpg"}}},"rental_agreement":{"links":{"rental_agreement":{"method":"GET","href":"https:/example.com/rentalconditions.pdf"}}},"house_rules":["Children welcome","No pets","No smoking","No parties or events"],"amenities":{"2859":{"id":"2859","name":"Private pool"},"4296":{"id":"4296","name":"Furnished balcony or patio"}},"vrbo_srp_id":"123.1234567.5678910","listing_id":"1234567","listing_number":"5678910","listing_source":"HOMEAWAY_US","listing_unit":"/units/0000/32d82dfa-1a48-45d6-9132-49fdbf1bfc60"},"supply_source":"vrbo","registry_number":"Property Registration Number 123456"} ``` operationId: getPropertyContentFile parameters: @@ -3468,28 +3508,38 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: language in: query description: > Desired language for the response as a subset of BCP47 format that - only uses hyphenated pairs of two-digit language and country codes. - Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 - country codes. See - [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) + only uses hyphenated pairs of two-digit + + language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. +

    Reference: - Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) + * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) + + * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) required: true schema: type: string - example: en-US + examples: + English: + value: en-US + Japanese: + value: ja-JP - name: supply_source in: query description: > @@ -3498,41 +3548,52 @@ paths: return all properties that match the requested supply source. An error is thrown if the parameter is provided multiple times. * `expedia` - Standard Expedia supply. - * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their + profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) + + for more information. required: true schema: type: string - example: vrbo + examples: + Standard: + value: expedia + VRBO: + value: vrbo - name: billing_terms in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - - name: payment_terms + - name: partner_point_of_sale in: query description: > - 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. + 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. schema: type: string - - name: partner_point_of_sale + - name: payment_terms in: query description: > - 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. + 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. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -3864,24 +3925,31 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: include in: query description: > Options for which content to return in the response. This parameter - can be supplied multiple times with different values. The standard - and details options cannot be requested together. The value must be - lower case. + can be supplied multiple times with + + different values. The standard and details options cannot be requested together. The value must be lower + + case. * standard - Include the metadata and basic hierarchy of each region. * details - Include the metadata, coordinates and full hierarchy of each region. * property_ids - Include the list of property IDs within the bounding polygon of each region. - * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and property IDs from the surrounding area if minimal properties are within the region. + * property_ids_expanded - Include the list of property IDs within the bounding polygon of each region and + property IDs from the surrounding area if minimal properties are within the region. required: true schema: type: array @@ -3892,32 +3960,48 @@ paths: - details - property_ids - property_ids_expanded - example: - - details + examples: + Single: + value: standard + Multiple: + value: + - property_ids + - standard - name: language in: query description: > Desired language for the response as a subset of BCP47 format that - only uses hyphenated pairs of two-digit language and country codes. - Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 - country codes. See - [https://www.w3.org/International/articles/language-tags/](https://www.w3.org/International/articles/language-tags/) + only uses hyphenated pairs of two-digit + language and country codes. Use only ISO 639-1 alpha-2 language codes and ISO 3166-1 alpha-2 country codes. - Language Options: [https://developers.expediagroup.com/docs/rapid/resources/reference/language-options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) +

    Reference: + + * [W3 Language Tags](https://www.w3.org/International/articles/language-tags/) + + * [Language Options](https://developers.expediagroup.com/docs/rapid/resources/reference/language-options) required: true schema: type: string - example: en-US + examples: + English: + value: en-US + Japanese: + value: ja-JP - name: ancestor_id in: query description: > Search for regions whose ancestors include the requested ancestor - region ID. Refer to the list of [top level - regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists). + region ID. Refer to the list of + + [top level regions](https://developers.expediagroup.com/docs/rapid/lodging/geography/geography-reference-lists). schema: type: string - example: 602962 + examples: + Optional: + ? value + Single: + value: 602962 - name: area in: query description: > @@ -3944,7 +4028,11 @@ paths: `&type=airport&limit=3&area=50,37.227924,-93.310036` schema: type: string - example: 3,602962 + examples: + Optional: + ? value + Area: + value: 3,602962 - name: country_code in: query description: > @@ -3956,8 +4044,11 @@ paths: type: array items: type: string - example: - - US + examples: + Optional: + ? value + United States: + value: US - name: country_subdivision_code in: query description: Filter the results down to only the ISO 3166-2 country subdivision. @@ -3965,8 +4056,11 @@ paths: type: array items: type: string - example: - - US-MO + examples: + Optional: + ? value + Missouri: + value: US-MO - name: iata_location_code in: query description: > @@ -3975,7 +4069,11 @@ paths: iata_airport_metro_code. The code must be upper case. schema: type: string - example: SGF + examples: + Optional: + ? value + Springfield: + value: SGF - name: limit in: query description: > @@ -3995,7 +4093,11 @@ paths: * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. schema: type: string - example: vrbo + examples: + Optional: + ? value + VRBO: + value: vrbo - name: type in: query description: | @@ -4008,32 +4110,36 @@ paths: in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > 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. + shop and book. If this field is needed, + + the value for this will be provided to you separately. schema: type: string - name: payment_terms in: query description: > 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. + paid for a resulting booking. If this + + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -4487,11 +4593,15 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: region_id @@ -4539,50 +4649,58 @@ paths: - property_ids_expanded example: - details + - name: supply_source + in: query + description: > + Options for which supply source you would like returned in the + geography response. This parameter may only be supplied once and + will return all properties that match the requested supply source. + An error is thrown if the parameter is provided multiple times. + * `expedia` - Standard Expedia supply. + * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + schema: + type: string + examples: + Optional: + ? value + VRBO: + value: vrbo - name: billing_terms in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > 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. + shop and book. If this field is needed, + + the value for this will be provided to you separately. schema: type: string - name: payment_terms in: query description: > 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. + paid for a resulting booking. If this + + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name in: query description: > 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. - schema: - type: string - - name: supply_source - in: query - description: > - Options for which supply source you would like returned in the - geography response. This parameter may only be supplied once and - will return all properties that match the requested supply source. - An error is thrown if the parameter is provided multiple times. - * `expedia` - Standard Expedia supply. - * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string - example: vrbo responses: "200": description: OK @@ -4989,11 +5107,15 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: include @@ -5006,50 +5128,64 @@ paths: schema: type: string example: property_ids + - name: supply_source + in: query + description: > + Options for which supply source you would like returned in the + content response. This parameter may only be + + supplied once and will return all properties that match the requested supply source. An error is thrown if + + the parameter is provided multiple times. + * `expedia` - Standard Expedia supply. + * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their + profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) + + for more information. + required: true + schema: + type: string + examples: + Standard: + value: expedia + VRBO: + value: vrbo - name: billing_terms in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > 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. + shop and book. If this field is needed, + + the value for this will be provided to you separately. schema: type: string - name: payment_terms in: query description: > 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. + paid for a resulting booking. If this + + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name in: query description: > 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. - schema: - type: string - - name: supply_source - in: query - description: > - Options for which supply source you would like returned in the - geography response. This parameter may only be supplied once and - will return all properties that match the requested supply source. - An error is thrown if the parameter is provided multiple times. - * `expedia` - Standard Expedia supply. - * `vrbo` - VRBO supply - This option is restricted to partners who have VRBO supply enabled for their profile. See [Vacation Rentals](https://developers.expediagroup.com/docs/rapid/lodging/vacation-rentals) for more information. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string - example: vrbo requestBody: content: application/json: @@ -5324,15 +5460,20 @@ paths: Also used for fraud recovery and other important analytics. schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -5381,7 +5522,9 @@ paths: required: true schema: type: string - example: USD + examples: + Dollar: + value: USD - name: country_code in: query description: > @@ -5393,7 +5536,9 @@ paths: required: true schema: type: string - example: US + examples: + United States: + value: US - name: language in: query description: > @@ -5407,7 +5552,9 @@ paths: required: true schema: type: string - example: en-US + examples: + English: + value: en-US - name: occupancy in: query description: > @@ -5430,7 +5577,9 @@ paths: type: array items: type: string - example: 2 + examples: + Two: + value: 2 - name: property_id in: query description: > @@ -5443,8 +5592,10 @@ paths: type: array items: type: string - example: - - 20321 + examples: + Single: + value: + - 20321 - name: rate_plan_count in: query description: > @@ -5458,7 +5609,9 @@ paths: required: true schema: type: number - example: 1 + examples: + Single: + value: 1 - name: sales_channel in: query description: > @@ -5481,7 +5634,9 @@ paths: required: true schema: type: string - example: website + examples: + Website: + value: website - name: sales_environment in: query description: > @@ -5498,7 +5653,9 @@ paths: required: true schema: type: string - example: hotel_only + examples: + Hotel: + value: hotel_only - name: amenity_category in: query description: > @@ -5516,8 +5673,12 @@ paths: type: array items: type: string - example: - - swimming_pool + examples: + Optional: + ? value + Multiple: + value: + - swimming_pool - name: exclusion in: query description: > @@ -5534,8 +5695,16 @@ paths: enum: - refundable_damage_deposit - card_on_file - example: - - refundable_damage_deposit + examples: + Optional: + ? value + Single: + value: + - refundable_damage_deposit + Multiple: + value: + - refundable_damage_deposit + - card_on_file - name: filter in: query description: > @@ -5559,8 +5728,12 @@ paths: - refundable - expedia_collect - property_collect - example: - - expedia_collect + examples: + Optional: + ? value + Multiple: + value: + - expedia_collect - name: include in: query description: > @@ -5580,7 +5753,12 @@ paths: - unavailable_reason - sale_scenario.mobile_promotion - rooms.rates.marketing_fee_incentives - example: unavailable_reason + examples: + Optional: + ? value + Multiple: + value: + - unavailable_reason - name: rate_option in: query description: > @@ -5618,37 +5796,45 @@ paths: enum: - leisure - business - example: leisure + examples: + Optional: + ? value + Single: + value: leisure - name: billing_terms in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - - name: payment_terms + - name: partner_point_of_sale in: query description: > - 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. + 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. schema: type: string - - name: partner_point_of_sale + - name: payment_terms in: query description: > - 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. + 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. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -6492,15 +6678,20 @@ paths: Also used for fraud recovery and other important analytics. schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -6590,8 +6781,16 @@ paths: enum: - refundable_damage_deposit - card_on_file - example: - - refundable_damage_deposit + examples: + Optional: + ? value + Single: + value: + - refundable_damage_deposit + Multiple: + value: + - refundable_damage_deposit + - card_on_file - name: filter in: query description: > @@ -6619,9 +6818,17 @@ paths: - refundable - expedia_collect - property_collect - example: - - refundable - - expedia_collect + examples: + Optional: + ? value + Refundable: + value: refundable + ExpediaCollect: + value: expedia_collect + Multiple: + value: + - refundable + - expedia_collect - name: include in: query description: > @@ -6635,7 +6842,11 @@ paths: type: string enum: - sale_scenario.mobile_promotion - example: sale_scenario.mobile_promotion + examples: + Optional: + ? value + MobilePromotion: + value: sale_scenario.mobile_promotion - name: occupancy in: query description: > @@ -6684,9 +6895,17 @@ paths: - member - net_rates - cross_sell - example: - - member - - net_rates + examples: + Optional: + ? value + Member: + value: member + NetRates: + value: net_rates + Multiple: + value: + - member + - net_rates - name: sales_channel in: query description: > @@ -7270,15 +7489,20 @@ paths: Also used for fraud recovery and other important analytics. schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -7839,15 +8063,20 @@ paths: Also used for fraud recovery and other important analytics. schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: property_id @@ -7868,7 +8097,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m responses: "200": description: OK @@ -8137,7 +8365,7 @@ paths: in: header description: > Shop calls have a test header that can be used to return set - responses with the following keywords:
    + responses with the following keywords: * `standard` @@ -8162,7 +8390,13 @@ paths: type: array items: type: string - example: property_id=1234&property_id=5678 + examples: + Single: + value: 1234 + Multiple: + value: + - 1234 + - 5678 - name: start_date in: query description: > @@ -8173,7 +8407,7 @@ paths: schema: type: string format: date - example: 2023-01-15 + example: 2024-11-15 - name: end_date in: query description: > @@ -8184,7 +8418,7 @@ paths: schema: type: string format: date - example: 2023-12-17 + example: 2025-05-17 responses: "200": description: OK @@ -8319,7 +8553,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: invalid_input message: An invalid request was sent in, please check the nested errors for @@ -8351,7 +8584,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: request_unauthenticated message: Data required to authenticate your request is missing or inaccurate. @@ -8379,7 +8611,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: request_unauthorized message: Your request could not be authorized. @@ -8392,7 +8623,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: upgrade_required message: This service requires the use of TLS. @@ -8441,7 +8671,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: too_many_requests message: You have reached your capacity for this type of request. @@ -8454,7 +8683,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: unknown_internal_error message: An internal server error has occurred. @@ -8467,7 +8695,6 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - Example: example: type: service_unavailable message: This service is currently unavailable. @@ -8497,15 +8724,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -8535,7 +8767,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m requestBody: content: application/json: @@ -8805,15 +9036,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -8841,7 +9077,9 @@ paths: required: true schema: type: string - example: 111A222BB33344CC5555 + examples: + Single: + value: 111A222BB33344CC5555 - name: email in: query description: > @@ -8850,14 +9088,18 @@ paths: required: true schema: type: string - example: test@example.com + examples: + Single: + value: test@example.com - name: include in: query description: > Options for which information to return in the response. The value must be lower case. - * `history` - Include itinerary history, showing details of the changes made to this itinerary + * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. + + * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. required: false schema: type: array @@ -8865,8 +9107,11 @@ paths: type: string enum: - history - example: - - history + examples: + Optional: + ? value + History: + value: history responses: "200": description: OK @@ -9082,7 +9327,7 @@ paths: accommodation. Supplier cancellation policy will apply terms_and_conditions: https://forever.travel-assets.com/flex/flexmanager/mediaasset/618796-0_2-UnitedKingdom_en.pdf - Itinerary With History and Change - Extend Stay: + Itinerary with History and Change - Extend Stay: value: - itinerary_id: "8999989898988" property_id: "8150374" @@ -9407,36 +9652,364 @@ paths: billable_currency: value: "11.95" currency: USD - No itineraries: - value: [] - "400": - description: Bad Request - headers: - Rate-Limit-Day: - description: Reserved for future use. Optional header for request capacity per - day. - schema: - type: number - Rate-Limit-Day-Remaining: - description: Optional header for the remaining capacity, as a percentage, for - the daily time window. - schema: - type: number - Rate-Limit-Day-Reset: - description: Optional header for the timestamp, as the number of milliseconds - since the Unix Epoch, when the daily capacity resets. - schema: - type: number - Rate-Limit-Minute: - description: Reserved for future use. Optional header for request capacity per - minute. - schema: - type: number - Rate-Limit-Minute-Remaining: - description: Optional header for the remaining capacity, as a percentage, for - the per minute time window. - schema: - type: number + Itinerary with History V2 - Traveler No Show: + value: + itinerary_id: "8999989898988" + property_id: "8150374" + links: + cancel: + method: DELETE + href: /v3/itineraries/8999989898988?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + email: smith@example.com + phone: + country_code: "1" + area_code: "487" + number: "5550077" + rooms: + - id: "926784314" + confirmation_id: + expedia: "1234567890" + property: BEF23123AA + bed_group_id: d395b56d-d31d-4a84-ad2b-66820b1d48e2 + checkin: 2018-09-21 + checkout: 2018-09-23 + number_of_adults: 2 + child_ages: + - 2 + - 3 + given_name: Givenne + family_name: Nameo + status: booked + special_request: Please give me extra towels. + smoking: false + rate: + id: "035943984" + merchant_of_record: expedia + refundable: true + cancel_refund: + amount: "-65.98" + currency: USD + amenities: + - "12345" + - "678" + - "9999" + promotions: + value_adds: + 123abc: + id: 123abc + description: 10 USD credit on activities and sports for your stay. + 3x4mp13: + id: 3x4mp13 + description: 20% discount on theme park tickets purchased through the concierge + desk. + cancel_penalties: + - start: 2018-01-01T01:01:01.000-08:00 + end: 2018-12-12T01:01:01.000-08:00 + amount: "250.75" + currency: USD + nonrefundable_date_ranges: + - start: 2018-09-14 + end: 2018-09-23 + deposits: + - currency: USD + value: "220.75" + due: 2018-08-24T01:01:01.000-08:00 + pricing: + nightly: + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + stay: + - type: base_rate + value: "123.45" + currency: USD + totals: + inclusive: + billable_currency: + value: "368.15" + currency: USD + exclusive: + billable_currency: + value: "345.91" + currency: USD + marketing_fee: + billable_currency: + value: "7.75" + currency: USD + property_fees: + billable_currency: + value: "36.95" + currency: USD + fees: + mandatory_fee: + billable_currency: + value: "5.00" + currency: USD + resort_fee: + billable_currency: + value: "20.00" + currency: USD + mandatory_tax: + billable_currency: + value: "11.95" + currency: USD + links: + cancel: + method: DELETE + href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + change: + method: PUT + href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + shop_for_change: + method: GET + href: /v3/properties/8150374/availability?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + billing_contact: + given_name: John + family_name: Smith + address: + line_1: 555 1st St + line_2: 10th Floor + line_3: Unit 12 + city: Seattle + state_province_code: WA + postal_code: "98121" + country_code: US + adjustment: + value: "-32.10" + type: base_rate + currency: USD + creation_date_time: 2017-08-15T15:32:55.523Z + affiliate_reference_id: 4480ABC + affiliate_metadata: This booking was made with EPS. + conversations: + links: + property: + method: GET + href: https://www.example.com?key=123abd456 + travel_purpose: unspecified + itinerary_history: + - history_id: "802737048" + event_timestamp: 2017-09-17T13:31:15.523Z + event_type: adjustment + amount: + value: "-32.10" + currency: USD + agent_id: "10203" + room_history: + - - history_id: "928364986296" + event_timestamp: 2017-08-15T15:32:55.523Z + event_type: created + event_source: rapid_api + room_id: "926784314" + confirmation_id: + expedia: "664637628" + property: COR8729347BB + bed_group_id: d395b56d-d31d-4a84-ad2b-66820b1d48e2 + checkin: 2018-09-21 + checkout: 2018-09-22 + number_of_adults: 2 + child_ages: + - 2 + - 3 + given_name: Givenne + family_name: Nameo + status: booked + special_request: Please give me extra towels. + smoking: false + amount_charged: + billable_currency: + value: "244.70" + currency: USD + rate: + id: "035943984" + promotions: + value_adds: + 123abc: + id: 123abc + description: 10 USD credit on activities and sports for your stay. + 3x4mp13: + id: 3x4mp13 + description: 20% discount on theme park tickets purchased through the concierge + desk. + deposits: + - currency: USD + value: "220.75" + due: 2018-08-24T01:01:01.000-08:00 + pricing: + nightly: + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + stay: + - type: base_rate + value: "123.45" + currency: USD + totals: + inclusive: + billable_currency: + value: "244.70" + currency: USD + exclusive: + billable_currency: + value: "234.68" + currency: USD + marketing_fee: + billable_currency: + value: "5.14" + currency: USD + property_fees: + billable_currency: + value: "36.95" + currency: USD + fees: + mandatory_fee: + billable_currency: + value: "5.00" + currency: USD + resort_fee: + billable_currency: + value: "20.00" + currency: USD + mandatory_tax: + billable_currency: + value: "11.95" + currency: USD + - history_id: "30303030" + event_timestamp: 2017-08-17T13:31:15.523Z + event_type: canceled_no_show + event_source: supplier + change_reference_id: v1-Givenne + room_id: "926784314" + confirmation_id: + expedia: "1234567890" + property: BEF23123AA + bed_group_id: d395b56d-d31d-4a84-ad2b-66820b1d48e2 + checkin: 2018-09-21 + checkout: 2018-09-23 + number_of_adults: 2 + child_ages: + - 2 + - 3 + given_name: Givenne + family_name: Nameo + status: canceled + special_request: Please give me extra towels. + smoking: false + amount_charged: + billable_currency: + value: "123.45" + currency: USD + rate: + id: "035943984" + promotions: + value_adds: + 123abc: + id: 123abc + description: 10 USD credit on activities and sports for your stay. + 3x4mp13: + id: 3x4mp13 + description: 20% discount on theme park tickets purchased through the concierge + desk. + deposits: + - currency: USD + value: "220.75" + due: 2018-08-24T01:01:01.000-08:00 + pricing: + nightly: + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + stay: + - type: base_rate + value: "123.45" + currency: USD + totals: + inclusive: + billable_currency: + value: "368.15" + currency: USD + exclusive: + billable_currency: + value: "345.91" + currency: USD + marketing_fee: + billable_currency: + value: "7.75" + currency: USD + property_fees: + billable_currency: + value: "36.95" + currency: USD + fees: + mandatory_fee: + billable_currency: + value: "5.00" + currency: USD + resort_fee: + billable_currency: + value: "20.00" + currency: USD + mandatory_tax: + billable_currency: + value: "11.95" + currency: USD + No itineraries: + value: [] + "400": + description: Bad Request + headers: + Rate-Limit-Day: + description: Reserved for future use. Optional header for request capacity per + day. + schema: + type: number + Rate-Limit-Day-Remaining: + description: Optional header for the remaining capacity, as a percentage, for + the daily time window. + schema: + type: number + Rate-Limit-Day-Reset: + description: Optional header for the timestamp, as the number of milliseconds + since the Unix Epoch, when the daily capacity resets. + schema: + type: number + Rate-Limit-Minute: + description: Reserved for future use. Optional header for request capacity per + minute. + schema: + type: number + Rate-Limit-Minute-Remaining: + description: Optional header for the remaining capacity, as a percentage, for + the per minute time window. + schema: + type: number Rate-Limit-Minute-Reset: description: Optional header for the timestamp, as the number of milliseconds since the Unix Epoch, when the per minute capacity resets. @@ -9618,15 +10191,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it + + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -9667,7 +10245,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m requestBody: content: application/json: @@ -10080,15 +10657,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -10130,7 +10712,6 @@ paths: potential for errors. Token values cannot be viewed or changed. schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m - name: email in: query description: > @@ -10139,13 +10720,20 @@ paths: not provided the request)
    schema: type: string - example: test@example.com + examples: + Optional: + ? value + Single: + value: test@example.com - name: include in: query description: > Options for which information to return in the response. The value must be lower case. - * history - Include itinerary history, showing details of the changes made to this itinerary + + * `history` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `other` in the response. + + * `history_v2` - Include itinerary history, showing details of the changes made to this itinerary. Changes from the property/supplier have an event_source equal to `supplier` in the response. See the [Itinerary history](https://developers.expediagroup.com/docs/rapid/lodging/manage-booking/itinerary-history#overview) for details. required: false schema: type: array @@ -10153,8 +10741,11 @@ paths: type: string enum: - history - example: - - history + examples: + Optional: + ? value + History: + value: history responses: "200": description: OK @@ -10232,13 +10823,157 @@ paths: status: booked special_request: Please give me extra towels. smoking: false - loyalty_id: ABC123 + loyalty_id: ABC123 + rate: + id: "035943984" + merchant_of_record: expedia + refundable: true + cancel_refund: + amount: -65.98 + currency: USD + amenities: + - "12345" + - "678" + - "9999" + promotions: + value_adds: + 123abc: + id: 123abc + description: 10 USD credit on activities and sports for your stay. + 3x4mp13: + id: 3x4mp13 + description: 20% discount on theme park tickets purchased through the concierge + desk. + cancel_penalties: + - start: 2018-01-01T01:01:01.000-08:00 + end: 2018-12-12T01:01:01.000-08:00 + amount: "250.75" + currency: USD + nonrefundable_date_ranges: + - start: 2022-02-02 + end: 2022-02-02 + deposits: + - currency: USD + value: "220.75" + due: 2018-12-12T01:01:01.000-08:00 + pricing: + nightly: + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + stay: + - type: base_rate + value: "123.45" + currency: USD + totals: + inclusive: + billable_currency: + value: "368.15" + currency: USD + exclusive: + billable_currency: + value: "345.91" + currency: USD + marketing_fee: + billable_currency: + value: "7.75" + currency: USD + property_fees: + billable_currency: + value: "36.95" + currency: USD + fees: + mandatory_fee: + billable_currency: + value: "5.00" + currency: USD + resort_fee: + billable_currency: + value: "20.00" + currency: USD + mandatory_tax: + billable_currency: + value: "11.95" + currency: USD + links: + cancel: + method: DELETE + href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + change: + method: PUT + href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + shop_for_change: + method: GET + href: /v3/properties/8150374/availability?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + billing_contact: + given_name: John + family_name: Smith + address: + line_1: 555 1st St + line_2: 10th Floor + line_3: Unit 12 + city: Seattle + state_province_code: WA + postal_code: "98121" + country_code: US + adjustment: + value: -100 + type: base_rate + currency: USD + creation_date_time: 2017-08-17T13:31:15.523Z + affiliate_reference_id: 4480ABC + affiliate_metadata: This booking was made with EPS. + conversations: + links: + property: + method: GET + href: https://www.example.com?key=123abd456 + travel_purpose: leisure + Itinerary with History: + value: + itinerary_id: "8999989898988" + property_id: "8150374" + links: + cancel: + method: DELETE + href: /v3/itineraries/8999989898988?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + email: smith@example.com + phone: + country_code: "1" + area_code: "487" + number: "5550077" + rooms: + - id: "926784314" + confirmation_id: + expedia: "1234567890" + property: BEF23123AA + bed_group_id: d395b56d-d31d-4a84-ad2b-66820b1d48e2 + checkin: 2018-09-21 + checkout: 2018-09-23 + number_of_adults: 2 + child_ages: + - 2 + - 3 + given_name: Givenne + family_name: Nameo + status: booked + special_request: Please give me extra towels. + smoking: false rate: id: "035943984" merchant_of_record: expedia refundable: true cancel_refund: - amount: -65.98 + amount: "-65.98" currency: USD amenities: - "12345" @@ -10259,12 +10994,12 @@ paths: amount: "250.75" currency: USD nonrefundable_date_ranges: - - start: 2022-02-02 - end: 2022-02-02 + - start: 2018-09-14 + end: 2018-09-23 deposits: - currency: USD value: "220.75" - due: 2018-12-12T01:01:01.000-08:00 + due: 2018-08-24T01:01:01.000-08:00 pricing: nightly: - - type: base_rate @@ -10313,41 +11048,225 @@ paths: billable_currency: value: "11.95" currency: USD - links: - cancel: - method: DELETE - href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m - change: - method: PUT - href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m - shop_for_change: - method: GET - href: /v3/properties/8150374/availability?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m - billing_contact: - given_name: John - family_name: Smith - address: - line_1: 555 1st St - line_2: 10th Floor - line_3: Unit 12 - city: Seattle - state_province_code: WA - postal_code: "98121" - country_code: US - adjustment: - value: -100 - type: base_rate - currency: USD - creation_date_time: 2017-08-17T13:31:15.523Z - affiliate_reference_id: 4480ABC - affiliate_metadata: This booking was made with EPS. - conversations: - links: - property: - method: GET - href: https://www.example.com?key=123abd456 - travel_purpose: leisure - Itinerary with History: + links: + cancel: + method: DELETE + href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + change: + method: PUT + href: /v3/itineraries/8999989898988/rooms/d08572fc-82d2-4d5d-ad30-60f5be7fb53e?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + shop_for_change: + method: GET + href: /v3/properties/8150374/availability?token=MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m + billing_contact: + given_name: John + family_name: Smith + address: + line_1: 555 1st St + line_2: 10th Floor + line_3: Unit 12 + city: Seattle + state_province_code: WA + postal_code: "98121" + country_code: US + adjustment: + value: "-32.10" + type: base_rate + currency: USD + creation_date_time: 2017-08-15T15:32:55.523Z + affiliate_reference_id: 4480ABC + affiliate_metadata: This booking was made with EPS. + conversations: + links: + property: + method: GET + href: https://www.example.com?key=123abd456 + travel_purpose: unspecified + itinerary_history: + - history_id: "802737048" + event_timestamp: 2017-09-17T13:31:15.523Z + event_type: adjustment + amount: + value: "-32.10" + currency: USD + agent_id: "10203" + room_history: + - - history_id: "928364986296" + event_timestamp: 2017-08-15T15:32:55.523Z + event_type: created + event_source: rapid_api + room_id: "926784314" + confirmation_id: + expedia: "664637628" + property: COR8729347BB + bed_group_id: d395b56d-d31d-4a84-ad2b-66820b1d48e2 + checkin: 2018-09-21 + checkout: 2018-09-22 + number_of_adults: 2 + child_ages: + - 2 + - 3 + given_name: Givenne + family_name: Nameo + status: booked + special_request: Please give me extra towels. + smoking: false + amount_charged: + billable_currency: + value: "244.70" + currency: USD + rate: + id: "035943984" + promotions: + value_adds: + 123abc: + id: 123abc + description: 10 USD credit on activities and sports for your stay. + 3x4mp13: + id: 3x4mp13 + description: 20% discount on theme park tickets purchased through the concierge + desk. + deposits: + - currency: USD + value: "220.75" + due: 2018-08-24T01:01:01.000-08:00 + pricing: + nightly: + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + stay: + - type: base_rate + value: "123.45" + currency: USD + totals: + inclusive: + billable_currency: + value: "244.70" + currency: USD + exclusive: + billable_currency: + value: "234.68" + currency: USD + marketing_fee: + billable_currency: + value: "5.14" + currency: USD + property_fees: + billable_currency: + value: "36.95" + currency: USD + fees: + mandatory_fee: + billable_currency: + value: "5.00" + currency: USD + resort_fee: + billable_currency: + value: "20.00" + currency: USD + mandatory_tax: + billable_currency: + value: "11.95" + currency: USD + - history_id: "30303030" + event_timestamp: 2017-08-17T13:31:15.523Z + event_type: modified + event_source: rapid_api + change_reference_id: v1-Givenne + room_id: "926784314" + confirmation_id: + expedia: "1234567890" + property: BEF23123AA + bed_group_id: d395b56d-d31d-4a84-ad2b-66820b1d48e2 + checkin: 2018-09-21 + checkout: 2018-09-23 + number_of_adults: 2 + child_ages: + - 2 + - 3 + given_name: Givenne + family_name: Nameo + status: booked + special_request: Please give me extra towels. + smoking: false + amount_charged: + billable_currency: + value: "123.45" + currency: USD + rate: + id: "035943984" + promotions: + value_adds: + 123abc: + id: 123abc + description: 10 USD credit on activities and sports for your stay. + 3x4mp13: + id: 3x4mp13 + description: 20% discount on theme park tickets purchased through the concierge + desk. + deposits: + - currency: USD + value: "220.75" + due: 2018-08-24T01:01:01.000-08:00 + pricing: + nightly: + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + - - type: base_rate + value: "111.23" + currency: USD + - type: sales_tax + value: "11.12" + currency: USD + stay: + - type: base_rate + value: "123.45" + currency: USD + totals: + inclusive: + billable_currency: + value: "368.15" + currency: USD + exclusive: + billable_currency: + value: "345.91" + currency: USD + marketing_fee: + billable_currency: + value: "7.75" + currency: USD + property_fees: + billable_currency: + value: "36.95" + currency: USD + fees: + mandatory_fee: + billable_currency: + value: "5.00" + currency: USD + resort_fee: + billable_currency: + value: "20.00" + currency: USD + mandatory_tax: + billable_currency: + value: "11.95" + currency: USD + Itinerary with History V2 - Traveler No Show: value: itinerary_id: "8999989898988" property_id: "8150374" @@ -10589,8 +11508,8 @@ paths: currency: USD - history_id: "30303030" event_timestamp: 2017-08-17T13:31:15.523Z - event_type: modified - event_source: rapid_api + event_type: canceled_no_show + event_source: supplier change_reference_id: v1-Givenne room_id: "926784314" confirmation_id: @@ -10605,7 +11524,7 @@ paths: - 3 given_name: Givenne family_name: Nameo - status: booked + status: canceled special_request: Please give me extra towels. smoking: false amount_charged: @@ -10924,15 +11843,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -10971,7 +11895,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m responses: "202": description: Accepted - Request is valid but the state of the booking is @@ -11307,15 +12230,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -11357,7 +12285,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m responses: "202": description: Accepted - Request is valid but the state of the booking is @@ -12083,15 +13010,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -12130,7 +13062,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m responses: "200": description: Payment Session Completed @@ -12449,15 +13380,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -12504,7 +13440,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m requestBody: description: The request body is required, but only the fields that are being changed need to be passed in. Fields that are not being changed should @@ -12849,15 +13784,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -12907,7 +13847,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m responses: "202": description: Accepted - Request is valid but the state of the booking is @@ -13243,8 +14182,7 @@ paths: - name: Customer-Ip in: header description: > - IP address of the customer, as captured by your integration. Send - IPV4 addresses only.
    + 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.
    @@ -13252,15 +14190,20 @@ paths: required: true schema: type: string + example: 5.5.5.5 - name: Customer-Session-Id in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: Test @@ -13307,7 +14250,6 @@ paths: required: true schema: type: string - example: MY5S3j36cOcLfLBZjPYQ1abhfc8CqmjmFVzkk7euvWaunE57LLeDgaxm516m requestBody: description: > The request body is required if additional payment is necessary. The @@ -13745,15 +14687,19 @@ paths: description: > Returns a complete collection of chains recognized by the Rapid API. +
    Chains represent a parent company which can have multiple brands associated with it. A brand can only be -
    Chains represent a parent company which can have multiple brands associated with it. A brand can only be associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands including Doubletree, Hampton Inn and Embassy Suites. + associated with one chain. For example, Hilton Worldwide is a chain that has multiple associated brands + including DoubleTree, Hampton Inn and Embassy Suites. -
    The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object also contains a map of its related brands. +
    The response is a JSON map where the key is the chain ID and the value is a chain object. Each chain object + also contains a map of its related brands. -
    Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning. +
    Note that the set of chain IDs and brand IDs are totally independent of one another. It is possible for a + chain and a brand to both use the same number as their ID, but this is just a coincidence that holds no meaning.
    Chain and brand names are provided in English only. operationId: getChainReference @@ -13762,43 +14708,51 @@ paths: in: header description: > Insert your own unique value for each user session, beginning with - the first API call. + the first API call. Continue to pass the - Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session.
    + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it - Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it explicitly links together request paths for individual user's session. + explicitly links together request paths for individual user's session. schema: type: string - name: billing_terms in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > 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. + shop and book. If this field is needed, + + the value for this will be provided to you separately. schema: type: string - name: payment_terms in: query description: > 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. + paid for a resulting booking. If this + + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -14076,32 +15030,36 @@ paths: in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > 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. + shop and book. If this field is needed, + + the value for this will be provided to you separately. schema: type: string - name: payment_terms in: query description: > 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. + paid for a resulting booking. If this + + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string responses: @@ -14148,32 +15106,36 @@ paths: in: query description: > 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. + should be billed. If this field is + + needed, the value for this will be provided to you separately. schema: type: string - name: partner_point_of_sale in: query description: > 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. + shop and book. If this field is needed, + + the value for this will be provided to you separately. schema: type: string - name: payment_terms in: query description: > 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. + paid for a resulting booking. If this + + field is needed, the value for this will be provided to you separately. schema: type: string - name: platform_name in: query description: > 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. + book. If this field is needed, the + + value for this will be provided to you separately. schema: type: string requestBody: @@ -14332,6 +15294,9 @@ components: supply_source: type: string description: The supply source of the property. + registry_number: + type: string + description: The property's registry number required by some jurisdictions. description: An individual property object in the map of property objects. Address: type: object @@ -16733,20 +17698,29 @@ components: format. event_type: type: string - description: Type type of event associated with this history item such as - modified or canceled. + description: Type of event associated with this history item such as modified or + canceled. If the booking is marked as a no-show by the + property/supplier, the value of event_type is `canceled` when the + `include` request parameter is `history`. However, it is + `canceled_no_show` when the `include` request parameter is + `history_v2`. enum: - created - modified - canceled + - canceled_no_show event_source: type: string description: The source of the event. If `voyager_agent`, `agent_id` will be - supplied. + supplied. If the event source is property/supplier, the value of + event_source is `other` when the `include` request parameter is + `history`. However, it is `supplier` when the `include` request + parameter is `history_v2`. enum: - rapid_api - voyager_agent - other + - supplier change_reference_id: type: string description: Optional identifier provided during changes via Rapid. @@ -17649,6 +18623,120 @@ components: type: string description: The url linking to the full text terms and conditions. example: https://www.expedia.com/terms_and_conditions + parameters: + AcceptHeader: + name: Accept + in: header + description: > + Specifies the response format that the client would like to receive + back. This must be `application/json`. + required: true + schema: + type: string + example: application/json + AcceptEncodingHeader: + name: Accept-Encoding + in: header + description: > + Specifies the response encoding that the client would like to receive + back. This must be `gzip`. + required: true + schema: + type: string + example: gzip + UserAgentHeader: + name: User-Agent + in: header + description: > + The `User-Agent` header string from the customer's request, as captured + by your integration. If you are + + building an application then the `User-Agent` value should be `{app name}/{app version}`. + required: true + schema: + type: string + example: TravelNow/3.30.112 + CustomerSessionIdHeader: + name: Customer-Session-Id + in: header + description: > + Insert your own unique value for each user session, beginning with the + first API call. Continue to pass the + + same value for each subsequent API call during the user's session, using a new value for every new customer + + session.
    + + Including this value greatly eases EPS's internal debugging process for issues with partner requests, as it + + explicitly links together request paths for individual user's session. + schema: + type: string + BillingTermsQuery: + name: billing_terms + in: query + description: > + 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. + schema: + type: string + PartnerPointOfSaleQuery: + name: partner_point_of_sale + in: query + description: > + 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. + schema: + type: string + PaymentTermsQuery: + name: payment_terms + in: query + description: > + 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. + schema: + type: string + PlatformNameQuery: + name: platform_name + in: query + description: > + 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. + schema: + type: string + CustomerIpHeader: + name: Customer-Ip + in: header + description: > + 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. + schema: + type: string + example: 5.5.5.5 + CustomerIpRequiredHeader: + name: Customer-Ip + in: header + description: > + 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. + required: true + schema: + type: string + example: 5.5.5.5 headers: Region: description: Optional header that provides information about where the request From 432ff1ea0481265d7603a53137b138074f2a5550 Mon Sep 17 00:00:00 2001 From: Dana AlTayeh Date: Tue, 26 Nov 2024 19:32:02 +0300 Subject: [PATCH 2/2] bypass examples test run --- .github/workflows/release-sdk.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-sdk.yaml b/.github/workflows/release-sdk.yaml index e6933d2e58..b191393e39 100644 --- a/.github/workflows/release-sdk.yaml +++ b/.github/workflows/release-sdk.yaml @@ -22,8 +22,7 @@ jobs: jdk: ${{ matrix.jdk }} release-sdk: - uses: ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-release-sdk.yaml@v20241125 - needs: [ run-examples ] + uses: ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-release-sdk.yaml@v20241126 secrets: inherit with: branch: ${{ inputs.branch }}