diff --git a/code/README.md b/code/README.md index 765db25234..534abc5ae4 100644 --- a/code/README.md +++ b/code/README.md @@ -5,7 +5,7 @@ com.expediagroup rapid-sdk - 5.3.2 + 5.3.2+ads-SNAPSHOT ``` diff --git a/code/pom.xml b/code/pom.xml index c551f19c70..ec1968a772 100644 --- a/code/pom.xml +++ b/code/pom.xml @@ -4,9 +4,9 @@ 4.0.0 com.expediagroup rapid-sdk - 5.3.2 + 5.3.2+ads-SNAPSHOT EG rapid-sdk for Java - EG rapid-sdk v5.3.2 + EG rapid-sdk v5.3.2+ads-SNAPSHOT https://github.com/ExpediaGroup/test-sdk 2022 jar @@ -63,7 +63,7 @@ ${project.artifactId} - 3.13.0 + 3.14.0 3.8.1 3.5.0 3.4.2 @@ -79,9 +79,9 @@ 1.2.1 4.6 1.6.0 - 2.1.0 + 2.1.10 1.10.1 - 3.0.3 + 3.1.1 0.27.0 2.0.16 1.7.0 @@ -131,7 +131,7 @@ com.fasterxml.jackson jackson-bom - 2.18.2 + 2.18.3 pom import @@ -153,7 +153,7 @@ com.fasterxml.jackson.core jackson-annotations - 2.18.2 + 2.18.3 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 9422980213..915b962f05 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,19 +16,38 @@ package com.expediagroup.sdk.core.constant.provider internal object LogMaskingRegexProvider { + /** + * Generates a regex pattern to match specified fields in a JSON string. + * + * @param maskedBodyFields the set of fields to be masked + * @param valueToMatch regex pattern to match the value of the fields. Default: match any sequence of characters except double quotes. + * @return the regex pattern to match the specified fields and their values + */ fun getMaskedFieldsRegex( maskedBodyFields: Set, - value: String = "[^\\\"]+" + valueToMatch: String = "[^\\\"]+" ): Regex { val fields = maskedBodyFields.joinToString("|") - return "\"($fields)(\\\\*\"\\s*:\\s*\\\\*\")$value(?:\\\\?\"|)".toRegex() + // The pattern matches: + // - The field name (one of the specified fields) captured in group 1. + // - Optional backslash, closing double quotes, colon(:), optional whitespace, and opening double quotes. + // - The value of the field, matching the specified valueToMatch pattern. + // - Optional backslash, followed by a closing double quote + return "\"($fields)(\\\\?\"\\s*:\\s*\\\\*\")$valueToMatch(?:\\\\?\")".toRegex() } + /** + * Generates a regex pattern to match a specified field in a JSON string. + * + * @param maskedBodyField the field to be masked + * @param valueToMatch regex pattern to match the value of the field. Default: match any sequence of characters except double quotes. + * @return the regex pattern to match the specified field and its value + */ fun getMaskedFieldsRegex( maskedBodyField: String, - value: String = "[^\\\"]+" + valueToMatch: String = "[^\\\"]+" ): Regex { val fields = setOf(maskedBodyField) - return getMaskedFieldsRegex(fields, value) + return getMaskedFieldsRegex(fields, valueToMatch) } } 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 20de3f7b4e..d606666655 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 @@ -42,6 +42,8 @@ import com.expediagroup.sdk.rapid.operations.DeleteRoomOperation import com.expediagroup.sdk.rapid.operations.DeleteRoomOperationParams import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperation import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperationParams +import com.expediagroup.sdk.rapid.operations.GetAdsOperation +import com.expediagroup.sdk.rapid.operations.GetAdsOperationParams import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperation import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperationParams import com.expediagroup.sdk.rapid.operations.GetBookingReceiptOperation @@ -896,6 +898,107 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat } } + /** + * + * Returns relevant ads. + * @param operation [GetAdsOperation] + * @throws ExpediaGroupApiErrorException + * @return a [Response] object with a body of type AdsResponse + */ + fun execute(operation: GetAdsOperation): Response = execute(operation) + + /** + * + * Returns relevant ads. + * @param operation [GetAdsOperation] + * @throws ExpediaGroupApiErrorException + * @return a [CompletableFuture] object with a body of type AdsResponse + */ + fun executeAsync(operation: GetAdsOperation): CompletableFuture> = executeAsync(operation) + + private suspend inline fun kgetAdsWithResponse( + customerId: kotlin.String, + customerIp: kotlin.String? = + null, + customerSessionId: kotlin.String? = + null, + adsRequest: AdsRequest? = + null + ): Response { + val params = + GetAdsOperationParams( + customerIp = customerIp, + customerSessionId = customerSessionId, + customerId = customerId + ) + + val operation = + GetAdsOperation( + params, + adsRequest + ) + + return execute(operation) + } + + /** + * + * Returns relevant ads. + * @param customerId An obfuscated unique identifier for each customer. This should not contain any personal information such as email, first or last name. + * @param customerIp IP address of the customer, as captured by your integration. Ensure your integration passes the customer's IP, not your own. Used for fraud recovery and other important analytics. (optional) + * @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. (optional) + * @param adsRequest (optional) + * @throws ExpediaGroupApiErrorException + * @return AdsResponse + */ + @Throws( + ExpediaGroupApiErrorException::class + ) + @JvmOverloads + @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdsOperation)")) + fun getAds( + customerId: kotlin.String, + customerIp: kotlin.String? = + null, + customerSessionId: kotlin.String? = + null, + adsRequest: AdsRequest? = + null + ): AdsResponse = getAdsWithResponse(customerId, customerIp, customerSessionId, adsRequest).data + + /** + * + * Returns relevant ads. + * @param customerId An obfuscated unique identifier for each customer. This should not contain any personal information such as email, first or last name. + * @param customerIp IP address of the customer, as captured by your integration. Ensure your integration passes the customer's IP, not your own. Used for fraud recovery and other important analytics. (optional) + * @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. (optional) + * @param adsRequest (optional) + * @throws ExpediaGroupApiErrorException + * @return a [Response] object with a body of type AdsResponse + */ + @Throws( + ExpediaGroupApiErrorException::class + ) + @JvmOverloads + @Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdsOperation)")) + fun getAdsWithResponse( + customerId: kotlin.String, + customerIp: kotlin.String? = + null, + customerSessionId: kotlin.String? = + null, + adsRequest: AdsRequest? = + null + ): Response { + try { + return GlobalScope.future(Dispatchers.IO) { + kgetAdsWithResponse(customerId, customerIp, customerSessionId, adsRequest) + }.get() + } catch (exception: Exception) { + exception.handle() + } + } + /** * Get property room rates and availability * Returns rates on available room types for specified properties (maximum of 250 properties per request). The response includes rate details such as promos, whether the rate is refundable, cancellation penalties and a full price breakdown to meet the price display requirements for your market. _Note_: If there are no available rooms, the response will be an empty array. * Multiple rooms of the same type may be requested by including multiple instances of the `occupancy` parameter. * The `nightly` array includes each individual night's charges. When the total price includes fees, charges, or adjustments that are not divided by night, these amounts will be included in the `stay` rate array, which details charges applied to the entire stay (each check-in). diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AdsRequest.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AdsRequest.kt new file mode 100644 index 0000000000..e0707dd2af --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AdsRequest.kt @@ -0,0 +1,229 @@ +/* + * 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 + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.rapid.models.GuestCounts +import com.expediagroup.sdk.rapid.models.PageType +import com.expediagroup.sdk.rapid.models.ProductLine +import com.expediagroup.sdk.rapid.models.SalesChannel +import com.expediagroup.sdk.rapid.models.SortType +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern + +/** + * + * @param countryCode The country code of the traveler's point of sale, in ISO 3166-1 alpha-2 format. This should represent the country where the shopping transaction is taking place. For more information see: https://www.iso.org/obp/ui/#search/code/ + * @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/ Language Options: https://developers.expediagroup.com/docs/rapid/resources/reference/language-options + * @param salesChannel + * @param pageType + * @param searchProductLines The product lines the traveler is searching for. lodging indicates hotel_standalone. lodging and flight would indicate a lodging_package. + * @param checkin Check-in date, in ISO 8601 format (YYYY-MM-DD). + * @param checkout Check-out date, in ISO 8601 format (YYYY-MM-DD). + * @param occupancies Each array item represents guests of one room. + * @param propertyIds The list of property ids eligible for returning sponsored listings. These are the potential candidates that could be included in the auction. + * @param sortType + * @param focusedPropertyId The property id the ranking of ads should be based on. Examples of a focused property are a customer searching for a specific property and it being pinned to the top of a page or the property recommendation carousel based on the currently or previously viewed property. The focused_property_id itself will be excluded from the ranking. + * @param experimentIds A list of experiment ids that can be used for testing different behavior. The ids can be associated with different tests ran by the publisher and are completely arbitrary. The experiment ids will be included reports back to the publisher. + */ +data class AdsRequest( + // The country code of the traveler's point of sale, in ISO 3166-1 alpha-2 format. This should represent the country where the shopping transaction is taking place. For more information see: https://www.iso.org/obp/ui/#search/code/ + @JsonProperty("country_code") + @field:Pattern(regexp = "^[A-Z]{2}$") + @field:NotNull + @field:Valid + val countryCode: kotlin.String, + // 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/ Language Options: https://developers.expediagroup.com/docs/rapid/resources/reference/language-options + @JsonProperty("language") + @field:Pattern(regexp = "^[a-z]{2}-[A-Z]{2}$") + @field:NotNull + @field:Valid + val language: kotlin.String, + @JsonProperty("sales_channel") + @field:NotNull + @field:Valid + val salesChannel: SalesChannel, + @JsonProperty("page_type") + @field:NotNull + @field:Valid + val pageType: PageType, + // The product lines the traveler is searching for. lodging indicates hotel_standalone. lodging and flight would indicate a lodging_package. + @JsonProperty("search_product_lines") + @field:NotNull + @field:Valid + val searchProductLines: kotlin.collections + .List< + ProductLine + >, + // Check-in date, in ISO 8601 format (YYYY-MM-DD). + @JsonProperty("checkin") + @field:Pattern(regexp = "^\\d{4}-\\d{2}-\\d{2}$") + @field:NotNull + @field:Valid + val checkin: kotlin.String, + // Check-out date, in ISO 8601 format (YYYY-MM-DD). + @JsonProperty("checkout") + @field:Pattern(regexp = "^\\d{4}-\\d{2}-\\d{2}$") + @field:NotNull + @field:Valid + val checkout: kotlin.String, + // Each array item represents guests of one room. + @JsonProperty("occupancies") + @field:NotNull + @field:Valid + val occupancies: kotlin.collections + .List< + GuestCounts + >, + // The list of property ids eligible for returning sponsored listings. These are the potential candidates that could be included in the auction. + @JsonProperty("property_ids") + @field:NotNull + @field:Valid + val propertyIds: kotlin.collections + .List< + kotlin.String + >, + @JsonProperty("sort_type") + @field:Valid + val sortType: SortType? = null, + // The property id the ranking of ads should be based on. Examples of a focused property are a customer searching for a specific property and it being pinned to the top of a page or the property recommendation carousel based on the currently or previously viewed property. The focused_property_id itself will be excluded from the ranking. + @JsonProperty("focused_property_id") + @field:Valid + val focusedPropertyId: kotlin.String? = null, + // A list of experiment ids that can be used for testing different behavior. The ids can be associated with different tests ran by the publisher and are completely arbitrary. The experiment ids will be included reports back to the publisher. + @JsonProperty("experiment_ids") + @field:Valid + val experimentIds: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var countryCode: kotlin.String? = null, + private var language: kotlin.String? = null, + private var salesChannel: SalesChannel? = null, + private var pageType: PageType? = null, + private var searchProductLines: kotlin.collections.List? = null, + private var checkin: kotlin.String? = null, + private var checkout: kotlin.String? = null, + private var occupancies: kotlin.collections.List? = null, + private var propertyIds: kotlin.collections.List? = null, + private var sortType: SortType? = null, + private var focusedPropertyId: kotlin.String? = null, + private var experimentIds: kotlin.collections.List? = null + ) { + fun countryCode(countryCode: kotlin.String) = apply { this.countryCode = countryCode } + + fun language(language: kotlin.String) = apply { this.language = language } + + fun salesChannel(salesChannel: SalesChannel) = apply { this.salesChannel = salesChannel } + + fun pageType(pageType: PageType) = apply { this.pageType = pageType } + + fun searchProductLines(searchProductLines: kotlin.collections.List) = apply { this.searchProductLines = searchProductLines } + + fun checkin(checkin: kotlin.String) = apply { this.checkin = checkin } + + fun checkout(checkout: kotlin.String) = apply { this.checkout = checkout } + + fun occupancies(occupancies: kotlin.collections.List) = apply { this.occupancies = occupancies } + + fun propertyIds(propertyIds: kotlin.collections.List) = apply { this.propertyIds = propertyIds } + + fun sortType(sortType: SortType?) = apply { this.sortType = sortType } + + fun focusedPropertyId(focusedPropertyId: kotlin.String?) = apply { this.focusedPropertyId = focusedPropertyId } + + fun experimentIds(experimentIds: kotlin.collections.List?) = apply { this.experimentIds = experimentIds } + + fun build(): AdsRequest { + val instance = + AdsRequest( + countryCode = countryCode!!, + language = language!!, + salesChannel = salesChannel!!, + pageType = pageType!!, + searchProductLines = searchProductLines!!, + checkin = checkin!!, + checkout = checkout!!, + occupancies = occupancies!!, + propertyIds = propertyIds!!, + sortType = sortType, + focusedPropertyId = focusedPropertyId, + experimentIds = experimentIds + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AdsRequest) { + 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( + countryCode = countryCode!!, + language = language!!, + salesChannel = salesChannel!!, + pageType = pageType!!, + searchProductLines = searchProductLines!!, + checkin = checkin!!, + checkout = checkout!!, + occupancies = occupancies!!, + propertyIds = propertyIds!!, + sortType = sortType, + focusedPropertyId = focusedPropertyId, + experimentIds = experimentIds + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AdsResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AdsResponse.kt new file mode 100644 index 0000000000..1fd3150486 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/AdsResponse.kt @@ -0,0 +1,93 @@ +/* + * 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 + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.rapid.models.SponsoredListing +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param sponsoredListings + */ +data class AdsResponse( + @JsonProperty("sponsored_listings") + @field:Valid + val sponsoredListings: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var sponsoredListings: kotlin.collections.List? = null + ) { + fun sponsoredListings(sponsoredListings: kotlin.collections.List?) = apply { this.sponsoredListings = sponsoredListings } + + fun build(): AdsResponse { + val instance = + AdsResponse( + sponsoredListings = sponsoredListings + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AdsResponse) { + 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( + sponsoredListings = sponsoredListings + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Beacons.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Beacons.kt new file mode 100644 index 0000000000..6adf458a00 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Beacons.kt @@ -0,0 +1,115 @@ +/* + * 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 + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.rapid.models.Link1 +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull + +/** + * + * @param view + * @param render + * @param click + */ +data class Beacons( + @JsonProperty("view") + @field:NotNull + @field:Valid + val view: Link1, + @JsonProperty("render") + @field:NotNull + @field:Valid + val render: Link1, + @JsonProperty("click") + @field:NotNull + @field:Valid + val click: Link1 +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var view: Link1? = null, + private var render: Link1? = null, + private var click: Link1? = null + ) { + fun view(view: Link1) = apply { this.view = view } + + fun render(render: Link1) = apply { this.render = render } + + fun click(click: Link1) = apply { this.click = click } + + fun build(): Beacons { + val instance = + Beacons( + view = view!!, + render = render!!, + click = click!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Beacons) { + 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( + view = view!!, + render = render!!, + click = click!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Creative.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Creative.kt new file mode 100644 index 0000000000..98f16590fb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Creative.kt @@ -0,0 +1,93 @@ +/* + * 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 + +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.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The image to be rendered for the sponsored listing. + * @param image + */ +data class Creative( + @JsonProperty("image") + @field:Valid + val image: Image1? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var image: Image1? = null + ) { + fun image(image: Image1?) = apply { this.image = image } + + fun build(): Creative { + val instance = + Creative( + image = image + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Creative) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestCounts.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestCounts.kt new file mode 100644 index 0000000000..e9159de8df --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/GuestCounts.kt @@ -0,0 +1,98 @@ +/* + * 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 + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Validation + +/** + * + * @param adultCount + * @param childCount + */ +data class GuestCounts( + @JsonProperty("adult_count") + val adultCount: kotlin.Int, + @JsonProperty("child_count") + val childCount: kotlin.Int? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adultCount: kotlin.Int? = null, + private var childCount: kotlin.Int? = null + ) { + fun adultCount(adultCount: kotlin.Int) = apply { this.adultCount = adultCount } + + fun childCount(childCount: kotlin.Int?) = apply { this.childCount = childCount } + + fun build(): GuestCounts { + val instance = + GuestCounts( + adultCount = adultCount!!, + childCount = childCount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: GuestCounts) { + 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( + adultCount = adultCount!!, + childCount = childCount + ) +} 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 ec822ae30e..8677fe2ad7 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 @@ -31,30 +31,26 @@ package com.expediagroup.sdk.rapid.models import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.rapid.models.Link1 import com.fasterxml.jackson.annotation.JsonProperty import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator import javax.validation.Valid import javax.validation.Validation /** - * - * @param url The url of the image. - * @param width The width of the image. - * @param height The height of the image. + * An individual image. + * @param caption The image caption. + * @param link The url to retrieve the image. */ data class Image1( - // The url of the image. - @JsonProperty("url") - @field:Valid - val url: kotlin.String? = null, - // The width of the image. - @JsonProperty("width") + // The image caption. + @JsonProperty("caption") @field:Valid - val width: kotlin.String? = null, - // The height of the image. - @JsonProperty("height") + val caption: kotlin.String? = null, + // The url to retrieve the image. + @JsonProperty("link") @field:Valid - val height: kotlin.String? = null + val link: kotlin.collections.Map? = null ) { companion object { @JvmStatic @@ -62,22 +58,18 @@ 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 caption: kotlin.String? = null, + private var link: kotlin.collections.Map? = null ) { - fun url(url: kotlin.String?) = apply { this.url = url } - - fun width(width: kotlin.String?) = apply { this.width = width } + fun caption(caption: kotlin.String?) = apply { this.caption = caption } - fun height(height: kotlin.String?) = apply { this.height = height } + fun link(link: kotlin.collections.Map?) = apply { this.link = link } fun build(): Image1 { val instance = Image1( - url = url, - width = width, - height = height + caption = caption, + link = link ) validate(instance) @@ -106,8 +98,7 @@ data class Image1( fun toBuilder() = Builder( - url = url, - width = width, - height = height + caption = caption, + link = link ) } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link1.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link1.kt new file mode 100644 index 0000000000..498973c685 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/Link1.kt @@ -0,0 +1,113 @@ +/* + * 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 + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * An individual link. + * @param method The request method used to access the link. + * @param href The URL for the link. This can be absolute or relative. Placeholders will be need to be populated by the client. + * @param expires If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. + */ +data class Link1( + // The request method used to access the link. + @JsonProperty("method") + @field:Valid + val method: kotlin.String? = null, + // The URL for the link. This can be absolute or relative. Placeholders will be need to be populated by the client. + @JsonProperty("href") + @field:Valid + val href: kotlin.String? = null, + // If the link expires, this will be the UTC date the link will expire, in ISO 8601 format. + @JsonProperty("expires") + @field:Valid + val expires: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var method: kotlin.String? = null, + private var href: kotlin.String? = null, + private var expires: kotlin.String? = null + ) { + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun expires(expires: kotlin.String?) = apply { this.expires = expires } + + fun build(): Link1 { + val instance = + Link1( + method = method, + href = href, + expires = expires + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Link1) { + 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( + method = method, + href = href, + expires = expires + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PageType.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PageType.kt new file mode 100644 index 0000000000..280d09e82c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/PageType.kt @@ -0,0 +1,51 @@ +/* + * 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 + +import com.fasterxml.jackson.annotation.JsonProperty + +/** +* The type of page the ads will be rendered on. +* Values: OTHER,SEARCH_RESULTS,DETAILS,CONFIRMATION +*/ +enum class PageType(val value: kotlin.String) { + @JsonProperty("other") + OTHER("other"), + + @JsonProperty("search_results") + SEARCH_RESULTS("search_results"), + + @JsonProperty("details") + DETAILS("details"), + + @JsonProperty("confirmation") + CONFIRMATION("confirmation") +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ProductLine.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ProductLine.kt new file mode 100644 index 0000000000..2735a8fa0b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/ProductLine.kt @@ -0,0 +1,48 @@ +/* + * 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 + +import com.fasterxml.jackson.annotation.JsonProperty + +/** +* The different types of travel product lines a traveler can search for. +* Values: CAR,FLIGHT,LODGING +*/ +enum class ProductLine(val value: kotlin.String) { + @JsonProperty("car") + CAR("car"), + + @JsonProperty("flight") + FLIGHT("flight"), + + @JsonProperty("lodging") + LODGING("lodging") +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SalesChannel.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SalesChannel.kt new file mode 100644 index 0000000000..4267e91f14 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SalesChannel.kt @@ -0,0 +1,48 @@ +/* + * 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 + +import com.fasterxml.jackson.annotation.JsonProperty + +/** +* The sales channel for the request. +* Values: WEBSITE,MOBILE_APP,MOBILE_WEB +*/ +enum class SalesChannel(val value: kotlin.String) { + @JsonProperty("website") + WEBSITE("website"), + + @JsonProperty("mobile_app") + MOBILE_APP("mobile_app"), + + @JsonProperty("mobile_web") + MOBILE_WEB("mobile_web") +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SortType.kt similarity index 52% rename from code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt rename to code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SortType.kt index dfd4edb11d..d172260a96 100644 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetBookingReceiptOperationLink.kt +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SortType.kt @@ -13,4 +13,30 @@ * 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 + +import com.fasterxml.jackson.annotation.JsonProperty +/** +* The sort type selected for the organic results. +* Values: DEFAULT +*/ +enum class SortType(val value: kotlin.String) { + @JsonProperty("default") + DEFAULT("default") +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SponsoredListing.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SponsoredListing.kt new file mode 100644 index 0000000000..d7cbe67c73 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/models/SponsoredListing.kt @@ -0,0 +1,138 @@ +/* + * 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 + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.rapid.models.Beacons +import com.expediagroup.sdk.rapid.models.Creative +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull + +/** + * The sponsored listing which advertises a specific property. + * @param rank The sponsored listing should adhere to the rank and not be re-ranked. This field is 0-based. + * @param propertyId + * @param beacons + * @param creative + * @param adTransparencyUrl The url used to retrieve digital services act information regarding why the ad was selected. + */ +data class SponsoredListing( + // The sponsored listing should adhere to the rank and not be re-ranked. This field is 0-based. + @JsonProperty("rank") + @field:Min(0) + @field:NotNull + @field:Valid + val rank: kotlin.Int, + @JsonProperty("property_id") + @field:NotNull + @field:Valid + val propertyId: kotlin.String, + @JsonProperty("beacons") + @field:NotNull + @field:Valid + val beacons: Beacons, + @JsonProperty("creative") + @field:Valid + val creative: Creative? = null, + // The url used to retrieve digital services act information regarding why the ad was selected. + @JsonProperty("ad_transparency_url") + @field:Valid + val adTransparencyUrl: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var rank: kotlin.Int? = null, + private var propertyId: kotlin.String? = null, + private var beacons: Beacons? = null, + private var creative: Creative? = null, + private var adTransparencyUrl: kotlin.String? = null + ) { + fun rank(rank: kotlin.Int) = apply { this.rank = rank } + + fun propertyId(propertyId: kotlin.String) = apply { this.propertyId = propertyId } + + fun beacons(beacons: Beacons) = apply { this.beacons = beacons } + + fun creative(creative: Creative?) = apply { this.creative = creative } + + fun adTransparencyUrl(adTransparencyUrl: kotlin.String?) = apply { this.adTransparencyUrl = adTransparencyUrl } + + fun build(): SponsoredListing { + val instance = + SponsoredListing( + rank = rank!!, + propertyId = propertyId!!, + beacons = beacons!!, + creative = creative, + adTransparencyUrl = adTransparencyUrl + ) + + validate(instance) + + return instance + } + + private fun validate(instance: SponsoredListing) { + 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( + rank = rank!!, + propertyId = propertyId!!, + beacons = beacons!!, + creative = creative, + adTransparencyUrl = adTransparencyUrl + ) +} 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 f533fb1b43..43f076c988 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 @@ -135,6 +135,19 @@ internal object ErrorObjectMapper { DefaultHttpStatusCodeRange ) ), + Pair( + "getAds", + 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 + ) + ), Pair( "getAvailability", listOf( 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 823e71ab0b..467dee6e03 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 da9d89770b..baa0f05e6d 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 52030271e5..069059f063 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 37f0d30ea6..d7cd767948 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 fcda1a7d9f..062433dbd5 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdsOperation.kt new file mode 100644 index 0000000000..c630477908 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdsOperation.kt @@ -0,0 +1,43 @@ +/* + * 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. + */ +package com.expediagroup.sdk.rapid.operations + +import com.expediagroup.sdk.core.model.Operation +import com.expediagroup.sdk.rapid.models.AdsRequest + +/** + * + * @property requestBody [AdsRequest] + * @property params [GetAdsOperationParams] + */ +class GetAdsOperation( + params: GetAdsOperationParams, + requestBody: AdsRequest? +) : Operation< + AdsRequest + >( + "/v1/ads", + "POST", + "getAds", + requestBody, + params + ) { + @Deprecated("Switch order of arguments", ReplaceWith("Operation(params: GetAdsOperationParams, requestBody: AdsRequest?)")) + constructor( + requestBody: AdsRequest?, + params: GetAdsOperationParams + ) : this(params, requestBody) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdsOperationParams.kt new file mode 100644 index 0000000000..6a538c57ea --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetAdsOperationParams.kt @@ -0,0 +1,132 @@ +/* + * 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. + */ +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. 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. + * @property customerId An obfuscated unique identifier for each customer. This should not contain any personal information such as email, first or last name. + */ +@JsonDeserialize(builder = GetAdsOperationParams.Builder::class) +data class GetAdsOperationParams( + @field:Valid + val customerIp: kotlin.String? = + null, + @field:Valid + val customerSessionId: kotlin.String? = + null, + @field:NotNull + @field:Valid + val customerId: kotlin.String +) : + OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + @JsonProperty("Customer-Ip") private var customerIp: kotlin.String? = null, + @JsonProperty("Customer-Session-Id") private var customerSessionId: kotlin.String? = null, + @JsonProperty("Customer-Id") private var customerId: 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. Used for fraud recovery and other important analytics. + */ + fun customerIp(customerIp: kotlin.String) = apply { this.customerIp = customerIp } + + /** + * @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. + */ + fun customerSessionId(customerSessionId: kotlin.String) = apply { this.customerSessionId = customerSessionId } + + /** + * @param customerId An obfuscated unique identifier for each customer. This should not contain any personal information such as email, first or last name. + */ + fun customerId(customerId: kotlin.String) = apply { this.customerId = customerId } + + fun build(): GetAdsOperationParams { + val params = + GetAdsOperationParams( + customerIp = customerIp, + customerSessionId = customerSessionId, + customerId = customerId!! + ) + + validate(params) + + return params + } + + private fun validate(params: GetAdsOperationParams) { + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + customerIp = customerIp, + customerSessionId = customerSessionId, + customerId = customerId + ) + + override fun getHeaders(): Headers = + Headers.build { + customerIp?.let { + append("Customer-Ip", it) + } + customerSessionId?.let { + append("Customer-Session-Id", it) + } + customerId?.let { + append("Customer-Id", it) + } + append("Accept", "application/json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + } + + override fun getPathParams(): Map = + buildMap { + } +} 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 a104b143d6..2467ef25cf 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetCalendarAvailabilityOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetChainReferenceOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetInactivePropertiesOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 7fde799240..759f25143b 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyCatalogFileOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyContentFileOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 4a6b6bc392..dff7d14741 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetPropertyGuestReviewsOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetRegionsOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 488cb077db..1e22901927 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/GetReservationOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/PostGeographyOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 9e11bf0147..aa3affc5ba 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 e30e661b49..fbd0d15574 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 bd69be4098..89183e12dc 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 c13410ba11..981d52a635 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 6728361c14..612fae343d 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 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.expediagroup.sdk.rapid.operations import com.expediagroup.sdk.rapid.models.Link 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestTestNotificationOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - 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 deleted file mode 100644 index dfd4edb11d..0000000000 --- a/code/src/main/kotlin/com/expediagroup/sdk/rapid/operations/RequestUndeliveredNotificationsOperationLink.kt +++ /dev/null @@ -1,16 +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. - */ - diff --git a/code/transformedSpecs.yaml b/code/transformedSpecs.yaml index 6c7b114e26..ecb3836db5 100644 --- a/code/transformedSpecs.yaml +++ b/code/transformedSpecs.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.0.3 info: title: Rapid description: EPS Rapid V3 @@ -21,6 +21,8 @@ tags: description: Retrieve existing itineraries or cancel existing rooms. - name: Notifications description: Requests test notifications and undelivered notifications. + - name: Ad Delivery + description: API to retrieve ads paths: /v3/properties/content: get: @@ -9195,7 +9197,7 @@ paths: special_request: Please give me extra towels. smoking: false rate: - id: "035943984" + id: 35943984 merchant_of_record: expedia refundable: true cancel_refund: @@ -9358,7 +9360,7 @@ paths: special_request: Please give me extra towels. smoking: false rate: - id: "035943984" + id: 35943984 merchant_of_record: expedia refundable: true cancel_refund: @@ -9502,7 +9504,7 @@ paths: value: "244.70" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -9590,7 +9592,7 @@ paths: value: "123.45" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -9683,7 +9685,7 @@ paths: special_request: Please give me extra towels. smoking: false rate: - id: "035943984" + id: 35943984 merchant_of_record: expedia refundable: true cancel_refund: @@ -9830,7 +9832,7 @@ paths: value: "244.70" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -9918,7 +9920,7 @@ paths: value: "123.45" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -10825,7 +10827,7 @@ paths: smoking: false loyalty_id: ABC123 rate: - id: "035943984" + id: 35943984 merchant_of_record: expedia refundable: true cancel_refund: @@ -10969,7 +10971,7 @@ paths: special_request: Please give me extra towels. smoking: false rate: - id: "035943984" + id: 35943984 merchant_of_record: expedia refundable: true cancel_refund: @@ -11116,7 +11118,7 @@ paths: value: "244.70" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -11204,7 +11206,7 @@ paths: value: "123.45" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -11297,7 +11299,7 @@ paths: special_request: Please give me extra towels. smoking: false rate: - id: "035943984" + id: 35943984 merchant_of_record: expedia refundable: true cancel_refund: @@ -11444,7 +11446,7 @@ paths: value: "244.70" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -11532,7 +11534,7 @@ paths: value: "123.45" currency: USD rate: - id: "035943984" + id: 35943984 promotions: value_adds: 123abc: @@ -15175,6 +15177,141 @@ paths: type: path security: - rapidAuth: [] + /v1/ads: + post: + tags: + - getAds + description: Returns relevant ads. + operationId: getAds + parameters: + - 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. Used for + fraud recovery and other important analytics. + required: false + schema: + type: string + example: 192.168.123.132 + - 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. + required: false + schema: + type: string + example: 7f9a24ea-2145-4819-a7b7-2a4cbe1165ab + - name: Customer-Id + in: header + description: An obfuscated unique identifier for each customer. This should not + contain any personal information such as email, first or last name. + required: true + schema: + type: string + example: 7f9a24ea-2145-4819-a7b7-2a4cbe1165ab + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AdsRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/AdsResponse" + "400": + description: Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: invalid_input + message: An invalid request was sent in, please check the nested errors for + details. + errors: + - type: language.required + message: "A language is required. Supported languages are: [ar-SA, cs-CZ, + da-DK, de-DE, el-GR, en-US, es-ES, es-MX, fi-FI, fr-CA, + fr-FR, hr-HR, hu-HU, id-ID, is-IS, it-IT, ja-JP, lt-LT, + ko-KR, ms-MY, nb-NO, nl-NL, pl-PL, pt-BR, pt-PT, ru-RU, + sk-SK, sv-SE, th-TH, tr-TR, uk-UA, vi-VN, zh-CN, zh-TW]" + fields: + - name: language + type: request + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: request_unauthenticated + message: Data required to authenticate your request is missing or + inaccurate. Ensure that your request follows the guidelines + in our documentation. + fields: + - name: apikey + type: header + value: jaj3982k239dka328e + - name: signature + type: header + value: 129d75332614a5bdbe0c7eb540e95a65f9d85a5b53dabb38d19b37fad6312a2bd25c12ee5a82831d55112087e1b + - name: timestamp + type: header + value: "198284729" + - name: servertimestamp + type: server + value: "198284729" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: request_unauthorized + message: Your request could not be authorized. + "426": + description: Upgrade Required + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: upgrade_required + message: This service requires the use of TLS. + "429": + description: Too Many Requests + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: too_many_requests + message: You have reached your capacity for this type of request. + "500": + description: Unknown Internal Error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: unknown_internal_error + message: An internal server error has occurred. + "503": + description: Service Unavailable + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + example: + type: service_unavailable + message: This service is currently unavailable. components: schemas: PropertyContent: @@ -17013,7 +17150,7 @@ components: - type: customer_card number: "4111111111111111" security_code: "123" - expiration_month: "08" + expiration_month: 8 expiration_year: "2025" billing_contact: given_name: John @@ -17889,7 +18026,7 @@ components: - type: customer_card number: "4111111111111111" security_code: "123" - expiration_month: "08" + expiration_month: 8 expiration_year: "2025" billing_contact: given_name: John @@ -18086,7 +18223,7 @@ components: - type: customer_card number: "4111111111111111" security_code: "123" - expiration_month: "08" + expiration_month: 8 expiration_year: "2025" billing_contact: given_name: John @@ -18621,6 +18758,238 @@ components: type: string description: The url linking to the full text terms and conditions. example: https://www.expedia.com/terms_and_conditions + PageType: + type: string + enum: + - other + - search_results + - details + - confirmation + example: search_results + description: The type of page the ads will be rendered on. + SortType: + type: string + enum: + - default + example: default + description: The sort type selected for the organic results. + ProductLine: + type: string + enum: + - car + - flight + - lodging + example: lodging + description: The different types of travel product lines a traveler can search for. + SalesChannel: + type: string + enum: + - website + - mobile_app + - mobile_web + example: mobile_app + description: The sales channel for the request. + GuestCounts: + type: object + required: + - adult_count + properties: + adult_count: + type: integer + format: int32 + example: 2 + child_count: + type: integer + format: int32 + example: 1 + AdsRequest: + type: object + required: + - sales_channel + - language + - country_code + - page_type + - search_product_lines + - checkin + - checkout + - occupancies + - property_ids + properties: + country_code: + type: string + example: US + pattern: ^[A-Z]{2}$ + description: "The country code of the traveler's point of sale, in ISO 3166-1 + alpha-2 format. This should represent the country where the + shopping transaction is taking place. For more information see: + https://www.iso.org/obp/ui/#search/code/" + language: + type: string + example: en-US + pattern: ^[a-z]{2}-[A-Z]{2}$ + 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/ Language + Options: + https://developers.expediagroup.com/docs/rapid/resources/reference/\ + language-options" + sales_channel: + $ref: "#/components/schemas/SalesChannel" + page_type: + $ref: "#/components/schemas/PageType" + sort_type: + $ref: "#/components/schemas/SortType" + search_product_lines: + example: + - lodging + - flight + description: The product lines the traveler is searching for. lodging indicates + hotel_standalone. lodging and flight would indicate a + lodging_package. + type: array + items: + $ref: "#/components/schemas/ProductLine" + checkin: + type: string + description: Check-in date, in ISO 8601 format (YYYY-MM-DD). + pattern: ^\d{4}-\d{2}-\d{2}$ + example: 2025-01-01 + checkout: + type: string + description: Check-out date, in ISO 8601 format (YYYY-MM-DD). + pattern: ^\d{4}-\d{2}-\d{2}$ + example: 2025-01-05 + occupancies: + type: array + items: + $ref: "#/components/schemas/GuestCounts" + description: Each array item represents guests of one room. + focused_property_id: + type: string + description: The property id the ranking of ads should be based on. Examples of + a focused property are a customer searching for a specific property + and it being pinned to the top of a page or the property + recommendation carousel based on the currently or previously viewed + property. The focused_property_id itself will be excluded from the + ranking. + example: "23433" + property_ids: + type: array + items: + type: string + example: + - "2717582" + - "16159546" + - "2025453" + description: The list of property ids eligible for returning sponsored listings. + These are the potential candidates that could be included in the + auction. + experiment_ids: + description: A list of experiment ids that can be used for testing different + behavior. The ids can be associated with different tests ran by the + publisher and are completely arbitrary. The experiment ids will be + included reports back to the publisher. + type: array + items: + type: string + example: + - "324324.1" + - "2423423.3" + - "3242343.5" + additionalProperties: false + Image1: + type: object + properties: + caption: + type: string + description: The image caption. + example: Hotel Lobby + link: + type: object + additionalProperties: + $ref: "#/components/schemas/Link1" + description: The url to retrieve the image. + example: + 70px: + method: GET + href: https://i.travelapi.com/hotels/1000000/20000/15300/15237/bef1b976_t.jpg + description: An individual image. + Creative: + type: object + properties: + image: + $ref: "#/components/schemas/Image1" + description: The image to be rendered for the sponsored listing. + additionalProperties: false + Link1: + type: object + properties: + method: + type: string + description: The request method used to access the link. + example: POST + href: + type: string + description: The URL for the link. This can be absolute or relative. + Placeholders will be need to be populated by the client. + example: https://advertising.expedia.com/sponsoredcontent/v1/View?position=[position]&data=AAAAAQAAAAEAAA + expires: + type: string + description: If the link expires, this will be the UTC date the link will + expire, in ISO 8601 format. + example: 2025-07-10 15:00:00.000 + description: An individual link. + Beacons: + type: object + required: + - view + - render + - click + properties: + view: + $ref: "#/components/schemas/Link1" + render: + $ref: "#/components/schemas/Link1" + click: + $ref: "#/components/schemas/Link1" + SponsoredListing: + description: The sponsored listing which advertises a specific property. + type: object + required: + - rank + - property_id + - beacons + properties: + rank: + type: integer + pattern: int32 + minimum: 0 + example: 1 + description: The sponsored listing should adhere to the rank and not be + re-ranked. This field is 0-based. + property_id: + type: string + example: "13243534" + creative: + $ref: "#/components/schemas/Creative" + beacons: + $ref: "#/components/schemas/Beacons" + ad_transparency_url: + type: string + example: https://advertising.expedia.com/sponsoredcontent/dsa/id=123 + description: The url used to retrieve digital services act information regarding + why the ad was selected. + additionalProperties: false + AdsResponse: + type: object + properties: + sponsored_listings: + type: array + items: + $ref: "#/components/schemas/SponsoredListing" + additionalProperties: false parameters: AcceptHeader: name: Accept