diff --git a/.github/workflows/generate-and-publish-sdk-sources.yaml b/.github/workflows/generate-and-publish-sdk-sources.yaml index 430f639fb..94208ea84 100644 --- a/.github/workflows/generate-and-publish-sdk-sources.yaml +++ b/.github/workflows/generate-and-publish-sdk-sources.yaml @@ -12,7 +12,7 @@ on: jobs: generate-and-publish-sources: - uses: ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-full-workflow.yaml@v20241013 + uses: ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-full-workflow.yaml@nanssari/validations secrets: inherit with: name: xap @@ -20,3 +20,4 @@ jobs: transformations: "--headers key --operationIdsToTags" repository: 'ExpediaGroup/xap-java-sdk' ref: ${{ github.head_ref || github.ref_name }} + sdk_repo_ref: 'nanssari/validations' diff --git a/code/LICENSE-HEADER.txt b/code/LICENSE-HEADER.txt new file mode 100644 index 000000000..732a2da66 --- /dev/null +++ b/code/LICENSE-HEADER.txt @@ -0,0 +1,13 @@ +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. \ No newline at end of file diff --git a/code/README.md b/code/README.md new file mode 100644 index 000000000..ff08fb5a3 --- /dev/null +++ b/code/README.md @@ -0,0 +1,14 @@ +# Welcome to the xap-sdk SDK! + +## Usage +```xml + + com.expediagroup + xap-sdk + 0.0.18-SNAPSHOT + +``` + +## License + +This project is licensed under the Apache License v2.0 - see the [LICENSE](LICENSE) for details. diff --git a/code/pom.xml b/code/pom.xml new file mode 100644 index 000000000..10fbf53ea --- /dev/null +++ b/code/pom.xml @@ -0,0 +1,874 @@ + + + 4.0.0 + com.expediagroup + xap-sdk + 0.0.18-SNAPSHOT + EG xap-sdk for Java + EG xap-sdk v0.0.18-SNAPSHOT + https://github.com/ExpediaGroup/test-sdk + 2022 + jar + + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + Expedia Group Committers + Expedia Group + https://expediagroup.com + + + + + scm:git:git@github.com:ExpediaGroup/test-sdk.git + scm:git:git@github.com:ExpediaGroup/test-sdk.git + https://github.com/ExpediaGroup/test-sdk/ + + + + + oss-sonatype + Sonatype Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + oss-sonatype + Sonatype Nexus Snapshots Repository + https://oss.sonatype.org/content/repositories/snapshots + + + + + 1.8 + 8 + + UTF-8 + UTF-8 + + 3.8.0 + 1.8.0 + + 0.90 + com.expediagroup.sdk + + ${project.version} + ${project.artifactId} + + + 3.13.0 + 3.8.1 + 3.5.0 + 3.4.2 + 3.3.1 + 3.6.0 + 3.3.1 + 3.5.2 + 3.6.0 + 3.4.0 + 0.8.12 + 1.9.20 + + 1.2.1 + 4.6 + 1.6.0 + 2.0.21 + 1.9.0 + 2.3.13 + 0.26.0 + 2.0.16 + 1.7.0 + 3.2.7 + + + + + + + org.jetbrains.kotlin + kotlin-bom + ${kotlin.version} + pom + import + + + org.jetbrains.kotlinx + kotlinx-coroutines-bom + ${kotlinx.coroutines.version} + pom + import + + + io.ktor + ktor-bom + ${ktor.version} + pom + import + + + org.jetbrains.kotlinx + atomicfu-jvm + ${kotlin-atomic.version} + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + + + + com.fasterxml.jackson + jackson-bom + 2.18.1 + pom + import + + + com.squareup.okio + okio-jvm + 3.9.1 + + + org.jetbrains + annotations + 26.0.1 + + + org.hibernate.validator + hibernate-validator + 6.2.5.Final + + + com.fasterxml.jackson.core + jackson-annotations + 2.18.1 + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + false + + @@ + + + + + include-domain-helpers + generate-sources + + copy-resources + + + ${basedir}/src/main/kotlin/com/expediagroup/sdk/domain/xap + + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + analyze + + analyze + + + true + true + + + + + + org.codehaus.mojo + flatten-maven-plugin + + all + true + true + bom + true + + + + + + + + ${flatten.maven.plugin.version} + + + flatten + process-resources + + flatten + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + attach-test-jar + + test-jar + + + + + true + + + true + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + -parameters + -XDcompilePolicy=simple + + + + + + default-compile + none + + + + default-testCompile + none + + + kotlin-java-compile + compile + + compile + + + + kotlin-java-test-compile + test-compile + + testCompile + + + + + + org.codehaus.mojo + properties-maven-plugin + ${properties.maven.plugin.version} + + + generate-resources + + write-project-properties + + + ${project.build.outputDirectory}/sdk.properties + + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + compile-kotlin + + compile + + + + ${project.basedir}/src/main/kotlin + + ${java.release} + + + + test-compile-kotlin + + test-compile + + + + ${project.basedir}/src/test/kotlin + + ${java.release} + + + + + + kotlinx-serialization + + + + + org.jetbrains.kotlin + kotlin-maven-serialization + ${kotlin.version} + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + add-kotlin-sources + generate-sources + + add-source + + + + + ${project.basedir}/src/main/kotlin + + + + + + add-kotlin-test-sources + generate-sources + + add-test-source + + + + + ${project.basedir}/src/test/kotlin + + + + + + get-the-year + + timestamp-property + + + current.year + yyyy + + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + + shade + + + true + true + true + + + + + + org.hibernate + ${shadePrefix}.dependencies.org.hibernate + + + + + org.jetbrains.kotlin:* + org.jetbrains.kotlinx:* + org.slf4j:slf4j-api + + + + + + + + + org.jetbrains.dokka + dokka-maven-plugin + + + ${project.basedir}/src/main/kotlin/com/expediagroup/sdk/xap + ${project.basedir}/src/main/kotlin/com/expediagroup/sdk/domain/xap + + + + org.jetbrains.dokka + kotlin-as-java-plugin + ${dokka-plugin.version} + + + org.jetbrains.dokka + versioning-plugin + ${dokka-plugin.version} + + + + + ${project.version} + ${dokka-old-versions.location} + + + true + + + + prepare-package + + dokka + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-pom-standards + validate + + enforce + + + + + + + + + ${minimum.jdk.version} + + + ${minimum.maven.version} + + + true + Snapshot dependencies must be resolved before releasing + + + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-plugin.version} + + ${project.build.directory}/jacoco.exec + ${project.build.directory}/jacoco + + + + instrument-coverage + initialize + + prepare-agent + + + + coverage-report + prepare-package + + report + + + + coverage-check + verify + + check + + + + + CLASS + + *Test + + + + INSTRUCTION + COVEREDRATIO + ${minimum.code.coverage} + + + BRANCH + COVEREDRATIO + ${minimum.code.coverage} + + + + + + + + + + + exec-maven-plugin + org.codehaus.mojo + + + delete-empty-files + process-sources + + exec + + + find + + src + -type + f + -empty + -print + -delete + + + + + + + + com.github.gantsign.maven + ktlint-maven-plugin + ${ktlint-plugin.version} + + + format + + format + + + + + + + + com.mycila + license-maven-plugin + ${maven.licence.plugin.version} + + + ${current.year} + Expedia, Inc. + + + +
./LICENSE-HEADER.txt
+ + **/*.kt + +
+
+
+ + + add-license-header + process-sources + + format + + + +
+
+
+ + + + org.hibernate.validator + hibernate-validator + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + runtime + + + org.jetbrains + annotations + + + org.jetbrains.kotlin + kotlin-stdlib + + + io.ktor + ktor-serialization-jackson-jvm + + + com.fasterxml.jackson.core + jackson-databind + + + io.ktor + ktor-client-core-jvm + + + io.ktor + ktor-client-okhttp-jvm + + + io.ktor + ktor-client-auth-jvm + + + io.ktor + ktor-client-content-negotiation-jvm + + + io.ktor + ktor-http-jvm + + + io.ktor + ktor-utils-jvm + + + io.ktor + ktor-client-logging-jvm + + + org.jetbrains.kotlinx + kotlinx-coroutines-core-jvm + + + io.ktor + ktor-serialization-jvm + + + io.ktor + ktor-client-encoding-jvm + + + + org.slf4j + slf4j-api + + + + org.jetbrains.kotlinx + atomicfu-jvm + + + + org.apache.commons + commons-lang3 + 3.14.0 + + + + org.apache.commons + commons-text + 1.12.0 + + + + com.ebay.ejmask + ejmask-api + 1.0.3 + + + + com.ebay.ejmask + ejmask-extensions + 1.0.3 + + + + + + release + + true + false + true + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven.gpg.plugin.version} + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${maven.nexus-staging.plugin.version} + true + + oss-sonatype + https://oss.sonatype.org/ + true + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/jacoco.exec + + + **/PerformanceTest.java + @{argLine} + + + + + + maven-jar-plugin + ${maven-jar-plugin.version} + + + + javadoc + ${project.basedir}/target/site/apidocs + **/* + ${project.build.finalName} + + pack-javadoc + package + + jar + + + + + + + org.jetbrains.dokka + dokka-maven-plugin + + + ${project.basedir}/src/main/kotlin/com/expediagroup/sdk/xap + + + + org.jetbrains.dokka + kotlin-as-java-plugin + ${dokka-plugin.version} + + + org.jetbrains.dokka + versioning-plugin + ${dokka-plugin.version} + + + + + ${project.version} + ${dokka-old-versions.location} + + + + + + prepare-package + + javadocJar + + + + + + + + +
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 new file mode 100644 index 000000000..c1b903440 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseRapidClient.kt @@ -0,0 +1,57 @@ +/* + * 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.core.client + +import com.expediagroup.sdk.core.configuration.RapidClientConfiguration +import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import io.ktor.client.HttpClient +import io.ktor.client.engine.HttpClientEngine + +/** + * The integration point between the SDK Core and the product SDKs. + * + * @param httpClientEngine The HTTP client engine to use. + * @param clientConfiguration The configuration for the client. + */ +abstract class BaseRapidClient( + namespace: String, + clientConfiguration: RapidClientConfiguration, + httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE +) : Client(namespace) { + private val _configurationProvider: ConfigurationProvider = + ConfigurationCollector.create( + clientConfiguration.toProvider(), + RapidConfigurationProvider + ) + private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.SIGNATURE, httpClientEngine) + + init { + finalize() + } + + override val configurationProvider: ConfigurationProvider + get() = _configurationProvider + + override val httpClient: HttpClient + get() = _httpClient + + /** A [BaseRapidClient] builder. */ + @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients. + abstract class Builder> : Client.Builder() +} 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 new file mode 100644 index 000000000..b3f550c53 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt @@ -0,0 +1,57 @@ +/* + * 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.core.client + +import com.expediagroup.sdk.core.configuration.XapClientConfiguration +import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +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 + +/** + * The integration point between the SDK Core and the product SDKs. + * + * @param httpClientEngine The HTTP client engine to use. + * @param clientConfiguration The configuration for the client. + */ +abstract class BaseXapClient( + namespace: String, + clientConfiguration: XapClientConfiguration, + httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE +) : Client(namespace) { + private val _configurationProvider: ConfigurationProvider = + ConfigurationCollector.create( + clientConfiguration.toProvider(), + XapConfigurationProvider + ) + private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BASIC, httpClientEngine) + + init { + finalize() + } + + override val configurationProvider: ConfigurationProvider + get() = _configurationProvider + + override val httpClient: HttpClient + get() = _httpClient + + /** A [BaseXapClient] builder. */ + @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients. + abstract class Builder> : Client.Builder() +} 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 new file mode 100644 index 000000000..dd8e7e166 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt @@ -0,0 +1,302 @@ +/* + * 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.core.client + +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.constant.ConfigurationName +import com.expediagroup.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider.getMissingRequiredConfigurationMessage +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.contract.Contract +import com.expediagroup.sdk.core.contract.adhereTo +import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupConfigurationException +import com.expediagroup.sdk.core.model.getTransactionId +import com.expediagroup.sdk.core.plugin.Hooks +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationHookFactory +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationPlugin +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import com.expediagroup.sdk.core.plugin.encoding.EncodingConfiguration +import com.expediagroup.sdk.core.plugin.encoding.EncodingPlugin +import com.expediagroup.sdk.core.plugin.exception.ExceptionHandlingConfiguration +import com.expediagroup.sdk.core.plugin.exception.ExceptionHandlingPlugin +import com.expediagroup.sdk.core.plugin.hooks +import com.expediagroup.sdk.core.plugin.httptimeout.HttpTimeoutConfiguration +import com.expediagroup.sdk.core.plugin.httptimeout.HttpTimeoutPlugin +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory +import com.expediagroup.sdk.core.plugin.logging.LoggingConfiguration +import com.expediagroup.sdk.core.plugin.logging.LoggingPlugin +import com.expediagroup.sdk.core.plugin.plugins +import com.expediagroup.sdk.core.plugin.request.DefaultRequestConfiguration +import com.expediagroup.sdk.core.plugin.request.DefaultRequestPlugin +import com.expediagroup.sdk.core.plugin.serialization.SerializationConfiguration +import com.expediagroup.sdk.core.plugin.serialization.SerializationPlugin +import io.ktor.client.HttpClient +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.engine.okhttp.OkHttp +import io.ktor.client.statement.HttpResponse +import io.ktor.client.statement.request +import okhttp3.Dispatcher + +// Create a Dispatcher with limits +val dispatcher = + Dispatcher().apply { + maxRequests = 10000 // Maximum number of concurrent requests + maxRequestsPerHost = 1000 + } + +val DEFAULT_HTTP_CLIENT_ENGINE: HttpClientEngine = + OkHttp.create { + config { + eventListener(OkHttpEventListener) + dispatcher(dispatcher) + } + } + +/** + * The base integration point between the SDK Core and the product SDKs. + */ +abstract class Client( + namespace: String, + environmentProvider: EnvironmentProvider = DefaultEnvironmentProvider(namespace) +) : EnvironmentProvider by environmentProvider { + private val httpHandler = DefaultHttpHandler(environmentProvider) + + companion object { + private val log = ExpediaGroupLoggerFactory.getLogger(this::class.java) + } + + /** The configuration provider to use. */ + abstract val configurationProvider: ConfigurationProvider + + /** The HTTP client to perform requests with. */ + abstract val httpClient: HttpClient + + internal fun buildHttpClient( + configurationProvider: ConfigurationProvider, + authenticationType: AuthenticationStrategy.AuthenticationType, + httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE + ): HttpClient = + HttpClient(httpClientEngine) { + val httpClientConfig = this + + val key: String = configurationProvider.key ?: fireMissingConfigurationIssue(ConfigurationName.KEY) + 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 maskedLoggingHeaders: Set = configurationProvider.maskedLoggingHeaders ?: setOf() + val maskedLoggingBodyFields: Set = configurationProvider.maskedLoggingBodyFields ?: setOf() + + val authenticationConfiguration = + AuthenticationConfiguration.from( + httpClientConfig, + Credentials.from(key, secret), + authEndpoint, + authenticationType + ) + + plugins { + use(LoggingPlugin).with(LoggingConfiguration.from(httpClientConfig, maskedLoggingHeaders, maskedLoggingBodyFields)) + use(SerializationPlugin).with(SerializationConfiguration.from(httpClientConfig)) + 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(ExceptionHandlingPlugin).with(ExceptionHandlingConfiguration.from(httpClientConfig)) + } + + hooks { + use(AuthenticationHookFactory).with(authenticationConfiguration) + } + } + + /** Throw an exception if the configuration is missing. */ + private fun fireMissingConfigurationIssue(configurationKey: String): Nothing = throw ExpediaGroupConfigurationException(getMissingRequiredConfigurationMessage(configurationKey)) + + private fun isNotSuccessfulResponse(response: HttpResponse) = response.status.value !in Constant.SUCCESSFUL_STATUS_CODES_RANGE + + @Suppress("unused") // This is used by the product SDKs. + suspend fun throwIfError(response: HttpResponse, operationId: String) { + if (isNotSuccessfulResponse(response)) { + log.info(LoggingMessageProvider.getResponseUnsuccessfulMessage(response.status, response.request.headers.getTransactionId())) + throwServiceException(response, operationId) + } + } + + abstract suspend fun throwServiceException( + response: HttpResponse, + operationId: String + ) + + suspend fun performGet(url: String): HttpResponse = httpHandler.performGet(httpClient, url) + + /** + * A [Client] builder. + */ + abstract class Builder> { + /** Sets the API key to use for authentication. */ + protected var key: String? = null + + /** Sets the API secret to use for authentication. */ + protected var secret: String? = null + + /** 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 + + /** Sets tne body fields to be masked in logging. */ + protected var maskedLoggingBodyFields: Set? = null + + /** Sets the API key to use for authentication. + * + * @param key The API key to use for authentication. + * @return The [Builder] instance. + */ + fun key(key: String): SELF { + this.key = key + return self() + } + + /** Sets the API secret to use for authentication. + * + * @param secret The API secret to use for authentication. + * @return The [Builder] instance. + */ + fun secret(secret: String): SELF { + this.secret = secret + return self() + } + + /** Sets the API endpoint to use for requests. + * + * @param endpoint The API endpoint to use for requests. + * @return The [Builder] instance. + */ + fun endpoint(endpoint: String): SELF { + this.endpoint = endpoint.adhereTo(Contract.TRAILING_SLASH) + log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.ENDPOINT, endpoint)) + return self() + } + + /** + * 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. + * + * @param milliseconds The request timeout to be used. + * @return The [Builder] instance. + */ + fun requestTimeout(milliseconds: Long): SELF { + this.requestTimeout = milliseconds + log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.REQUEST_TIMEOUT_MILLIS, milliseconds.toString())) + return self() + } + + /** + * 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). + * + * @param milliseconds The connection timeout to be used. + * @return The [Builder] instance. + */ + fun connectionTimeout(milliseconds: Long): SELF { + this.connectionTimeout = milliseconds + log.info(LoggingMessageProvider.getRuntimeConfigurationProviderMessage(ConfigurationName.CONNECTION_TIMEOUT_MILLIS, milliseconds.toString())) + return self() + } + + /** + * 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). + * + * @param milliseconds The socket timeout to be used. + * @return The [Builder] instance. + */ + fun socketTimeout(milliseconds: Long): SELF { + this.socketTimeout = milliseconds + 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() + } + + /** + * 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 + } +} + +/** Executes the hooks for the client. */ +fun T.finalize() = Hooks.execute(this) 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 new file mode 100644 index 000000000..b2ed3e342 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/ClientHelpers.kt @@ -0,0 +1,21 @@ +/* + * 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.core.client + +/** Handy utils and helpers for a client. */ +abstract class ClientHelpers( + 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 new file mode 100644 index 000000000..a0a76bcaf --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/Environment.kt @@ -0,0 +1,45 @@ +/* + * 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.core.client + +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.model.Properties +import com.expediagroup.sdk.core.model.TransactionId +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())) +} + +class DefaultEnvironmentProvider( + namespace: String +) : EnvironmentProvider { + private val properties = Properties.from(javaClass.classLoader.getResource("sdk.properties")!!) + private val javaVersion = System.getProperty("java.version") + private val operatingSystemName = System.getProperty("os.name") + private val operatingSystemVersion = System.getProperty("os.version") + private val userAgent = "expediagroup-sdk-java-$namespace/${properties["sdk-version"]!!} (Java $javaVersion; $operatingSystemName $operatingSystemVersion)" + + @Suppress("MemberVisibilityCanBePrivate") + override fun HttpRequestBuilder.appendHeaders(extraHeaders: Map) { + with(headers) { + append(HttpHeaders.UserAgent, userAgent) + append(HeaderKey.X_SDK_TITLE, properties["sdk-title"]!!) + extraHeaders.forEach { (key, value) -> append(key, value) } + } + } +} 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 new file mode 100644 index 000000000..cf28f895d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt @@ -0,0 +1,70 @@ +/* + * 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.core.client + +import com.expediagroup.sdk.core.configuration.ExpediaGroupClientConfiguration +import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import io.ktor.client.HttpClient +import io.ktor.client.engine.HttpClientEngine + +/** + * The integration point between the SDK Core and the product SDKs. + * + * @param httpClientEngine The HTTP client engine to use. + * @param clientConfiguration The configuration for the client. + */ +abstract class ExpediaGroupClient( + namespace: String, + clientConfiguration: ExpediaGroupClientConfiguration, + httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE +) : Client(namespace) { + private val _configurationProvider: ConfigurationProvider = + ConfigurationCollector.create( + clientConfiguration.toProvider(), + ExpediaGroupConfigurationProvider + ) + private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BEARER, httpClientEngine) + + init { + finalize() + } + + override val configurationProvider: ConfigurationProvider + get() = _configurationProvider + + override val httpClient: HttpClient + get() = _httpClient + + /** An [ExpediaGroupClient] builder. */ + @Suppress("unused") // This is used by the generated SDK clients. + abstract class Builder> : Client.Builder() { + /** Sets the API auth endpoint to use for requests. */ + protected var authEndpoint: String? = null + + /** Sets the API auth endpoint to use for requests. + * + * @param authEndpoint The API auth endpoint to use for requests. + * @return The [Builder] instance. + */ + fun authEndpoint(authEndpoint: String): SELF { + this.authEndpoint = authEndpoint + return self() + } + } +} 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 new file mode 100644 index 000000000..28101ef39 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/HttpHandler.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.core.client + +import io.ktor.client.HttpClient +import io.ktor.client.request.request +import io.ktor.client.request.url +import io.ktor.client.statement.HttpResponse +import io.ktor.http.HttpMethod + +internal interface HttpHandler { + suspend fun performGet( + httpClient: HttpClient, + link: String + ): HttpResponse +} + +internal class DefaultHttpHandler( + private val environmentProvider: EnvironmentProvider +) : HttpHandler, EnvironmentProvider by environmentProvider { + override suspend fun performGet( + httpClient: HttpClient, + 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 new file mode 100644 index 000000000..25dbd741a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/client/OkHttpEventListener.kt @@ -0,0 +1,185 @@ +/* + * 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.core.client + +import com.expediagroup.sdk.core.constant.HeaderKey +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory +import okhttp3.Call +import okhttp3.Connection +import okhttp3.EventListener +import okhttp3.Handshake +import okhttp3.Protocol +import okhttp3.Request +import okhttp3.Response +import java.io.IOException +import java.net.InetSocketAddress +import java.net.Proxy + +object OkHttpEventListener : EventListener() { + private val log = ExpediaGroupLoggerFactory.getLogger(this::class.java) + + fun Call.getTransactionId() = request().headers[HeaderKey.TRANSACTION_ID] + + override fun callStart(call: Call) { + super.callStart(call) + log.debug("Call start for transaction-id: [${call.getTransactionId()}]") + } + + override fun callEnd(call: Call) { + super.callEnd(call) + log.debug("Call end for transaction-id: [${call.getTransactionId()}]") + } + + override fun callFailed( + call: Call, + ioe: IOException + ) { + super.callFailed(call, ioe) + log.debug("Call failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}") + } + + override fun canceled(call: Call) { + super.canceled(call) + log.debug("Call canceled for transaction-id: [${call.getTransactionId()}]") + } + + override fun connectStart( + call: Call, + inetSocketAddress: InetSocketAddress, + proxy: Proxy + ) { + super.connectStart(call, inetSocketAddress, proxy) + log.debug("Connect start for transaction-id: [${call.getTransactionId()}]") + } + + override fun connectEnd( + call: Call, + inetSocketAddress: InetSocketAddress, + proxy: Proxy, + protocol: Protocol? + ) { + super.connectEnd(call, inetSocketAddress, proxy, protocol) + log.debug("Connect end for transaction-id: [${call.getTransactionId()}]") + } + + override fun connectFailed( + call: Call, + inetSocketAddress: InetSocketAddress, + proxy: Proxy, + protocol: Protocol?, + ioe: IOException + ) { + super.connectFailed(call, inetSocketAddress, proxy, protocol, ioe) + log.debug("Connect failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}") + } + + override fun connectionAcquired( + call: Call, + connection: Connection + ) { + super.connectionAcquired(call, connection) + log.debug("Connection acquired for transaction-id: [${call.getTransactionId()}]") + } + + override fun connectionReleased( + call: Call, + connection: Connection + ) { + super.connectionReleased(call, connection) + log.debug("Connection released for transaction-id: [${call.getTransactionId()}]") + } + + override fun secureConnectStart(call: Call) { + super.secureConnectStart(call) + log.debug("Secure connect start for transaction-id: [${call.getTransactionId()}]") + } + + override fun secureConnectEnd( + call: Call, + handshake: Handshake? + ) { + super.secureConnectEnd(call, handshake) + log.debug("Secure connect end for transaction-id: [${call.getTransactionId()}]") + } + + override fun requestHeadersStart(call: Call) { + super.requestHeadersStart(call) + log.debug("Sending request headers start for transaction-id: [${call.getTransactionId()}]") + } + + override fun requestHeadersEnd( + call: Call, + request: Request + ) { + super.requestHeadersEnd(call, request) + log.debug("Sending request headers end for transaction-id: [${call.getTransactionId()}]") + } + + override fun requestBodyStart(call: Call) { + super.requestBodyStart(call) + log.debug("Sending request body start for transaction-id: [${call.getTransactionId()}]") + } + + override fun requestBodyEnd( + call: Call, + byteCount: Long + ) { + super.requestBodyEnd(call, byteCount) + log.debug("Sending request body end for transaction-id: [${call.getTransactionId()}] with byte count: $byteCount") + } + + override fun requestFailed( + call: Call, + ioe: IOException + ) { + super.requestFailed(call, ioe) + log.debug("Request failed for transaction-id: [${call.getTransactionId()}] with exception message: ${ioe.message}") + } + + override fun responseHeadersStart(call: Call) { + super.responseHeadersStart(call) + log.debug("Receiving response headers start for transaction-id: [${call.getTransactionId()}]") + } + + override fun responseHeadersEnd( + call: Call, + response: Response + ) { + super.responseHeadersEnd(call, response) + log.debug("Receiving response headers end for transaction-id: [${call.getTransactionId()}]") + } + + override fun responseBodyStart(call: Call) { + super.responseBodyStart(call) + log.debug("Receiving response body start for transaction-id: [${call.getTransactionId()}]") + } + + override fun responseBodyEnd( + call: Call, + byteCount: Long + ) { + super.responseBodyEnd(call, byteCount) + log.debug("Receiving response body end for transaction-id: [${call.getTransactionId()}] with byte count: $byteCount") + } + + override fun responseFailed( + call: Call, + ioe: IOException + ) { + super.responseFailed(call, ioe) + log.debug("Receiving response failed for transaction-id: [${call.getTransactionId()}] with exception message: ${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 new file mode 100644 index 000000000..d8dfdedd9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ClientConfiguration.kt @@ -0,0 +1,42 @@ +/* + * 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.core.configuration + +import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider + +interface ClientConfiguration { + val key: String? + val secret: String? + val endpoint: String? + val requestTimeout: Long? + val connectionTimeout: Long? + val socketTimeout: Long? + val maskedLoggingHeaders: Set? + val maskedLoggingBodyFields: Set? + + /** Build a [RuntimeConfigurationProvider] from a [ClientConfiguration]. */ + fun toProvider(): RuntimeConfigurationProvider = + RuntimeConfigurationProvider( + key = key, + secret = secret, + endpoint = endpoint, + requestTimeout = requestTimeout, + connectionTimeout = connectionTimeout, + socketTimeout = socketTimeout, + maskedLoggingHeaders = maskedLoggingHeaders, + maskedLoggingBodyFields = maskedLoggingBodyFields + ) +} 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 new file mode 100644 index 000000000..1e249b810 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/Credentials.kt @@ -0,0 +1,45 @@ +/* + * 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.core.configuration + +/** + * A pair of key-secret. + * + * @property key the client key + * @property secret the client secret + */ +internal data class Credentials( + val key: String, + val secret: String +) { + /** + * A factory of [Credentials]. + */ + companion object Factory { + /** + * Create a [Credentials] object. + * + * @param key Client key. + * @param secret Client secret. + * @return ClientCredentials object. + */ + @JvmStatic + fun from( + key: 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 new file mode 100644 index 000000000..e5289d9e9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/ExpediaGroupClientConfiguration.kt @@ -0,0 +1,47 @@ +/* + * 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.core.configuration + +import com.expediagroup.sdk.core.client.ExpediaGroupClient +import com.expediagroup.sdk.core.configuration.provider.RuntimeConfigurationProvider + +/** + * Configuration for the [ExpediaGroupClient]. + * + * @property key The API key to use for authentication. + * @property secret The API secret to use for authentication. + * @property endpoint The API endpoint to use for requests. + * @property requestTimeout The request timeout to be used in milliseconds. + * @property connectionTimeout The connection timeout to be used in milliseconds. + * @property socketTimeout The socket timeout to be used in milliseconds. + * @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. + */ +data class ExpediaGroupClientConfiguration( + override val key: String? = null, + override val secret: String? = null, + override val endpoint: String? = null, + override val requestTimeout: Long? = null, + override val connectionTimeout: Long? = null, + override val socketTimeout: Long? = null, + override val maskedLoggingHeaders: Set? = null, + override val maskedLoggingBodyFields: Set? = 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 new file mode 100644 index 000000000..cac3637de --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/RapidClientConfiguration.kt @@ -0,0 +1,41 @@ +/* + * 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.core.configuration + +import com.expediagroup.sdk.core.client.BaseRapidClient + +/** + * Configuration for the [BaseRapidClient]. + * + * @property key The API key to use for authentication. + * @property secret The API secret to use for authentication. + * @property endpoint The API endpoint to use for requests. + * @property requestTimeout The request timeout to be used in milliseconds. + * @property connectionTimeout The connection timeout to be used in milliseconds. + * @property socketTimeout The socket timeout to be used in milliseconds. + * @property maskedLoggingHeaders The headers to be masked in logging. + * @property maskedLoggingBodyFields The body fields to be masked in logging. + */ +data class RapidClientConfiguration( + override val key: String? = null, + override val secret: String? = null, + override val endpoint: String? = null, + override val requestTimeout: Long? = null, + override val connectionTimeout: Long? = null, + override val socketTimeout: Long? = null, + override val maskedLoggingHeaders: Set? = null, + override val maskedLoggingBodyFields: Set? = 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 new file mode 100644 index 000000000..f17f9d778 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/XapClientConfiguration.kt @@ -0,0 +1,41 @@ +/* + * 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.core.configuration + +import com.expediagroup.sdk.core.client.BaseXapClient + +/** + * Configuration for the [BaseXapClient]. + * + * @property key The API key to use for authentication. + * @property secret The API secret to use for authentication. + * @property endpoint The API endpoint to use for requests. + * @property requestTimeout The request timeout to be used in milliseconds. + * @property connectionTimeout The connection timeout to be used in milliseconds. + * @property socketTimeout The socket timeout to be used in milliseconds. + * @property maskedLoggingHeaders The headers to be masked in logging. + * @property maskedLoggingBodyFields The body fields to be masked in logging. + */ +data class XapClientConfiguration( + override val key: String? = null, + override val secret: String? = null, + override val endpoint: String? = null, + override val requestTimeout: Long? = null, + override val connectionTimeout: Long? = null, + override val socketTimeout: Long? = null, + override val maskedLoggingHeaders: Set? = null, + override val maskedLoggingBodyFields: Set? = 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 new file mode 100644 index 000000000..a83d40fbe --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationCollector.kt @@ -0,0 +1,73 @@ +/* + * 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.core.configuration.collector + +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider +import com.expediagroup.sdk.core.constant.ConfigurationName.AUTH_ENDPOINT +import com.expediagroup.sdk.core.constant.ConfigurationName.CONFIGURATION_COLLECTOR +import com.expediagroup.sdk.core.constant.ConfigurationName.CONNECTION_TIMEOUT_MILLIS +import com.expediagroup.sdk.core.constant.ConfigurationName.ENDPOINT +import com.expediagroup.sdk.core.constant.ConfigurationName.KEY +import com.expediagroup.sdk.core.constant.ConfigurationName.MASKED_LOGGING_BODY_FIELDS +import com.expediagroup.sdk.core.constant.ConfigurationName.MASKED_LOGGING_HEADERS +import com.expediagroup.sdk.core.constant.ConfigurationName.REQUEST_TIMEOUT_MILLIS +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 + +/** + * Configuration collector that collects configuration from all available providers. + * + * @param providers A configuration providers queue. + */ +internal class ConfigurationCollector private constructor(providers: ConfigurationProviderQueue) : ConfigurationProvider { + override val name: String = CONFIGURATION_COLLECTOR + + companion object Factory { + private val log = ExpediaGroupLoggerFactory.getLogger(ConfigurationCollector::class.java) + + /** + * Creates a new [ConfigurationCollector] with the given [providerQueue]. + * + * @param providerQueue the [ConfigurationProviderQueue] to use. + * @return a new [ConfigurationCollector] with the given [providerQueue]. + */ + fun create(providerQueue: ConfigurationProviderQueue): ConfigurationCollector = ConfigurationCollector(providerQueue) + + /** + * Creates a new [ConfigurationCollector] with the given [providers]. + * + * @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())) + } + + override val key: String? = providers.firstWith { it.key }.also { it?.log(KEY) }?.retrieve() + override val secret: String? = providers.firstWith { it.secret }.also { it?.log(SECRET) }?.retrieve() + 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 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() + + 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 new file mode 100644 index 000000000..3a964739c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/collector/ConfigurationProviderQueue.kt @@ -0,0 +1,47 @@ +/* + * 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.core.configuration.collector + +import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider + +/** + * A queue of all configuration providers. + * + * @property providers List of configuration providers + */ +internal class ConfigurationProviderQueue private constructor(private val providers: List) { + /** Returns the first provider in the queue. */ + fun first(): ConfigurationProvider? = providers.firstOrNull() + + /** Returns the first provider in the queue that matches the given [predicate]. */ + 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) } + + companion object { + /** Builds a [ConfigurationProviderQueue] from the given [providers]. + * + * @param providers the providers to build the queue from. + * @return a [ConfigurationProviderQueue] instance. + */ + fun from(providers: List) = ConfigurationProviderQueue(providers.toList()) + } +} + +internal data class ProvidedConfiguration(private val configuration: T, val providerName: String) { + fun retrieve(): T = configuration +} 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 new file mode 100644 index 000000000..ac7f7ea43 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ConfigurationProvider.kt @@ -0,0 +1,58 @@ +/* + * 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.core.configuration.provider + +import com.expediagroup.sdk.core.constant.Constant + +/** + * A configuration provider that can be used to provide configuration values. + */ +interface ConfigurationProvider { + /** The name of the provider. */ + val name: String + + /** The API key to use for authentication. */ + val key: String? + get() = Constant.EMPTY_STRING + + /** The API secret to use for authentication. */ + val secret: String? + get() = Constant.EMPTY_STRING + + /** The API endpoint to use for requests. */ + val endpoint: String? + + /** The API endpoint to use for authentication. */ + val authEndpoint: String? + get() = Constant.EMPTY_STRING + + /** The time period from the start of the request to the completion of the response. */ + val requestTimeout: Long? + + /** The time period from the start of the request to the establishment of the connection with the server. */ + val connectionTimeout: Long? + + /** The maximum period of inactivity between two consecutive data packets. */ + val socketTimeout: Long? + + /** The headers to be masked in logging. */ + val maskedLoggingHeaders: Set? + get() = setOf() + + /** The body fields to be masked in logging.*/ + val maskedLoggingBodyFields: Set? + get() = setOf() +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProvider.kt new file mode 100644 index 000000000..75295aeb2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/ExpediaGroupConfigurationProvider.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.core.configuration.provider + +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.authEndpoint +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.connectionTimeout +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.endpoint +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.name +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.requestTimeout +import com.expediagroup.sdk.core.configuration.provider.ExpediaGroupConfigurationProvider.socketTimeout +import com.expediagroup.sdk.core.constant.Constant + +/** + * Default configuration provider for ExpediaGroup. + * + * @property name The name of the provider. + * @property endpoint The API endpoint to use for requests. + * @property authEndpoint The API endpoint to use for authentication. + * @property requestTimeout The API response timeout to use for requests. + * @property connectionTimeout The connection timeout to be used in milliseconds. + * @property socketTimeout The socket timeout to be used in milliseconds. + */ +internal object ExpediaGroupConfigurationProvider : ConfigurationProvider { + override val name: String = "ExpediaGroup Configuration Provider" + override val endpoint: String = "https://api.expediagroup.com/" + override val authEndpoint: String = "${endpoint}identity/oauth2/v3/token/" + override val requestTimeout: Long = Constant.INFINITE_TIMEOUT + override val connectionTimeout: Long = Constant.TEN_SECONDS_IN_MILLIS + override val socketTimeout: Long = Constant.FIFTEEN_SECONDS_IN_MILLIS +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProvider.kt new file mode 100644 index 000000000..bc8e06c60 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RapidConfigurationProvider.kt @@ -0,0 +1,40 @@ +/* + * 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.core.configuration.provider + +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.connectionTimeout +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.endpoint +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.name +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.requestTimeout +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.socketTimeout +import com.expediagroup.sdk.core.constant.Constant + +/** + * Default configuration provider for Rapid. + * + * @property name The name of the provider. + * @property endpoint The API endpoint to use for requests. + * @property requestTimeout The API response timeout to use for requests. + * @property connectionTimeout The connection timeout to use for requests. + * @property socketTimeout The socket timeout to use for requests. + */ +internal object RapidConfigurationProvider : ConfigurationProvider { + override val name: String = "Rapid Configuration Provider" + override val endpoint: String = "https://api.ean.com/v3" + override val requestTimeout: Long = Constant.INFINITE_TIMEOUT + override val connectionTimeout: Long = Constant.TEN_SECONDS_IN_MILLIS + override val socketTimeout: Long = Constant.FIFTEEN_SECONDS_IN_MILLIS +} 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 new file mode 100644 index 000000000..fd72dc58e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/RuntimeConfigurationProvider.kt @@ -0,0 +1,45 @@ +/* + * 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.core.configuration.provider + +import com.expediagroup.sdk.core.constant.ConfigurationName.RUNTIME_CONFIGURATION_PROVIDER + +/** + * A runtime-built configuration provider. + * + * @property name The name of the provider. + * @property key The API key to use for authentication. + * @property secret The API secret to use for authentication. + * @property endpoint The API endpoint to use for requests. + * @property authEndpoint The API endpoint to use for authentication. + * @property requestTimeout The request timeout to be used in milliseconds. + * @property connectionTimeout The connection timeout to be used in milliseconds. + * @property socketTimeout The socket timeout to be used in milliseconds. + * @property maskedLoggingHeaders The headers to be masked in logging. + * @property maskedLoggingBodyFields The body fields to be masked in logging. + */ +data class RuntimeConfigurationProvider( + override val name: String = RUNTIME_CONFIGURATION_PROVIDER, + override val key: String? = null, + override val secret: String? = null, + override val endpoint: String? = null, + override val authEndpoint: String? = null, + override val requestTimeout: Long? = null, + override val connectionTimeout: Long? = null, + override val socketTimeout: Long? = null, + override val maskedLoggingHeaders: Set? = null, + override val maskedLoggingBodyFields: Set? = null +) : ConfigurationProvider diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/XapConfigurationProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/XapConfigurationProvider.kt new file mode 100644 index 000000000..20857cce7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/XapConfigurationProvider.kt @@ -0,0 +1,40 @@ +/* + * 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.core.configuration.provider + +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.connectionTimeout +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.endpoint +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.name +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.requestTimeout +import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.socketTimeout +import com.expediagroup.sdk.core.constant.Constant + +/** + * Default configuration provider for Rapid. + * + * @property name The name of the provider. + * @property endpoint The API endpoint to use for requests. + * @property requestTimeout The API response timeout to use for requests. + * @property connectionTimeout The connection timeout to use for requests. + * @property socketTimeout The socket timeout to use for requests. + */ +internal object XapConfigurationProvider : ConfigurationProvider { + override val name: String = "XAP Configuration Provider" + override val endpoint: String = "https://apim.expedia.com" + override val requestTimeout: Long = Constant.INFINITE_TIMEOUT + override val connectionTimeout: Long = Constant.TEN_SECONDS_IN_MILLIS + override val socketTimeout: Long = Constant.FIFTEEN_SECONDS_IN_MILLIS +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Authentication.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Authentication.kt new file mode 100644 index 000000000..2b22a50e1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Authentication.kt @@ -0,0 +1,29 @@ +/* + * 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.core.constant + +internal object Authentication { + const val AUTHORIZATION_REQUEST_LOCK_DELAY = 20L + const val BEARER_EXPIRY_DATE_MARGIN: Long = 10 // In seconds + + const val EAN = "EAN" + + const val BEARER = "Bearer" + + const val GRANT_TYPE = "grant_type" + + const val CLIENT_CREDENTIALS = "client_credentials" +} 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 new file mode 100644 index 000000000..0004086b7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ConfigurationName.kt @@ -0,0 +1,40 @@ +/* + * 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.core.constant + +internal object ConfigurationName { + const val KEY = "key" + + const val SECRET = "secret" + + const val ENDPOINT = "endpoint" + + const val AUTH_ENDPOINT = "auth endpoint" + + const val REQUEST_TIMEOUT_MILLIS = "request timeout in milliseconds" + + const val CONNECTION_TIMEOUT_MILLIS = "connection timeout in milliseconds" + + const val SOCKET_TIMEOUT_MILLIS = "socket timeout in milliseconds" + + const val MASKED_LOGGING_HEADERS = "masked logging headers" + + const val MASKED_LOGGING_BODY_FIELDS = "masked logging body fields" + + const val RUNTIME_CONFIGURATION_PROVIDER = "runtime configuration" + + const val CONFIGURATION_COLLECTOR = "configuration collector" +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt new file mode 100644 index 000000000..5f7a9d8c1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt @@ -0,0 +1,29 @@ +/* + * 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.core.constant + +import io.ktor.client.plugins.HttpTimeout + +internal object Constant { + const val EMPTY_STRING = "" + const val TEN_SECONDS_IN_MILLIS = 10_000L + const val FIFTEEN_SECONDS_IN_MILLIS = 15_000L + const val INFINITE_TIMEOUT = HttpTimeout.INFINITE_TIMEOUT_MS + + private const val SUCCESSFUL_STATUS_CODES_RANGE_START = 200 + private const val SUCCESSFUL_STATUS_CODES_RANGE_END = 299 + val SUCCESSFUL_STATUS_CODES_RANGE: IntRange = SUCCESSFUL_STATUS_CODES_RANGE_START..SUCCESSFUL_STATUS_CODES_RANGE_END +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ExceptionMessage.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ExceptionMessage.kt new file mode 100644 index 000000000..332204407 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/ExceptionMessage.kt @@ -0,0 +1,24 @@ +/* + * 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.core.constant + +internal object ExceptionMessage { + const val AUTHENTICATION_FAILURE = "Unable to authenticate" + + const val AUTHENTICATION_NOT_CONFIGURED_FOR_CLIENT = "Authentication is not configured" + + const val LOGGING_MASKED_FIELDS_NOT_CONFIGURED_FOR_CLIENT = "Logging masked fields is not configured" +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderKey.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderKey.kt new file mode 100644 index 000000000..425d0f5fc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderKey.kt @@ -0,0 +1,26 @@ +/* + * 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.core.constant + +internal object HeaderKey { + const val PAGINATION_TOTAL_RESULTS = "pagination-total-results" + + const val LINK = "link" + + const val TRANSACTION_ID = "Partner-Transaction-Id" + + const val X_SDK_TITLE = "x-sdk-title" +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderValue.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderValue.kt new file mode 100644 index 000000000..3c418bc74 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/HeaderValue.kt @@ -0,0 +1,20 @@ +/* + * 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.core.constant + +internal object HeaderValue { + const val GZIP = "gzip" +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Key.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Key.kt new file mode 100644 index 000000000..a7a71ca1c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/Key.kt @@ -0,0 +1,26 @@ +/* + * 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.core.constant + +internal object Key { + const val CLIENT_KEY = "client_key" + + const val CLIENT_SECRET = "client_secret" + + const val ENDPOINT = "endpoint" + + const val AUTH_ENDPOINT = "auth_endpoint" +} 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 new file mode 100644 index 000000000..f66681346 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingFields.kt @@ -0,0 +1,36 @@ +/* + * 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.core.constant + +import io.ktor.http.HttpHeaders + +internal data object LogMaskingFields { + val DEFAULT_MASKED_HEADER_FIELDS: Set = setOf(HttpHeaders.Authorization) + val DEFAULT_MASKED_BODY_FIELDS: Set = + setOf( + "cvv", + "pin", + "card_cvv", + "card_cvv2", + "card_number", + "access_token", + "security_code", + "account_number", + "card_avs_response", + "card_cvv_response", + "card_cvv2_response" + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt new file mode 100644 index 000000000..63d51c0be --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt @@ -0,0 +1,22 @@ +/* + * 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.core.constant + +internal object LogMaskingRegex { + val FIELD_REGEX = "^[a-zA-Z0-9-_]+$".toRegex() + + val NUMBER_FIELD_REGEX = "(?<=[\"']?number[\"']?:\\s?[\"'])(\\s*\\d{15,16}\\s*)(?=[\"'])".toRegex() +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggerName.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggerName.kt new file mode 100644 index 000000000..749fcd3fe --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggerName.kt @@ -0,0 +1,21 @@ +/* + * 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.core.constant + +internal object LoggerName { + const val REQUEST_BODY_LOGGER: String = "RequestBodyLogger" + const val RESPONSE_BODY_LOGGER: String = "ResponseBodyLogger" +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggingMessage.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggingMessage.kt new file mode 100644 index 000000000..50d9b3bce --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/LoggingMessage.kt @@ -0,0 +1,32 @@ +/* + * 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.core.constant + +internal object LoggingMessage { + const val LOGGING_PREFIX = "ExpediaSDK:" + + const val TOKEN_RENEWAL_IN_PROGRESS = "Renewing token" + + const val TOKEN_RENEWAL_SUCCESSFUL = "Token renewal successful" + + const val TOKEN_CLEARING_IN_PROGRESS = "Clearing tokens" + + const val TOKEN_CLEARING_SUCCESSFUL = "Tokens successfully cleared" + + const val TOKEN_EXPIRED = "Token expired or is about to expire. Request will wait until token is renewed" + + const val OMITTED = "<-- omitted -->" +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/constant/SignatureValues.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/SignatureValues.kt new file mode 100644 index 000000000..cdf04e37d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/SignatureValues.kt @@ -0,0 +1,30 @@ +/* + * 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.core.constant + +internal object SignatureValues { + const val ONE_BYTE_MASK = 0xFF + + const val INCREMENT = 0x100 + + const val RADIX = 16 + + const val API_KEY = "apikey" + + const val SIGNATURE = "signature" + + const val TIMESTAMP = "timestamp" +} 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 new file mode 100644 index 000000000..316ef3906 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/ExceptionMessageProvider.kt @@ -0,0 +1,29 @@ +/* + * 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.core.constant.provider + +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider.getTransactionIdMessage + +internal object ExceptionMessageProvider { + fun getMissingRequiredConfigurationMessage(name: String): String = "Missing required configuration: $name" + + fun getExceptionOccurredWithTransactionIdMessage( + transactionId: 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 new file mode 100644 index 000000000..475e6f4c2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt @@ -0,0 +1,20 @@ +/* + * 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.core.constant.provider + +internal object LogMaskingRegexProvider { + 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 new file mode 100644 index 000000000..f9d358ad3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LoggingMessageProvider.kt @@ -0,0 +1,49 @@ +/* + * 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.core.constant.provider + +import io.ktor.http.HttpStatusCode + +internal object LoggingMessageProvider { + fun getTokenExpiresInMessage(expiresIn: Int) = "New token expires in $expiresIn seconds" + + fun getResponseUnsuccessfulMessage( + httpStatusCode: HttpStatusCode, + transactionId: String? + ) = "Unsuccessful response [$httpStatusCode]${getTransactionIdMessage(transactionId)}" + + fun getChosenProviderMessage( + property: String, + providerName: String + ) = "Successfully loaded [$property] from [$providerName]" + + fun getRuntimeConfigurationProviderMessage( + property: String, + value: T + ) = "Setting [$property] to [$value] from runtime configuration provider" + + fun getResponseBodyMessage( + body: String, + transactionId: String? + ) = "Response Body${getTransactionIdMessage(transactionId)}: $body" + + fun getRequestBodyMessage( + body: 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 new file mode 100644 index 000000000..6527759ca --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/contract/Contract.kt @@ -0,0 +1,35 @@ +/* + * 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.core.contract + +internal typealias Operation = (String) -> String + +/** + * A contract for a specific [operation]. + * + * @property operation The operation to perform on a string. + */ +internal enum class Contract(val operation: Operation) { + TRAILING_SLASH({ if (it.endsWith("/")) it else "$it/" }) +} + +/** + * Adheres to the given [contract] on a [String]. + * + * @param contract the [Contract] to adhere to. + * @return the [String] adhering to the given [contract]. + */ +internal fun String.adhereTo(contract: Contract): String = contract.operation(this) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Headers.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Headers.kt new file mode 100644 index 000000000..93bc60783 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Headers.kt @@ -0,0 +1,26 @@ +/* + * 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.core.model + +import com.expediagroup.sdk.core.constant.HeaderKey +import io.ktor.http.Headers +import io.ktor.http.HeadersBuilder + +/** Get transaction id from headers. */ +fun Headers.getTransactionId(): String? = get(HeaderKey.TRANSACTION_ID) + +/** Get transaction id from headers builder. */ +fun HeadersBuilder.getTransactionId(): String? = get(HeaderKey.TRANSACTION_ID) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/Nothing.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Nothing.kt new file mode 100644 index 000000000..bd6863c42 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Nothing.kt @@ -0,0 +1,21 @@ +/* + * 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.core.model + +/** + * A representation of nothingness. Philosophers have debated the existence of nothing for centuries, but we have finally found it. + */ +data object Nothing 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 new file mode 100644 index 000000000..baf620810 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Operation.kt @@ -0,0 +1,27 @@ +/* + * 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.core.model + +abstract class Operation( + val url: String, + val method: String, + val operationId: String, + val requestBody: T?, + val params: OperationParams? +) { + var transactionId: TransactionId = TransactionId() + private set +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/OperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/OperationParams.kt new file mode 100644 index 000000000..c78314c41 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/OperationParams.kt @@ -0,0 +1,27 @@ +/* + * 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.core.model + +import io.ktor.http.Headers +import io.ktor.http.Parameters + +interface OperationParams { + fun getHeaders(): Headers + + fun getQueryParams(): Parameters + + fun getPathParams(): Map +} 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 new file mode 100644 index 000000000..5c93b9990 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Properties.kt @@ -0,0 +1,36 @@ +/* + * 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.core.model + +import java.io.BufferedReader +import java.io.InputStreamReader +import java.net.URL + +/** A model of "*.properties" file with some handy methods. */ +class Properties(private val data: Map) { + companion object { + /** Creates a new SdkProperties with the given data. */ + fun from(path: URL) = + Properties( + java.util.Properties().apply { + load(BufferedReader(InputStreamReader(path.openStream()))) + }.map { it.key.toString() to it.value.toString() }.toMap() + ) + } + + /** Returns the data for a given [key]. */ + operator fun get(key: String): String? = data[key] +} 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 new file mode 100644 index 000000000..d5bd9747e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/Response.kt @@ -0,0 +1,62 @@ +/* + * 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. + */ +@file:Suppress("unused") + +package com.expediagroup.sdk.core.model + +import java.util.stream.Collectors +import kotlin.collections.Map.Entry + +/** + * A Generic Response to represent the response from a service call. + * + * @property statusCode The HTTP status code of the response + * @property data The body of the response + * @property headers The headers of the response + */ +@Suppress("MemberVisibilityCanBePrivate") +open class Response( + val statusCode: Int, + val data: T, + val headers: Map> +) { + constructor(statusCode: Int, data: T, headers: Set>>) : this(statusCode, data, toHeadersMap(headers)) + + companion object { + @JvmStatic + fun toHeadersMap(headers: Set>>): Map> = + headers.stream().collect( + Collectors.toMap( + Entry>::key, + Entry>::value + ) + ) + } + + override fun toString() = "Response(statusCode=$statusCode, data=$data, headers=$headers)" + + @Deprecated("Use getData() instead", replaceWith = ReplaceWith("getData()")) + fun getBody() = data +} + +class EmptyResponse( + statusCode: Int, + headers: Map> +) : Response(statusCode, Nothing, headers) { + constructor(statusCode: Int, headers: Set>>) : this(statusCode, toHeadersMap(headers)) + + override fun toString(): String = "EmptyResponse(statusCode=$statusCode, headers=$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 new file mode 100644 index 000000000..07333147e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/TransactionId.kt @@ -0,0 +1,26 @@ +/* + * 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.core.model + +import java.util.UUID + +class TransactionId { + private var transactionId: UUID = UUID.randomUUID() + + fun peek(): UUID = transactionId + + 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 new file mode 100644 index 000000000..02fcaabd8 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExceptionUtils.kt @@ -0,0 +1,40 @@ +/* + * 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.core.model.exception + +import com.expediagroup.sdk.core.constant.provider.ExceptionMessageProvider +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceException + +/** Handles exceptions by ensuring that only instances of [ExpediaGroupException] are thrown. */ +fun Throwable.handle(): Nothing = handleWith(null) + +/** + * Handles exceptions by ensuring that only instances of [ExpediaGroupException] are thrown. + * + * @param transactionId the transaction ID to be included in the exception message, can be null. + */ +fun Throwable.handleWith(transactionId: String?): Nothing { + if (this is ExpediaGroupException) throw this + + when (val cause = this.cause) { + is ExpediaGroupException -> throw cause + else -> throw ExpediaGroupServiceException( + ExceptionMessageProvider.getExceptionOccurredWithTransactionIdMessage(transactionId, message), + this, + 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 new file mode 100644 index 000000000..cf3d8b72c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/ExpediaGroupException.kt @@ -0,0 +1,27 @@ +/* + * 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.core.model.exception + +/** + * A base exception for all ExpediaGroup exceptions. + * + * @param message An optional error message. + * @param cause An optional cause of the error. + */ +open class ExpediaGroupException( + message: String? = 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 new file mode 100644 index 000000000..4ea0b2ed2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupClientException.kt @@ -0,0 +1,29 @@ +/* + * 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.core.model.exception.client + +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException + +/** + * An exception that is thrown when a client error occurs. + * + * @param message An optional message. + * @param cause An optional cause. + */ +open class ExpediaGroupClientException( + message: String? = 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 new file mode 100644 index 000000000..63fd9ca96 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupConfigurationException.kt @@ -0,0 +1,27 @@ +/* + * 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.core.model.exception.client + +/** + * An exception that is thrown when a configuration error occurs. + * + * @param message An optional error message. + * @param cause An optional cause of the error. + */ +class ExpediaGroupConfigurationException( + message: String? = 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 new file mode 100644 index 000000000..6d06ffc87 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/ExpediaGroupInvalidFieldNameException.kt @@ -0,0 +1,24 @@ +/* + * 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.core.model.exception.client + +/** + * Thrown to indicate that one or more passed field names are invalid. + * + * @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(",")}]") diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/PropertyConstraintViolationException.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/PropertyConstraintViolationException.kt new file mode 100644 index 000000000..8f05fec81 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/client/PropertyConstraintViolationException.kt @@ -0,0 +1,27 @@ +/* + * 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.core.model.exception.client + +/** + * An exception to be thrown when a constraint on some property has been violated. + * + * @property message The detail message. + * @property constraintViolations A list of the constraint violations that occurred + */ +class PropertyConstraintViolationException( + 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 new file mode 100644 index 000000000..64e901c52 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupApiException.kt @@ -0,0 +1,23 @@ +/* + * 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.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) + +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 new file mode 100644 index 000000000..d3d6ac149 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupAuthException.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.core.model.exception.service + +import io.ktor.http.HttpStatusCode + +/** + * An exception that is thrown when an authentication error occurs. + * + * @param message The error message. + * @param cause The cause of the error. + * @param transactionId The transaction-id of the auth request. + */ +class ExpediaGroupAuthException( + message: String? = null, + cause: Throwable? = null, + transactionId: String? = null +) : ExpediaGroupServiceException(message, cause, transactionId) { + /** + * An exception that is thrown when an authentication error occurs. + * + * @param errorCode The HTTP status code of the error. + * @param message The error message. + */ + constructor( + errorCode: HttpStatusCode, + message: 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 new file mode 100644 index 000000000..e25db920b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceDefaultErrorException.kt @@ -0,0 +1,18 @@ +/* + * 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.core.model.exception.service + +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 new file mode 100644 index 000000000..130c1c19f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/exception/service/ExpediaGroupServiceException.kt @@ -0,0 +1,30 @@ +/* + * 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.core.model.exception.service + +import com.expediagroup.sdk.core.model.exception.ExpediaGroupException + +/** + * An exception that is thrown when a service error occurs. + * + * @param message An optional error message. + * @param cause An optional cause of the error. + */ +open class ExpediaGroupServiceException( + message: String? = null, + cause: Throwable? = 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 new file mode 100644 index 000000000..7fbaa064b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/Paginator.kt @@ -0,0 +1,89 @@ +/* + * 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.core.model.paging + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.HeaderKey.LINK +import com.expediagroup.sdk.core.constant.HeaderKey.PAGINATION_TOTAL_RESULTS +import com.expediagroup.sdk.core.model.Response +import io.ktor.client.statement.HttpResponse + +sealed class BasePaginator( + private val client: Client, + firstResponse: Response, + private val fallbackBody: 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? = + 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() + state = ResponseStateFactory.getState(extractLink(response.headers), client, fallbackBody, getBody) + return response + } +} + +/** + * Paginator that returns the body of the response. + * + * @param client The client to use to fetch the next response + * @param firstResponse The first response to start the paginator with + * @param getBody A function to extract the body from the response + */ +class Paginator( + client: Client, + firstResponse: Response, + fallbackBody: T, + getBody: suspend (HttpResponse) -> T +) : BasePaginator(client, firstResponse, fallbackBody, getBody) { + /** + * Returns the body of the next response. + * + * @throws NoSuchElementException if the iteration has no next element. + */ + override fun next(): T = nextResponse().data +} + +/** + * Paginator that returns the full response. + * + * @param client The client to use to fetch the next response + * @param firstResponse The first response to start the paginator with + * @param getBody A function to extract the body from the response + */ +class ResponsePaginator( + client: Client, + firstResponse: Response, + fallbackBody: T, + getBody: suspend (HttpResponse) -> T +) : BasePaginator, T>(client, firstResponse, fallbackBody, getBody) { + /** + * Returns the next response. + * + * @throws NoSuchElementException if the iteration has no next element. + */ + override fun next(): Response = nextResponse() +} 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 new file mode 100644 index 000000000..19897831d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/ResponseState.kt @@ -0,0 +1,94 @@ +/* + * 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.core.model.paging + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.HeaderValue +import com.expediagroup.sdk.core.model.Response +import com.expediagroup.sdk.core.plugin.logging.GZipEncoder.decode +import com.expediagroup.sdk.core.plugin.logging.contentEncoding +import io.ktor.client.statement.HttpResponse +import io.ktor.util.InternalAPI +import io.ktor.util.moveToByteArray +import io.ktor.utils.io.ByteReadChannel +import io.ktor.utils.io.bits.Memory +import kotlinx.coroutines.runBlocking +import java.nio.ByteBuffer + +internal interface ResponseState { + fun getNextResponse(): Response + + fun hasNext(): Boolean +} + +internal class DefaultResponseState( + private val response: Response +) : ResponseState { + override fun getNextResponse(): Response = response + + override fun hasNext(): Boolean = true +} + +internal class LastResponseState : ResponseState { + override fun getNextResponse(): Response = throw NoSuchElementException() + + 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 +) : ResponseState { + 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 = true + + 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 bodyString: String = decodedByteReadChannel.readRemaining().readText() + return bodyString + } + + @OptIn(InternalAPI::class) + private suspend fun prepareByteReadChannel(response: HttpResponse): ByteReadChannel { + val bufferSize = response.content.availableForRead + val buffer = ByteBuffer.allocate(bufferSize) + val numberOfBytesRead = response.content.peekTo(Memory(buffer), 0, 0, 0, bufferSize.toLong()).toInt() + val byteReadChannel = ByteReadChannel(buffer.moveToByteArray(), 0, numberOfBytesRead) + return byteReadChannel + } +} + +internal class ResponseStateFactory { + companion object { + fun getState( + link: String?, + client: Client, + fallbackBody: T, + 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 new file mode 100644 index 000000000..9a688c6b2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Hook.kt @@ -0,0 +1,75 @@ +/* + * 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.core.plugin + +import com.expediagroup.sdk.core.client.Client + +/** + * A helper to build a hook. + */ +internal interface HookBuilder { + fun build(configs: C) +} + +/** + * A hook is a post action we need to apply after creating a [Client]. + */ +internal open class Hook( + private val configuration: C, + private val builder: HookBuilder +) { + fun execute() = builder.build(configuration) +} + +/** A singleton repository of all [Hook]s we need to apply on the [Client]. */ +internal object Hooks { + private val clientsHooks: MutableMap>> = mutableMapOf() + + fun add( + client: Client, + hook: Hook + ) { + clientsHooks.getOrPut(client) { mutableListOf() } += hook + } + + fun execute(client: Client) { + clientsHooks[client]?.forEach { it.execute() } + } +} + +/** + * Provide an idiomatic scope to define hooks. + */ +internal fun Client.hooks(block: HookContext.() -> Unit) = block(HookContext(this)) + +internal class HookContext(private val client: Client) { + /** + * Provides an idiomatic way of defining a hook. + */ + fun use(hookFactory: HookFactory) = hookFactory + + /** + * Provides an idiomatic way of configuring a hook. + */ + fun HookFactory.with(config: C) = Hooks.add(client, create(client, config)) +} + +internal interface HookFactory { + fun create( + client: Client, + 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 new file mode 100644 index 000000000..6a81db9d9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/Plugin.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.core.plugin + +import com.expediagroup.sdk.core.client.Client + +internal interface Plugin { + /** Install a plugin. */ + fun install( + client: Client, + configurations: C + ) +} + +/** + * Provide an idiomatic scope to define plugins. + */ +internal fun Client.plugins(block: PluginContext.() -> Unit) = block(PluginContext(this)) + +internal class PluginContext(private val client: Client) { + /** + * Provides an idiomatic way of starting a plugin. + */ + fun > use(plugin: P): P = plugin + + /** + * Provides an idiomatic way of configuring a plugin. + */ + fun Plugin.with(configs: C) = install(client, configs) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/PluginConfiguration.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/PluginConfiguration.kt new file mode 100644 index 000000000..8eafdd383 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/PluginConfiguration.kt @@ -0,0 +1,23 @@ +/* + * 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.core.plugin + +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig + +internal interface PluginConfiguration + +internal abstract class KtorPluginConfiguration(open val httpClientConfiguration: HttpClientConfig) : PluginConfiguration 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 new file mode 100644 index 000000000..4e0a69c26 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationConfiguration.kt @@ -0,0 +1,38 @@ +/* + * 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.core.plugin.authentication + +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig + +internal data class AuthenticationConfiguration( + override val httpClientConfiguration: HttpClientConfig, + val credentials: Credentials, + val authUrl: String, + val authType: AuthenticationType +) : KtorPluginConfiguration(httpClientConfiguration) { + companion object { + fun from( + httpClientConfig: HttpClientConfig, + credentials: Credentials, + authUrl: String, + 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 new file mode 100644 index 000000000..ca6d13a76 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationHookFactory.kt @@ -0,0 +1,65 @@ +/* + * 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.core.plugin.authentication + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.Authentication.AUTHORIZATION_REQUEST_LOCK_DELAY +import com.expediagroup.sdk.core.plugin.Hook +import com.expediagroup.sdk.core.plugin.HookBuilder +import com.expediagroup.sdk.core.plugin.HookFactory +import io.ktor.client.plugins.HttpSend +import io.ktor.client.plugins.plugin +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.http.HttpHeaders +import kotlinx.atomicfu.atomic +import kotlinx.coroutines.delay + +internal object AuthenticationHookFactory : HookFactory { + override fun create( + client: Client, + configuration: AuthenticationConfiguration + ): Hook = Hook(configuration, AuthenticationHookBuilder(client)) +} + +private class AuthenticationHookBuilder(private val client: Client) : HookBuilder { + private val lock = atomic(false) + private val authenticationStrategy = client.getAuthenticationStrategy() + + override fun build(configs: AuthenticationConfiguration) { + val httpClient = client.httpClient + + httpClient.plugin(HttpSend).intercept { request -> + if (!authenticationStrategy.isIdentityRequest(request)) { + if (authenticationStrategy.isTokenAboutToExpire()) { + if (!lock.getAndSet(true)) { + try { + authenticationStrategy.renewToken() + } finally { + lock.compareAndSet(expect = true, update = false) + } + } + } + while (lock.value) delay(AUTHORIZATION_REQUEST_LOCK_DELAY) + assignLatestToken(request) + } + execute(request) + } + } + + private fun assignLatestToken(request: HttpRequestBuilder) { + request.headers[HttpHeaders.Authorization] = authenticationStrategy.getAuthorizationHeader() + } +} 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 new file mode 100644 index 000000000..174f9feea --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/AuthenticationPlugin.kt @@ -0,0 +1,42 @@ +/* + * 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.core.plugin.authentication + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.ExceptionMessage.AUTHENTICATION_NOT_CONFIGURED_FOR_CLIENT +import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupClientException +import com.expediagroup.sdk.core.plugin.Plugin +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy +import io.ktor.client.plugins.auth.Auth +import kotlin.collections.set + +internal object AuthenticationPlugin : Plugin { + val clientAuthenticationStrategies = mutableMapOf() + + override fun install( + client: Client, + configurations: AuthenticationConfiguration + ) { + val strategy = AuthenticationStrategy.from(configurations, client) + clientAuthenticationStrategies[client] = strategy + configurations.httpClientConfiguration.install(Auth) { + strategy.loadAuth(this) + } + } +} + +internal fun Client.getAuthenticationStrategy(): AuthenticationStrategy = + AuthenticationPlugin.clientAuthenticationStrategies[this] ?: throw ExpediaGroupClientException(AUTHENTICATION_NOT_CONFIGURED_FOR_CLIENT) 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 new file mode 100644 index 000000000..6a44a53d4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt @@ -0,0 +1,54 @@ +/* + * 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.core.plugin.authentication.strategy + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.BASIC +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.BEARER +import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.SIGNATURE +import io.ktor.client.plugins.auth.Auth +import io.ktor.client.request.HttpRequestBuilder + +internal interface AuthenticationStrategy { + fun loadAuth(auth: Auth) {} + + fun isTokenAboutToExpire(): Boolean + + fun renewToken() + + fun isIdentityRequest(request: HttpRequestBuilder): Boolean + + fun getAuthorizationHeader(): String + + companion object { + fun from( + configs: AuthenticationConfiguration, + client: Client + ): AuthenticationStrategy = + when (configs.authType) { + BASIC -> BasicAuthenticationStrategy(configs) + BEARER -> ExpediaGroupAuthenticationStrategy(client, configs) + SIGNATURE -> RapidAuthenticationStrategy(configs) + } + } + + enum class AuthenticationType { + BASIC, + BEARER, + 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 new file mode 100644 index 000000000..2d87d76df --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/BasicAuthenticationStrategy.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.core.plugin.authentication.strategy + +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import io.ktor.client.plugins.auth.Auth +import io.ktor.client.plugins.auth.providers.BasicAuthCredentials +import io.ktor.client.plugins.auth.providers.basic +import io.ktor.client.request.HttpRequestBuilder + +internal class BasicAuthenticationStrategy( + private val configs: AuthenticationConfiguration +) : AuthenticationStrategy { + override fun loadAuth(auth: Auth) { + auth.basic { + sendWithoutRequest { true } + credentials { + BasicAuthCredentials(username = configs.credentials.key, password = configs.credentials.secret) + } + } + } + + override fun isTokenAboutToExpire(): Boolean = false + + override fun renewToken() = Unit + + override fun isIdentityRequest(request: HttpRequestBuilder) = true + + override fun getAuthorizationHeader() = String() +} 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 new file mode 100644 index 000000000..1404a27bc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/ExpediaGroupAuthenticationStrategy.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. + */ +package com.expediagroup.sdk.core.plugin.authentication.strategy + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.configuration.Credentials +import com.expediagroup.sdk.core.constant.Authentication +import com.expediagroup.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.ExceptionMessage +import com.expediagroup.sdk.core.constant.LoggingMessage +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupAuthException +import com.expediagroup.sdk.core.model.getTransactionId +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory +import io.ktor.client.HttpClient +import io.ktor.client.call.body +import io.ktor.client.plugins.auth.Auth +import io.ktor.client.plugins.auth.providers.BearerAuthProvider +import io.ktor.client.plugins.auth.providers.BearerTokens +import io.ktor.client.plugins.auth.providers.bearer +import io.ktor.client.plugins.plugin +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.basicAuth +import io.ktor.client.request.parameter +import io.ktor.client.request.request +import io.ktor.client.request.url +import io.ktor.http.ContentType +import io.ktor.http.HttpMethod +import io.ktor.http.ParametersBuilder +import io.ktor.http.clone +import io.ktor.http.contentType +import kotlinx.coroutines.runBlocking +import java.time.LocalDateTime + +internal class ExpediaGroupAuthenticationStrategy( + private val client: Client, + private val configs: AuthenticationConfiguration +) : AuthenticationStrategy { + private val log = ExpediaGroupLoggerFactory.getLogger(javaClass) + private var bearerTokenStorage = BearerTokensInfo.emptyBearerTokenInfo + + override fun loadAuth(auth: Auth) { + auth.bearer { + sendWithoutRequest { request -> + isIdentityRequest(request) + } + } + } + + override fun isTokenAboutToExpire(): Boolean = bearerTokenStorage.isAboutToExpire().also { if (it) log.info(LoggingMessage.TOKEN_EXPIRED) } + + override fun renewToken() { + val httpClient = client.httpClient + log.info(LoggingMessage.TOKEN_RENEWAL_IN_PROGRESS) + clearTokens(httpClient) + val renewTokenResponse = + runBlocking { + httpClient.request { + method = HttpMethod.Post + parameter(Authentication.GRANT_TYPE, Authentication.CLIENT_CREDENTIALS) + contentType(ContentType.Application.FormUrlEncoded) + url(configs.authUrl) + basicAuth(configs.credentials) + with(client) { appendHeaders() } + } + } + if (renewTokenResponse.status.value !in Constant.SUCCESSFUL_STATUS_CODES_RANGE) { + throw ExpediaGroupAuthException(renewTokenResponse.status, ExceptionMessage.AUTHENTICATION_FAILURE, renewTokenResponse.headers.getTransactionId()) + } + val renewedTokenInfo: TokenResponse = runBlocking { renewTokenResponse.body() } + log.info(LoggingMessage.TOKEN_RENEWAL_SUCCESSFUL) + log.info(LoggingMessageProvider.getTokenExpiresInMessage(renewedTokenInfo.expiresIn)) + bearerTokenStorage = + BearerTokensInfo( + BearerTokens(renewedTokenInfo.accessToken, renewedTokenInfo.accessToken), + renewedTokenInfo.expiresIn + ) + bearerTokenStorage + } + + private fun clearTokens(client: HttpClient) { + log.info(LoggingMessage.TOKEN_CLEARING_IN_PROGRESS) + client.plugin(Auth).providers.filterIsInstance().first().clearToken() + bearerTokenStorage = BearerTokensInfo.emptyBearerTokenInfo + log.info(LoggingMessage.TOKEN_CLEARING_SUCCESSFUL) + } + + private fun getTokens(): BearerTokens = bearerTokenStorage.bearerTokens + + private fun HttpRequestBuilder.basicAuth(credentials: Credentials) { + basicAuth( + credentials.key, + credentials.secret + ) + } + + override fun isIdentityRequest(request: HttpRequestBuilder): Boolean = request.url.clone().apply { encodedParameters = ParametersBuilder() }.buildString() == configs.authUrl + + override fun getAuthorizationHeader() = "${Authentication.BEARER} ${getTokens().accessToken}" + + internal open class BearerTokensInfo(val bearerTokens: BearerTokens, expiresIn: Int) { + private val expiryDate: LocalDateTime + + init { + this.expiryDate = calculateExpiryDate(expiresIn) + } + + private fun calculateExpiryDate(expiresIn: Int): LocalDateTime = LocalDateTime.now().plusSeconds(expiresIn.toLong()) + + open fun isAboutToExpire(): Boolean = LocalDateTime.now().isAfter(expiryDate.minusSeconds(Authentication.BEARER_EXPIRY_DATE_MARGIN)) + + companion object { + internal val emptyBearerTokenInfo = + object : BearerTokensInfo(BearerTokens(Constant.EMPTY_STRING, Constant.EMPTY_STRING), -1) { + override fun isAboutToExpire() = true + } + } + } + + internal data class TokenResponse( + val accessToken: String, + 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 new file mode 100644 index 000000000..0927b7566 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/RapidAuthenticationStrategy.kt @@ -0,0 +1,61 @@ +/* + * 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.core.plugin.authentication.strategy + +import com.expediagroup.sdk.core.constant.Authentication +import com.expediagroup.sdk.core.constant.Constant +import com.expediagroup.sdk.core.constant.SignatureValues +import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfiguration +import io.ktor.client.request.HttpRequestBuilder +import java.math.BigInteger +import java.nio.charset.StandardCharsets +import java.security.MessageDigest +import java.security.spec.MGF1ParameterSpec +import java.time.Instant + +internal class RapidAuthenticationStrategy(private val configs: AuthenticationConfiguration) : AuthenticationStrategy { + private var signature: String = Constant.EMPTY_STRING + + override fun isTokenAboutToExpire(): Boolean = true + + override fun renewToken() { + val credentials = configs.credentials + signature = calculateSignature(credentials.key, credentials.secret, Instant.now().epochSecond) + } + + override fun isIdentityRequest(request: HttpRequestBuilder) = false + + override fun getAuthorizationHeader() = createAuthorizationHeader(signature) + + private fun createAuthorizationHeader(signature: String?): String = "${Authentication.EAN} $signature" + + private fun calculateSignature( + apiKey: String, + secret: String, + timestamp: Long + ): String { + val toBeHashed = apiKey + secret + timestamp + val messageDigest = MessageDigest.getInstance(MGF1ParameterSpec.SHA512.digestAlgorithm) + val bytes = messageDigest.digest(toBeHashed.toByteArray(StandardCharsets.UTF_8)) + val signature = + buildString { + bytes.forEach { + 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 new file mode 100644 index 000000000..c789bc69f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingConfiguration.kt @@ -0,0 +1,28 @@ +/* + * 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.core.plugin.encoding + +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig + +internal data class EncodingConfiguration( + 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 new file mode 100644 index 000000000..658dd6362 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/encoding/EncodingPlugin.kt @@ -0,0 +1,31 @@ +/* + * 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.core.plugin.encoding + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin +import io.ktor.client.plugins.compression.ContentEncoding + +internal object EncodingPlugin : Plugin { + override fun install( + client: Client, + 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 new file mode 100644 index 000000000..89cdd14c4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingConfiguration.kt @@ -0,0 +1,28 @@ +/* + * 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.core.plugin.exception + +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig + +internal data class ExceptionHandlingConfiguration( + 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 new file mode 100644 index 000000000..15d58a136 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/exception/ExceptionHandlingPlugin.kt @@ -0,0 +1,37 @@ +/* + * 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.core.plugin.exception + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.model.exception.handleWith +import com.expediagroup.sdk.core.model.getTransactionId +import com.expediagroup.sdk.core.plugin.Plugin +import io.ktor.client.plugins.HttpResponseValidator + +internal object ExceptionHandlingPlugin : Plugin { + override fun install( + client: Client, + configurations: ExceptionHandlingConfiguration + ) { + with(configurations.httpClientConfiguration) { + HttpResponseValidator { + handleResponseExceptionWithRequest { exception, request -> + exception.handleWith(request.headers.getTransactionId()) + } + } + } + } +} 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 new file mode 100644 index 000000000..a0d28f3cb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutConfiguration.kt @@ -0,0 +1,36 @@ +/* + * 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.core.plugin.httptimeout + +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig + +internal data class HttpTimeoutConfiguration( + override val httpClientConfiguration: HttpClientConfig, + val requestTimeout: Long, + val connectionTimeout: Long, + val socketTimeout: Long +) : KtorPluginConfiguration(httpClientConfiguration) { + companion object { + fun from( + httpClientConfig: HttpClientConfig, + requestTimeout: Long, + connectionTimeout: 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 new file mode 100644 index 000000000..0590d8847 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/httptimeout/HttpTimeoutPlugin.kt @@ -0,0 +1,33 @@ +/* + * 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.core.plugin.httptimeout + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin +import io.ktor.client.plugins.HttpTimeout + +internal object HttpTimeoutPlugin : Plugin { + override fun install( + client: Client, + configurations: HttpTimeoutConfiguration + ) { + configurations.httpClientConfiguration.install(HttpTimeout) { + requestTimeoutMillis = configurations.requestTimeout + connectTimeoutMillis = configurations.connectionTimeout + socketTimeoutMillis = configurations.socketTimeout + } + } +} 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 new file mode 100644 index 000000000..9a60c277d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldFilter.kt @@ -0,0 +1,23 @@ +/* + * 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.core.plugin.logging + +import com.ebay.ejmask.core.BaseFilter + +internal class ExpediaGroupJsonFieldFilter(maskedFields: Array) : BaseFilter( + ExpediaGroupJsonFieldPatternBuilder::class.java, + *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 new file mode 100644 index 000000000..63ca9cfdb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupJsonFieldPatternBuilder.kt @@ -0,0 +1,26 @@ +/* + * 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.core.plugin.logging + +import com.ebay.ejmask.extenstion.builder.json.JsonFieldPatternBuilder +import com.expediagroup.sdk.core.constant.LoggingMessage.OMITTED + +internal class ExpediaGroupJsonFieldPatternBuilder : JsonFieldPatternBuilder() { + override fun buildReplacement( + visibleCharacters: Int, + 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 new file mode 100644 index 000000000..6390f5c7a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLogger.kt @@ -0,0 +1,52 @@ +/* + * 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.core.plugin.logging + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.LogMaskingFields +import com.expediagroup.sdk.core.constant.LoggingMessage.LOGGING_PREFIX +import org.slf4j.Logger + +internal class ExpediaGroupLogger(private val logger: Logger, private val client: Client? = null) : Logger by logger { + private val mask = LogMasker(getMaskedBodyFieldFilters()) + + override fun info(msg: String) { + if (logger.isInfoEnabled) { + logger.info(decorate(msg)) + } + } + + override fun warn(msg: String) { + if (logger.isWarnEnabled) { + logger.warn(decorate(msg)) + } + } + + override fun debug(msg: String) { + if (logger.isDebugEnabled) { + logger.debug(decorate(msg)) + } + } + + private fun decorate(msg: String): String = "$LOGGING_PREFIX ${mask(msg)}" + + private fun getMaskedBodyFields(): Set = client?.getLoggingMaskedFieldsProvider()?.getMaskedBodyFields() ?: LogMaskingFields.DEFAULT_MASKED_BODY_FIELDS + + private fun getMaskedBodyFieldFilters(): Iterable = + listOf( + 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 new file mode 100644 index 000000000..e2d2326eb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ExpediaGroupLoggerFactory.kt @@ -0,0 +1,28 @@ +/* + * 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.core.plugin.logging + +import com.expediagroup.sdk.core.client.Client +import org.slf4j.LoggerFactory + +internal object ExpediaGroupLoggerFactory { + fun getLogger(clazz: Class<*>) = ExpediaGroupLogger(LoggerFactory.getLogger(clazz)) + + fun getLogger( + clazz: Class<*>, + 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 new file mode 100644 index 000000000..36628610f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LogMasker.kt @@ -0,0 +1,32 @@ +/* + * 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.core.plugin.logging + +import com.ebay.ejmask.core.BaseFilter +import com.ebay.ejmask.core.EJMask +import com.ebay.ejmask.core.EJMaskInitializer +import com.ebay.ejmask.core.util.LoggerUtil + +internal class LogMasker( + filters: Iterable +) : (String) -> String { + init { + LoggerUtil.register { _, _, _ -> /* disable logging */ } + filters.forEach { EJMaskInitializer.addFilter(it) } + } + + override fun invoke(message: String): String = EJMask.mask(message) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggableContentTypes.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggableContentTypes.kt new file mode 100644 index 000000000..9031d78b3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggableContentTypes.kt @@ -0,0 +1,32 @@ +/* + * 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.core.plugin.logging + +import io.ktor.http.ContentType + +val LoggableContentTypes: List = + buildList { + add(ContentType.Application.Json) + add(ContentType.Application.Xml) + add(ContentType.Application.Xml_Dtd) + add(ContentType.Application.ProblemXml) + add(ContentType.Application.Json) + add(ContentType.Application.HalJson) + add(ContentType.Application.FormUrlEncoded) + add(ContentType.Application.ProblemJson) + add(ContentType.Text.Xml) + add(ContentType.Text.Plain) + } 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 new file mode 100644 index 000000000..cd34324a9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingConfiguration.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. + */ +package com.expediagroup.sdk.core.plugin.logging + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger + +internal data class LoggingConfiguration( + override val httpClientConfiguration: HttpClientConfig, + val maskedLoggingHeaders: Set, + val maskedLoggingBodyFields: Set, + val level: LogLevel = LogLevel.HEADERS, + val getLogger: (client: Client) -> Logger = createCustomLogger +) : KtorPluginConfiguration(httpClientConfiguration) { + companion object { + fun from( + httpClientConfig: HttpClientConfig, + maskedLoggingHeaders: Set, + maskedLoggingBodyFields: Set + ) = LoggingConfiguration(httpClientConfig, maskedLoggingHeaders, maskedLoggingBodyFields) + } +} + +private val createCustomLogger: (client: Client) -> Logger + get() = { + object : Logger { + val delegate = ExpediaGroupLoggerFactory.getLogger(Client::class.java, it) + + override fun log(message: String) = delegate.info(message) + } + } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingMaskedFieldsProvider.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingMaskedFieldsProvider.kt new file mode 100644 index 000000000..033ff1f6f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingMaskedFieldsProvider.kt @@ -0,0 +1,45 @@ +/* + * 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.core.plugin.logging + +import com.expediagroup.sdk.core.constant.LogMaskingFields.DEFAULT_MASKED_BODY_FIELDS +import com.expediagroup.sdk.core.constant.LogMaskingFields.DEFAULT_MASKED_HEADER_FIELDS +import com.expediagroup.sdk.core.constant.LogMaskingRegex.FIELD_REGEX +import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupInvalidFieldNameException + +class LoggingMaskedFieldsProvider(maskedLoggingHeaders: Set, maskedLoggingBodyFields: Set) { + private val maskedHeaderFields: Set + private val maskedBodyFields: Set + + init { + maskedLoggingHeaders.filter(::isInvalid).takeIf { it.isNotEmpty() }?.let { throw ExpediaGroupInvalidFieldNameException(it) } + maskedLoggingBodyFields.filter(::isInvalid).takeIf { it.isNotEmpty() }?.let { throw ExpediaGroupInvalidFieldNameException(it) } + maskedHeaderFields = DEFAULT_MASKED_HEADER_FIELDS.union(maskedLoggingHeaders) + maskedBodyFields = DEFAULT_MASKED_BODY_FIELDS.union(maskedLoggingBodyFields) + } + + /** + * @return a copy of the list of headers to be masked + */ + fun getMaskedHeaderFields(): Set = maskedHeaderFields.toSet() + + /** + * @return a copy of the list of body fields to be masked + */ + fun getMaskedBodyFields(): Set = maskedBodyFields.toSet() + + private fun isInvalid(fieldName: String): Boolean = !fieldName.matches(FIELD_REGEX) +} 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 new file mode 100644 index 000000000..758a5df72 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/LoggingPlugin.kt @@ -0,0 +1,50 @@ +/* + * 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.core.plugin.logging + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.constant.ExceptionMessage +import com.expediagroup.sdk.core.constant.LoggingMessage +import com.expediagroup.sdk.core.model.exception.client.ExpediaGroupClientException +import com.expediagroup.sdk.core.plugin.Plugin +import io.ktor.client.plugins.logging.Logging + +internal object LoggingPlugin : Plugin { + val clientLoggingMaskedFieldsProviders = mutableMapOf() + + override fun install( + client: Client, + configurations: LoggingConfiguration + ) { + clientLoggingMaskedFieldsProviders[client] = + LoggingMaskedFieldsProvider( + configurations.maskedLoggingHeaders, + configurations.maskedLoggingBodyFields + ) + configurations.httpClientConfiguration.install(Logging) { + logger = configurations.getLogger(client) + level = configurations.level + sanitizeHeader(LoggingMessage.OMITTED) { header -> + client.getLoggingMaskedFieldsProvider().getMaskedHeaderFields().contains(header) + } + } + configurations.httpClientConfiguration.install(RequestBodyLogger) + configurations.httpClientConfiguration.install(ResponseBodyLogger) + } +} + +internal fun Client.getLoggingMaskedFieldsProvider(): LoggingMaskedFieldsProvider = + 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 new file mode 100644 index 000000000..5a077a148 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/RequestBodyLogger.kt @@ -0,0 +1,70 @@ +/* + * 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.core.plugin.logging + +import com.expediagroup.sdk.core.constant.LoggerName +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.model.getTransactionId +import io.ktor.client.HttpClient +import io.ktor.client.plugins.HttpClientPlugin +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.HttpSendPipeline +import io.ktor.http.content.OutputStreamContent +import io.ktor.http.contentType +import io.ktor.util.AttributeKey +import io.ktor.util.pipeline.PipelineContext +import io.ktor.utils.io.writer +import kotlinx.coroutines.coroutineScope + +internal class RequestBodyLogger { + private val log = ExpediaGroupLoggerFactory.getLogger(javaClass) + + companion object Plugin : HttpClientPlugin { + override val key: AttributeKey = AttributeKey(LoggerName.REQUEST_BODY_LOGGER) + + override fun install( + plugin: RequestBodyLogger, + scope: HttpClient + ) { + scope.sendPipeline.intercept(HttpSendPipeline.Monitoring) { + val body: String = getBody() + plugin.log.debug(LoggingMessageProvider.getRequestBodyMessage(body, context.headers.getTransactionId())) + proceed() + } + } + + private suspend fun PipelineContext.getBody(): String { + val body = + when { + context.contentType() in LoggableContentTypes -> context.body + else -> return "Body of type ${context.contentType()?.contentType} cannot be logged!" + } + + if (body is OutputStreamContent) { + return coroutineScope { + writer { + body.writeTo(channel) + }.channel.readRemaining().readText() + } + } + return body.toString() + } + + override fun prepare(block: RequestBodyLoggerConfig.() -> Unit): RequestBodyLogger = RequestBodyLogger() + } +} + +internal class RequestBodyLoggerConfig 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 new file mode 100644 index 000000000..c06f8fdc7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/logging/ResponseBodyLogger.kt @@ -0,0 +1,77 @@ +/* + * 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.core.plugin.logging + +import com.expediagroup.sdk.core.constant.HeaderValue +import com.expediagroup.sdk.core.constant.LoggerName +import com.expediagroup.sdk.core.constant.provider.LoggingMessageProvider +import com.expediagroup.sdk.core.model.getTransactionId +import com.expediagroup.sdk.core.plugin.logging.GZipEncoder.decode +import io.ktor.client.HttpClient +import io.ktor.client.plugins.HttpClientPlugin +import io.ktor.client.plugins.compression.ContentEncoder +import io.ktor.client.statement.HttpResponse +import io.ktor.client.statement.HttpResponsePipeline +import io.ktor.client.statement.request +import io.ktor.http.HttpHeaders +import io.ktor.http.contentType +import io.ktor.util.AttributeKey +import io.ktor.util.Encoder +import io.ktor.util.GZip +import io.ktor.util.InternalAPI +import io.ktor.utils.io.ByteReadChannel + +class ResponseBodyLogger { + private val log = ExpediaGroupLoggerFactory.getLogger(javaClass) + + companion object Plugin : HttpClientPlugin { + override val key: AttributeKey = AttributeKey(LoggerName.RESPONSE_BODY_LOGGER) + + @OptIn(InternalAPI::class) + override fun install( + plugin: ResponseBodyLogger, + 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 + + 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()) + }.let { + plugin.log.debug(it) + } + + proceed() + } + } + + override fun prepare(block: ResponseBodyLoggerConfig.() -> Unit): ResponseBodyLogger = ResponseBodyLogger() + } +} + +fun HttpResponse.contentEncoding(): String? = headers[HttpHeaders.ContentEncoding] + +internal object GZipEncoder : ContentEncoder, Encoder by GZip { + override val name: String = HeaderValue.GZIP +} + +class ResponseBodyLoggerConfig 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 new file mode 100644 index 000000000..c1114a221 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestConfiguration.kt @@ -0,0 +1,32 @@ +/* + * 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.core.plugin.request + +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig + +internal data class DefaultRequestConfiguration( + override val httpClientConfiguration: HttpClientConfig, + val endpoint: String +) : KtorPluginConfiguration(httpClientConfiguration) { + companion object { + fun from( + httpClientConfig: HttpClientConfig, + 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 new file mode 100644 index 000000000..745c67718 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/request/DefaultRequestPlugin.kt @@ -0,0 +1,31 @@ +/* + * 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.core.plugin.request + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin +import io.ktor.client.plugins.DefaultRequest + +internal object DefaultRequestPlugin : Plugin { + override fun install( + client: Client, + configurations: DefaultRequestConfiguration + ) { + configurations.httpClientConfiguration.install(DefaultRequest) { + url(configurations.endpoint) + } + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/ContentNegotiation.kt b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/ContentNegotiation.kt new file mode 100644 index 000000000..00d4e672a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/ContentNegotiation.kt @@ -0,0 +1,246 @@ +/* + * 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.core.plugin.serialization + +import com.expediagroup.sdk.core.plugin.logging.ExpediaGroupLoggerFactory +import io.ktor.client.HttpClient +import io.ktor.client.plugins.HttpClientPlugin +import io.ktor.client.plugins.contentnegotiation.ContentConverterException +import io.ktor.client.plugins.contentnegotiation.JsonContentTypeMatcher +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.HttpRequestPipeline +import io.ktor.client.statement.HttpResponseContainer +import io.ktor.client.statement.HttpResponsePipeline +import io.ktor.client.utils.EmptyContent +import io.ktor.http.ContentType +import io.ktor.http.ContentTypeMatcher +import io.ktor.http.HttpHeaders +import io.ktor.http.HttpStatusCode +import io.ktor.http.Url +import io.ktor.http.charset +import io.ktor.http.content.NullBody +import io.ktor.http.content.OutgoingContent +import io.ktor.http.contentType +import io.ktor.serialization.Configuration +import io.ktor.serialization.ContentConverter +import io.ktor.serialization.deserialize +import io.ktor.serialization.suitableCharset +import io.ktor.util.AttributeKey +import io.ktor.util.InternalAPI +import io.ktor.util.reflect.TypeInfo +import io.ktor.utils.io.ByteReadChannel +import io.ktor.utils.io.charsets.Charset +import java.io.InputStream +import kotlin.reflect.KClass + +internal val DefaultCommonIgnoredTypes: Set> = + setOf( + ByteArray::class, + String::class, + HttpStatusCode::class, + ByteReadChannel::class, + OutgoingContent::class + ) + +internal val DefaultIgnoredTypes: Set> = mutableSetOf(InputStream::class) + +internal class ContentNegotiation( + private val registrations: List, + private val ignoredTypes: Set> +) { + internal class Config : Configuration { + internal class ConverterRegistration( + val converter: ContentConverter, + val contentTypeToSend: ContentType, + val contentTypeMatcher: ContentTypeMatcher + ) + + val registrations = mutableListOf() + val ignoredTypes: MutableSet> = + (DefaultIgnoredTypes + DefaultCommonIgnoredTypes).toMutableSet() + + override fun register( + contentType: ContentType, + converter: T, + configuration: T.() -> Unit + ) { + val matcher = + when (contentType) { + ContentType.Application.Json -> JsonContentTypeMatcher + else -> defaultMatcher(contentType) + } + register(contentType, converter, matcher, configuration) + } + + private fun register( + contentTypeToSend: ContentType, + converter: T, + contentTypeMatcher: ContentTypeMatcher, + configuration: T.() -> Unit + ) { + val registration = + ConverterRegistration( + converter.apply(configuration), + contentTypeToSend, + contentTypeMatcher + ) + registrations.add(registration) + } + + private fun defaultMatcher(pattern: ContentType): ContentTypeMatcher = + object : ContentTypeMatcher { + override fun contains(contentType: ContentType): Boolean = contentType.match(pattern) + } + } + + private val log = ExpediaGroupLoggerFactory.getLogger(this::class.java) + + internal suspend fun convertRequest( + request: HttpRequestBuilder, + body: Any + ): Any? { + if (body is OutgoingContent || ignoredTypes.any { it.isInstance(body) }) { + log.trace( + "Body type ${body::class} is in ignored types. " + + "Skipping ContentNegotiation for ${request.url}." + ) + return null + } + val contentType = + request.contentType() ?: run { + log.trace("Request doesn't have Content-Type header. Skipping ContentNegotiation for ${request.url}.") + return null + } + + if (body is Unit) { + log.trace("Sending empty body for ${request.url}") + request.headers.remove(HttpHeaders.ContentType) + return EmptyContent + } + + val matchingRegistrations = + registrations.filter { it.contentTypeMatcher.contains(contentType) } + .takeIf { it.isNotEmpty() } ?: run { + log.trace( + "None of the registered converters match request Content-Type=$contentType. " + + "Skipping ContentNegotiation for ${request.url}." + ) + return null + } + if (request.bodyType == null) { + log.trace("Request has unknown body type. Skipping ContentNegotiation for ${request.url}.") + return null + } + request.headers.remove(HttpHeaders.ContentType) + + // Pick the first one that can convert the subject successfully + val serializedContent = + matchingRegistrations.firstNotNullOfOrNull { registration -> + val result = + registration.converter.serializeNullable( + contentType, + contentType.charset() ?: Charsets.UTF_8, + request.bodyType!!, + body.takeIf { it != NullBody } + ) + if (result != null) { + log.trace("Converted request body using ${registration.converter} for ${request.url}") + } + result + } ?: throw ContentConverterException( + "Can't convert $body with contentType $contentType using converters " + + matchingRegistrations.joinToString { it.converter.toString() } + ) + + return serializedContent + } + + @OptIn(InternalAPI::class) + internal suspend fun convertResponse( + requestUrl: Url, + info: TypeInfo, + body: Any, + responseContentType: ContentType, + charset: Charset = Charsets.UTF_8 + ): Any? { + if (body !is ByteReadChannel) { + log.trace("Response body is already transformed. Skipping ContentNegotiation for $requestUrl.") + return null + } + if (info.type in ignoredTypes) { + log.trace( + "Response body type ${info.type} is in ignored types. " + + "Skipping ContentNegotiation for $requestUrl." + ) + return null + } + + log.debug("Test: ${registrations.size}") + val suitableConverters = + registrations + .filter { it.contentTypeMatcher.contains(responseContentType) } + .map { it.converter } + .takeIf { it.isNotEmpty() } + ?: run { + log.trace( + "None of the registered converters match response with Content-Type=$responseContentType. " + + "Skipping ContentNegotiation for $requestUrl." + ) + return null + } + + val result = suitableConverters.deserialize(body, info, charset) + if (result !is ByteReadChannel) { + log.trace("Response body was converted to ${result::class} for $requestUrl.") + } + return result + } + + companion object Plugin : HttpClientPlugin { + override val key: AttributeKey = AttributeKey("ContentNegotiation") + private val log = ExpediaGroupLoggerFactory.getLogger(this::class.java) + + override fun install( + plugin: ContentNegotiation, + scope: HttpClient + ) { + scope.requestPipeline.intercept(HttpRequestPipeline.Transform) { + val result = plugin.convertRequest(context, subject) ?: return@intercept + proceedWith(result) + } + + scope.responsePipeline.intercept(HttpResponsePipeline.Transform) { (info, body) -> + val contentType = + context.response.contentType() ?: run { + log.trace("Response doesn't have \"Content-Type\" header, skipping ContentNegotiation plugin") + return@intercept + } + val charset = context.request.headers.suitableCharset() + + val deserializedBody = + plugin.convertResponse(context.request.url, info, body, contentType, charset) + ?: return@intercept + val result = HttpResponseContainer(info, deserializedBody) + proceedWith(result) + } + } + + override fun prepare(block: Config.() -> Unit): ContentNegotiation { + val config = Config().apply(block) + return ContentNegotiation(config.registrations, config.ignoredTypes) + } + } +} 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 new file mode 100644 index 000000000..dc1546df3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationConfiguration.kt @@ -0,0 +1,30 @@ +/* + * 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.core.plugin.serialization + +import com.expediagroup.sdk.core.plugin.KtorPluginConfiguration +import io.ktor.client.HttpClientConfig +import io.ktor.client.engine.HttpClientEngineConfig +import io.ktor.http.ContentType + +internal data class SerializationConfiguration( + override val httpClientConfiguration: HttpClientConfig, + 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 new file mode 100644 index 000000000..eda9abc14 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/core/plugin/serialization/SerializationPlugin.kt @@ -0,0 +1,40 @@ +/* + * 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.core.plugin.serialization + +import com.expediagroup.sdk.core.client.Client +import com.expediagroup.sdk.core.plugin.Plugin +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.PropertyNamingStrategies +import io.ktor.serialization.jackson.jackson +import java.text.SimpleDateFormat + +internal object SerializationPlugin : Plugin { + override fun install( + client: Client, + configurations: SerializationConfiguration + ) { + configurations.httpClientConfiguration.install(ContentNegotiation) { + jackson { + enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) + disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) + setDateFormat(SimpleDateFormat()) + findAndRegisterModules() + } + } + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/client/XapClient.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/client/XapClient.kt new file mode 100644 index 000000000..00e64f468 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/client/XapClient.kt @@ -0,0 +1,303 @@ +/* + * 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.xap.client + +import com.expediagroup.sdk.core.client.BaseXapClient +import com.expediagroup.sdk.core.configuration.XapClientConfiguration +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.handle +import com.expediagroup.sdk.xap.models.* +import com.expediagroup.sdk.xap.models.exception.ErrorObjectMapper +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiAPIGatewayErrorException +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiAPIMErrorException +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiCarsErrorsException +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiErrorsException +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiLodgingErrorsException +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiPresignedUrlResponseException +import com.expediagroup.sdk.xap.models.exception.ExpediaGroupApiSdpAPIMErrorException +import com.expediagroup.sdk.xap.operations.GetCarDetailsOperation +import com.expediagroup.sdk.xap.operations.GetCarsListingsOperation +import com.expediagroup.sdk.xap.operations.GetFeedDownloadUrlOperation +import com.expediagroup.sdk.xap.operations.GetLodgingAvailabilityCalendarsOperation +import com.expediagroup.sdk.xap.operations.GetLodgingDetailsOperation +import com.expediagroup.sdk.xap.operations.GetLodgingListingsOperation +import com.expediagroup.sdk.xap.operations.GetLodgingQuotesOperation +import com.expediagroup.sdk.xap.operations.GetLodgingRateCalendarOperation +import io.ktor.client.call.body +import io.ktor.client.request.request +import io.ktor.client.request.setBody +import io.ktor.client.request.url +import io.ktor.client.statement.HttpResponse +import io.ktor.http.ContentType +import io.ktor.http.HttpMethod +import io.ktor.http.contentType +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.future.future +import java.util.concurrent.CompletableFuture + +/** +* The XAP Lodging Search APIs can be used by partners both booking via an Expedia website, or by partners that +will be booking via the XAP APIs. Each API also provides pre-configured links to the Expedia website, +the XAP Booking API, or both. + +*/ + +class XapClient private constructor(clientConfiguration: XapClientConfiguration) : BaseXapClient("xap", clientConfiguration) { + class Builder : BaseXapClient.Builder() { + override fun build() = + XapClient( + XapClientConfiguration(key, secret, endpoint, requestTimeout, connectionTimeout, socketTimeout, maskedLoggingHeaders, maskedLoggingBodyFields) + ) + } + + companion object { + @JvmStatic fun builder() = Builder() + } + + override suspend fun throwServiceException( + response: HttpResponse, + operationId: String + ): Unit = throw ErrorObjectMapper.process(response, operationId) + + private suspend inline fun executeHttpRequest(operation: Operation): HttpResponse = + httpClient.request { + method = HttpMethod.parse(operation.method) + url(operation.url) + + operation.params?.getHeaders()?.let { + headers.appendAll(it) + } + + operation.params?.getQueryParams()?.let { + url.parameters.appendAll(it) + } + + val extraHeaders = + buildMap { + put("key", configurationProvider.key ?: "") + } + + appendHeaders(extraHeaders) + contentType(ContentType.Application.Json) + setBody(operation.requestBody) + } + + private inline fun executeWithEmptyResponse(operation: Operation): EmptyResponse { + try { + return executeAsyncWithEmptyResponse(operation).get() + } catch (exception: Exception) { + exception.handle() + } + } + + private inline fun executeAsyncWithEmptyResponse(operation: Operation): CompletableFuture = + GlobalScope.future(Dispatchers.IO) { + try { + val response = executeHttpRequest(operation) + throwIfError(response, operation.operationId) + EmptyResponse(response.status.value, response.headers.entries()) + } catch (exception: Exception) { + exception.handle() + } + } + + private inline fun execute(operation: Operation): Response { + try { + return executeAsync(operation).get() + } catch (exception: Exception) { + exception.handle() + } + } + + private inline fun executeAsync(operation: Operation): CompletableFuture> = + GlobalScope.future(Dispatchers.IO) { + try { + val response = executeHttpRequest(operation) + throwIfError(response, operation.operationId) + Response(response.status.value, response.body(), response.headers.entries()) + } catch (exception: Exception) { + exception.handle() + } + } + + /** + * Get Extended information with a single car offer + * Extended information about the rates, charges, fees, and other terms associated with a single car offer. + * @param operation [GetCarDetailsOperation] + * @throws ExpediaGroupApiCarsErrorsException + * @throws ExpediaGroupApiAPIMErrorException + * @throws ExpediaGroupApiException + * @return a [Response] object with a body of type CarDetailsResponse + */ + fun execute(operation: GetCarDetailsOperation): Response = execute(operation) + + /** + * Get Extended information with a single car offer + * Extended information about the rates, charges, fees, and other terms associated with a single car offer. + * @param operation [GetCarDetailsOperation] + * @throws ExpediaGroupApiCarsErrorsException + * @throws ExpediaGroupApiAPIMErrorException + * @throws ExpediaGroupApiException + * @return a [CompletableFuture] object with a body of type CarDetailsResponse + */ + fun executeAsync(operation: GetCarDetailsOperation): CompletableFuture> = executeAsync(operation) + + /** + * Search Expedia car inventory + * Search Expedia car inventory by date, pickup, and dropoff location to return a listing of available cars for hire. + * @param operation [GetCarsListingsOperation] + * @throws ExpediaGroupApiCarsErrorsException + * @throws ExpediaGroupApiAPIMErrorException + * @throws ExpediaGroupApiException + * @return a [Response] object with a body of type CarListingsResponse + */ + fun execute(operation: GetCarsListingsOperation): Response = execute(operation) + + /** + * Search Expedia car inventory + * Search Expedia car inventory by date, pickup, and dropoff location to return a listing of available cars for hire. + * @param operation [GetCarsListingsOperation] + * @throws ExpediaGroupApiCarsErrorsException + * @throws ExpediaGroupApiAPIMErrorException + * @throws ExpediaGroupApiException + * @return a [CompletableFuture] object with a body of type CarListingsResponse + */ + fun executeAsync(operation: GetCarsListingsOperation): CompletableFuture> = executeAsync(operation) + + /** + * + * Get the Download URL and other details of the static files. + * @param operation [GetFeedDownloadUrlOperation] + * @throws ExpediaGroupApiPresignedUrlResponseException + * @throws ExpediaGroupApiSdpAPIMErrorException + * @return a [Response] object with a body of type PresignedUrlResponse + */ + fun execute(operation: GetFeedDownloadUrlOperation): Response = execute(operation) + + /** + * + * Get the Download URL and other details of the static files. + * @param operation [GetFeedDownloadUrlOperation] + * @throws ExpediaGroupApiPresignedUrlResponseException + * @throws ExpediaGroupApiSdpAPIMErrorException + * @return a [CompletableFuture] object with a body of type PresignedUrlResponse + */ + fun executeAsync(operation: GetFeedDownloadUrlOperation): CompletableFuture> = executeAsync(operation) + + /** + * Get availability calendars of properties + * Returns the availability of each day for a range of dates for given Expedia lodging properties. + * @param operation [GetLodgingAvailabilityCalendarsOperation] + * @throws ExpediaGroupApiLodgingErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [Response] object with a body of type AvailabilityCalendarResponse + */ + fun execute(operation: GetLodgingAvailabilityCalendarsOperation): Response = execute(operation) + + /** + * Get availability calendars of properties + * Returns the availability of each day for a range of dates for given Expedia lodging properties. + * @param operation [GetLodgingAvailabilityCalendarsOperation] + * @throws ExpediaGroupApiLodgingErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [CompletableFuture] object with a body of type AvailabilityCalendarResponse + */ + fun executeAsync(operation: GetLodgingAvailabilityCalendarsOperation): CompletableFuture> = executeAsync(operation) + + /** + * Get Extended information with a single property offer + * Extended information about the rate, charges, fees, and financial terms associated with booking a single lodging rate plan offer. + * @param operation [GetLodgingDetailsOperation] + * @throws ExpediaGroupApiErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [Response] object with a body of type HotelDetailsResponse + */ + fun execute(operation: GetLodgingDetailsOperation): Response = execute(operation) + + /** + * Get Extended information with a single property offer + * Extended information about the rate, charges, fees, and financial terms associated with booking a single lodging rate plan offer. + * @param operation [GetLodgingDetailsOperation] + * @throws ExpediaGroupApiErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [CompletableFuture] object with a body of type HotelDetailsResponse + */ + fun executeAsync(operation: GetLodgingDetailsOperation): CompletableFuture> = executeAsync(operation) + + /** + * Search lodging inventory + * Search Expedia lodging inventory by Location Keyword, Region ID, Lat/Long, or Hotel ID(s) and return up to 1,000 offers in response. Provides deeplink to Expedia site to book, or rate plan info to enable API booking. + * @param operation [GetLodgingListingsOperation] + * @throws ExpediaGroupApiErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [Response] object with a body of type HotelListingsResponse + */ + fun execute(operation: GetLodgingListingsOperation): Response = execute(operation) + + /** + * Search lodging inventory + * Search Expedia lodging inventory by Location Keyword, Region ID, Lat/Long, or Hotel ID(s) and return up to 1,000 offers in response. Provides deeplink to Expedia site to book, or rate plan info to enable API booking. + * @param operation [GetLodgingListingsOperation] + * @throws ExpediaGroupApiErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [CompletableFuture] object with a body of type HotelListingsResponse + */ + fun executeAsync(operation: GetLodgingListingsOperation): CompletableFuture> = executeAsync(operation) + + /** + * Get properties price and availability information + * The Lodging Quotes API will return the price and availability information for given Expedia lodging property ID(s). + * @param operation [GetLodgingQuotesOperation] + * @throws ExpediaGroupApiLodgingErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [Response] object with a body of type LodgingQuotesResponse + */ + fun execute(operation: GetLodgingQuotesOperation): Response = execute(operation) + + /** + * Get properties price and availability information + * The Lodging Quotes API will return the price and availability information for given Expedia lodging property ID(s). + * @param operation [GetLodgingQuotesOperation] + * @throws ExpediaGroupApiLodgingErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [CompletableFuture] object with a body of type LodgingQuotesResponse + */ + fun executeAsync(operation: GetLodgingQuotesOperation): CompletableFuture> = executeAsync(operation) + + /** + * Get rate calendar of a property + * The Rate Calendar API will return the lowest rate plan for a range of days for one selected Expedia lodging property. + * @param operation [GetLodgingRateCalendarOperation] + * @throws ExpediaGroupApiErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [Response] object with a body of type RateCalendarResponse + */ + fun execute(operation: GetLodgingRateCalendarOperation): Response = execute(operation) + + /** + * Get rate calendar of a property + * The Rate Calendar API will return the lowest rate plan for a range of days for one selected Expedia lodging property. + * @param operation [GetLodgingRateCalendarOperation] + * @throws ExpediaGroupApiErrorsException + * @throws ExpediaGroupApiAPIGatewayErrorException + * @return a [CompletableFuture] object with a body of type RateCalendarResponse + */ + fun executeAsync(operation: GetLodgingRateCalendarOperation): CompletableFuture> = executeAsync(operation) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/infrastructure/ApiAbstractions.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/infrastructure/ApiAbstractions.kt new file mode 100644 index 000000000..ae25a7478 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/infrastructure/ApiAbstractions.kt @@ -0,0 +1,45 @@ +/* + * 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.xap.infrastructure + +typealias MultiValueMap = MutableMap> + +fun collectionDelimiter(collectionFormat: String) = + when (collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" + } + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun toMultiValue( + items: Array, + collectionFormat: String, + map: (item: T) -> String = defaultMultiValueConverter +) = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue( + items: Iterable, + collectionFormat: String, + map: (item: T) -> String = defaultMultiValueConverter +): List = + when (collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/APIGatewayError.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/APIGatewayError.kt new file mode 100644 index 000000000..09112ca39 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/APIGatewayError.kt @@ -0,0 +1,92 @@ +/* + * 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.xap.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 + +/** + * + * @param message + */ +data class APIGatewayError( + @JsonProperty("message") + @field:Valid + val message: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var message: kotlin.String? = null + ) { + fun message(message: kotlin.String?) = apply { this.message = message } + + fun build(): APIGatewayError { + val instance = + APIGatewayError( + message = message + ) + + validate(instance) + + return instance + } + + private fun validate(instance: APIGatewayError) { + 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( + message = message + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/APIMError.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/APIMError.kt new file mode 100644 index 000000000..25345be0b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/APIMError.kt @@ -0,0 +1,92 @@ +/* + * 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.xap.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 + +/** + * + * @param message + */ +data class APIMError( + @JsonProperty("message") + @field:Valid + val message: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var message: kotlin.String? = null + ) { + fun message(message: kotlin.String?) = apply { this.message = message } + + fun build(): APIMError { + val instance = + APIMError( + message = message + ) + + validate(instance) + + return instance + } + + private fun validate(instance: APIMError) { + 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( + message = message + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AdditionalFee.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AdditionalFee.kt new file mode 100644 index 000000000..30241211d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AdditionalFee.kt @@ -0,0 +1,148 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsMoney +import com.expediagroup.sdk.xap.models.Deductible +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 + +/** + * List of additional fees including both mandatory and optional fees.such as young driver fee/drop off fee /CollisionDamageWaiver + * @param isRequired Indicates whether this additional fee is mandatory. + * @param financeCategory Category of the fee / Coverages + * @param financeSubCategory Sub category of the fee / Coverages . + * @param amount + * @param description Description of the fee. + * @param deductible + */ +data class AdditionalFee( + // Indicates whether this additional fee is mandatory. + @JsonProperty("IsRequired") + @field:NotNull + @field:Valid + val isRequired: kotlin.Boolean, + // Category of the fee / Coverages + @JsonProperty("FinanceCategory") + @field:NotNull + @field:Valid + val financeCategory: kotlin.String, + // Sub category of the fee / Coverages . + @JsonProperty("FinanceSubCategory") + @field:NotNull + @field:Valid + val financeSubCategory: kotlin.String, + @JsonProperty("Amount") + @field:NotNull + @field:Valid + val amount: CarsMoney, + // Description of the fee. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + @JsonProperty("Deductible") + @field:Valid + val deductible: Deductible? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var isRequired: kotlin.Boolean? = null, + private var financeCategory: kotlin.String? = null, + private var financeSubCategory: kotlin.String? = null, + private var amount: CarsMoney? = null, + private var description: kotlin.String? = null, + private var deductible: Deductible? = null + ) { + fun isRequired(isRequired: kotlin.Boolean) = apply { this.isRequired = isRequired } + + fun financeCategory(financeCategory: kotlin.String) = apply { this.financeCategory = financeCategory } + + fun financeSubCategory(financeSubCategory: kotlin.String) = apply { this.financeSubCategory = financeSubCategory } + + fun amount(amount: CarsMoney) = apply { this.amount = amount } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun deductible(deductible: Deductible?) = apply { this.deductible = deductible } + + fun build(): AdditionalFee { + val instance = + AdditionalFee( + isRequired = isRequired!!, + financeCategory = financeCategory!!, + financeSubCategory = financeSubCategory!!, + amount = amount!!, + description = description, + deductible = deductible + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AdditionalFee) { + 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( + isRequired = isRequired!!, + financeCategory = financeCategory!!, + financeSubCategory = financeSubCategory!!, + amount = amount!!, + description = description, + deductible = deductible + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Address.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Address.kt new file mode 100644 index 000000000..d10f7d59c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Address.kt @@ -0,0 +1,143 @@ +/* + * 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.xap.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 + +/** + * The address information of the location. + * @param address1 Street Number, Street Name, or PO Box + * @param address2 Apartment, Floor, Suite, Bldg or more specific information about Address1. + * @param city The city + * @param province The state or province + * @param country 3-letter code for the country + * @param postalCode Zip/postal code + */ +data class Address( + // Street Number, Street Name, or PO Box + @JsonProperty("Address1") + @field:Valid + val address1: kotlin.String? = null, + // Apartment, Floor, Suite, Bldg or more specific information about Address1. + @JsonProperty("Address2") + @field:Valid + val address2: kotlin.String? = null, + // The city + @JsonProperty("City") + @field:Valid + val city: kotlin.String? = null, + // The state or province + @JsonProperty("Province") + @field:Valid + val province: kotlin.String? = null, + // 3-letter code for the country + @JsonProperty("Country") + @field:Valid + val country: kotlin.String? = null, + // Zip/postal code + @JsonProperty("PostalCode") + @field:Valid + val postalCode: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var address1: kotlin.String? = null, + private var address2: kotlin.String? = null, + private var city: kotlin.String? = null, + private var province: kotlin.String? = null, + private var country: kotlin.String? = null, + private var postalCode: kotlin.String? = null + ) { + fun address1(address1: kotlin.String?) = apply { this.address1 = address1 } + + fun address2(address2: kotlin.String?) = apply { this.address2 = address2 } + + fun city(city: kotlin.String?) = apply { this.city = city } + + fun province(province: kotlin.String?) = apply { this.province = province } + + fun country(country: kotlin.String?) = apply { this.country = country } + + fun postalCode(postalCode: kotlin.String?) = apply { this.postalCode = postalCode } + + fun build(): Address { + val instance = + Address( + address1 = address1, + address2 = address2, + city = city, + province = province, + country = country, + postalCode = postalCode + ) + + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + address1 = address1, + address2 = address2, + city = city, + province = province, + country = country, + postalCode = postalCode + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AgeClassRestriction.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AgeClassRestriction.kt new file mode 100644 index 000000000..a3c948d70 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AgeClassRestriction.kt @@ -0,0 +1,142 @@ +/* + * 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.xap.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 + +/** + * Container for room occupancy rules based on the age of the guests. + * @param ageClass Categories for hotel guests, based on age. + * @param ageMinimum The minimum age defined in a particular `AgeClass`. + * @param ageMaximum The maximum age defined in a particular `AgeClass`. If not specified, the `AgeClass` has no upper bound. + * @param maxGuestCount The max guest count allowed in a particular `AgeClass`. + */ +data class AgeClassRestriction( + // Categories for hotel guests, based on age. + @JsonProperty("AgeClass") + val ageClass: AgeClassRestriction.AgeClass? = null, + // The minimum age defined in a particular `AgeClass`. + @JsonProperty("AgeMinimum") + val ageMinimum: kotlin.Int? = null, + // The maximum age defined in a particular `AgeClass`. If not specified, the `AgeClass` has no upper bound. + @JsonProperty("AgeMaximum") + val ageMaximum: kotlin.Int? = null, + // The max guest count allowed in a particular `AgeClass`. + @JsonProperty("MaxGuestCount") + val maxGuestCount: kotlin.Int? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var ageClass: AgeClassRestriction.AgeClass? = null, + private var ageMinimum: kotlin.Int? = null, + private var ageMaximum: kotlin.Int? = null, + private var maxGuestCount: kotlin.Int? = null + ) { + fun ageClass(ageClass: AgeClassRestriction.AgeClass?) = apply { this.ageClass = ageClass } + + fun ageMinimum(ageMinimum: kotlin.Int?) = apply { this.ageMinimum = ageMinimum } + + fun ageMaximum(ageMaximum: kotlin.Int?) = apply { this.ageMaximum = ageMaximum } + + fun maxGuestCount(maxGuestCount: kotlin.Int?) = apply { this.maxGuestCount = maxGuestCount } + + fun build(): AgeClassRestriction { + val instance = + AgeClassRestriction( + ageClass = ageClass, + ageMinimum = ageMinimum, + ageMaximum = ageMaximum, + maxGuestCount = maxGuestCount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AgeClassRestriction) { + 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( + ageClass = ageClass, + ageMinimum = ageMinimum, + ageMaximum = ageMaximum, + maxGuestCount = maxGuestCount + ) + + /** + * Categories for hotel guests, based on age. + * Values: ALL_AGES,SENIOR,ADULT,CHILD,INFANT,OTHER + */ + enum class AgeClass(val value: kotlin.String) { + @JsonProperty("All Ages") + ALL_AGES("All Ages"), + + @JsonProperty("Senior") + SENIOR("Senior"), + + @JsonProperty("Adult") + ADULT("Adult"), + + @JsonProperty("Child") + CHILD("Child"), + + @JsonProperty("Infant") + INFANT("Infant"), + + @JsonProperty("Other") + OTHER("Other") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AvailabilityCalendar.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AvailabilityCalendar.kt new file mode 100644 index 000000000..9e0076e00 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AvailabilityCalendar.kt @@ -0,0 +1,153 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.DateRange +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param propertyId The unique property identifier that designates a single property. + * @param dateRange + * @param availability A string of codes that shows property availability, one for every day in the specified date range. Valid values include Y (available) and N (unavailable). ***Note**: The first code stands for availability on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`.* + * @param changeOver A string of codes that shows changeover action, one for every day in the specified date range. Valid values include - X (no action possible) - C (check-in, checkout) - O (checkout only) - I (check-in only) ***Note**: The first code stands for possible action on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. All actions are possible if not returned.* + * @param minPriorNotify A comma-separated list of numbers that shows how many days before a reservation the booking must occur, one for every day in the specified date range. Valid values include 0-999, and 0 indicates no prior notification required for a given day. The unit is always day. ***Note**: The first number stands for the minimum advance booking days on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. No limitation if not returned.* + * @param minStay A comma-separated list of numbers that show the minimum number of days a traveler can stay, one for every day in the specified date range. Valid values include 0-999, and 0 indicates no minimum for a given day. The unit is always day. ***Note**: The first number stands for the minimum stay on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. No limitation if not returned.* + * @param maxStay A comma-separated list of numbers that show the maximum number of days a traveler can stay, one for every day in the specified date range. Valid values include 0-999, and 0 indicates no maximum for a given day. The unit is always day. ***Note**: The first number stands for the maximum stay on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. No limitation if not returned. + */ +data class AvailabilityCalendar( + // The unique property identifier that designates a single property. + @JsonProperty("PropertyId") + @field:Valid + val propertyId: kotlin.String? = null, + @JsonProperty("DateRange") + @field:Valid + val dateRange: DateRange? = null, + // A string of codes that shows property availability, one for every day in the specified date range. Valid values include Y (available) and N (unavailable). ***Note**: The first code stands for availability on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`.* + @JsonProperty("Availability") + @field:Valid + val availability: kotlin.String? = null, + // A string of codes that shows changeover action, one for every day in the specified date range. Valid values include - X (no action possible) - C (check-in, checkout) - O (checkout only) - I (check-in only) ***Note**: The first code stands for possible action on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. All actions are possible if not returned.* + @JsonProperty("ChangeOver") + @field:Valid + val changeOver: kotlin.String? = null, + // A comma-separated list of numbers that shows how many days before a reservation the booking must occur, one for every day in the specified date range. Valid values include 0-999, and 0 indicates no prior notification required for a given day. The unit is always day. ***Note**: The first number stands for the minimum advance booking days on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. No limitation if not returned.* + @JsonProperty("MinPriorNotify") + @field:Valid + val minPriorNotify: kotlin.String? = null, + // A comma-separated list of numbers that show the minimum number of days a traveler can stay, one for every day in the specified date range. Valid values include 0-999, and 0 indicates no minimum for a given day. The unit is always day. ***Note**: The first number stands for the minimum stay on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. No limitation if not returned.* + @JsonProperty("MinStay") + @field:Valid + val minStay: kotlin.String? = null, + // A comma-separated list of numbers that show the maximum number of days a traveler can stay, one for every day in the specified date range. Valid values include 0-999, and 0 indicates no maximum for a given day. The unit is always day. ***Note**: The first number stands for the maximum stay on the `StartDate` in the `DateRange` and the last one stands for the `EndDate`. No limitation if not returned. + @JsonProperty("MaxStay") + @field:Valid + val maxStay: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var propertyId: kotlin.String? = null, + private var dateRange: DateRange? = null, + private var availability: kotlin.String? = null, + private var changeOver: kotlin.String? = null, + private var minPriorNotify: kotlin.String? = null, + private var minStay: kotlin.String? = null, + private var maxStay: kotlin.String? = null + ) { + fun propertyId(propertyId: kotlin.String?) = apply { this.propertyId = propertyId } + + fun dateRange(dateRange: DateRange?) = apply { this.dateRange = dateRange } + + fun availability(availability: kotlin.String?) = apply { this.availability = availability } + + fun changeOver(changeOver: kotlin.String?) = apply { this.changeOver = changeOver } + + fun minPriorNotify(minPriorNotify: kotlin.String?) = apply { this.minPriorNotify = minPriorNotify } + + fun minStay(minStay: kotlin.String?) = apply { this.minStay = minStay } + + fun maxStay(maxStay: kotlin.String?) = apply { this.maxStay = maxStay } + + fun build(): AvailabilityCalendar { + val instance = + AvailabilityCalendar( + propertyId = propertyId, + dateRange = dateRange, + availability = availability, + changeOver = changeOver, + minPriorNotify = minPriorNotify, + minStay = minStay, + maxStay = maxStay + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AvailabilityCalendar) { + 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, + dateRange = dateRange, + availability = availability, + changeOver = changeOver, + minPriorNotify = minPriorNotify, + minStay = minStay, + maxStay = maxStay + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AvailabilityCalendarResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AvailabilityCalendarResponse.kt new file mode 100644 index 000000000..1539de6b9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/AvailabilityCalendarResponse.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.AvailabilityCalendar +import com.expediagroup.sdk.xap.models.LodgingWarning +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param warnings There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + * @param transactionId Unique identifier for the transaction. + * @param availabilityCalendars A list of the calendar entities. + */ +data class AvailabilityCalendarResponse( + // There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + // Unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null, + // A list of the calendar entities. + @JsonProperty("AvailabilityCalendars") + @field:Valid + val availabilityCalendars: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var warnings: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null, + private var availabilityCalendars: kotlin.collections.List? = null + ) { + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun availabilityCalendars(availabilityCalendars: kotlin.collections.List?) = apply { this.availabilityCalendars = availabilityCalendars } + + fun build(): AvailabilityCalendarResponse { + val instance = + AvailabilityCalendarResponse( + warnings = warnings, + transactionId = transactionId, + availabilityCalendars = availabilityCalendars + ) + + validate(instance) + + return instance + } + + private fun validate(instance: AvailabilityCalendarResponse) { + 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( + warnings = warnings, + transactionId = transactionId, + availabilityCalendars = availabilityCalendars + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/BedType.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/BedType.kt new file mode 100644 index 000000000..8dd01d693 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/BedType.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * Statement of bed types available for this offer. A room may have several bed type options available. **NOTE**: due to the large number of bed type options available, we no longer publish a list of available bed types. More information is available in [Lodging Bed Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/bed-types). + * @param id The bed type ID + * @param description The bed type description. + */ +data class BedType( + // The bed type ID + @JsonProperty("Id") + @field:Valid + val id: kotlin.String? = null, + // The bed type description. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: 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(): BedType { + val instance = + BedType( + id = id, + description = description + ) + + validate(instance) + + return instance + } + + private fun validate(instance: BedType) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPenaltyRule.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPenaltyRule.kt new file mode 100644 index 000000000..813dd4764 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPenaltyRule.kt @@ -0,0 +1,130 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CancellationPenaltyRulePenaltyPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param penaltyNightCount Specifies the per-stay cancellation fee charged in terms of the cost of the number of nights listed, in addition to any other penalties. The rate charged is based on the earliest night(s) of the stay. + * @param penaltyPercentOfStay Specifies the per-stay cancellation fee charged as a percentage of the total rate, in addition to any other penalties listed. + * @param penaltyPrice + * @param penaltyStartDateTime The beginning of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the hotel. + * @param penaltyEndDateTime The end of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the hotel. + */ +data class CancellationPenaltyRule( + // Specifies the per-stay cancellation fee charged in terms of the cost of the number of nights listed, in addition to any other penalties. The rate charged is based on the earliest night(s) of the stay. + @JsonProperty("PenaltyNightCount") + val penaltyNightCount: kotlin.Int? = null, + // Specifies the per-stay cancellation fee charged as a percentage of the total rate, in addition to any other penalties listed. + @JsonProperty("PenaltyPercentOfStay") + @field:Valid + val penaltyPercentOfStay: kotlin.String? = null, + @JsonProperty("PenaltyPrice") + @field:Valid + val penaltyPrice: CancellationPenaltyRulePenaltyPrice? = null, + // The beginning of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the hotel. + @JsonProperty("PenaltyStartDateTime") + val penaltyStartDateTime: java.time.OffsetDateTime? = null, + // The end of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the hotel. + @JsonProperty("PenaltyEndDateTime") + val penaltyEndDateTime: java.time.OffsetDateTime? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var penaltyNightCount: kotlin.Int? = null, + private var penaltyPercentOfStay: kotlin.String? = null, + private var penaltyPrice: CancellationPenaltyRulePenaltyPrice? = null, + private var penaltyStartDateTime: java.time.OffsetDateTime? = null, + private var penaltyEndDateTime: java.time.OffsetDateTime? = null + ) { + fun penaltyNightCount(penaltyNightCount: kotlin.Int?) = apply { this.penaltyNightCount = penaltyNightCount } + + fun penaltyPercentOfStay(penaltyPercentOfStay: kotlin.String?) = apply { this.penaltyPercentOfStay = penaltyPercentOfStay } + + fun penaltyPrice(penaltyPrice: CancellationPenaltyRulePenaltyPrice?) = apply { this.penaltyPrice = penaltyPrice } + + fun penaltyStartDateTime(penaltyStartDateTime: java.time.OffsetDateTime?) = apply { this.penaltyStartDateTime = penaltyStartDateTime } + + fun penaltyEndDateTime(penaltyEndDateTime: java.time.OffsetDateTime?) = apply { this.penaltyEndDateTime = penaltyEndDateTime } + + fun build(): CancellationPenaltyRule { + val instance = + CancellationPenaltyRule( + penaltyNightCount = penaltyNightCount, + penaltyPercentOfStay = penaltyPercentOfStay, + penaltyPrice = penaltyPrice, + penaltyStartDateTime = penaltyStartDateTime, + penaltyEndDateTime = penaltyEndDateTime + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CancellationPenaltyRule) { + 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( + penaltyNightCount = penaltyNightCount, + penaltyPercentOfStay = penaltyPercentOfStay, + penaltyPrice = penaltyPrice, + penaltyStartDateTime = penaltyStartDateTime, + penaltyEndDateTime = penaltyEndDateTime + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPenaltyRulePenaltyPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPenaltyRulePenaltyPrice.kt new file mode 100644 index 000000000..448d38b1f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPenaltyRulePenaltyPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class CancellationPenaltyRulePenaltyPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): CancellationPenaltyRulePenaltyPrice { + val instance = + CancellationPenaltyRulePenaltyPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CancellationPenaltyRulePenaltyPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPolicy.kt new file mode 100644 index 000000000..5a12667ea --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CancellationPolicy.kt @@ -0,0 +1,164 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CancellationPenaltyRule +import com.expediagroup.sdk.xap.models.NonRefundableDateRange +import com.expediagroup.sdk.xap.models.WaiverPolicy +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for room cancellation policy. + * @param waiverPolicy + * @param cancellableOnline Boolean value to identify if the reservation can be cancelled online. If false, the customer will only be able to cancel a refundable room by calling Expedia Customer Service. + * @param refundable Indicate whether the rate is refundable or not. + * @param freeCancellation Indicate whether the room can be cancelled free of charge. + * @param freeCancellationEndDateTime The date and time until which the room can be cancelled free of charge. This is expressed in the local time of the Hotel. + * @param cancellationPenaltyRules Container for cancellation penalty details. + * @param cancelPolicyDescription Additional cancellation policy information available as static text. + * @param nonRefundableDateRanges A list of dates ranges that are non-refundable. **Note**: The stay dates in those date ranges will always be charged whenever there is any cancellation penalty rule. + */ +data class CancellationPolicy( + @JsonProperty("WaiverPolicy") + @field:Valid + val waiverPolicy: WaiverPolicy? = null, + // Boolean value to identify if the reservation can be cancelled online. If false, the customer will only be able to cancel a refundable room by calling Expedia Customer Service. + @JsonProperty("CancellableOnline") + @field:Valid + val cancellableOnline: kotlin.Boolean? = null, + // Indicate whether the rate is refundable or not. + @JsonProperty("Refundable") + @field:Valid + val refundable: kotlin.Boolean? = null, + // Indicate whether the room can be cancelled free of charge. + @JsonProperty("FreeCancellation") + @field:Valid + val freeCancellation: kotlin.Boolean? = null, + // The date and time until which the room can be cancelled free of charge. This is expressed in the local time of the Hotel. + @JsonProperty("FreeCancellationEndDateTime") + val freeCancellationEndDateTime: java.time.OffsetDateTime? = null, + // Container for cancellation penalty details. + @JsonProperty("CancellationPenaltyRules") + @field:Valid + val cancellationPenaltyRules: kotlin.collections.List? = null, + // Additional cancellation policy information available as static text. + @JsonProperty("CancelPolicyDescription") + @field:Valid + val cancelPolicyDescription: kotlin.String? = null, + // A list of dates ranges that are non-refundable. **Note**: The stay dates in those date ranges will always be charged whenever there is any cancellation penalty rule. + @JsonProperty("NonRefundableDateRanges") + @field:Valid + val nonRefundableDateRanges: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var waiverPolicy: WaiverPolicy? = null, + private var cancellableOnline: kotlin.Boolean? = null, + private var refundable: kotlin.Boolean? = null, + private var freeCancellation: kotlin.Boolean? = null, + private var freeCancellationEndDateTime: java.time.OffsetDateTime? = null, + private var cancellationPenaltyRules: kotlin.collections.List? = null, + private var cancelPolicyDescription: kotlin.String? = null, + private var nonRefundableDateRanges: kotlin.collections.List? = null + ) { + fun waiverPolicy(waiverPolicy: WaiverPolicy?) = apply { this.waiverPolicy = waiverPolicy } + + fun cancellableOnline(cancellableOnline: kotlin.Boolean?) = apply { this.cancellableOnline = cancellableOnline } + + fun refundable(refundable: kotlin.Boolean?) = apply { this.refundable = refundable } + + fun freeCancellation(freeCancellation: kotlin.Boolean?) = apply { this.freeCancellation = freeCancellation } + + fun freeCancellationEndDateTime(freeCancellationEndDateTime: java.time.OffsetDateTime?) = apply { this.freeCancellationEndDateTime = freeCancellationEndDateTime } + + fun cancellationPenaltyRules(cancellationPenaltyRules: kotlin.collections.List?) = apply { this.cancellationPenaltyRules = cancellationPenaltyRules } + + fun cancelPolicyDescription(cancelPolicyDescription: kotlin.String?) = apply { this.cancelPolicyDescription = cancelPolicyDescription } + + fun nonRefundableDateRanges(nonRefundableDateRanges: kotlin.collections.List?) = apply { this.nonRefundableDateRanges = nonRefundableDateRanges } + + fun build(): CancellationPolicy { + val instance = + CancellationPolicy( + waiverPolicy = waiverPolicy, + cancellableOnline = cancellableOnline, + refundable = refundable, + freeCancellation = freeCancellation, + freeCancellationEndDateTime = freeCancellationEndDateTime, + cancellationPenaltyRules = cancellationPenaltyRules, + cancelPolicyDescription = cancelPolicyDescription, + nonRefundableDateRanges = nonRefundableDateRanges + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CancellationPolicy) { + 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( + waiverPolicy = waiverPolicy, + cancellableOnline = cancellableOnline, + refundable = refundable, + freeCancellation = freeCancellation, + freeCancellationEndDateTime = freeCancellationEndDateTime, + cancellationPenaltyRules = cancellationPenaltyRules, + cancelPolicyDescription = cancelPolicyDescription, + nonRefundableDateRanges = nonRefundableDateRanges + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Capacity.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Capacity.kt new file mode 100644 index 000000000..17fbeb6c1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Capacity.kt @@ -0,0 +1,118 @@ +/* + * 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.xap.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 + +/** + * Capacity for car's properties. + * @param adultCount The typical number of adults that can fit comfortably in the car. + * @param childCount The typical number of children that can fit comfortably in the car. + * @param smallLuggageCount The typical number of small pieces of luggage that fit in the cargo space. + * @param largeLuggageCount The typical number of large pieces of luggage that fit in the cargo space. + */ +data class Capacity( + // The typical number of adults that can fit comfortably in the car. + @JsonProperty("AdultCount") + val adultCount: kotlin.Long, + // The typical number of children that can fit comfortably in the car. + @JsonProperty("ChildCount") + val childCount: kotlin.Long? = null, + // The typical number of small pieces of luggage that fit in the cargo space. + @JsonProperty("SmallLuggageCount") + val smallLuggageCount: kotlin.Long? = null, + // The typical number of large pieces of luggage that fit in the cargo space. + @JsonProperty("LargeLuggageCount") + val largeLuggageCount: kotlin.Long? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adultCount: kotlin.Long? = null, + private var childCount: kotlin.Long? = null, + private var smallLuggageCount: kotlin.Long? = null, + private var largeLuggageCount: kotlin.Long? = null + ) { + fun adultCount(adultCount: kotlin.Long) = apply { this.adultCount = adultCount } + + fun childCount(childCount: kotlin.Long?) = apply { this.childCount = childCount } + + fun smallLuggageCount(smallLuggageCount: kotlin.Long?) = apply { this.smallLuggageCount = smallLuggageCount } + + fun largeLuggageCount(largeLuggageCount: kotlin.Long?) = apply { this.largeLuggageCount = largeLuggageCount } + + fun build(): Capacity { + val instance = + Capacity( + adultCount = adultCount!!, + childCount = childCount, + smallLuggageCount = smallLuggageCount, + largeLuggageCount = largeLuggageCount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Capacity) { + 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, + smallLuggageCount = smallLuggageCount, + largeLuggageCount = largeLuggageCount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Car.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Car.kt new file mode 100644 index 000000000..2e806cdb7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Car.kt @@ -0,0 +1,262 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.AdditionalFee +import com.expediagroup.sdk.xap.models.CarsCancellationPolicy +import com.expediagroup.sdk.xap.models.CarsLink +import com.expediagroup.sdk.xap.models.CarsMoney +import com.expediagroup.sdk.xap.models.Image +import com.expediagroup.sdk.xap.models.PenaltyType +import com.expediagroup.sdk.xap.models.Price +import com.expediagroup.sdk.xap.models.RateDetails +import com.expediagroup.sdk.xap.models.RatingWithoutDetails +import com.expediagroup.sdk.xap.models.Supplier +import com.expediagroup.sdk.xap.models.VehicleDetails +import com.expediagroup.sdk.xap.models.VendorLocationDetails +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 + +/** + * List of cars matching the search criteria. + * @param id Uniquely identifies a Car Offer.Note: since pay-online and pay-at-the-counter Car Offers have the same associated Rate Code, the Offer ID is the only unique identifier to differentiate between the two offers when referencing or booking. + * @param vehicleDetails + * @param supplier + * @param pickupDetails + * @param dropOffDetails + * @param price + * @param cancellationPolicy + * @param dataTimeStamp DataTimeStamp + * @param onlineCheckIn Indicate whether the supplier supports online checkin + * @param skipTheCounter Indicate whether the supplier supports skip the counter + * @param links A map of links to other Car APIs or Expedia websites. + * @param rateDetails + * @param referencePrice + * @param additionalFees List of additional fees including both mandatory and optional fees.such as young driver fee/drop off fee /CollisionDamageWaiver + * @param noShowPenalty + * @param images List of image resources of the car product. + * @param rating + */ +data class Car( + // Uniquely identifies a Car Offer.Note: since pay-online and pay-at-the-counter Car Offers have the same associated Rate Code, the Offer ID is the only unique identifier to differentiate between the two offers when referencing or booking. + @JsonProperty("Id") + @field:NotNull + @field:Valid + val id: kotlin.String, + @JsonProperty("VehicleDetails") + @field:NotNull + @field:Valid + val vehicleDetails: VehicleDetails, + @JsonProperty("Supplier") + @field:NotNull + @field:Valid + val supplier: Supplier, + @JsonProperty("PickupDetails") + @field:NotNull + @field:Valid + val pickupDetails: VendorLocationDetails, + @JsonProperty("DropOffDetails") + @field:NotNull + @field:Valid + val dropOffDetails: VendorLocationDetails, + @JsonProperty("Price") + @field:NotNull + @field:Valid + val price: Price, + @JsonProperty("CancellationPolicy") + @field:NotNull + @field:Valid + val cancellationPolicy: CarsCancellationPolicy, + // DataTimeStamp + @JsonProperty("DataTimeStamp") + val dataTimeStamp: java.time.OffsetDateTime? = null, + // Indicate whether the supplier supports online checkin + @JsonProperty("OnlineCheckIn") + @field:Valid + val onlineCheckIn: kotlin.Boolean? = null, + // Indicate whether the supplier supports skip the counter + @JsonProperty("SkipTheCounter") + @field:Valid + val skipTheCounter: kotlin.Boolean? = null, + // A map of links to other Car APIs or Expedia websites. + @JsonProperty("Links") + @field:Valid + val links: kotlin.collections.Map? = null, + @JsonProperty("RateDetails") + @field:Valid + val rateDetails: RateDetails? = null, + @JsonProperty("ReferencePrice") + @field:Valid + val referencePrice: CarsMoney? = null, + // List of additional fees including both mandatory and optional fees.such as young driver fee/drop off fee /CollisionDamageWaiver + @JsonProperty("AdditionalFees") + @field:Valid + val additionalFees: kotlin.collections.List? = null, + @JsonProperty("NoShowPenalty") + @field:Valid + val noShowPenalty: PenaltyType? = null, + // List of image resources of the car product. + @JsonProperty("Images") + @field:Valid + val images: kotlin.collections.List? = null, + @JsonProperty("Rating") + @field:Valid + val rating: RatingWithoutDetails? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.String? = null, + private var vehicleDetails: VehicleDetails? = null, + private var supplier: Supplier? = null, + private var pickupDetails: VendorLocationDetails? = null, + private var dropOffDetails: VendorLocationDetails? = null, + private var price: Price? = null, + private var cancellationPolicy: CarsCancellationPolicy? = null, + private var dataTimeStamp: java.time.OffsetDateTime? = null, + private var onlineCheckIn: kotlin.Boolean? = null, + private var skipTheCounter: kotlin.Boolean? = null, + private var links: kotlin.collections.Map? = null, + private var rateDetails: RateDetails? = null, + private var referencePrice: CarsMoney? = null, + private var additionalFees: kotlin.collections.List? = null, + private var noShowPenalty: PenaltyType? = null, + private var images: kotlin.collections.List? = null, + private var rating: RatingWithoutDetails? = null + ) { + fun id(id: kotlin.String) = apply { this.id = id } + + fun vehicleDetails(vehicleDetails: VehicleDetails) = apply { this.vehicleDetails = vehicleDetails } + + fun supplier(supplier: Supplier) = apply { this.supplier = supplier } + + fun pickupDetails(pickupDetails: VendorLocationDetails) = apply { this.pickupDetails = pickupDetails } + + fun dropOffDetails(dropOffDetails: VendorLocationDetails) = apply { this.dropOffDetails = dropOffDetails } + + fun price(price: Price) = apply { this.price = price } + + fun cancellationPolicy(cancellationPolicy: CarsCancellationPolicy) = apply { this.cancellationPolicy = cancellationPolicy } + + fun dataTimeStamp(dataTimeStamp: java.time.OffsetDateTime?) = apply { this.dataTimeStamp = dataTimeStamp } + + fun onlineCheckIn(onlineCheckIn: kotlin.Boolean?) = apply { this.onlineCheckIn = onlineCheckIn } + + fun skipTheCounter(skipTheCounter: kotlin.Boolean?) = apply { this.skipTheCounter = skipTheCounter } + + fun links(links: kotlin.collections.Map?) = apply { this.links = links } + + fun rateDetails(rateDetails: RateDetails?) = apply { this.rateDetails = rateDetails } + + fun referencePrice(referencePrice: CarsMoney?) = apply { this.referencePrice = referencePrice } + + fun additionalFees(additionalFees: kotlin.collections.List?) = apply { this.additionalFees = additionalFees } + + fun noShowPenalty(noShowPenalty: PenaltyType?) = apply { this.noShowPenalty = noShowPenalty } + + fun images(images: kotlin.collections.List?) = apply { this.images = images } + + fun rating(rating: RatingWithoutDetails?) = apply { this.rating = rating } + + fun build(): Car { + val instance = + Car( + id = id!!, + vehicleDetails = vehicleDetails!!, + supplier = supplier!!, + pickupDetails = pickupDetails!!, + dropOffDetails = dropOffDetails!!, + price = price!!, + cancellationPolicy = cancellationPolicy!!, + dataTimeStamp = dataTimeStamp, + onlineCheckIn = onlineCheckIn, + skipTheCounter = skipTheCounter, + links = links, + rateDetails = rateDetails, + referencePrice = referencePrice, + additionalFees = additionalFees, + noShowPenalty = noShowPenalty, + images = images, + rating = rating + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Car) { + 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!!, + vehicleDetails = vehicleDetails!!, + supplier = supplier!!, + pickupDetails = pickupDetails!!, + dropOffDetails = dropOffDetails!!, + price = price!!, + cancellationPolicy = cancellationPolicy!!, + dataTimeStamp = dataTimeStamp, + onlineCheckIn = onlineCheckIn, + skipTheCounter = skipTheCounter, + links = links, + rateDetails = rateDetails, + referencePrice = referencePrice, + additionalFees = additionalFees, + noShowPenalty = noShowPenalty, + images = images, + rating = rating + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarCategory.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarCategory.kt new file mode 100644 index 000000000..df984b321 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarCategory.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Car category. Please find list of Car Type Codes in https://expediaintegration.zendesk.com/hc/en-us/articles/115008631767 + * @param code Car category code. + * @param `value` Car category value. + */ +data class CarCategory( + // Car category code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Car category value. + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var `value`: kotlin.String? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun build(): CarCategory { + val instance = + CarCategory( + code = code!!, + `value` = `value`!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarCategory) { + 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!!, + `value` = `value`!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarDetails.kt new file mode 100644 index 000000000..e2047620e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarDetails.kt @@ -0,0 +1,285 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.AdditionalFee +import com.expediagroup.sdk.xap.models.CarPolicy +import com.expediagroup.sdk.xap.models.CarsCancellationPolicy +import com.expediagroup.sdk.xap.models.CarsMoney +import com.expediagroup.sdk.xap.models.Equipment +import com.expediagroup.sdk.xap.models.ExtraFees +import com.expediagroup.sdk.xap.models.Image +import com.expediagroup.sdk.xap.models.PenaltyType +import com.expediagroup.sdk.xap.models.Price +import com.expediagroup.sdk.xap.models.RateDetails +import com.expediagroup.sdk.xap.models.Rating +import com.expediagroup.sdk.xap.models.RentalLimits +import com.expediagroup.sdk.xap.models.Supplier +import com.expediagroup.sdk.xap.models.TaxesAndFees +import com.expediagroup.sdk.xap.models.VehicleDetails +import com.expediagroup.sdk.xap.models.VendorLocationDetails +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 + +/** + * Details of requested car. + * @param vehicleDetails + * @param supplier + * @param pickupDetails + * @param dropOffDetails + * @param price + * @param cancellationPolicy + * @param onlineCheckIn Indicate whether the supplier supports online checkin + * @param skipTheCounter Indicate whether the supplier supports skip the counter + * @param rateDetails + * @param referencePrice + * @param additionalFees List of additional fees including both mandatory and optional fees.such as young driver fee/drop off fee /CollisionDamageWaiver + * @param taxesAndFeesDetails List of TaxesAndFees Details + * @param extraFeesDetails List of ExtraFeesDetails + * @param specialEquipments Description and costs of any optional special equipment that may be rented with the car. + * @param rentalLimits + * @param noShowPenalty + * @param carPolicies A list of policies that apply to this car rental. + * @param images List of image resources of the car product. + * @param rating + */ +data class CarDetails( + @JsonProperty("VehicleDetails") + @field:NotNull + @field:Valid + val vehicleDetails: VehicleDetails, + @JsonProperty("Supplier") + @field:NotNull + @field:Valid + val supplier: Supplier, + @JsonProperty("PickupDetails") + @field:NotNull + @field:Valid + val pickupDetails: VendorLocationDetails, + @JsonProperty("DropOffDetails") + @field:NotNull + @field:Valid + val dropOffDetails: VendorLocationDetails, + @JsonProperty("Price") + @field:NotNull + @field:Valid + val price: Price, + @JsonProperty("CancellationPolicy") + @field:NotNull + @field:Valid + val cancellationPolicy: CarsCancellationPolicy, + // Indicate whether the supplier supports online checkin + @JsonProperty("OnlineCheckIn") + @field:Valid + val onlineCheckIn: kotlin.Boolean? = null, + // Indicate whether the supplier supports skip the counter + @JsonProperty("SkipTheCounter") + @field:Valid + val skipTheCounter: kotlin.Boolean? = null, + @JsonProperty("RateDetails") + @field:Valid + val rateDetails: RateDetails? = null, + @JsonProperty("ReferencePrice") + @field:Valid + val referencePrice: CarsMoney? = null, + // List of additional fees including both mandatory and optional fees.such as young driver fee/drop off fee /CollisionDamageWaiver + @JsonProperty("AdditionalFees") + @field:Valid + val additionalFees: kotlin.collections.List? = null, + // List of TaxesAndFees Details + @JsonProperty("TaxesAndFeesDetails") + @field:Valid + val taxesAndFeesDetails: kotlin.collections.List? = null, + // List of ExtraFeesDetails + @JsonProperty("ExtraFeesDetails") + @field:Valid + val extraFeesDetails: kotlin.collections.List? = null, + // Description and costs of any optional special equipment that may be rented with the car. + @JsonProperty("SpecialEquipments") + @field:Valid + val specialEquipments: kotlin.collections.List? = null, + @JsonProperty("RentalLimits") + @field:Valid + val rentalLimits: RentalLimits? = null, + @JsonProperty("NoShowPenalty") + @field:Valid + val noShowPenalty: PenaltyType? = null, + // A list of policies that apply to this car rental. + @JsonProperty("CarPolicies") + @field:Valid + val carPolicies: kotlin.collections.List? = null, + // List of image resources of the car product. + @JsonProperty("Images") + @field:Valid + val images: kotlin.collections.List? = null, + @JsonProperty("Rating") + @field:Valid + val rating: Rating? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var vehicleDetails: VehicleDetails? = null, + private var supplier: Supplier? = null, + private var pickupDetails: VendorLocationDetails? = null, + private var dropOffDetails: VendorLocationDetails? = null, + private var price: Price? = null, + private var cancellationPolicy: CarsCancellationPolicy? = null, + private var onlineCheckIn: kotlin.Boolean? = null, + private var skipTheCounter: kotlin.Boolean? = null, + private var rateDetails: RateDetails? = null, + private var referencePrice: CarsMoney? = null, + private var additionalFees: kotlin.collections.List? = null, + private var taxesAndFeesDetails: kotlin.collections.List? = null, + private var extraFeesDetails: kotlin.collections.List? = null, + private var specialEquipments: kotlin.collections.List? = null, + private var rentalLimits: RentalLimits? = null, + private var noShowPenalty: PenaltyType? = null, + private var carPolicies: kotlin.collections.List? = null, + private var images: kotlin.collections.List? = null, + private var rating: Rating? = null + ) { + fun vehicleDetails(vehicleDetails: VehicleDetails) = apply { this.vehicleDetails = vehicleDetails } + + fun supplier(supplier: Supplier) = apply { this.supplier = supplier } + + fun pickupDetails(pickupDetails: VendorLocationDetails) = apply { this.pickupDetails = pickupDetails } + + fun dropOffDetails(dropOffDetails: VendorLocationDetails) = apply { this.dropOffDetails = dropOffDetails } + + fun price(price: Price) = apply { this.price = price } + + fun cancellationPolicy(cancellationPolicy: CarsCancellationPolicy) = apply { this.cancellationPolicy = cancellationPolicy } + + fun onlineCheckIn(onlineCheckIn: kotlin.Boolean?) = apply { this.onlineCheckIn = onlineCheckIn } + + fun skipTheCounter(skipTheCounter: kotlin.Boolean?) = apply { this.skipTheCounter = skipTheCounter } + + fun rateDetails(rateDetails: RateDetails?) = apply { this.rateDetails = rateDetails } + + fun referencePrice(referencePrice: CarsMoney?) = apply { this.referencePrice = referencePrice } + + fun additionalFees(additionalFees: kotlin.collections.List?) = apply { this.additionalFees = additionalFees } + + fun taxesAndFeesDetails(taxesAndFeesDetails: kotlin.collections.List?) = apply { this.taxesAndFeesDetails = taxesAndFeesDetails } + + fun extraFeesDetails(extraFeesDetails: kotlin.collections.List?) = apply { this.extraFeesDetails = extraFeesDetails } + + fun specialEquipments(specialEquipments: kotlin.collections.List?) = apply { this.specialEquipments = specialEquipments } + + fun rentalLimits(rentalLimits: RentalLimits?) = apply { this.rentalLimits = rentalLimits } + + fun noShowPenalty(noShowPenalty: PenaltyType?) = apply { this.noShowPenalty = noShowPenalty } + + fun carPolicies(carPolicies: kotlin.collections.List?) = apply { this.carPolicies = carPolicies } + + fun images(images: kotlin.collections.List?) = apply { this.images = images } + + fun rating(rating: Rating?) = apply { this.rating = rating } + + fun build(): CarDetails { + val instance = + CarDetails( + vehicleDetails = vehicleDetails!!, + supplier = supplier!!, + pickupDetails = pickupDetails!!, + dropOffDetails = dropOffDetails!!, + price = price!!, + cancellationPolicy = cancellationPolicy!!, + onlineCheckIn = onlineCheckIn, + skipTheCounter = skipTheCounter, + rateDetails = rateDetails, + referencePrice = referencePrice, + additionalFees = additionalFees, + taxesAndFeesDetails = taxesAndFeesDetails, + extraFeesDetails = extraFeesDetails, + specialEquipments = specialEquipments, + rentalLimits = rentalLimits, + noShowPenalty = noShowPenalty, + carPolicies = carPolicies, + images = images, + rating = rating + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarDetails) { + 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( + vehicleDetails = vehicleDetails!!, + supplier = supplier!!, + pickupDetails = pickupDetails!!, + dropOffDetails = dropOffDetails!!, + price = price!!, + cancellationPolicy = cancellationPolicy!!, + onlineCheckIn = onlineCheckIn, + skipTheCounter = skipTheCounter, + rateDetails = rateDetails, + referencePrice = referencePrice, + additionalFees = additionalFees, + taxesAndFeesDetails = taxesAndFeesDetails, + extraFeesDetails = extraFeesDetails, + specialEquipments = specialEquipments, + rentalLimits = rentalLimits, + noShowPenalty = noShowPenalty, + carPolicies = carPolicies, + images = images, + rating = rating + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarDetailsResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarDetailsResponse.kt new file mode 100644 index 000000000..3649d3c5d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarDetailsResponse.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarDetails +import com.expediagroup.sdk.xap.models.CarsLink +import com.expediagroup.sdk.xap.models.CarsValidFormsOfPayment +import com.expediagroup.sdk.xap.models.CarsWarning +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 transactionId A unique identifier for this transaction. + * @param warnings Container for warning codes + * @param carDetails + * @param validFormsOfPayment List of all the forms of payment that will be accepted for the booking of this rental transaction. + * @param links A map of links to other Car APIs. possible link name: ApiBooking + */ +data class CarDetailsResponse( + // A unique identifier for this transaction. + @JsonProperty("TransactionId") + @field:NotNull + @field:Valid + val transactionId: kotlin.String, + // Container for warning codes + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + @JsonProperty("CarDetails") + @field:Valid + val carDetails: CarDetails? = null, + // List of all the forms of payment that will be accepted for the booking of this rental transaction. + @JsonProperty("ValidFormsOfPayment") + @field:Valid + val validFormsOfPayment: kotlin.collections.List? = null, + // A map of links to other Car APIs. possible link name: ApiBooking + @JsonProperty("Links") + @field:Valid + val links: kotlin.collections.Map? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var transactionId: kotlin.String? = null, + private var warnings: kotlin.collections.List? = null, + private var carDetails: CarDetails? = null, + private var validFormsOfPayment: kotlin.collections.List? = null, + private var links: kotlin.collections.Map? = null + ) { + fun transactionId(transactionId: kotlin.String) = apply { this.transactionId = transactionId } + + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun carDetails(carDetails: CarDetails?) = apply { this.carDetails = carDetails } + + fun validFormsOfPayment(validFormsOfPayment: kotlin.collections.List?) = apply { this.validFormsOfPayment = validFormsOfPayment } + + fun links(links: kotlin.collections.Map?) = apply { this.links = links } + + fun build(): CarDetailsResponse { + val instance = + CarDetailsResponse( + transactionId = transactionId!!, + warnings = warnings, + carDetails = carDetails, + validFormsOfPayment = validFormsOfPayment, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarDetailsResponse) { + 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( + transactionId = transactionId!!, + warnings = warnings, + carDetails = carDetails, + validFormsOfPayment = validFormsOfPayment, + links = links + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarListingsResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarListingsResponse.kt new file mode 100644 index 000000000..c98eeed36 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarListingsResponse.kt @@ -0,0 +1,126 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Car +import com.expediagroup.sdk.xap.models.CarsWarning +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 transactionId A unique identifier for this transaction. + * @param carCount The number of cars offers returned in the response. + * @param warnings Container for warning codes + * @param cars List of cars matching the search criteria. + */ +data class CarListingsResponse( + // A unique identifier for this transaction. + @JsonProperty("TransactionId") + @field:NotNull + @field:Valid + val transactionId: kotlin.String, + // The number of cars offers returned in the response. + @JsonProperty("CarCount") + val carCount: kotlin.Long, + // Container for warning codes + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + // List of cars matching the search criteria. + @JsonProperty("Cars") + @field:Valid + val cars: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var transactionId: kotlin.String? = null, + private var carCount: kotlin.Long? = null, + private var warnings: kotlin.collections.List? = null, + private var cars: kotlin.collections.List? = null + ) { + fun transactionId(transactionId: kotlin.String) = apply { this.transactionId = transactionId } + + fun carCount(carCount: kotlin.Long) = apply { this.carCount = carCount } + + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun cars(cars: kotlin.collections.List?) = apply { this.cars = cars } + + fun build(): CarListingsResponse { + val instance = + CarListingsResponse( + transactionId = transactionId!!, + carCount = carCount!!, + warnings = warnings, + cars = cars + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarListingsResponse) { + 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( + transactionId = transactionId!!, + carCount = carCount!!, + warnings = warnings, + cars = cars + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarPolicy.kt new file mode 100644 index 000000000..4e181742b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarPolicy.kt @@ -0,0 +1,105 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * A list of policies that apply to this car rental. + * @param categoryCode The category that this policy applies to (e.g. cancellation, drivers license requirements, driver age requirements) + * @param policyText The raw text of the policy.This is generally localized into the requested language, but may be English if no other translations are available. + */ +data class CarPolicy( + // The category that this policy applies to (e.g. cancellation, drivers license requirements, driver age requirements) + @JsonProperty("CategoryCode") + @field:NotNull + @field:Valid + val categoryCode: kotlin.String, + // The raw text of the policy.This is generally localized into the requested language, but may be English if no other translations are available. + @JsonProperty("PolicyText") + @field:Valid + val policyText: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var categoryCode: kotlin.String? = null, + private var policyText: kotlin.String? = null + ) { + fun categoryCode(categoryCode: kotlin.String) = apply { this.categoryCode = categoryCode } + + fun policyText(policyText: kotlin.String?) = apply { this.policyText = policyText } + + fun build(): CarPolicy { + val instance = + CarPolicy( + categoryCode = categoryCode!!, + policyText = policyText + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarPolicy) { + 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( + categoryCode = categoryCode!!, + policyText = policyText + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarType.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarType.kt new file mode 100644 index 000000000..e5694075b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarType.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Car type. Please find list of Car Type Codes in https://expediaintegration.zendesk.com/hc/en-us/articles/115002516708 + * @param code Car type code. + * @param `value` Car type value. + */ +data class CarType( + // Car type code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Car type value. + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var `value`: kotlin.String? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun build(): CarType { + val instance = + CarType( + code = code!!, + `value` = `value`!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarType) { + 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!!, + `value` = `value`!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsAddress.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsAddress.kt new file mode 100644 index 000000000..55c39e7d0 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsAddress.kt @@ -0,0 +1,157 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Address information + * @param address1 Street Number, Street Name, or PO Box + * @param city The city + * @param country 3-letter code for the country + * @param address2 Apartment, Floor, Suite, Bldg # or more specific information about Address1. + * @param suite Suite/apartment number + * @param province The state or province + * @param postalCode Zip/postal code + */ +data class CarsAddress( + // Street Number, Street Name, or PO Box + @JsonProperty("Address1") + @field:NotNull + @field:Valid + val address1: kotlin.String, + // The city + @JsonProperty("City") + @field:NotNull + @field:Valid + val city: kotlin.String, + // 3-letter code for the country + @JsonProperty("Country") + @field:NotNull + @field:Valid + val country: kotlin.String, + // Apartment, Floor, Suite, Bldg # or more specific information about Address1. + @JsonProperty("Address2") + @field:Valid + val address2: kotlin.String? = null, + // Suite/apartment number + @JsonProperty("Suite") + @field:Valid + val suite: kotlin.String? = null, + // The state or province + @JsonProperty("Province") + @field:Valid + val province: kotlin.String? = null, + // Zip/postal code + @JsonProperty("PostalCode") + @field:Valid + val postalCode: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var address1: kotlin.String? = null, + private var city: kotlin.String? = null, + private var country: kotlin.String? = null, + private var address2: kotlin.String? = null, + private var suite: kotlin.String? = null, + private var province: kotlin.String? = null, + private var postalCode: kotlin.String? = null + ) { + fun address1(address1: kotlin.String) = apply { this.address1 = address1 } + + fun city(city: kotlin.String) = apply { this.city = city } + + fun country(country: kotlin.String) = apply { this.country = country } + + fun address2(address2: kotlin.String?) = apply { this.address2 = address2 } + + fun suite(suite: kotlin.String?) = apply { this.suite = suite } + + fun province(province: kotlin.String?) = apply { this.province = province } + + fun postalCode(postalCode: kotlin.String?) = apply { this.postalCode = postalCode } + + fun build(): CarsAddress { + val instance = + CarsAddress( + address1 = address1!!, + city = city!!, + country = country!!, + address2 = address2, + suite = suite, + province = province, + postalCode = postalCode + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsAddress) { + 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( + address1 = address1!!, + city = city!!, + country = country!!, + address2 = address2, + suite = suite, + province = province, + postalCode = postalCode + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsCancellationPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsCancellationPolicy.kt new file mode 100644 index 000000000..5b98a5167 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsCancellationPolicy.kt @@ -0,0 +1,133 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.NonCancellableDateTimeRange +import com.expediagroup.sdk.xap.models.PenaltyRule +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Cancellation Policy Container. + * @param cancellable Indicates if this car can be cancelled (free cancel or penalty cancel) + * @param freeCancellation Indicates if this car may be cancelled without a penalty. + * @param freeCancellationEndDateTime Indicates the latest time that the car can be cancelled for free. + * @param penaltyRules Container for penalty rules + * @param nonCancellableDateTimeRange + */ +data class CarsCancellationPolicy( + // Indicates if this car can be cancelled (free cancel or penalty cancel) + @JsonProperty("Cancellable") + @field:Valid + val cancellable: kotlin.Boolean? = null, + // Indicates if this car may be cancelled without a penalty. + @JsonProperty("FreeCancellation") + @field:Valid + val freeCancellation: kotlin.Boolean? = null, + // Indicates the latest time that the car can be cancelled for free. + @JsonProperty("FreeCancellationEndDateTime") + val freeCancellationEndDateTime: java.time.LocalDateTime? = null, + // Container for penalty rules + @JsonProperty("PenaltyRules") + @field:Valid + val penaltyRules: kotlin.collections.List? = null, + @JsonProperty("NonCancellableDateTimeRange") + @field:Valid + val nonCancellableDateTimeRange: NonCancellableDateTimeRange? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var cancellable: kotlin.Boolean? = null, + private var freeCancellation: kotlin.Boolean? = null, + private var freeCancellationEndDateTime: java.time.LocalDateTime? = null, + private var penaltyRules: kotlin.collections.List? = null, + private var nonCancellableDateTimeRange: NonCancellableDateTimeRange? = null + ) { + fun cancellable(cancellable: kotlin.Boolean?) = apply { this.cancellable = cancellable } + + fun freeCancellation(freeCancellation: kotlin.Boolean?) = apply { this.freeCancellation = freeCancellation } + + fun freeCancellationEndDateTime(freeCancellationEndDateTime: java.time.LocalDateTime?) = apply { this.freeCancellationEndDateTime = freeCancellationEndDateTime } + + fun penaltyRules(penaltyRules: kotlin.collections.List?) = apply { this.penaltyRules = penaltyRules } + + fun nonCancellableDateTimeRange(nonCancellableDateTimeRange: NonCancellableDateTimeRange?) = apply { this.nonCancellableDateTimeRange = nonCancellableDateTimeRange } + + fun build(): CarsCancellationPolicy { + val instance = + CarsCancellationPolicy( + cancellable = cancellable, + freeCancellation = freeCancellation, + freeCancellationEndDateTime = freeCancellationEndDateTime, + penaltyRules = penaltyRules, + nonCancellableDateTimeRange = nonCancellableDateTimeRange + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsCancellationPolicy) { + 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( + cancellable = cancellable, + freeCancellation = freeCancellation, + freeCancellationEndDateTime = freeCancellationEndDateTime, + penaltyRules = penaltyRules, + nonCancellableDateTimeRange = nonCancellableDateTimeRange + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsCountry.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsCountry.kt new file mode 100644 index 000000000..a77c1f2d7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsCountry.kt @@ -0,0 +1,127 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Container for disambiguation country information + * @param name country name + * @param isoCode2 2-letter code for the country + * @param isoCode3 3-letter code for the country + * @param code 3-letter code for the country + */ +data class CarsCountry( + // country name + @JsonProperty("Name") + @field:NotNull + @field:Valid + val name: kotlin.String, + // 2-letter code for the country + @JsonProperty("IsoCode2") + @field:NotNull + @field:Valid + val isoCode2: kotlin.String, + // 3-letter code for the country + @JsonProperty("IsoCode3") + @field:NotNull + @field:Valid + val isoCode3: kotlin.String, + // 3-letter code for the country + @JsonProperty("Code") + @field:Valid + val code: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var name: kotlin.String? = null, + private var isoCode2: kotlin.String? = null, + private var isoCode3: kotlin.String? = null, + private var code: kotlin.String? = null + ) { + fun name(name: kotlin.String) = apply { this.name = name } + + fun isoCode2(isoCode2: kotlin.String) = apply { this.isoCode2 = isoCode2 } + + fun isoCode3(isoCode3: kotlin.String) = apply { this.isoCode3 = isoCode3 } + + fun code(code: kotlin.String?) = apply { this.code = code } + + fun build(): CarsCountry { + val instance = + CarsCountry( + name = name!!, + isoCode2 = isoCode2!!, + isoCode3 = isoCode3!!, + code = code + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsCountry) { + 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!!, + isoCode2 = isoCode2!!, + isoCode3 = isoCode3!!, + code = code + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsDateRange.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsDateRange.kt new file mode 100644 index 000000000..175d2ab4c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsDateRange.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 + +/** + * Date range of the period. + * @param startDate Start date at pickup location of the period. + * @param endDate End date at pickup location of the period. + */ +data class CarsDateRange( + // Start date at pickup location of the period. + @JsonProperty("StartDate") + val startDate: java.time.LocalDate, + // End date at pickup location of the period. + @JsonProperty("EndDate") + val endDate: java.time.LocalDate +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var startDate: java.time.LocalDate? = null, + private var endDate: java.time.LocalDate? = null + ) { + fun startDate(startDate: java.time.LocalDate) = apply { this.startDate = startDate } + + fun endDate(endDate: java.time.LocalDate) = apply { this.endDate = endDate } + + fun build(): CarsDateRange { + val instance = + CarsDateRange( + startDate = startDate!!, + endDate = endDate!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsDateRange) { + 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( + startDate = startDate!!, + endDate = endDate!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsDistance.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsDistance.kt new file mode 100644 index 000000000..9ddab12f4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsDistance.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.xap.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 +import javax.validation.constraints.NotNull + +/** + * The extra distance information. + * @param `value` The number of miles/kilometers of the distance (specified by the Unit). + * @param unit The unit (KM or MI) for the distance. + * @param direction The direction of the location from the search 'center'.Possible values are: N,S,W,E,NW,NE,SW,SE + */ +data class CarsDistance( + // The number of miles/kilometers of the distance (specified by the Unit). + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String, + // The unit (KM or MI) for the distance. + @JsonProperty("Unit") + @field:Valid + val unit: kotlin.String? = null, + // The direction of the location from the search 'center'.Possible values are: N,S,W,E,NW,NE,SW,SE + @JsonProperty("Direction") + @field:Valid + val direction: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var unit: kotlin.String? = null, + private var direction: kotlin.String? = null + ) { + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun unit(unit: kotlin.String?) = apply { this.unit = unit } + + fun direction(direction: kotlin.String?) = apply { this.direction = direction } + + fun build(): CarsDistance { + val instance = + CarsDistance( + `value` = `value`!!, + unit = unit, + direction = direction + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsDistance) { + 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`!!, + unit = unit, + direction = direction + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsError.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsError.kt new file mode 100644 index 000000000..dee35fba4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsError.kt @@ -0,0 +1,137 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsLocationOption +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 + +/** + * Container for error list. + * @param code Error code describing the issue + * @param description A simple description of what the error is. + * @param detailCode Detailed error code describing the issue. + * @param locationKeyword The requested location that caused the error. + * @param locationOptions List for possible locations from which the customer must choose the best one to be re-submitted in the request. + */ +data class CarsError( + // Error code describing the issue + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // A simple description of what the error is. + @JsonProperty("Description") + @field:NotNull + @field:Valid + val description: kotlin.String, + // Detailed error code describing the issue. + @JsonProperty("DetailCode") + @field:Valid + val detailCode: kotlin.String? = null, + // The requested location that caused the error. + @JsonProperty("LocationKeyword") + @field:Valid + val locationKeyword: kotlin.String? = null, + // List for possible locations from which the customer must choose the best one to be re-submitted in the request. + @JsonProperty("LocationOptions") + @field:Valid + val locationOptions: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var description: kotlin.String? = null, + private var detailCode: kotlin.String? = null, + private var locationKeyword: kotlin.String? = null, + private var locationOptions: kotlin.collections.List? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun description(description: kotlin.String) = apply { this.description = description } + + fun detailCode(detailCode: kotlin.String?) = apply { this.detailCode = detailCode } + + fun locationKeyword(locationKeyword: kotlin.String?) = apply { this.locationKeyword = locationKeyword } + + fun locationOptions(locationOptions: kotlin.collections.List?) = apply { this.locationOptions = locationOptions } + + fun build(): CarsError { + val instance = + CarsError( + code = code!!, + description = description!!, + detailCode = detailCode, + locationKeyword = locationKeyword, + locationOptions = locationOptions + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsError) { + 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!!, + description = description!!, + detailCode = detailCode, + locationKeyword = locationKeyword, + locationOptions = locationOptions + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsErrors.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsErrors.kt new file mode 100644 index 000000000..31d0e6c13 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsErrors.kt @@ -0,0 +1,110 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsError +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 errors Container for error list. + * @param transactionId A unique identifier for the transaction. + */ +data class CarsErrors( + // Container for error list. + @JsonProperty("Errors") + @field:NotNull + @field:Valid + val errors: kotlin.collections + .List< + CarsError + >, + // A unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:NotNull + @field:Valid + val transactionId: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var errors: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null + ) { + fun errors(errors: kotlin.collections.List) = apply { this.errors = errors } + + fun transactionId(transactionId: kotlin.String) = apply { this.transactionId = transactionId } + + fun build(): CarsErrors { + val instance = + CarsErrors( + errors = errors!!, + transactionId = transactionId!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsErrors) { + 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( + errors = errors!!, + transactionId = transactionId!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsGeoLocation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsGeoLocation.kt new file mode 100644 index 000000000..8f4854918 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsGeoLocation.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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Container for Geo location. + * @param latitude Latitude of the location. + * @param longitude Longitude of the location. + * @param obfuscated + */ +data class CarsGeoLocation( + // Latitude of the location. + @JsonProperty("Latitude") + @field:NotNull + @field:Valid + val latitude: kotlin.String, + // Longitude of the location. + @JsonProperty("Longitude") + @field:NotNull + @field:Valid + val longitude: kotlin.String, + @JsonProperty("Obfuscated") + @field:Valid + val obfuscated: kotlin.Boolean? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var latitude: kotlin.String? = null, + private var longitude: kotlin.String? = null, + private var obfuscated: kotlin.Boolean? = null + ) { + fun latitude(latitude: kotlin.String) = apply { this.latitude = latitude } + + fun longitude(longitude: kotlin.String) = apply { this.longitude = longitude } + + fun obfuscated(obfuscated: kotlin.Boolean?) = apply { this.obfuscated = obfuscated } + + fun build(): CarsGeoLocation { + val instance = + CarsGeoLocation( + latitude = latitude!!, + longitude = longitude!!, + obfuscated = obfuscated + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsGeoLocation) { + 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!!, + obfuscated = obfuscated + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLink.kt new file mode 100644 index 000000000..620b2083b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLink.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.xap.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 +import javax.validation.constraints.NotNull + +/** + * A map of links to other Car APIs. possible link name: ApiBooking + * @param href HATEOAS URL to fetch details. + * @param accept Accept header. + * @param method HTTP method to connect. + */ +data class CarsLink( + // HATEOAS URL to fetch details. + @JsonProperty("Href") + @field:NotNull + @field:Valid + val href: kotlin.String, + // Accept header. + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // HTTP method to connect. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var href: kotlin.String? = null, + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null + ) { + fun href(href: kotlin.String) = apply { this.href = href } + + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun build(): CarsLink { + val instance = + CarsLink( + href = href!!, + accept = accept, + method = method + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsLink) { + 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( + href = href!!, + accept = accept, + method = method + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLocation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLocation.kt new file mode 100644 index 000000000..2c3a77fae --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLocation.kt @@ -0,0 +1,193 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsAddress +import com.expediagroup.sdk.xap.models.CarsCountry +import com.expediagroup.sdk.xap.models.CarsGeoLocation +import com.expediagroup.sdk.xap.models.CarsNeighborhood +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 + +/** + * Container for list of possible locations that could be used to disambiguate the query. + * @param locationId Location id. + * @param type The type of location code (MULTICITY | METROCODE). + * @param id Expedia Region ID of the specified airport. + * @param name Location Name + * @param code Location Code + * @param address + * @param pointOfInterest + * @param geoLocation + * @param neighborhood + * @param regionId RegionId the location resides in. + * @param country + */ +data class CarsLocation( + // Location id. + @JsonProperty("LocationId") + @field:NotNull + @field:Valid + val locationId: kotlin.String, + // The type of location code (MULTICITY | METROCODE). + @JsonProperty("Type") + @field:Valid + val type: kotlin.String? = null, + // Expedia Region ID of the specified airport. + @JsonProperty("Id") + @field:Valid + val id: kotlin.String? = null, + // Location Name + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null, + // Location Code + @JsonProperty("Code") + @field:Valid + val code: kotlin.String? = null, + @JsonProperty("Address") + @field:Valid + val address: CarsAddress? = null, + @JsonProperty("PointOfInterest") + @field:Valid + val pointOfInterest: kotlin.String? = null, + @JsonProperty("GeoLocation") + @field:Valid + val geoLocation: CarsGeoLocation? = null, + @JsonProperty("Neighborhood") + @field:Valid + val neighborhood: CarsNeighborhood? = null, + // RegionId the location resides in. + @JsonProperty("RegionId") + val regionId: kotlin.Long? = null, + @JsonProperty("Country") + @field:Valid + val country: CarsCountry? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var locationId: kotlin.String? = null, + private var type: kotlin.String? = null, + private var id: kotlin.String? = null, + private var name: kotlin.String? = null, + private var code: kotlin.String? = null, + private var address: CarsAddress? = null, + private var pointOfInterest: kotlin.String? = null, + private var geoLocation: CarsGeoLocation? = null, + private var neighborhood: CarsNeighborhood? = null, + private var regionId: kotlin.Long? = null, + private var country: CarsCountry? = null + ) { + fun locationId(locationId: kotlin.String) = apply { this.locationId = locationId } + + fun type(type: kotlin.String?) = apply { this.type = type } + + fun id(id: kotlin.String?) = apply { this.id = id } + + fun name(name: kotlin.String?) = apply { this.name = name } + + fun code(code: kotlin.String?) = apply { this.code = code } + + fun address(address: CarsAddress?) = apply { this.address = address } + + fun pointOfInterest(pointOfInterest: kotlin.String?) = apply { this.pointOfInterest = pointOfInterest } + + fun geoLocation(geoLocation: CarsGeoLocation?) = apply { this.geoLocation = geoLocation } + + fun neighborhood(neighborhood: CarsNeighborhood?) = apply { this.neighborhood = neighborhood } + + fun regionId(regionId: kotlin.Long?) = apply { this.regionId = regionId } + + fun country(country: CarsCountry?) = apply { this.country = country } + + fun build(): CarsLocation { + val instance = + CarsLocation( + locationId = locationId!!, + type = type, + id = id, + name = name, + code = code, + address = address, + pointOfInterest = pointOfInterest, + geoLocation = geoLocation, + neighborhood = neighborhood, + regionId = regionId, + country = country + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsLocation) { + 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( + locationId = locationId!!, + type = type, + id = id, + name = name, + code = code, + address = address, + pointOfInterest = pointOfInterest, + geoLocation = geoLocation, + neighborhood = neighborhood, + regionId = regionId, + country = country + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLocationOption.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLocationOption.kt new file mode 100644 index 000000000..129b2c18a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsLocationOption.kt @@ -0,0 +1,180 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsCountry +import com.expediagroup.sdk.xap.models.CarsGeoLocation +import com.expediagroup.sdk.xap.models.CarsLocation +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 + +/** + * List for possible locations from which the customer must choose the best one to be re-submitted in the request. + * @param requestedLocation Location used in partner request. + * @param locations Container for list of possible locations that could be used to disambiguate the query. + * @param type Type of the location. + * @param regionId RegionId the location resides in. + * @param shortName The name of the location which matches the location keyword. + * @param airportCode Indicates the nearest major airport to the location. + * @param address The address of the location. + * @param country + * @param geoLocation + */ +data class CarsLocationOption( + // Location used in partner request. + @JsonProperty("RequestedLocation") + @field:NotNull + @field:Valid + val requestedLocation: kotlin.String, + // Container for list of possible locations that could be used to disambiguate the query. + @JsonProperty("Locations") + @field:NotNull + @field:Valid + val locations: kotlin.collections + .List< + CarsLocation + >, + // Type of the location. + @JsonProperty("Type") + @field:Valid + val type: kotlin.String? = null, + // RegionId the location resides in. + @JsonProperty("RegionId") + @field:Valid + val regionId: kotlin.String? = null, + // The name of the location which matches the location keyword. + @JsonProperty("ShortName") + @field:Valid + val shortName: kotlin.String? = null, + // Indicates the nearest major airport to the location. + @JsonProperty("AirportCode") + @field:Valid + val airportCode: kotlin.String? = null, + // The address of the location. + @JsonProperty("Address") + @field:Valid + val address: kotlin.String? = null, + @JsonProperty("Country") + @field:Valid + val country: CarsCountry? = null, + @JsonProperty("GeoLocation") + @field:Valid + val geoLocation: CarsGeoLocation? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var requestedLocation: kotlin.String? = null, + private var locations: kotlin.collections.List? = null, + private var type: kotlin.String? = null, + private var regionId: kotlin.String? = null, + private var shortName: kotlin.String? = null, + private var airportCode: kotlin.String? = null, + private var address: kotlin.String? = null, + private var country: CarsCountry? = null, + private var geoLocation: CarsGeoLocation? = null + ) { + fun requestedLocation(requestedLocation: kotlin.String) = apply { this.requestedLocation = requestedLocation } + + fun locations(locations: kotlin.collections.List) = apply { this.locations = locations } + + fun type(type: kotlin.String?) = apply { this.type = type } + + fun regionId(regionId: kotlin.String?) = apply { this.regionId = regionId } + + fun shortName(shortName: kotlin.String?) = apply { this.shortName = shortName } + + fun airportCode(airportCode: kotlin.String?) = apply { this.airportCode = airportCode } + + fun address(address: kotlin.String?) = apply { this.address = address } + + fun country(country: CarsCountry?) = apply { this.country = country } + + fun geoLocation(geoLocation: CarsGeoLocation?) = apply { this.geoLocation = geoLocation } + + fun build(): CarsLocationOption { + val instance = + CarsLocationOption( + requestedLocation = requestedLocation!!, + locations = locations!!, + type = type, + regionId = regionId, + shortName = shortName, + airportCode = airportCode, + address = address, + country = country, + geoLocation = geoLocation + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsLocationOption) { + 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( + requestedLocation = requestedLocation!!, + locations = locations!!, + type = type, + regionId = regionId, + shortName = shortName, + airportCode = airportCode, + address = address, + country = country, + geoLocation = geoLocation + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsMoney.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsMoney.kt new file mode 100644 index 000000000..8cc209bff --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsMoney.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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Price of Special equipment. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class CarsMoney( + // The value of the element being defined. + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:NotNull + @field:Valid + val currency: kotlin.String, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: CarsMoney? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: CarsMoney? = null + ) { + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: CarsMoney?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): CarsMoney { + val instance = + CarsMoney( + `value` = `value`!!, + currency = currency!!, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsMoney) { + 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!!, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsNeighborhood.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsNeighborhood.kt new file mode 100644 index 000000000..2bff29b2d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsNeighborhood.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Geography entities which are typically contained within a city. This includes the categories neighborhood and point of interest. Low level regions are not a formally defined concept in the geography model. + * @param id Neighborhood id. + * @param name Neighborhood name. + */ +data class CarsNeighborhood( + // Neighborhood id. + @JsonProperty("Id") + @field:NotNull + @field:Valid + val id: kotlin.String, + // Neighborhood name. + @JsonProperty("Name") + @field:NotNull + @field:Valid + val name: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: 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(): CarsNeighborhood { + val instance = + CarsNeighborhood( + id = id!!, + name = name!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsNeighborhood) { + 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!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsValidFormsOfPayment.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsValidFormsOfPayment.kt new file mode 100644 index 000000000..96d0a0194 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsValidFormsOfPayment.kt @@ -0,0 +1,117 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * List of all the forms of payment that will be accepted for the booking of this rental transaction. + * @param paymentMethod Method of payment + * @param paymentSubMethod Sub method of payment + * @param brandName The brand name of the payment sub-method to be displayed to the customer. In many cases it will be the same as the payment sub-method, but \"Visa/Carte Bleue\" and \"Visa/Delta are some of the exceptions. + */ +data class CarsValidFormsOfPayment( + // Method of payment + @JsonProperty("PaymentMethod") + @field:NotNull + @field:Valid + val paymentMethod: kotlin.String, + // Sub method of payment + @JsonProperty("PaymentSubMethod") + @field:NotNull + @field:Valid + val paymentSubMethod: kotlin.String, + // The brand name of the payment sub-method to be displayed to the customer. In many cases it will be the same as the payment sub-method, but \"Visa/Carte Bleue\" and \"Visa/Delta are some of the exceptions. + @JsonProperty("BrandName") + @field:NotNull + @field:Valid + val brandName: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var paymentMethod: kotlin.String? = null, + private var paymentSubMethod: kotlin.String? = null, + private var brandName: kotlin.String? = null + ) { + fun paymentMethod(paymentMethod: kotlin.String) = apply { this.paymentMethod = paymentMethod } + + fun paymentSubMethod(paymentSubMethod: kotlin.String) = apply { this.paymentSubMethod = paymentSubMethod } + + fun brandName(brandName: kotlin.String) = apply { this.brandName = brandName } + + fun build(): CarsValidFormsOfPayment { + val instance = + CarsValidFormsOfPayment( + paymentMethod = paymentMethod!!, + paymentSubMethod = paymentSubMethod!!, + brandName = brandName!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsValidFormsOfPayment) { + 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( + paymentMethod = paymentMethod!!, + paymentSubMethod = paymentSubMethod!!, + brandName = brandName!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsWarning.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsWarning.kt new file mode 100644 index 000000000..e94f77176 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/CarsWarning.kt @@ -0,0 +1,154 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsLink +import com.expediagroup.sdk.xap.models.CarsMoney +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 + +/** + * Container for warning codes + * @param code Standardized warning code. + * @param description Standardized warning description message. + * @param originalPrice + * @param newPrice + * @param changedAmount + * @param changedPercentage The changed percentage. In the sample 2.97 means the changed percentage is 2.97%. + * @param links + */ +data class CarsWarning( + // Standardized warning code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Standardized warning description message. + @JsonProperty("Description") + @field:NotNull + @field:Valid + val description: kotlin.String, + @JsonProperty("OriginalPrice") + @field:Valid + val originalPrice: CarsMoney? = null, + @JsonProperty("NewPrice") + @field:Valid + val newPrice: CarsMoney? = null, + @JsonProperty("ChangedAmount") + @field:Valid + val changedAmount: CarsMoney? = null, + // The changed percentage. In the sample 2.97 means the changed percentage is 2.97%. + @JsonProperty("ChangedPercentage") + @field:Valid + val changedPercentage: kotlin.String? = null, + @JsonProperty("Links") + @field:Valid + val links: kotlin.collections.Map? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var description: kotlin.String? = null, + private var originalPrice: CarsMoney? = null, + private var newPrice: CarsMoney? = null, + private var changedAmount: CarsMoney? = null, + private var changedPercentage: kotlin.String? = null, + private var links: kotlin.collections.Map? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun description(description: kotlin.String) = apply { this.description = description } + + fun originalPrice(originalPrice: CarsMoney?) = apply { this.originalPrice = originalPrice } + + fun newPrice(newPrice: CarsMoney?) = apply { this.newPrice = newPrice } + + fun changedAmount(changedAmount: CarsMoney?) = apply { this.changedAmount = changedAmount } + + fun changedPercentage(changedPercentage: kotlin.String?) = apply { this.changedPercentage = changedPercentage } + + fun links(links: kotlin.collections.Map?) = apply { this.links = links } + + fun build(): CarsWarning { + val instance = + CarsWarning( + code = code!!, + description = description!!, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount, + changedPercentage = changedPercentage, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: CarsWarning) { + 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!!, + description = description!!, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount, + changedPercentage = changedPercentage, + links = links + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ChainAndBrandInfo.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ChainAndBrandInfo.kt new file mode 100644 index 000000000..96f6032f4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ChainAndBrandInfo.kt @@ -0,0 +1,121 @@ +/* + * 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.xap.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 + +/** + * The chain and brand information of hotel. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + * @param chainId The chain id. + * @param chainName The name of the chain. + * @param brandId The brand id. + * @param brandName The name of the brand. + */ +data class ChainAndBrandInfo( + // The chain id. + @JsonProperty("ChainId") + val chainId: kotlin.Int? = null, + // The name of the chain. + @JsonProperty("ChainName") + @field:Valid + val chainName: kotlin.String? = null, + // The brand id. + @JsonProperty("BrandId") + val brandId: kotlin.Int? = null, + // The name of the brand. + @JsonProperty("BrandName") + @field:Valid + val brandName: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var chainId: kotlin.Int? = null, + private var chainName: kotlin.String? = null, + private var brandId: kotlin.Int? = null, + private var brandName: kotlin.String? = null + ) { + fun chainId(chainId: kotlin.Int?) = apply { this.chainId = chainId } + + fun chainName(chainName: kotlin.String?) = apply { this.chainName = chainName } + + fun brandId(brandId: kotlin.Int?) = apply { this.brandId = brandId } + + fun brandName(brandName: kotlin.String?) = apply { this.brandName = brandName } + + fun build(): ChainAndBrandInfo { + val instance = + ChainAndBrandInfo( + chainId = chainId, + chainName = chainName, + brandId = brandId, + brandName = brandName + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ChainAndBrandInfo) { + 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( + chainId = chainId, + chainName = chainName, + brandId = brandId, + brandName = brandName + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Country.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Country.kt new file mode 100644 index 000000000..debe86224 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Country.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.xap.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 + +/** + * Container for disambiguation country information + * @param name country name + * @param isoCode2 2-letter code for the country + * @param isoCode3 3-letter code for the country + */ +data class Country( + // country name + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null, + // 2-letter code for the country + @JsonProperty("IsoCode2") + @field:Valid + val isoCode2: kotlin.String? = null, + // 3-letter code for the country + @JsonProperty("IsoCode3") + @field:Valid + val isoCode3: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var name: kotlin.String? = null, + private var isoCode2: kotlin.String? = null, + private var isoCode3: kotlin.String? = null + ) { + fun name(name: kotlin.String?) = apply { this.name = name } + + fun isoCode2(isoCode2: kotlin.String?) = apply { this.isoCode2 = isoCode2 } + + fun isoCode3(isoCode3: kotlin.String?) = apply { this.isoCode3 = isoCode3 } + + fun build(): Country { + val instance = + Country( + name = name, + isoCode2 = isoCode2, + isoCode3 = isoCode3 + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Country) { + 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, + isoCode2 = isoCode2, + isoCode3 = isoCode3 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DateRange.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DateRange.kt new file mode 100644 index 000000000..fa031697f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DateRange.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 + +/** + * The actual date range for the shown availability. + * @param startDate The initial day of the date range in an ISO 8601 Date format [YYYY-MM-DD]. + * @param endDate The final day of the date range in an ISO 8601 Date format [YYYY-MM-DD]. + */ +data class DateRange( + // The initial day of the date range in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("StartDate") + val startDate: java.time.LocalDate? = null, + // The final day of the date range in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("EndDate") + val endDate: java.time.LocalDate? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var startDate: java.time.LocalDate? = null, + private var endDate: java.time.LocalDate? = null + ) { + fun startDate(startDate: java.time.LocalDate?) = apply { this.startDate = startDate } + + fun endDate(endDate: java.time.LocalDate?) = apply { this.endDate = endDate } + + fun build(): DateRange { + val instance = + DateRange( + startDate = startDate, + endDate = endDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DateRange) { + 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( + startDate = startDate, + endDate = endDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DateTimePeriod.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DateTimePeriod.kt new file mode 100644 index 000000000..5a8ccf07e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DateTimePeriod.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsDateRange +import com.expediagroup.sdk.xap.models.TimeRange +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 + +/** + * A List of date time periods to indicate the vendor business hours for the pickup time. + * @param dateRange + * @param timeRanges A list of time range to indicate the operation hours of the date range. + */ +data class DateTimePeriod( + @JsonProperty("DateRange") + @field:NotNull + @field:Valid + val dateRange: CarsDateRange, + // A list of time range to indicate the operation hours of the date range. + @JsonProperty("TimeRanges") + @field:Valid + val timeRanges: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var dateRange: CarsDateRange? = null, + private var timeRanges: kotlin.collections.List? = null + ) { + fun dateRange(dateRange: CarsDateRange) = apply { this.dateRange = dateRange } + + fun timeRanges(timeRanges: kotlin.collections.List?) = apply { this.timeRanges = timeRanges } + + fun build(): DateTimePeriod { + val instance = + DateTimePeriod( + dateRange = dateRange!!, + timeRanges = timeRanges + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DateTimePeriod) { + 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( + dateRange = dateRange!!, + timeRanges = timeRanges + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Deductible.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Deductible.kt new file mode 100644 index 000000000..65516b64c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Deductible.kt @@ -0,0 +1,111 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsMoney +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Indicate whether it is deductible + * @param excessAmount + * @param liabilityAmount + * @param deductibleAmount + */ +data class Deductible( + @JsonProperty("ExcessAmount") + @field:Valid + val excessAmount: CarsMoney? = null, + @JsonProperty("LiabilityAmount") + @field:Valid + val liabilityAmount: CarsMoney? = null, + @JsonProperty("DeductibleAmount") + @field:Valid + val deductibleAmount: CarsMoney? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var excessAmount: CarsMoney? = null, + private var liabilityAmount: CarsMoney? = null, + private var deductibleAmount: CarsMoney? = null + ) { + fun excessAmount(excessAmount: CarsMoney?) = apply { this.excessAmount = excessAmount } + + fun liabilityAmount(liabilityAmount: CarsMoney?) = apply { this.liabilityAmount = liabilityAmount } + + fun deductibleAmount(deductibleAmount: CarsMoney?) = apply { this.deductibleAmount = deductibleAmount } + + fun build(): Deductible { + val instance = + Deductible( + excessAmount = excessAmount, + liabilityAmount = liabilityAmount, + deductibleAmount = deductibleAmount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Deductible) { + 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( + excessAmount = excessAmount, + liabilityAmount = liabilityAmount, + deductibleAmount = deductibleAmount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DepositDetail.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DepositDetail.kt new file mode 100644 index 000000000..456f33481 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DepositDetail.kt @@ -0,0 +1,130 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.When +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for deposit policy details + * @param type Should be one of the following values: PERCENT The deposit amount is calculated as a percentage of the total booking cost. NIGHT The deposit amount is calculated in terms of nights plus tax. AMOUNT The deposit amount in USD. REMAINDER The deposit amount is equal to the booking cost minus any deposits that have been made before this point. + * @param `value` Value to indicate how many/much of the type listed above is going to be charged as a deposit. + * @param `when` + */ +data class DepositDetail( + // Should be one of the following values: PERCENT The deposit amount is calculated as a percentage of the total booking cost. NIGHT The deposit amount is calculated in terms of nights plus tax. AMOUNT The deposit amount in USD. REMAINDER The deposit amount is equal to the booking cost minus any deposits that have been made before this point. + @JsonProperty("Type") + val type: DepositDetail.Type? = null, + // Value to indicate how many/much of the type listed above is going to be charged as a deposit. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + @JsonProperty("When") + @field:Valid + val `when`: When? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: DepositDetail.Type? = null, + private var `value`: kotlin.String? = null, + private var `when`: When? = null + ) { + fun type(type: DepositDetail.Type?) = apply { this.type = type } + + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun `when`(`when`: When?) = apply { this.`when` = `when` } + + fun build(): DepositDetail { + val instance = + DepositDetail( + type = type, + `value` = `value`, + `when` = `when` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DepositDetail) { + 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( + type = type, + `value` = `value`, + `when` = `when` + ) + + /** + * Should be one of the following values: PERCENT The deposit amount is calculated as a percentage of the total booking cost. NIGHT The deposit amount is calculated in terms of nights plus tax. AMOUNT The deposit amount in USD. REMAINDER The deposit amount is equal to the booking cost minus any deposits that have been made before this point. + * Values: PERCENT,NIGHT,AMOUNT,REMAINDER + */ + enum class Type(val value: kotlin.String) { + @JsonProperty("PERCENT") + PERCENT("PERCENT"), + + @JsonProperty("NIGHT") + NIGHT("NIGHT"), + + @JsonProperty("AMOUNT") + AMOUNT("AMOUNT"), + + @JsonProperty("REMAINDER") + REMAINDER("REMAINDER") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DepositPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DepositPolicy.kt new file mode 100644 index 000000000..e9100a633 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DepositPolicy.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.DepositDetail +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for deposit policy details + * @param description + * @param details Container for deposit policy details + */ +data class DepositPolicy( + @JsonProperty("Description") + @field:Valid + val description: kotlin.collections.List? = null, + // Container for deposit policy details + @JsonProperty("Details") + @field:Valid + val details: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var description: kotlin.collections.List? = null, + private var details: kotlin.collections.List? = null + ) { + fun description(description: kotlin.collections.List?) = apply { this.description = description } + + fun details(details: kotlin.collections.List?) = apply { this.details = details } + + fun build(): DepositPolicy { + val instance = + DepositPolicy( + description = description, + details = details + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DepositPolicy) { + 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( + description = description, + details = details + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Description.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Description.kt new file mode 100644 index 000000000..56080fb2f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Description.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.xap.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 + +/** + * Container for the descriptions of the property. + * @param locationTeaser A description of the property's location. + * @param hotelTeaser A description of the features and amenities of the property itself. + * @param roomTeaser The common description for all of the rooms in the property. + */ +data class Description( + // A description of the property's location. + @JsonProperty("LocationTeaser") + @field:Valid + val locationTeaser: kotlin.String? = null, + // A description of the features and amenities of the property itself. + @JsonProperty("HotelTeaser") + @field:Valid + val hotelTeaser: kotlin.String? = null, + // The common description for all of the rooms in the property. + @JsonProperty("RoomTeaser") + @field:Valid + val roomTeaser: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var locationTeaser: kotlin.String? = null, + private var hotelTeaser: kotlin.String? = null, + private var roomTeaser: kotlin.String? = null + ) { + fun locationTeaser(locationTeaser: kotlin.String?) = apply { this.locationTeaser = locationTeaser } + + fun hotelTeaser(hotelTeaser: kotlin.String?) = apply { this.hotelTeaser = hotelTeaser } + + fun roomTeaser(roomTeaser: kotlin.String?) = apply { this.roomTeaser = roomTeaser } + + fun build(): Description { + val instance = + Description( + locationTeaser = locationTeaser, + hotelTeaser = hotelTeaser, + roomTeaser = roomTeaser + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Description) { + 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( + locationTeaser = locationTeaser, + hotelTeaser = hotelTeaser, + roomTeaser = roomTeaser + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DisambiguationResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DisambiguationResponse.kt new file mode 100644 index 000000000..9dccf2592 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/DisambiguationResponse.kt @@ -0,0 +1,110 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsError +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 errors Container for error list. + * @param transactionId A unique identifier for the transaction. + */ +data class DisambiguationResponse( + // Container for error list. + @JsonProperty("Errors") + @field:NotNull + @field:Valid + val errors: kotlin.collections + .List< + CarsError + >, + // A unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:NotNull + @field:Valid + val transactionId: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var errors: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null + ) { + fun errors(errors: kotlin.collections.List) = apply { this.errors = errors } + + fun transactionId(transactionId: kotlin.String) = apply { this.transactionId = transactionId } + + fun build(): DisambiguationResponse { + val instance = + DisambiguationResponse( + errors = errors!!, + transactionId = transactionId!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: DisambiguationResponse) { + 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( + errors = errors!!, + transactionId = transactionId!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Discount.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Discount.kt new file mode 100644 index 000000000..24e75d55e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Discount.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * List of discount information. + * @param type Discount type. Supported values : CorpDiscount | Coupon. + * @param code Discount code. + */ +data class Discount( + // Discount type. Supported values : CorpDiscount | Coupon. + @JsonProperty("Type") + @field:NotNull + @field:Valid + val type: kotlin.String, + // Discount code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: kotlin.String? = null, + private var code: kotlin.String? = null + ) { + fun type(type: kotlin.String) = apply { this.type = type } + + fun code(code: kotlin.String) = apply { this.code = code } + + fun build(): Discount { + val instance = + Discount( + type = type!!, + code = code!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Discount) { + 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( + type = type!!, + code = code!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Distance.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Distance.kt new file mode 100644 index 000000000..9230cbaf3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Distance.kt @@ -0,0 +1,153 @@ +/* + * 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.xap.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 + +/** + * Container for distance information. Only returned for city/address search or `geoLocation` search or single `regionId` search. + * @param `value` The distance between the center of the search and the hotel. + * @param unit The unit of distance. + * @param direction The direction to the hotel from the center point of the search. + */ +data class Distance( + // The distance between the center of the search and the hotel. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The unit of distance. + @JsonProperty("Unit") + val unit: Distance.Unit? = null, + // The direction to the hotel from the center point of the search. + @JsonProperty("Direction") + val direction: Distance.Direction? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var unit: Distance.Unit? = null, + private var direction: Distance.Direction? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun unit(unit: Distance.Unit?) = apply { this.unit = unit } + + fun direction(direction: Distance.Direction?) = apply { this.direction = direction } + + fun build(): Distance { + val instance = + Distance( + `value` = `value`, + unit = unit, + direction = direction + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Distance) { + 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`, + unit = unit, + direction = direction + ) + + /** + * The unit of distance. + * Values: KM,MI + */ + enum class Unit(val value: kotlin.String) { + @JsonProperty("km") + KM("km"), + + @JsonProperty("mi") + MI("mi") + } + + /** + * The direction to the hotel from the center point of the search. + * Values: N,S,W,E,NW,NE,SW,SE + */ + enum class Direction(val value: kotlin.String) { + @JsonProperty("N") + N("N"), + + @JsonProperty("S") + S("S"), + + @JsonProperty("W") + W("W"), + + @JsonProperty("E") + E("E"), + + @JsonProperty("NW") + NW("NW"), + + @JsonProperty("NE") + NE("NE"), + + @JsonProperty("SW") + SW("SW"), + + @JsonProperty("SE") + SE("SE") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Duration.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Duration.kt new file mode 100644 index 000000000..aa3cffc68 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Duration.kt @@ -0,0 +1,104 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * The maximum amount of time for a rental that still qualifies for this rate.This may or may not be the same as the current rental duration. + * @param unit The unit for minimum amount of time for a rental. + * @param count The minimum number of units that qualify for minimum amount of time for a rental. + */ +data class Duration( + // The unit for minimum amount of time for a rental. + @JsonProperty("Unit") + @field:NotNull + @field:Valid + val unit: kotlin.String, + // The minimum number of units that qualify for minimum amount of time for a rental. + @JsonProperty("Count") + val count: kotlin.Long +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var unit: kotlin.String? = null, + private var count: kotlin.Long? = null + ) { + fun unit(unit: kotlin.String) = apply { this.unit = unit } + + fun count(count: kotlin.Long) = apply { this.count = count } + + fun build(): Duration { + val instance = + Duration( + unit = unit!!, + count = count!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Duration) { + 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( + unit = unit!!, + count = count!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Equipment.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Equipment.kt new file mode 100644 index 000000000..35d65f84c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Equipment.kt @@ -0,0 +1,126 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsMoney +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 + +/** + * Description and costs of any optional special equipment that may be rented with the car. + * @param code Special equipment code + * @param name Special equipment name + * @param ratePeriod Unit indicating the price of special equipment. Support value:Trip,Daily + * @param price + */ +data class Equipment( + // Special equipment code + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Special equipment name + @JsonProperty("Name") + @field:NotNull + @field:Valid + val name: kotlin.String, + // Unit indicating the price of special equipment. Support value:Trip,Daily + @JsonProperty("RatePeriod") + @field:Valid + val ratePeriod: kotlin.String? = null, + @JsonProperty("Price") + @field:Valid + val price: CarsMoney? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var name: kotlin.String? = null, + private var ratePeriod: kotlin.String? = null, + private var price: CarsMoney? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun name(name: kotlin.String) = apply { this.name = name } + + fun ratePeriod(ratePeriod: kotlin.String?) = apply { this.ratePeriod = ratePeriod } + + fun price(price: CarsMoney?) = apply { this.price = price } + + fun build(): Equipment { + val instance = + Equipment( + code = code!!, + name = name!!, + ratePeriod = ratePeriod, + price = price + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Equipment) { + 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!!, + name = name!!, + ratePeriod = ratePeriod, + price = price + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Error.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Error.kt new file mode 100644 index 000000000..de9e1b406 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Error.kt @@ -0,0 +1,134 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LocationOption +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for error list. + * @param code Error code describing the issue + * @param detailCode Detailed error code describing the issue. + * @param description A simple description of what the error is. + * @param locationKeyword The requested location that caused the error. + * @param locationOptions Container for possible matches to your ambiguous `locationKeyword` query. + */ +data class Error( + // Error code describing the issue + @JsonProperty("Code") + @field:Valid + val code: kotlin.String? = null, + // Detailed error code describing the issue. + @JsonProperty("DetailCode") + @field:Valid + val detailCode: kotlin.String? = null, + // A simple description of what the error is. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + // The requested location that caused the error. + @JsonProperty("LocationKeyword") + @field:Valid + val locationKeyword: kotlin.String? = null, + // Container for possible matches to your ambiguous `locationKeyword` query. + @JsonProperty("LocationOptions") + @field:Valid + val locationOptions: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var detailCode: kotlin.String? = null, + private var description: kotlin.String? = null, + private var locationKeyword: kotlin.String? = null, + private var locationOptions: kotlin.collections.List? = null + ) { + fun code(code: kotlin.String?) = apply { this.code = code } + + fun detailCode(detailCode: kotlin.String?) = apply { this.detailCode = detailCode } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun locationKeyword(locationKeyword: kotlin.String?) = apply { this.locationKeyword = locationKeyword } + + fun locationOptions(locationOptions: kotlin.collections.List?) = apply { this.locationOptions = locationOptions } + + fun build(): Error { + val instance = + Error( + code = code, + detailCode = detailCode, + description = description, + locationKeyword = locationKeyword, + locationOptions = locationOptions + ) + + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + code = code, + detailCode = detailCode, + description = description, + locationKeyword = locationKeyword, + locationOptions = locationOptions + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Errors.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Errors.kt new file mode 100644 index 000000000..41e530928 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Errors.kt @@ -0,0 +1,104 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Error +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param errors Container for error list. + * @param transactionId A unique identifier for the transaction. + */ +data class Errors( + // Container for error list. + @JsonProperty("Errors") + @field:Valid + val errors: kotlin.collections.List? = null, + // A unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var errors: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null + ) { + fun errors(errors: kotlin.collections.List?) = apply { this.errors = errors } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun build(): Errors { + val instance = + Errors( + errors = errors, + transactionId = transactionId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Errors) { + 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( + errors = errors, + transactionId = transactionId + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ExtraCostPerDistance.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ExtraCostPerDistance.kt new file mode 100644 index 000000000..541d9b2af --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ExtraCostPerDistance.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsDistance +import com.expediagroup.sdk.xap.models.CarsMoney +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 + +/** + * Extra cost for each increment of distance used. + * @param distance + * @param cost + */ +data class ExtraCostPerDistance( + @JsonProperty("Distance") + @field:NotNull + @field:Valid + val distance: CarsDistance, + @JsonProperty("Cost") + @field:NotNull + @field:Valid + val cost: CarsMoney +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var distance: CarsDistance? = null, + private var cost: CarsMoney? = null + ) { + fun distance(distance: CarsDistance) = apply { this.distance = distance } + + fun cost(cost: CarsMoney) = apply { this.cost = cost } + + fun build(): ExtraCostPerDistance { + val instance = + ExtraCostPerDistance( + distance = distance!!, + cost = cost!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ExtraCostPerDistance) { + 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( + distance = distance!!, + cost = cost!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ExtraFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ExtraFees.kt new file mode 100644 index 000000000..e98dcdc20 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ExtraFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsMoney +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 + +/** + * List of ExtraFeesDetails + * @param unit Rate period beyond the base rate. Supported values: ExtraHourly, ExtraDaily + * @param unitCount Numbers of period + * @param amount + */ +data class ExtraFees( + // Rate period beyond the base rate. Supported values: ExtraHourly, ExtraDaily + @JsonProperty("Unit") + @field:NotNull + @field:Valid + val unit: kotlin.String, + // Numbers of period + @JsonProperty("UnitCount") + val unitCount: kotlin.Long, + @JsonProperty("Amount") + @field:NotNull + @field:Valid + val amount: CarsMoney +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var unit: kotlin.String? = null, + private var unitCount: kotlin.Long? = null, + private var amount: CarsMoney? = null + ) { + fun unit(unit: kotlin.String) = apply { this.unit = unit } + + fun unitCount(unitCount: kotlin.Long) = apply { this.unitCount = unitCount } + + fun amount(amount: CarsMoney) = apply { this.amount = amount } + + fun build(): ExtraFees { + val instance = + ExtraFees( + unit = unit!!, + unitCount = unitCount!!, + amount = amount!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ExtraFees) { + 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( + unit = unit!!, + unitCount = unitCount!!, + amount = amount!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Fault.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Fault.kt new file mode 100644 index 000000000..cef192a49 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Fault.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * API returned information. + * @param code Fault code. + * @param description Fault description. + */ +data class Fault( + // Fault code. + @JsonProperty("code") + @field:Valid + val code: kotlin.String? = null, + // Fault description. + @JsonProperty("description") + @field:Valid + val description: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var description: kotlin.String? = null + ) { + fun code(code: kotlin.String?) = apply { this.code = code } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun build(): Fault { + val instance = + Fault( + code = code, + description = description + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Fault) { + 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, + description = description + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FileInfo.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FileInfo.kt new file mode 100644 index 000000000..fe1a11f85 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FileInfo.kt @@ -0,0 +1,193 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.FileSize +import com.expediagroup.sdk.xap.models.FilterConditions +import com.expediagroup.sdk.xap.models.SdpLink +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param partner The partner associated with the file. List of partners: `Bing`, `Criteo`, `Facebook`, `Google`, `Retarget`, `Snapchat`. + * @param brand The brand associated with the file content. List of brand: `Expedia`, `Hotels`, `Hotwire`, `Vrbo`, `HomeAway`, `Abritel`, `Bookabach`, `Stayz`, `Ebbokers`, `Travalocity`, `Orbitz`, `Wotif`. + * @param fileContentType The type associated with the file content. List of types: `Amenities`, `Descriptions`, `Images`, `Listings`, `Locations`, `Policies`, `Regions`, `Reviews`, `Summary`, `VacationRental` + * @param locale The locale associated with the file content. + * @param fileName File name. + * @param propertySize + * @param fileLastUpdated The time about the file last updated. The format is uuuu-MM-dd'T'HH:mm:ss.SSSX + * @param downloadUrl Pre-signed URL is a self signed URL generated for a resource in S3 with a set expiration time. + * @param downloadUrlExpires The time about the download Url expires. The format is uuuu-MM-dd'T'HH:mm:ss.SSSX + * @param filterConditions + * @param bestMatchedLink + */ +data class FileInfo( + // The partner associated with the file. List of partners: `Bing`, `Criteo`, `Facebook`, `Google`, `Retarget`, `Snapchat`. + @JsonProperty("partner") + @field:Valid + val partner: kotlin.String? = null, + // The brand associated with the file content. List of brand: `Expedia`, `Hotels`, `Hotwire`, `Vrbo`, `HomeAway`, `Abritel`, `Bookabach`, `Stayz`, `Ebbokers`, `Travalocity`, `Orbitz`, `Wotif`. + @JsonProperty("brand") + @field:Valid + val brand: kotlin.String? = null, + // The type associated with the file content. List of types: `Amenities`, `Descriptions`, `Images`, `Listings`, `Locations`, `Policies`, `Regions`, `Reviews`, `Summary`, `VacationRental` + @JsonProperty("fileContentType") + @field:Valid + val fileContentType: kotlin.String? = null, + // The locale associated with the file content. + @JsonProperty("locale") + @field:Valid + val locale: kotlin.String? = null, + // File name. + @JsonProperty("fileName") + @field:Valid + val fileName: kotlin.String? = null, + @JsonProperty("size") + @field:Valid + val propertySize: FileSize? = null, + // The time about the file last updated. The format is uuuu-MM-dd'T'HH:mm:ss.SSSX + @JsonProperty("fileLastUpdated") + @field:Valid + val fileLastUpdated: kotlin.String? = null, + // Pre-signed URL is a self signed URL generated for a resource in S3 with a set expiration time. + @JsonProperty("downloadUrl") + @field:Valid + val downloadUrl: kotlin.String? = null, + // The time about the download Url expires. The format is uuuu-MM-dd'T'HH:mm:ss.SSSX + @JsonProperty("downloadUrlExpires") + @field:Valid + val downloadUrlExpires: kotlin.String? = null, + @JsonProperty("filterConditions") + @field:Valid + val filterConditions: FilterConditions? = null, + @JsonProperty("bestMatchedLink") + @field:Valid + val bestMatchedLink: SdpLink? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var partner: kotlin.String? = null, + private var brand: kotlin.String? = null, + private var fileContentType: kotlin.String? = null, + private var locale: kotlin.String? = null, + private var fileName: kotlin.String? = null, + private var propertySize: FileSize? = null, + private var fileLastUpdated: kotlin.String? = null, + private var downloadUrl: kotlin.String? = null, + private var downloadUrlExpires: kotlin.String? = null, + private var filterConditions: FilterConditions? = null, + private var bestMatchedLink: SdpLink? = null + ) { + fun partner(partner: kotlin.String?) = apply { this.partner = partner } + + fun brand(brand: kotlin.String?) = apply { this.brand = brand } + + fun fileContentType(fileContentType: kotlin.String?) = apply { this.fileContentType = fileContentType } + + fun locale(locale: kotlin.String?) = apply { this.locale = locale } + + fun fileName(fileName: kotlin.String?) = apply { this.fileName = fileName } + + fun propertySize(propertySize: FileSize?) = apply { this.propertySize = propertySize } + + fun fileLastUpdated(fileLastUpdated: kotlin.String?) = apply { this.fileLastUpdated = fileLastUpdated } + + fun downloadUrl(downloadUrl: kotlin.String?) = apply { this.downloadUrl = downloadUrl } + + fun downloadUrlExpires(downloadUrlExpires: kotlin.String?) = apply { this.downloadUrlExpires = downloadUrlExpires } + + fun filterConditions(filterConditions: FilterConditions?) = apply { this.filterConditions = filterConditions } + + fun bestMatchedLink(bestMatchedLink: SdpLink?) = apply { this.bestMatchedLink = bestMatchedLink } + + fun build(): FileInfo { + val instance = + FileInfo( + partner = partner, + brand = brand, + fileContentType = fileContentType, + locale = locale, + fileName = fileName, + propertySize = propertySize, + fileLastUpdated = fileLastUpdated, + downloadUrl = downloadUrl, + downloadUrlExpires = downloadUrlExpires, + filterConditions = filterConditions, + bestMatchedLink = bestMatchedLink + ) + + validate(instance) + + return instance + } + + private fun validate(instance: FileInfo) { + 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( + partner = partner, + brand = brand, + fileContentType = fileContentType, + locale = locale, + fileName = fileName, + propertySize = propertySize, + fileLastUpdated = fileLastUpdated, + downloadUrl = downloadUrl, + downloadUrlExpires = downloadUrlExpires, + filterConditions = filterConditions, + bestMatchedLink = bestMatchedLink + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FileSize.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FileSize.kt new file mode 100644 index 000000000..877fffe0a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FileSize.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.xap.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 + +/** + * The information about the file size. + * @param unit The unit about the file size. + * @param `value` The value about the file size. + */ +data class FileSize( + // The unit about the file size. + @JsonProperty("unit") + val unit: FileSize.Unit? = null, + // The value about the file size. + @JsonProperty("value") + val `value`: kotlin.Long? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var unit: FileSize.Unit? = null, + private var `value`: kotlin.Long? = null + ) { + fun unit(unit: FileSize.Unit?) = apply { this.unit = unit } + + fun `value`(`value`: kotlin.Long?) = apply { this.`value` = `value` } + + fun build(): FileSize { + val instance = + FileSize( + unit = unit, + `value` = `value` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: FileSize) { + 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( + unit = unit, + `value` = `value` + ) + + /** + * The unit about the file size. + * Values: KB,MB,GB + */ + enum class Unit(val value: kotlin.String) { + @JsonProperty("KB") + KB("KB"), + + @JsonProperty("MB") + MB("MB"), + + @JsonProperty("GB") + GB("GB") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FilterConditions.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FilterConditions.kt new file mode 100644 index 000000000..a9359a600 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FilterConditions.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.xap.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 + +/** + * Container filter condition for the filtered file. [Filters](https://confluence.expedia.biz/display/EWS/Filtered+Feed+File+Generation+Schedule+and+Access#FilteredFeedFileGenerationScheduleandAccess-Filters) + * @param pointOfSupply List of filter condition for PointOfSupplies: `US`, `AT`,`BR`,`CA`,`FR`,`DE`,`GR`,`IT`, `JP`,`KR`,`MX`,`PT`,`ES`,`TR`, `AE`,`GB`. + * @param brand List of filter condition for Brands: `VRBO`. + * @param structureType List of filter condition for StructureTypes: `VR`, `CONVENTIONAL`. + */ +data class FilterConditions( + // List of filter condition for PointOfSupplies: `US`, `AT`,`BR`,`CA`,`FR`,`DE`,`GR`,`IT`, `JP`,`KR`,`MX`,`PT`,`ES`,`TR`, `AE`,`GB`. + @JsonProperty("pointOfSupply") + @field:Valid + val pointOfSupply: kotlin.String? = null, + // List of filter condition for Brands: `VRBO`. + @JsonProperty("brand") + @field:Valid + val brand: kotlin.String? = null, + // List of filter condition for StructureTypes: `VR`, `CONVENTIONAL`. + @JsonProperty("structureType") + @field:Valid + val structureType: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var pointOfSupply: kotlin.String? = null, + private var brand: kotlin.String? = null, + private var structureType: kotlin.String? = null + ) { + fun pointOfSupply(pointOfSupply: kotlin.String?) = apply { this.pointOfSupply = pointOfSupply } + + fun brand(brand: kotlin.String?) = apply { this.brand = brand } + + fun structureType(structureType: kotlin.String?) = apply { this.structureType = structureType } + + fun build(): FilterConditions { + val instance = + FilterConditions( + pointOfSupply = pointOfSupply, + brand = brand, + structureType = structureType + ) + + validate(instance) + + return instance + } + + private fun validate(instance: FilterConditions) { + 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( + pointOfSupply = pointOfSupply, + brand = brand, + structureType = structureType + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FuelAC.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FuelAC.kt new file mode 100644 index 000000000..fb7b26c15 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/FuelAC.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Car fuel type and whether Air Conditioning is included. Please find list of Car Fuel AC Codes in https://expediaintegration.zendesk.com/hc/en-us/articles/115005378328 + * @param code Car FuelAC code. + * @param `value` Car FuelAC value. + */ +data class FuelAC( + // Car FuelAC code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Car FuelAC value. + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var `value`: kotlin.String? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun build(): FuelAC { + val instance = + FuelAC( + code = code!!, + `value` = `value`!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: FuelAC) { + 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!!, + `value` = `value`!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/GeoLocation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/GeoLocation.kt new file mode 100644 index 000000000..279c90827 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/GeoLocation.kt @@ -0,0 +1,112 @@ +/* + * 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.xap.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 + +/** + * Container for Geo location. + * @param latitude Latitude of the location. + * @param longitude Longitude of the location. + * @param obfuscated + */ +data class GeoLocation( + // Latitude of the location. + @JsonProperty("Latitude") + @field:Valid + val latitude: kotlin.String? = null, + // Longitude of the location. + @JsonProperty("Longitude") + @field:Valid + val longitude: kotlin.String? = null, + @JsonProperty("Obfuscated") + @field:Valid + val obfuscated: kotlin.Boolean? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var latitude: kotlin.String? = null, + private var longitude: kotlin.String? = null, + private var obfuscated: kotlin.Boolean? = null + ) { + fun latitude(latitude: kotlin.String?) = apply { this.latitude = latitude } + + fun longitude(longitude: kotlin.String?) = apply { this.longitude = longitude } + + fun obfuscated(obfuscated: kotlin.Boolean?) = apply { this.obfuscated = obfuscated } + + fun build(): GeoLocation { + val instance = + GeoLocation( + latitude = latitude, + longitude = longitude, + obfuscated = obfuscated + ) + + validate(instance) + + return instance + } + + private fun validate(instance: GeoLocation) { + 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, + obfuscated = obfuscated + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Hotel.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Hotel.kt new file mode 100644 index 000000000..6856ffcf5 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Hotel.kt @@ -0,0 +1,480 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.ChainAndBrandInfo +import com.expediagroup.sdk.xap.models.Description +import com.expediagroup.sdk.xap.models.Distance +import com.expediagroup.sdk.xap.models.HotelHotelAmenitiesInner +import com.expediagroup.sdk.xap.models.HotelLinks +import com.expediagroup.sdk.xap.models.HotelLocation +import com.expediagroup.sdk.xap.models.HotelPolicies +import com.expediagroup.sdk.xap.models.HotelPropertyType +import com.expediagroup.sdk.xap.models.HotelRoomAmenitiesInner +import com.expediagroup.sdk.xap.models.Media +import com.expediagroup.sdk.xap.models.Phone +import com.expediagroup.sdk.xap.models.PropertyDetails +import com.expediagroup.sdk.xap.models.RoomType +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for information on each offered hotel. + * @param id The unique, Expedia-specific hotel property identifier used to designate a single hotel. + * @param hcomId The unique, Hotels.com-specific hotel property identifier used to designate a single hotel. This will only be returned if searching via hcomHotelIds in request. + * @param name The common name of the hotel + * @param propertyType + * @param propertyDetails + * @param localCurrencyCode The Local Currency Code for Hotel (which will be used for any fees that must be paid at the hotel) + * @param location + * @param phoneInfos Container for property phone numbers. Note: PhoneInfos section will not return for Vrbo Vacation Rental properties. + * @param distance + * @param description + * @param status Indicates whether there are available offers at the property during the dates requested, as well as information as to why. Note that pricing will only be present in the API response for a status of `AVAILABLE`. If there are no rooms available at the property for the dates requested, then `NOT_AVAILABLE` will be returned. If there are available rooms, but none that meet the specific parameters of the search request, then one of the other messages will be returned. + * @param renovationsAndClosures The information about renovations and closures + * @param chainAndBrandInfo + * @param thumbnailUrl URL of the thumbnail image of the hotel. Note that other images sizes are available - You can find a link to the complete list of Supported Hotel Image Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + * @param starRating Star rating value of the hotel property. + * @param guestRating Average overall guest rating of the hotel. The value is between 1.0 and 5.0 in 0.1 increments. Higher is better. + * @param guestReviewCount The total count of guest reviews used to create the average `GuestRating` above. + * @param petFriendly Indicates whether the property allows certain pets under certain circumstances. Prior to booking, guests should review the PetPolicies information in the Lodging Details API to find out whether a particular pet will be permitted to stay at the property. + * @param lgbtqiaFriendly This value is returned if the property owner has specifically designated this property as LGBTQIA-friendly. + * @param links + * @param policies + * @param cleanlinessAndSafety Container for all cleanliness and safety measures. The key is the measures category, the values are the information. The category will be: - CLEANLINESS - SOCIAL_DISTANCING - SAFETY - DISCLAIMER + * @param optionalExtras The optional extras info. + * @param importantNotices The important notices for hotel. + * @param media Container for hotel images + * @param hotelAmenities Container for all hotel amenities. + * @param hotelDescriptiveAmenities Container for all hotel amenities in group. The key is amenity category, the values are the amenity information. The category for grouped amenities in hotel level for conventional lodging hotel will be: - PARKING - FOOD_AND_DRINK - INTERNET - THINGS_TO_DO - FAMILY_FRIENDLY - CONVENIENCES - GUEST_SERVICES - BUSINESS_SERVICE - OUTDOOR - ACCESSIBILITY - SPA - ACTIVITIES_NEARBY - LANGS_SPOKEN - MORE The category for grouped amenities in hotel level for Vacation Rental hotel will be: - BEACH - SKI - POOL/SPA - INTERNET - PARKING - FAMILY_FRIENDLY - KITCHEN - DINING - BEDROOM - BATHROOMS - LIVING_SPACES - ENTERTAINMENT - OUTDOORS - LAUNDRY - WORKSPACES - CLIMATE_CONTROL - PETS - SUITABILITY/ACCESSIBILITY - SERVICES_AND_CONVENIENCES - LOCATION_HIGHLIGHTS - THINGS_TO_DO - GENERAL - SAFETY + * @param roomAmenities Container for all room amenities. + * @param roomDescriptiveAmenities Container for all common room amenities in group. The key is amenity category, the values are the amenity information. The category for grouped amenities in common room level will be: - BEDROOM - BATHROOM - FOOD_AND_DRINK - ENTERTAINMENT - OUTDOOR_SPACE - MORE + * @param accessibility The accessibility options available for the room. Possible accessibility include: - Accessible path of travel - Accessible bathroom - Roll-in shower - Handicapped parking - In-room accessibility - Accessibility equipment for the deaf - Braille or raised signage + * @param memberOnlyDealAvailable Indicates whether the property has member only deal rates available. + * @param roomTypes Container for all of available room types. + */ +data class Hotel( + // The unique, Expedia-specific hotel property identifier used to designate a single hotel. + @JsonProperty("Id") + @field:Valid + val id: kotlin.String? = null, + // The unique, Hotels.com-specific hotel property identifier used to designate a single hotel. This will only be returned if searching via hcomHotelIds in request. + @JsonProperty("HcomId") + @field:Valid + val hcomId: kotlin.String? = null, + // The common name of the hotel + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null, + @JsonProperty("PropertyType") + @field:Valid + val propertyType: HotelPropertyType? = null, + @JsonProperty("PropertyDetails") + @field:Valid + val propertyDetails: PropertyDetails? = null, + // The Local Currency Code for Hotel (which will be used for any fees that must be paid at the hotel) + @JsonProperty("LocalCurrencyCode") + @field:Valid + val localCurrencyCode: kotlin.String? = null, + @JsonProperty("Location") + @field:Valid + val location: HotelLocation? = null, + // Container for property phone numbers. Note: PhoneInfos section will not return for Vrbo Vacation Rental properties. + @JsonProperty("PhoneInfos") + @field:Valid + val phoneInfos: kotlin.collections.List? = null, + @JsonProperty("Distance") + @field:Valid + val distance: Distance? = null, + @JsonProperty("Description") + @field:Valid + val description: Description? = null, + // Indicates whether there are available offers at the property during the dates requested, as well as information as to why. Note that pricing will only be present in the API response for a status of `AVAILABLE`. If there are no rooms available at the property for the dates requested, then `NOT_AVAILABLE` will be returned. If there are available rooms, but none that meet the specific parameters of the search request, then one of the other messages will be returned. + @JsonProperty("Status") + val status: Hotel.Status? = null, + // The information about renovations and closures + @JsonProperty("RenovationsAndClosures") + @field:Valid + val renovationsAndClosures: kotlin.collections.List? = null, + @JsonProperty("ChainAndBrandInfo") + @field:Valid + val chainAndBrandInfo: ChainAndBrandInfo? = null, + // URL of the thumbnail image of the hotel. Note that other images sizes are available - You can find a link to the complete list of Supported Hotel Image Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + @JsonProperty("ThumbnailUrl") + @field:Valid + val thumbnailUrl: kotlin.String? = null, + // Star rating value of the hotel property. + @JsonProperty("StarRating") + val starRating: Hotel.StarRating? = null, + // Average overall guest rating of the hotel. The value is between 1.0 and 5.0 in 0.1 increments. Higher is better. + @JsonProperty("GuestRating") + @field:Valid + val guestRating: kotlin.String? = null, + // The total count of guest reviews used to create the average `GuestRating` above. + @JsonProperty("GuestReviewCount") + val guestReviewCount: kotlin.Int? = null, + // Indicates whether the property allows certain pets under certain circumstances. Prior to booking, guests should review the PetPolicies information in the Lodging Details API to find out whether a particular pet will be permitted to stay at the property. + @JsonProperty("PetFriendly") + @field:Valid + val petFriendly: kotlin.Boolean? = null, + // This value is returned if the property owner has specifically designated this property as LGBTQIA-friendly. + @JsonProperty("LgbtqiaFriendly") + @field:Valid + val lgbtqiaFriendly: kotlin.Boolean? = null, + @JsonProperty("Links") + @field:Valid + val links: HotelLinks? = null, + @JsonProperty("Policies") + @field:Valid + val policies: HotelPolicies? = null, + // Container for all cleanliness and safety measures. The key is the measures category, the values are the information. The category will be: - CLEANLINESS - SOCIAL_DISTANCING - SAFETY - DISCLAIMER + @JsonProperty("CleanlinessAndSafety") + @field:Valid + val cleanlinessAndSafety: kotlin.collections.Map>? = null, + // The optional extras info. + @JsonProperty("OptionalExtras") + @field:Valid + val optionalExtras: kotlin.collections.List? = null, + // The important notices for hotel. + @JsonProperty("ImportantNotices") + @field:Valid + val importantNotices: kotlin.collections.List? = null, + // Container for hotel images + @JsonProperty("Media") + @field:Valid + val media: kotlin.collections.List? = null, + // Container for all hotel amenities. + @JsonProperty("HotelAmenities") + @field:Valid + val hotelAmenities: kotlin.collections.List? = null, + // Container for all hotel amenities in group. The key is amenity category, the values are the amenity information. The category for grouped amenities in hotel level for conventional lodging hotel will be: - PARKING - FOOD_AND_DRINK - INTERNET - THINGS_TO_DO - FAMILY_FRIENDLY - CONVENIENCES - GUEST_SERVICES - BUSINESS_SERVICE - OUTDOOR - ACCESSIBILITY - SPA - ACTIVITIES_NEARBY - LANGS_SPOKEN - MORE The category for grouped amenities in hotel level for Vacation Rental hotel will be: - BEACH - SKI - POOL/SPA - INTERNET - PARKING - FAMILY_FRIENDLY - KITCHEN - DINING - BEDROOM - BATHROOMS - LIVING_SPACES - ENTERTAINMENT - OUTDOORS - LAUNDRY - WORKSPACES - CLIMATE_CONTROL - PETS - SUITABILITY/ACCESSIBILITY - SERVICES_AND_CONVENIENCES - LOCATION_HIGHLIGHTS - THINGS_TO_DO - GENERAL - SAFETY + @JsonProperty("HotelDescriptiveAmenities") + @field:Valid + val hotelDescriptiveAmenities: kotlin.collections.Map>? = null, + // Container for all room amenities. + @JsonProperty("RoomAmenities") + @field:Valid + val roomAmenities: kotlin.collections.List? = null, + // Container for all common room amenities in group. The key is amenity category, the values are the amenity information. The category for grouped amenities in common room level will be: - BEDROOM - BATHROOM - FOOD_AND_DRINK - ENTERTAINMENT - OUTDOOR_SPACE - MORE + @JsonProperty("RoomDescriptiveAmenities") + @field:Valid + val roomDescriptiveAmenities: kotlin.collections.Map>? = null, + // The accessibility options available for the room. Possible accessibility include: - Accessible path of travel - Accessible bathroom - Roll-in shower - Handicapped parking - In-room accessibility - Accessibility equipment for the deaf - Braille or raised signage + @JsonProperty("Accessibility") + @field:Valid + val accessibility: kotlin.collections.List? = null, + // Indicates whether the property has member only deal rates available. + @JsonProperty("MemberOnlyDealAvailable") + @field:Valid + val memberOnlyDealAvailable: kotlin.Boolean? = null, + // Container for all of available room types. + @JsonProperty("RoomTypes") + @field:Valid + val roomTypes: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.String? = null, + private var hcomId: kotlin.String? = null, + private var name: kotlin.String? = null, + private var propertyType: HotelPropertyType? = null, + private var propertyDetails: PropertyDetails? = null, + private var localCurrencyCode: kotlin.String? = null, + private var location: HotelLocation? = null, + private var phoneInfos: kotlin.collections.List? = null, + private var distance: Distance? = null, + private var description: Description? = null, + private var status: Hotel.Status? = null, + private var renovationsAndClosures: kotlin.collections.List? = null, + private var chainAndBrandInfo: ChainAndBrandInfo? = null, + private var thumbnailUrl: kotlin.String? = null, + private var starRating: Hotel.StarRating? = null, + private var guestRating: kotlin.String? = null, + private var guestReviewCount: kotlin.Int? = null, + private var petFriendly: kotlin.Boolean? = null, + private var lgbtqiaFriendly: kotlin.Boolean? = null, + private var links: HotelLinks? = null, + private var policies: HotelPolicies? = null, + private var cleanlinessAndSafety: kotlin.collections.Map>? = null, + private var optionalExtras: kotlin.collections.List? = null, + private var importantNotices: kotlin.collections.List? = null, + private var media: kotlin.collections.List? = null, + private var hotelAmenities: kotlin.collections.List? = null, + private var hotelDescriptiveAmenities: kotlin.collections.Map>? = null, + private var roomAmenities: kotlin.collections.List? = null, + private var roomDescriptiveAmenities: kotlin.collections.Map>? = null, + private var accessibility: kotlin.collections.List? = null, + private var memberOnlyDealAvailable: kotlin.Boolean? = null, + private var roomTypes: kotlin.collections.List? = null + ) { + fun id(id: kotlin.String?) = apply { this.id = id } + + fun hcomId(hcomId: kotlin.String?) = apply { this.hcomId = hcomId } + + fun name(name: kotlin.String?) = apply { this.name = name } + + fun propertyType(propertyType: HotelPropertyType?) = apply { this.propertyType = propertyType } + + fun propertyDetails(propertyDetails: PropertyDetails?) = apply { this.propertyDetails = propertyDetails } + + fun localCurrencyCode(localCurrencyCode: kotlin.String?) = apply { this.localCurrencyCode = localCurrencyCode } + + fun location(location: HotelLocation?) = apply { this.location = location } + + fun phoneInfos(phoneInfos: kotlin.collections.List?) = apply { this.phoneInfos = phoneInfos } + + fun distance(distance: Distance?) = apply { this.distance = distance } + + fun description(description: Description?) = apply { this.description = description } + + fun status(status: Hotel.Status?) = apply { this.status = status } + + fun renovationsAndClosures(renovationsAndClosures: kotlin.collections.List?) = apply { this.renovationsAndClosures = renovationsAndClosures } + + fun chainAndBrandInfo(chainAndBrandInfo: ChainAndBrandInfo?) = apply { this.chainAndBrandInfo = chainAndBrandInfo } + + fun thumbnailUrl(thumbnailUrl: kotlin.String?) = apply { this.thumbnailUrl = thumbnailUrl } + + fun starRating(starRating: Hotel.StarRating?) = apply { this.starRating = starRating } + + fun guestRating(guestRating: kotlin.String?) = apply { this.guestRating = guestRating } + + fun guestReviewCount(guestReviewCount: kotlin.Int?) = apply { this.guestReviewCount = guestReviewCount } + + fun petFriendly(petFriendly: kotlin.Boolean?) = apply { this.petFriendly = petFriendly } + + fun lgbtqiaFriendly(lgbtqiaFriendly: kotlin.Boolean?) = apply { this.lgbtqiaFriendly = lgbtqiaFriendly } + + fun links(links: HotelLinks?) = apply { this.links = links } + + fun policies(policies: HotelPolicies?) = apply { this.policies = policies } + + fun cleanlinessAndSafety(cleanlinessAndSafety: kotlin.collections.Map>?) = + apply { + this.cleanlinessAndSafety = + cleanlinessAndSafety + } + + fun optionalExtras(optionalExtras: kotlin.collections.List?) = apply { this.optionalExtras = optionalExtras } + + fun importantNotices(importantNotices: kotlin.collections.List?) = apply { this.importantNotices = importantNotices } + + fun media(media: kotlin.collections.List?) = apply { this.media = media } + + fun hotelAmenities(hotelAmenities: kotlin.collections.List?) = apply { this.hotelAmenities = hotelAmenities } + + fun hotelDescriptiveAmenities(hotelDescriptiveAmenities: kotlin.collections.Map>?) = + apply { + this.hotelDescriptiveAmenities = + hotelDescriptiveAmenities + } + + fun roomAmenities(roomAmenities: kotlin.collections.List?) = apply { this.roomAmenities = roomAmenities } + + fun roomDescriptiveAmenities(roomDescriptiveAmenities: kotlin.collections.Map>?) = + apply { + this.roomDescriptiveAmenities = + roomDescriptiveAmenities + } + + fun accessibility(accessibility: kotlin.collections.List?) = apply { this.accessibility = accessibility } + + fun memberOnlyDealAvailable(memberOnlyDealAvailable: kotlin.Boolean?) = apply { this.memberOnlyDealAvailable = memberOnlyDealAvailable } + + fun roomTypes(roomTypes: kotlin.collections.List?) = apply { this.roomTypes = roomTypes } + + fun build(): Hotel { + val instance = + Hotel( + id = id, + hcomId = hcomId, + name = name, + propertyType = propertyType, + propertyDetails = propertyDetails, + localCurrencyCode = localCurrencyCode, + location = location, + phoneInfos = phoneInfos, + distance = distance, + description = description, + status = status, + renovationsAndClosures = renovationsAndClosures, + chainAndBrandInfo = chainAndBrandInfo, + thumbnailUrl = thumbnailUrl, + starRating = starRating, + guestRating = guestRating, + guestReviewCount = guestReviewCount, + petFriendly = petFriendly, + lgbtqiaFriendly = lgbtqiaFriendly, + links = links, + policies = policies, + cleanlinessAndSafety = cleanlinessAndSafety, + optionalExtras = optionalExtras, + importantNotices = importantNotices, + media = media, + hotelAmenities = hotelAmenities, + hotelDescriptiveAmenities = hotelDescriptiveAmenities, + roomAmenities = roomAmenities, + roomDescriptiveAmenities = roomDescriptiveAmenities, + accessibility = accessibility, + memberOnlyDealAvailable = memberOnlyDealAvailable, + roomTypes = roomTypes + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Hotel) { + 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, + hcomId = hcomId, + name = name, + propertyType = propertyType, + propertyDetails = propertyDetails, + localCurrencyCode = localCurrencyCode, + location = location, + phoneInfos = phoneInfos, + distance = distance, + description = description, + status = status, + renovationsAndClosures = renovationsAndClosures, + chainAndBrandInfo = chainAndBrandInfo, + thumbnailUrl = thumbnailUrl, + starRating = starRating, + guestRating = guestRating, + guestReviewCount = guestReviewCount, + petFriendly = petFriendly, + lgbtqiaFriendly = lgbtqiaFriendly, + links = links, + policies = policies, + cleanlinessAndSafety = cleanlinessAndSafety, + optionalExtras = optionalExtras, + importantNotices = importantNotices, + media = media, + hotelAmenities = hotelAmenities, + hotelDescriptiveAmenities = hotelDescriptiveAmenities, + roomAmenities = roomAmenities, + roomDescriptiveAmenities = roomDescriptiveAmenities, + accessibility = accessibility, + memberOnlyDealAvailable = memberOnlyDealAvailable, + roomTypes = roomTypes + ) + + /** + * Indicates whether there are available offers at the property during the dates requested, as well as information as to why. Note that pricing will only be present in the API response for a status of `AVAILABLE`. If there are no rooms available at the property for the dates requested, then `NOT_AVAILABLE` will be returned. If there are available rooms, but none that meet the specific parameters of the search request, then one of the other messages will be returned. + * Values: AVAILABLE,NOT_AVAILABLE,ERROR,NUMBER_OF_ADULTS_NOT_ACCEPTED,NUMBER_OF_CHILDREN_NOT_ACCEPTED,NUMBER_OF_INFANTS_NOT_ACCEPTED,NUMBER_OF_PERSONS_NOT_ACCEPTED,CHECK_IN_AGE_NOT_ACCEPTED + */ + enum class Status(val value: kotlin.String) { + @JsonProperty("AVAILABLE") + AVAILABLE("AVAILABLE"), + + @JsonProperty("NOT_AVAILABLE") + NOT_AVAILABLE("NOT_AVAILABLE"), + + @JsonProperty("ERROR") + ERROR("ERROR"), + + @JsonProperty("NUMBER_OF_ADULTS_NOT_ACCEPTED") + NUMBER_OF_ADULTS_NOT_ACCEPTED("NUMBER_OF_ADULTS_NOT_ACCEPTED"), + + @JsonProperty("NUMBER_OF_CHILDREN_NOT_ACCEPTED") + NUMBER_OF_CHILDREN_NOT_ACCEPTED("NUMBER_OF_CHILDREN_NOT_ACCEPTED"), + + @JsonProperty("NUMBER_OF_INFANTS_NOT_ACCEPTED") + NUMBER_OF_INFANTS_NOT_ACCEPTED("NUMBER_OF_INFANTS_NOT_ACCEPTED"), + + @JsonProperty("NUMBER_OF_PERSONS_NOT_ACCEPTED") + NUMBER_OF_PERSONS_NOT_ACCEPTED("NUMBER_OF_PERSONS_NOT_ACCEPTED"), + + @JsonProperty("CHECK_IN_AGE_NOT_ACCEPTED") + CHECK_IN_AGE_NOT_ACCEPTED("CHECK_IN_AGE_NOT_ACCEPTED") + } + + /** + * Star rating value of the hotel property. + * Values: _1_PERIOD0,_1_PERIOD5,_2_PERIOD0,_2_PERIOD5,_3_PERIOD0,_3_PERIOD5,_4_PERIOD0,_4_PERIOD5,_5_PERIOD0 + */ + enum class StarRating(val value: kotlin.String) { + @JsonProperty("1.0") + _1_PERIOD0("1.0"), + + @JsonProperty("1.5") + _1_PERIOD5("1.5"), + + @JsonProperty("2.0") + _2_PERIOD0("2.0"), + + @JsonProperty("2.5") + _2_PERIOD5("2.5"), + + @JsonProperty("3.0") + _3_PERIOD0("3.0"), + + @JsonProperty("3.5") + _3_PERIOD5("3.5"), + + @JsonProperty("4.0") + _4_PERIOD0("4.0"), + + @JsonProperty("4.5") + _4_PERIOD5("4.5"), + + @JsonProperty("5.0") + _5_PERIOD0("5.0") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponse.kt new file mode 100644 index 000000000..909eca952 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponse.kt @@ -0,0 +1,164 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Hotel +import com.expediagroup.sdk.xap.models.HotelDetailsResponseOccupantsInner +import com.expediagroup.sdk.xap.models.HotelDetailsResponseStayDates +import com.expediagroup.sdk.xap.models.HotelDetailsResponseWarningsInner +import com.expediagroup.sdk.xap.models.ValidFormsOfPayment +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param warnings There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + * @param transactionId Unique identifier for the transaction. + * @param stayDates + * @param lengthOfStay The number of stay nights. + * @param numberOfRooms Number of rooms requested. + * @param occupants Container for the list of rooms requested by the traveler. Occupancy for each room is specified in this node. + * @param validFormsOfPayment Container for payment information. + * @param hotelDetails + */ +data class HotelDetailsResponse( + // There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + // Unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null, + @JsonProperty("StayDates") + @field:Valid + val stayDates: HotelDetailsResponseStayDates? = null, + // The number of stay nights. + @JsonProperty("LengthOfStay") + val lengthOfStay: kotlin.Int? = null, + // Number of rooms requested. + @JsonProperty("NumberOfRooms") + val numberOfRooms: kotlin.Int? = null, + // Container for the list of rooms requested by the traveler. Occupancy for each room is specified in this node. + @JsonProperty("Occupants") + @field:Valid + val occupants: kotlin.collections.List? = null, + // Container for payment information. + @JsonProperty("ValidFormsOfPayment") + @field:Valid + val validFormsOfPayment: kotlin.collections.List? = null, + @JsonProperty("HotelDetails") + @field:Valid + val hotelDetails: Hotel? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var warnings: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null, + private var stayDates: HotelDetailsResponseStayDates? = null, + private var lengthOfStay: kotlin.Int? = null, + private var numberOfRooms: kotlin.Int? = null, + private var occupants: kotlin.collections.List? = null, + private var validFormsOfPayment: kotlin.collections.List? = null, + private var hotelDetails: Hotel? = null + ) { + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun stayDates(stayDates: HotelDetailsResponseStayDates?) = apply { this.stayDates = stayDates } + + fun lengthOfStay(lengthOfStay: kotlin.Int?) = apply { this.lengthOfStay = lengthOfStay } + + fun numberOfRooms(numberOfRooms: kotlin.Int?) = apply { this.numberOfRooms = numberOfRooms } + + fun occupants(occupants: kotlin.collections.List?) = apply { this.occupants = occupants } + + fun validFormsOfPayment(validFormsOfPayment: kotlin.collections.List?) = apply { this.validFormsOfPayment = validFormsOfPayment } + + fun hotelDetails(hotelDetails: Hotel?) = apply { this.hotelDetails = hotelDetails } + + fun build(): HotelDetailsResponse { + val instance = + HotelDetailsResponse( + warnings = warnings, + transactionId = transactionId, + stayDates = stayDates, + lengthOfStay = lengthOfStay, + numberOfRooms = numberOfRooms, + occupants = occupants, + validFormsOfPayment = validFormsOfPayment, + hotelDetails = hotelDetails + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponse) { + 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( + warnings = warnings, + transactionId = transactionId, + stayDates = stayDates, + lengthOfStay = lengthOfStay, + numberOfRooms = numberOfRooms, + occupants = occupants, + validFormsOfPayment = validFormsOfPayment, + hotelDetails = hotelDetails + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseOccupantsInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseOccupantsInner.kt new file mode 100644 index 000000000..a2fef6c22 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseOccupantsInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param adults Specifies the number of adults staying in each room. + * @param childAges Specifies the age(s) of each of the children staying in the room, as well as the number of children in the room. + */ +data class HotelDetailsResponseOccupantsInner( + // Specifies the number of adults staying in each room. + @JsonProperty("Adults") + @field:Valid + val adults: kotlin.Any? = null, + // Specifies the age(s) of each of the children staying in the room, as well as the number of children in the room. + @JsonProperty("ChildAges") + @field:Valid + val childAges: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adults: kotlin.Any? = null, + private var childAges: kotlin.Any? = null + ) { + fun adults(adults: kotlin.Any?) = apply { this.adults = adults } + + fun childAges(childAges: kotlin.Any?) = apply { this.childAges = childAges } + + fun build(): HotelDetailsResponseOccupantsInner { + val instance = + HotelDetailsResponseOccupantsInner( + adults = adults, + childAges = childAges + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponseOccupantsInner) { + 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( + adults = adults, + childAges = childAges + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseOccupantsInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseOccupantsInnerAllOf.kt new file mode 100644 index 000000000..693532359 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseOccupantsInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param adults Specifies the number of adults staying in each room. + * @param childAges Specifies the age(s) of each of the children staying in the room, as well as the number of children in the room. + */ +data class HotelDetailsResponseOccupantsInnerAllOf( + // Specifies the number of adults staying in each room. + @JsonProperty("Adults") + @field:Valid + val adults: kotlin.Any? = null, + // Specifies the age(s) of each of the children staying in the room, as well as the number of children in the room. + @JsonProperty("ChildAges") + @field:Valid + val childAges: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adults: kotlin.Any? = null, + private var childAges: kotlin.Any? = null + ) { + fun adults(adults: kotlin.Any?) = apply { this.adults = adults } + + fun childAges(childAges: kotlin.Any?) = apply { this.childAges = childAges } + + fun build(): HotelDetailsResponseOccupantsInnerAllOf { + val instance = + HotelDetailsResponseOccupantsInnerAllOf( + adults = adults, + childAges = childAges + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponseOccupantsInnerAllOf) { + 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( + adults = adults, + childAges = childAges + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseStayDates.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseStayDates.kt new file mode 100644 index 000000000..7b5b89bfb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseStayDates.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param checkInDate Check-in date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkOut` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + * @param checkOutDate Checkout date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkIn` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + */ +data class HotelDetailsResponseStayDates( + // Check-in date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkOut` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + @JsonProperty("CheckInDate") + @field:Valid + val checkInDate: kotlin.Any? = null, + // Checkout date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkIn` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + @JsonProperty("CheckOutDate") + @field:Valid + val checkOutDate: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var checkInDate: kotlin.Any? = null, + private var checkOutDate: kotlin.Any? = null + ) { + fun checkInDate(checkInDate: kotlin.Any?) = apply { this.checkInDate = checkInDate } + + fun checkOutDate(checkOutDate: kotlin.Any?) = apply { this.checkOutDate = checkOutDate } + + fun build(): HotelDetailsResponseStayDates { + val instance = + HotelDetailsResponseStayDates( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponseStayDates) { + 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( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseStayDatesAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseStayDatesAllOf.kt new file mode 100644 index 000000000..e259006c3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseStayDatesAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param checkInDate Check-in date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkOut` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + * @param checkOutDate Checkout date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkIn` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + */ +data class HotelDetailsResponseStayDatesAllOf( + // Check-in date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkOut` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + @JsonProperty("CheckInDate") + @field:Valid + val checkInDate: kotlin.Any? = null, + // Checkout date for property stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkIn` parameter. The maximum advanced search window is 330 days in the future. The maximum length of stay is 28 days. + @JsonProperty("CheckOutDate") + @field:Valid + val checkOutDate: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var checkInDate: kotlin.Any? = null, + private var checkOutDate: kotlin.Any? = null + ) { + fun checkInDate(checkInDate: kotlin.Any?) = apply { this.checkInDate = checkInDate } + + fun checkOutDate(checkOutDate: kotlin.Any?) = apply { this.checkOutDate = checkOutDate } + + fun build(): HotelDetailsResponseStayDatesAllOf { + val instance = + HotelDetailsResponseStayDatesAllOf( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponseStayDatesAllOf) { + 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( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseWarningsInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseWarningsInner.kt new file mode 100644 index 000000000..09db60810 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseWarningsInner.kt @@ -0,0 +1,143 @@ +/* + * 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.xap.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 + +/** + * + * @param code The code of the warning. Available values are: - PRICE_DECREASED: The price decreased after shopping. - PRICE_INCREASED: The price increased after shopping. - CURRENCY_CHANGE: You will be charged in a different currency. + * @param description A detail information of what happened. + * @param originalPrice The original price from the Lodging Search API response. + * @param newPrice The new price. + * @param changedAmount The difference between `OriginalPrice` and `NewPrice`. + * @param changedPercentage The changed percentage. In the sample 2.97 means the changed percentage is 2.97%. + */ +data class HotelDetailsResponseWarningsInner( + // The code of the warning. Available values are: - PRICE_DECREASED: The price decreased after shopping. - PRICE_INCREASED: The price increased after shopping. - CURRENCY_CHANGE: You will be charged in a different currency. + @JsonProperty("Code") + @field:Valid + val code: kotlin.Any? = null, + // A detail information of what happened. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + // The original price from the Lodging Search API response. + @JsonProperty("OriginalPrice") + @field:Valid + val originalPrice: kotlin.Any? = null, + // The new price. + @JsonProperty("NewPrice") + @field:Valid + val newPrice: kotlin.Any? = null, + // The difference between `OriginalPrice` and `NewPrice`. + @JsonProperty("ChangedAmount") + @field:Valid + val changedAmount: kotlin.Any? = null, + // The changed percentage. In the sample 2.97 means the changed percentage is 2.97%. + @JsonProperty("ChangedPercentage") + @field:Valid + val changedPercentage: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.Any? = null, + private var description: kotlin.String? = null, + private var originalPrice: kotlin.Any? = null, + private var newPrice: kotlin.Any? = null, + private var changedAmount: kotlin.Any? = null, + private var changedPercentage: kotlin.String? = null + ) { + fun code(code: kotlin.Any?) = apply { this.code = code } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun originalPrice(originalPrice: kotlin.Any?) = apply { this.originalPrice = originalPrice } + + fun newPrice(newPrice: kotlin.Any?) = apply { this.newPrice = newPrice } + + fun changedAmount(changedAmount: kotlin.Any?) = apply { this.changedAmount = changedAmount } + + fun changedPercentage(changedPercentage: kotlin.String?) = apply { this.changedPercentage = changedPercentage } + + fun build(): HotelDetailsResponseWarningsInner { + val instance = + HotelDetailsResponseWarningsInner( + code = code, + description = description, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount, + changedPercentage = changedPercentage + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponseWarningsInner) { + 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, + description = description, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount, + changedPercentage = changedPercentage + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseWarningsInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseWarningsInnerAllOf.kt new file mode 100644 index 000000000..b26f37431 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelDetailsResponseWarningsInnerAllOf.kt @@ -0,0 +1,123 @@ +/* + * 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.xap.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 + +/** + * + * @param code The code of the warning. Available values are: - PRICE_DECREASED: The price decreased after shopping. - PRICE_INCREASED: The price increased after shopping. - CURRENCY_CHANGE: You will be charged in a different currency. + * @param originalPrice The original price from the Lodging Search API response. + * @param newPrice The new price. + * @param changedAmount The difference between `OriginalPrice` and `NewPrice`. + */ +data class HotelDetailsResponseWarningsInnerAllOf( + // The code of the warning. Available values are: - PRICE_DECREASED: The price decreased after shopping. - PRICE_INCREASED: The price increased after shopping. - CURRENCY_CHANGE: You will be charged in a different currency. + @JsonProperty("Code") + @field:Valid + val code: kotlin.Any? = null, + // The original price from the Lodging Search API response. + @JsonProperty("OriginalPrice") + @field:Valid + val originalPrice: kotlin.Any? = null, + // The new price. + @JsonProperty("NewPrice") + @field:Valid + val newPrice: kotlin.Any? = null, + // The difference between `OriginalPrice` and `NewPrice`. + @JsonProperty("ChangedAmount") + @field:Valid + val changedAmount: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.Any? = null, + private var originalPrice: kotlin.Any? = null, + private var newPrice: kotlin.Any? = null, + private var changedAmount: kotlin.Any? = null + ) { + fun code(code: kotlin.Any?) = apply { this.code = code } + + fun originalPrice(originalPrice: kotlin.Any?) = apply { this.originalPrice = originalPrice } + + fun newPrice(newPrice: kotlin.Any?) = apply { this.newPrice = newPrice } + + fun changedAmount(changedAmount: kotlin.Any?) = apply { this.changedAmount = changedAmount } + + fun build(): HotelDetailsResponseWarningsInnerAllOf { + val instance = + HotelDetailsResponseWarningsInnerAllOf( + code = code, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelDetailsResponseWarningsInnerAllOf) { + 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, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelHotelAmenitiesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelHotelAmenitiesInner.kt new file mode 100644 index 000000000..1efdca550 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelHotelAmenitiesInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id The identification number for a hotel amenity. + * @param name The description of a hotel amenity. + */ +data class HotelHotelAmenitiesInner( + // The identification number for a hotel amenity. + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // The description of a hotel amenity. + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): HotelHotelAmenitiesInner { + val instance = + HotelHotelAmenitiesInner( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelHotelAmenitiesInner) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelHotelAmenitiesInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelHotelAmenitiesInnerAllOf.kt new file mode 100644 index 000000000..bccedad58 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelHotelAmenitiesInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id The identification number for a hotel amenity. + * @param name The description of a hotel amenity. + */ +data class HotelHotelAmenitiesInnerAllOf( + // The identification number for a hotel amenity. + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // The description of a hotel amenity. + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): HotelHotelAmenitiesInnerAllOf { + val instance = + HotelHotelAmenitiesInnerAllOf( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelHotelAmenitiesInnerAllOf) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinks.kt new file mode 100644 index 000000000..747228435 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinks.kt @@ -0,0 +1,104 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.HotelLinksApiRateCalendar +import com.expediagroup.sdk.xap.models.HotelLinksWebSearchResult +import com.expediagroup.sdk.xap.models.Link +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for list of **HATEOAS** links to Expedia website to complete booking. This links section will only return a deeplink to the Website Search Results page by default. If you have selected AD deeplinks they will only appear within the `RoomTypes` section of the response, as the Lodging Details API returns details at the room offer level, and not at the property level. + * @param webSearchResult + * @param apiRateCalendar + */ +data class HotelLinks( + @JsonProperty("WebSearchResult") + @field:Valid + val webSearchResult: HotelLinksWebSearchResult? = null, + @JsonProperty("ApiRateCalendar") + @field:Valid + val apiRateCalendar: HotelLinksApiRateCalendar? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var webSearchResult: HotelLinksWebSearchResult? = null, + private var apiRateCalendar: HotelLinksApiRateCalendar? = null + ) { + fun webSearchResult(webSearchResult: HotelLinksWebSearchResult?) = apply { this.webSearchResult = webSearchResult } + + fun apiRateCalendar(apiRateCalendar: HotelLinksApiRateCalendar?) = apply { this.apiRateCalendar = apiRateCalendar } + + fun build(): HotelLinks { + val instance = + HotelLinks( + webSearchResult = webSearchResult, + apiRateCalendar = apiRateCalendar + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelLinks) { + 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( + webSearchResult = webSearchResult, + apiRateCalendar = apiRateCalendar + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinksApiRateCalendar.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinksApiRateCalendar.kt new file mode 100644 index 000000000..9e046cb5a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinksApiRateCalendar.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.xap.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 + +/** + * + * @param accept The Accept request header (for API queries only - not included for page URLs). + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class HotelLinksApiRateCalendar( + // The Accept request header (for API queries only - not included for page URLs). + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): HotelLinksApiRateCalendar { + val instance = + HotelLinksApiRateCalendar( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelLinksApiRateCalendar) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinksWebSearchResult.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinksWebSearchResult.kt new file mode 100644 index 000000000..f39b5e4e8 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLinksWebSearchResult.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.xap.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 + +/** + * + * @param accept The Accept request header (for API queries only - not included for page URLs). + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class HotelLinksWebSearchResult( + // The Accept request header (for API queries only - not included for page URLs). + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): HotelLinksWebSearchResult { + val instance = + HotelLinksWebSearchResult( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelLinksWebSearchResult) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelListingsResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelListingsResponse.kt new file mode 100644 index 000000000..098fbc5e5 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelListingsResponse.kt @@ -0,0 +1,172 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Hotel +import com.expediagroup.sdk.xap.models.HotelListingsResponseStayDates +import com.expediagroup.sdk.xap.models.Occupant +import com.expediagroup.sdk.xap.models.Warning +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param warnings There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + * @param count The number of hotels actually returned in the response. + * @param totalHotelCount The number of hotels present in the location. + * @param transactionId Unique identifier for the transaction. + * @param stayDates + * @param lengthOfStay The number of stay nights. + * @param numberOfRooms The number of the rooms requested on behalf of the user. + * @param occupants Container of occupants. It is an array including occupants of each room. + * @param hotels Container for all hotels. + */ +data class HotelListingsResponse( + // There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + // The number of hotels actually returned in the response. + @JsonProperty("Count") + val count: kotlin.Int? = null, + // The number of hotels present in the location. + @JsonProperty("TotalHotelCount") + val totalHotelCount: kotlin.Int? = null, + // Unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null, + @JsonProperty("StayDates") + @field:Valid + val stayDates: HotelListingsResponseStayDates? = null, + // The number of stay nights. + @JsonProperty("LengthOfStay") + val lengthOfStay: kotlin.Int? = null, + // The number of the rooms requested on behalf of the user. + @JsonProperty("NumberOfRooms") + val numberOfRooms: kotlin.Int? = null, + // Container of occupants. It is an array including occupants of each room. + @JsonProperty("Occupants") + @field:Valid + val occupants: kotlin.collections.List? = null, + // Container for all hotels. + @JsonProperty("Hotels") + @field:Valid + val hotels: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var warnings: kotlin.collections.List? = null, + private var count: kotlin.Int? = null, + private var totalHotelCount: kotlin.Int? = null, + private var transactionId: kotlin.String? = null, + private var stayDates: HotelListingsResponseStayDates? = null, + private var lengthOfStay: kotlin.Int? = null, + private var numberOfRooms: kotlin.Int? = null, + private var occupants: kotlin.collections.List? = null, + private var hotels: kotlin.collections.List? = null + ) { + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun count(count: kotlin.Int?) = apply { this.count = count } + + fun totalHotelCount(totalHotelCount: kotlin.Int?) = apply { this.totalHotelCount = totalHotelCount } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun stayDates(stayDates: HotelListingsResponseStayDates?) = apply { this.stayDates = stayDates } + + fun lengthOfStay(lengthOfStay: kotlin.Int?) = apply { this.lengthOfStay = lengthOfStay } + + fun numberOfRooms(numberOfRooms: kotlin.Int?) = apply { this.numberOfRooms = numberOfRooms } + + fun occupants(occupants: kotlin.collections.List?) = apply { this.occupants = occupants } + + fun hotels(hotels: kotlin.collections.List?) = apply { this.hotels = hotels } + + fun build(): HotelListingsResponse { + val instance = + HotelListingsResponse( + warnings = warnings, + count = count, + totalHotelCount = totalHotelCount, + transactionId = transactionId, + stayDates = stayDates, + lengthOfStay = lengthOfStay, + numberOfRooms = numberOfRooms, + occupants = occupants, + hotels = hotels + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelListingsResponse) { + 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( + warnings = warnings, + count = count, + totalHotelCount = totalHotelCount, + transactionId = transactionId, + stayDates = stayDates, + lengthOfStay = lengthOfStay, + numberOfRooms = numberOfRooms, + occupants = occupants, + hotels = hotels + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelListingsResponseStayDates.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelListingsResponseStayDates.kt new file mode 100644 index 000000000..d01cb1c2d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelListingsResponseStayDates.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 checkInDate The initial day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + * @param checkOutDate The final day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + */ +data class HotelListingsResponseStayDates( + // The initial day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("CheckInDate") + val checkInDate: java.time.LocalDate? = null, + // The final day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("CheckOutDate") + val checkOutDate: java.time.LocalDate? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var checkInDate: java.time.LocalDate? = null, + private var checkOutDate: java.time.LocalDate? = null + ) { + fun checkInDate(checkInDate: java.time.LocalDate?) = apply { this.checkInDate = checkInDate } + + fun checkOutDate(checkOutDate: java.time.LocalDate?) = apply { this.checkOutDate = checkOutDate } + + fun build(): HotelListingsResponseStayDates { + val instance = + HotelListingsResponseStayDates( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelListingsResponseStayDates) { + 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( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLocation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLocation.kt new file mode 100644 index 000000000..2e66d5ac5 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelLocation.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Address +import com.expediagroup.sdk.xap.models.LocationGeoLocation +import com.expediagroup.sdk.xap.models.Neighborhood +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param address + * @param geoLocation + * @param neighborhood + */ +data class HotelLocation( + @JsonProperty("Address") + @field:Valid + val address: Address? = null, + @JsonProperty("GeoLocation") + @field:Valid + val geoLocation: LocationGeoLocation? = null, + @JsonProperty("Neighborhood") + @field:Valid + val neighborhood: Neighborhood? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var address: Address? = null, + private var geoLocation: LocationGeoLocation? = null, + private var neighborhood: Neighborhood? = null + ) { + fun address(address: Address?) = apply { this.address = address } + + fun geoLocation(geoLocation: LocationGeoLocation?) = apply { this.geoLocation = geoLocation } + + fun neighborhood(neighborhood: Neighborhood?) = apply { this.neighborhood = neighborhood } + + fun build(): HotelLocation { + val instance = + HotelLocation( + address = address, + geoLocation = geoLocation, + neighborhood = neighborhood + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelLocation) { + 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( + address = address, + geoLocation = geoLocation, + neighborhood = neighborhood + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelPolicies.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelPolicies.kt new file mode 100644 index 000000000..2b71be3d4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelPolicies.kt @@ -0,0 +1,143 @@ +/* + * 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.xap.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 + +/** + * Container for Hotel policy information. + * @param checkInStartTime Beginning of the standard check-in window on the check in date, and in the local time of the hotel. + * @param checkInEndTime End of the standard check-in window on the check in date, and in the local time of the hotel. + * @param specialCheckInInstructions Some special instructions needed care by customer when check in. + * @param checkOutTime Customers must check out before this time on the check out date, expressed in the local time of the hotel. + * @param petPolicies The policy of the property toward having pets stay with guests. + * @param childrenAndExtraBedsPolicies The policy of the hotel for having children stay at the hotel, as well as for including extra beds in the room. + */ +data class HotelPolicies( + // Beginning of the standard check-in window on the check in date, and in the local time of the hotel. + @JsonProperty("CheckInStartTime") + @field:Valid + val checkInStartTime: kotlin.String? = null, + // End of the standard check-in window on the check in date, and in the local time of the hotel. + @JsonProperty("CheckInEndTime") + @field:Valid + val checkInEndTime: kotlin.String? = null, + // Some special instructions needed care by customer when check in. + @JsonProperty("SpecialCheckInInstructions") + @field:Valid + val specialCheckInInstructions: kotlin.collections.List? = null, + // Customers must check out before this time on the check out date, expressed in the local time of the hotel. + @JsonProperty("CheckOutTime") + @field:Valid + val checkOutTime: kotlin.String? = null, + // The policy of the property toward having pets stay with guests. + @JsonProperty("PetPolicies") + @field:Valid + val petPolicies: kotlin.collections.List? = null, + // The policy of the hotel for having children stay at the hotel, as well as for including extra beds in the room. + @JsonProperty("ChildrenAndExtraBedsPolicies") + @field:Valid + val childrenAndExtraBedsPolicies: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var checkInStartTime: kotlin.String? = null, + private var checkInEndTime: kotlin.String? = null, + private var specialCheckInInstructions: kotlin.collections.List? = null, + private var checkOutTime: kotlin.String? = null, + private var petPolicies: kotlin.collections.List? = null, + private var childrenAndExtraBedsPolicies: kotlin.collections.List? = null + ) { + fun checkInStartTime(checkInStartTime: kotlin.String?) = apply { this.checkInStartTime = checkInStartTime } + + fun checkInEndTime(checkInEndTime: kotlin.String?) = apply { this.checkInEndTime = checkInEndTime } + + fun specialCheckInInstructions(specialCheckInInstructions: kotlin.collections.List?) = apply { this.specialCheckInInstructions = specialCheckInInstructions } + + fun checkOutTime(checkOutTime: kotlin.String?) = apply { this.checkOutTime = checkOutTime } + + fun petPolicies(petPolicies: kotlin.collections.List?) = apply { this.petPolicies = petPolicies } + + fun childrenAndExtraBedsPolicies(childrenAndExtraBedsPolicies: kotlin.collections.List?) = apply { this.childrenAndExtraBedsPolicies = childrenAndExtraBedsPolicies } + + fun build(): HotelPolicies { + val instance = + HotelPolicies( + checkInStartTime = checkInStartTime, + checkInEndTime = checkInEndTime, + specialCheckInInstructions = specialCheckInInstructions, + checkOutTime = checkOutTime, + petPolicies = petPolicies, + childrenAndExtraBedsPolicies = childrenAndExtraBedsPolicies + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelPolicies) { + 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( + checkInStartTime = checkInStartTime, + checkInEndTime = checkInEndTime, + specialCheckInInstructions = specialCheckInInstructions, + checkOutTime = checkOutTime, + petPolicies = petPolicies, + childrenAndExtraBedsPolicies = childrenAndExtraBedsPolicies + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelPropertyType.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelPropertyType.kt new file mode 100644 index 000000000..f12b4691f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelPropertyType.kt @@ -0,0 +1,102 @@ +/* + * 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.xap.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 + +/** + * Container for information on hotel property type. You can find a complete list of Lodging Property Types in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + * @param id The id of hotel property type. + * @param name The name of hotel property type. + */ +data class HotelPropertyType( + // The id of hotel property type. + @JsonProperty("Id") + val id: kotlin.Int? = null, + // The name of hotel property type. + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Int? = null, + private var name: kotlin.String? = null + ) { + fun id(id: kotlin.Int?) = apply { this.id = id } + + fun name(name: kotlin.String?) = apply { this.name = name } + + fun build(): HotelPropertyType { + val instance = + HotelPropertyType( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelPropertyType) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRateCalendar.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRateCalendar.kt new file mode 100644 index 000000000..bc634ac91 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRateCalendar.kt @@ -0,0 +1,114 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RateCalendar +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for all hotel rate calendar data. + * @param ecomHotelId The unique, Expedia-specific hotel property identifier used to designate a single hotel. + * @param hcomHotelId The unique, Hotels.com-specific hotel property identifier used to designate a single hotel. This will be returned if searching via `hcomHotelId` in request or the request is coming from Hcom partner. + * @param rateCalendar Container for all rate calendar data. + */ +data class HotelRateCalendar( + // The unique, Expedia-specific hotel property identifier used to designate a single hotel. + @JsonProperty("EcomHotelId") + @field:Valid + val ecomHotelId: kotlin.String? = null, + // The unique, Hotels.com-specific hotel property identifier used to designate a single hotel. This will be returned if searching via `hcomHotelId` in request or the request is coming from Hcom partner. + @JsonProperty("HcomHotelId") + @field:Valid + val hcomHotelId: kotlin.String? = null, + // Container for all rate calendar data. + @JsonProperty("RateCalendar") + @field:Valid + val rateCalendar: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var ecomHotelId: kotlin.String? = null, + private var hcomHotelId: kotlin.String? = null, + private var rateCalendar: kotlin.collections.List? = null + ) { + fun ecomHotelId(ecomHotelId: kotlin.String?) = apply { this.ecomHotelId = ecomHotelId } + + fun hcomHotelId(hcomHotelId: kotlin.String?) = apply { this.hcomHotelId = hcomHotelId } + + fun rateCalendar(rateCalendar: kotlin.collections.List?) = apply { this.rateCalendar = rateCalendar } + + fun build(): HotelRateCalendar { + val instance = + HotelRateCalendar( + ecomHotelId = ecomHotelId, + hcomHotelId = hcomHotelId, + rateCalendar = rateCalendar + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelRateCalendar) { + 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( + ecomHotelId = ecomHotelId, + hcomHotelId = hcomHotelId, + rateCalendar = rateCalendar + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRoomAmenitiesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRoomAmenitiesInner.kt new file mode 100644 index 000000000..632f3b125 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRoomAmenitiesInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id The identification number for a room amenity. + * @param name The description of a room amenity. + */ +data class HotelRoomAmenitiesInner( + // The identification number for a room amenity. + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // The description of a room amenity. + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): HotelRoomAmenitiesInner { + val instance = + HotelRoomAmenitiesInner( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelRoomAmenitiesInner) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRoomAmenitiesInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRoomAmenitiesInnerAllOf.kt new file mode 100644 index 000000000..692b6c972 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/HotelRoomAmenitiesInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id The identification number for a room amenity. + * @param name The description of a room amenity. + */ +data class HotelRoomAmenitiesInnerAllOf( + // The identification number for a room amenity. + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // The description of a room amenity. + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): HotelRoomAmenitiesInnerAllOf { + val instance = + HotelRoomAmenitiesInnerAllOf( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: HotelRoomAmenitiesInnerAllOf) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Image.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Image.kt new file mode 100644 index 000000000..6d3a24ba2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Image.kt @@ -0,0 +1,117 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * List of image resources of the car product. + * @param type Resource typeSupported values :Thumbnail - (70 pixels wide)Image - (165 pixels wide) + * @param propertySize Size of imageSupported values :s - (165 pixels wide)t - (70 pixels wide) + * @param href URL for the image. + */ +data class Image( + // Resource typeSupported values :Thumbnail - (70 pixels wide)Image - (165 pixels wide) + @JsonProperty("Type") + @field:NotNull + @field:Valid + val type: kotlin.String, + // Size of imageSupported values :s - (165 pixels wide)t - (70 pixels wide) + @JsonProperty("Size") + @field:NotNull + @field:Valid + val propertySize: kotlin.String, + // URL for the image. + @JsonProperty("Href") + @field:NotNull + @field:Valid + val href: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: kotlin.String? = null, + private var propertySize: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun type(type: kotlin.String) = apply { this.type = type } + + fun propertySize(propertySize: kotlin.String) = apply { this.propertySize = propertySize } + + fun href(href: kotlin.String) = apply { this.href = href } + + fun build(): Image { + val instance = + Image( + type = type!!, + propertySize = propertySize!!, + href = href!! + ) + + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + type = type!!, + propertySize = propertySize!!, + href = href!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Link.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Link.kt new file mode 100644 index 000000000..0d1a271ca --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Link.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.xap.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 + +/** + * + * @param accept The Accept request header (for API queries only - not included for page URLs). + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class Link( + // The Accept request header (for API queries only - not included for page URLs). + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): Link { + val instance = + Link( + accept = accept, + method = method, + href = href + ) + + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Location.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Location.kt new file mode 100644 index 000000000..b10b28b93 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Location.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Address +import com.expediagroup.sdk.xap.models.LocationGeoLocation +import com.expediagroup.sdk.xap.models.Neighborhood +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for list of possible locations that could be used to disambiguate the query. + * @param address + * @param geoLocation + * @param neighborhood + */ +data class Location( + @JsonProperty("Address") + @field:Valid + val address: Address? = null, + @JsonProperty("GeoLocation") + @field:Valid + val geoLocation: LocationGeoLocation? = null, + @JsonProperty("Neighborhood") + @field:Valid + val neighborhood: Neighborhood? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var address: Address? = null, + private var geoLocation: LocationGeoLocation? = null, + private var neighborhood: Neighborhood? = null + ) { + fun address(address: Address?) = apply { this.address = address } + + fun geoLocation(geoLocation: LocationGeoLocation?) = apply { this.geoLocation = geoLocation } + + fun neighborhood(neighborhood: Neighborhood?) = apply { this.neighborhood = neighborhood } + + fun build(): Location { + val instance = + Location( + address = address, + geoLocation = geoLocation, + neighborhood = neighborhood + ) + + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + address = address, + geoLocation = geoLocation, + neighborhood = neighborhood + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationGeoLocation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationGeoLocation.kt new file mode 100644 index 000000000..2f75e9973 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationGeoLocation.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.xap.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 + +/** + * + * @param latitude The geographic coordinates of the hotel property, based on a horizontal angular measurement relative to The Equator. North latitude will be represented by a positive value. South latitude will be represented by a negative value. + * @param longitude The geographic coordinates of the hotel property, based on a vertical angular measurement relative to the universal Prime Meridian (Royal Observatory, Greenwich). East longitude will be represented by a positive value. West longitude will be represented by a negative value. + * @param obfuscated Indicates whether the displayed Latitude/Longitude information is obfuscated. Note: Exact Lat/Long values for Vacation Rental properties will not be shown in either XAPv3 Search or Details responses to respect the security of the homeowner. Instead an 'obfuscated' Lat/Long value will be returned that will indicate the general area within which the property is located, but not the exact location of the property itself. + */ +data class LocationGeoLocation( + // The geographic coordinates of the hotel property, based on a horizontal angular measurement relative to The Equator. North latitude will be represented by a positive value. South latitude will be represented by a negative value. + @JsonProperty("Latitude") + @field:Valid + val latitude: kotlin.String? = null, + // The geographic coordinates of the hotel property, based on a vertical angular measurement relative to the universal Prime Meridian (Royal Observatory, Greenwich). East longitude will be represented by a positive value. West longitude will be represented by a negative value. + @JsonProperty("Longitude") + @field:Valid + val longitude: kotlin.String? = null, + // Indicates whether the displayed Latitude/Longitude information is obfuscated. Note: Exact Lat/Long values for Vacation Rental properties will not be shown in either XAPv3 Search or Details responses to respect the security of the homeowner. Instead an 'obfuscated' Lat/Long value will be returned that will indicate the general area within which the property is located, but not the exact location of the property itself. + @JsonProperty("Obfuscated") + @field:Valid + val obfuscated: kotlin.Boolean? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var latitude: kotlin.String? = null, + private var longitude: kotlin.String? = null, + private var obfuscated: kotlin.Boolean? = null + ) { + fun latitude(latitude: kotlin.String?) = apply { this.latitude = latitude } + + fun longitude(longitude: kotlin.String?) = apply { this.longitude = longitude } + + fun obfuscated(obfuscated: kotlin.Boolean?) = apply { this.obfuscated = obfuscated } + + fun build(): LocationGeoLocation { + val instance = + LocationGeoLocation( + latitude = latitude, + longitude = longitude, + obfuscated = obfuscated + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LocationGeoLocation) { + 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, + obfuscated = obfuscated + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationGeoLocationAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationGeoLocationAllOf.kt new file mode 100644 index 000000000..08d0f20bb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationGeoLocationAllOf.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.xap.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 + +/** + * + * @param latitude The geographic coordinates of the hotel property, based on a horizontal angular measurement relative to The Equator. North latitude will be represented by a positive value. South latitude will be represented by a negative value. + * @param longitude The geographic coordinates of the hotel property, based on a vertical angular measurement relative to the universal Prime Meridian (Royal Observatory, Greenwich). East longitude will be represented by a positive value. West longitude will be represented by a negative value. + * @param obfuscated Indicates whether the displayed Latitude/Longitude information is obfuscated. Note: Exact Lat/Long values for Vacation Rental properties will not be shown in either XAPv3 Search or Details responses to respect the security of the homeowner. Instead an 'obfuscated' Lat/Long value will be returned that will indicate the general area within which the property is located, but not the exact location of the property itself. + */ +data class LocationGeoLocationAllOf( + // The geographic coordinates of the hotel property, based on a horizontal angular measurement relative to The Equator. North latitude will be represented by a positive value. South latitude will be represented by a negative value. + @JsonProperty("Latitude") + @field:Valid + val latitude: kotlin.String? = null, + // The geographic coordinates of the hotel property, based on a vertical angular measurement relative to the universal Prime Meridian (Royal Observatory, Greenwich). East longitude will be represented by a positive value. West longitude will be represented by a negative value. + @JsonProperty("Longitude") + @field:Valid + val longitude: kotlin.String? = null, + // Indicates whether the displayed Latitude/Longitude information is obfuscated. Note: Exact Lat/Long values for Vacation Rental properties will not be shown in either XAPv3 Search or Details responses to respect the security of the homeowner. Instead an 'obfuscated' Lat/Long value will be returned that will indicate the general area within which the property is located, but not the exact location of the property itself. + @JsonProperty("Obfuscated") + @field:Valid + val obfuscated: kotlin.Boolean? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var latitude: kotlin.String? = null, + private var longitude: kotlin.String? = null, + private var obfuscated: kotlin.Boolean? = null + ) { + fun latitude(latitude: kotlin.String?) = apply { this.latitude = latitude } + + fun longitude(longitude: kotlin.String?) = apply { this.longitude = longitude } + + fun obfuscated(obfuscated: kotlin.Boolean?) = apply { this.obfuscated = obfuscated } + + fun build(): LocationGeoLocationAllOf { + val instance = + LocationGeoLocationAllOf( + latitude = latitude, + longitude = longitude, + obfuscated = obfuscated + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LocationGeoLocationAllOf) { + 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, + obfuscated = obfuscated + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationOption.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationOption.kt new file mode 100644 index 000000000..fe3af0eab --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LocationOption.kt @@ -0,0 +1,153 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Country +import com.expediagroup.sdk.xap.models.GeoLocation +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for possible matches to your ambiguous `locationKeyword` query. + * @param type Type of the location. + * @param regionId RegionId the location resides in. + * @param shortName The name of the location which matches the location keyword. + * @param airportCode Indicates the nearest major airport to the location. + * @param address The address of the location. + * @param country + * @param geoLocation + */ +data class LocationOption( + // Type of the location. + @JsonProperty("Type") + @field:Valid + val type: kotlin.String? = null, + // RegionId the location resides in. + @JsonProperty("RegionId") + @field:Valid + val regionId: kotlin.String? = null, + // The name of the location which matches the location keyword. + @JsonProperty("ShortName") + @field:Valid + val shortName: kotlin.String? = null, + // Indicates the nearest major airport to the location. + @JsonProperty("AirportCode") + @field:Valid + val airportCode: kotlin.String? = null, + // The address of the location. + @JsonProperty("Address") + @field:Valid + val address: kotlin.String? = null, + @JsonProperty("Country") + @field:Valid + val country: Country? = null, + @JsonProperty("GeoLocation") + @field:Valid + val geoLocation: GeoLocation? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: kotlin.String? = null, + private var regionId: kotlin.String? = null, + private var shortName: kotlin.String? = null, + private var airportCode: kotlin.String? = null, + private var address: kotlin.String? = null, + private var country: Country? = null, + private var geoLocation: GeoLocation? = null + ) { + fun type(type: kotlin.String?) = apply { this.type = type } + + fun regionId(regionId: kotlin.String?) = apply { this.regionId = regionId } + + fun shortName(shortName: kotlin.String?) = apply { this.shortName = shortName } + + fun airportCode(airportCode: kotlin.String?) = apply { this.airportCode = airportCode } + + fun address(address: kotlin.String?) = apply { this.address = address } + + fun country(country: Country?) = apply { this.country = country } + + fun geoLocation(geoLocation: GeoLocation?) = apply { this.geoLocation = geoLocation } + + fun build(): LocationOption { + val instance = + LocationOption( + type = type, + regionId = regionId, + shortName = shortName, + airportCode = airportCode, + address = address, + country = country, + geoLocation = geoLocation + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LocationOption) { + 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( + type = type, + regionId = regionId, + shortName = shortName, + airportCode = airportCode, + address = address, + country = country, + geoLocation = geoLocation + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingAmenity.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingAmenity.kt new file mode 100644 index 000000000..7c31b4b32 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingAmenity.kt @@ -0,0 +1,101 @@ +/* + * 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.xap.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 + +/** + * + * @param id + * @param name + */ +data class LodgingAmenity( + @JsonProperty("Id") + @field:Valid + val id: kotlin.String? = null, + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: 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(): LodgingAmenity { + val instance = + LodgingAmenity( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingAmenity) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingCancellationPenaltyRule.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingCancellationPenaltyRule.kt new file mode 100644 index 000000000..687fe84c2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingCancellationPenaltyRule.kt @@ -0,0 +1,111 @@ +/* + * 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.xap.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 + +/** + * Container for cancellation penalty details. + * @param penaltyPercentOfStay Specifies the per-stay cancellation fee charged as a percentage of the total rate, in addition to any other penalties listed. + * @param penaltyStartDateTime The beginning of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the property. + * @param penaltyEndDateTime The end of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the property. + */ +data class LodgingCancellationPenaltyRule( + // Specifies the per-stay cancellation fee charged as a percentage of the total rate, in addition to any other penalties listed. + @JsonProperty("PenaltyPercentOfStay") + @field:Valid + val penaltyPercentOfStay: kotlin.String? = null, + // The beginning of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the property. + @JsonProperty("PenaltyStartDateTime") + val penaltyStartDateTime: java.time.OffsetDateTime? = null, + // The end of the window of time when the `CancellationPenaltyRule` is in effect. The date and time are expressed in ISO 8601 International Date format, and local to the property. + @JsonProperty("PenaltyEndDateTime") + val penaltyEndDateTime: java.time.OffsetDateTime? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var penaltyPercentOfStay: kotlin.String? = null, + private var penaltyStartDateTime: java.time.OffsetDateTime? = null, + private var penaltyEndDateTime: java.time.OffsetDateTime? = null + ) { + fun penaltyPercentOfStay(penaltyPercentOfStay: kotlin.String?) = apply { this.penaltyPercentOfStay = penaltyPercentOfStay } + + fun penaltyStartDateTime(penaltyStartDateTime: java.time.OffsetDateTime?) = apply { this.penaltyStartDateTime = penaltyStartDateTime } + + fun penaltyEndDateTime(penaltyEndDateTime: java.time.OffsetDateTime?) = apply { this.penaltyEndDateTime = penaltyEndDateTime } + + fun build(): LodgingCancellationPenaltyRule { + val instance = + LodgingCancellationPenaltyRule( + penaltyPercentOfStay = penaltyPercentOfStay, + penaltyStartDateTime = penaltyStartDateTime, + penaltyEndDateTime = penaltyEndDateTime + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingCancellationPenaltyRule) { + 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( + penaltyPercentOfStay = penaltyPercentOfStay, + penaltyStartDateTime = penaltyStartDateTime, + penaltyEndDateTime = penaltyEndDateTime + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingCancellationPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingCancellationPolicy.kt new file mode 100644 index 000000000..6ca1f264d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingCancellationPolicy.kt @@ -0,0 +1,123 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingCancellationPenaltyRule +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for Cancellation Policy information. + * @param refundable Indicate whether the rate is refundable or not. + * @param freeCancellation Indicate whether the room can be cancelled free of charge. + * @param freeCancellationEndDateTime The date and time until which the room can be cancelled free of charge. + * @param cancellationPenaltyRules Container for Cancellation Penalty Rules information. + */ +data class LodgingCancellationPolicy( + // Indicate whether the rate is refundable or not. + @JsonProperty("Refundable") + @field:Valid + val refundable: kotlin.Boolean? = null, + // Indicate whether the room can be cancelled free of charge. + @JsonProperty("FreeCancellation") + @field:Valid + val freeCancellation: kotlin.Boolean? = null, + // The date and time until which the room can be cancelled free of charge. + @JsonProperty("FreeCancellationEndDateTime") + val freeCancellationEndDateTime: java.time.OffsetDateTime? = null, + // Container for Cancellation Penalty Rules information. + @JsonProperty("CancellationPenaltyRules") + @field:Valid + val cancellationPenaltyRules: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var refundable: kotlin.Boolean? = null, + private var freeCancellation: kotlin.Boolean? = null, + private var freeCancellationEndDateTime: java.time.OffsetDateTime? = null, + private var cancellationPenaltyRules: kotlin.collections.List? = null + ) { + fun refundable(refundable: kotlin.Boolean?) = apply { this.refundable = refundable } + + fun freeCancellation(freeCancellation: kotlin.Boolean?) = apply { this.freeCancellation = freeCancellation } + + fun freeCancellationEndDateTime(freeCancellationEndDateTime: java.time.OffsetDateTime?) = apply { this.freeCancellationEndDateTime = freeCancellationEndDateTime } + + fun cancellationPenaltyRules(cancellationPenaltyRules: kotlin.collections.List?) = apply { this.cancellationPenaltyRules = cancellationPenaltyRules } + + fun build(): LodgingCancellationPolicy { + val instance = + LodgingCancellationPolicy( + refundable = refundable, + freeCancellation = freeCancellation, + freeCancellationEndDateTime = freeCancellationEndDateTime, + cancellationPenaltyRules = cancellationPenaltyRules + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingCancellationPolicy) { + 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( + refundable = refundable, + freeCancellation = freeCancellation, + freeCancellationEndDateTime = freeCancellationEndDateTime, + cancellationPenaltyRules = cancellationPenaltyRules + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingError.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingError.kt new file mode 100644 index 000000000..09cb9a147 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingError.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * Container for error list. + * @param code Error code describing the issue + * @param description A simple description of what the error is. + */ +data class LodgingError( + // Error code describing the issue + @JsonProperty("Code") + @field:Valid + val code: kotlin.String? = null, + // A simple description of what the error is. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var description: kotlin.String? = null + ) { + fun code(code: kotlin.String?) = apply { this.code = code } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun build(): LodgingError { + val instance = + LodgingError( + code = code, + description = description + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingError) { + 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, + description = description + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingErrors.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingErrors.kt new file mode 100644 index 000000000..a9eba2d8e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingErrors.kt @@ -0,0 +1,104 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingError +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param errors Container for error list. + * @param transactionId A unique identifier for the transaction. + */ +data class LodgingErrors( + // Container for error list. + @JsonProperty("Errors") + @field:Valid + val errors: kotlin.collections.List? = null, + // A unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var errors: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null + ) { + fun errors(errors: kotlin.collections.List?) = apply { this.errors = errors } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun build(): LodgingErrors { + val instance = + LodgingErrors( + errors = errors, + transactionId = transactionId + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingErrors) { + 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( + errors = errors, + transactionId = transactionId + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingLink.kt new file mode 100644 index 000000000..88b173658 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingLink.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.xap.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 + +/** + * + * @param accept The Accept request header for API queries only. Note: this value will only be returned if the link is an API query, as website URLs do not require an `Accept` header. + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class LodgingLink( + // The Accept request header for API queries only. Note: this value will only be returned if the link is an API query, as website URLs do not require an `Accept` header. + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): LodgingLink { + val instance = + LodgingLink( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingLink) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingMoney.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingMoney.kt new file mode 100644 index 000000000..890f2c1f2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingMoney.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * Pricing information of the stat date + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingMoney( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingMoney { + val instance = + LodgingMoney( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingMoney) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingOccupant.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingOccupant.kt new file mode 100644 index 000000000..d0bd6ce52 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingOccupant.kt @@ -0,0 +1,102 @@ +/* + * 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.xap.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 + +/** + * + * @param adults The number of adults in a room. + * @param childAges The ages of children in a room. + */ +data class LodgingOccupant( + // The number of adults in a room. + @JsonProperty("Adults") + val adults: kotlin.Int? = null, + // The ages of children in a room. + @JsonProperty("ChildAges") + @field:Valid + val childAges: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adults: kotlin.Int? = null, + private var childAges: kotlin.collections.List? = null + ) { + fun adults(adults: kotlin.Int?) = apply { this.adults = adults } + + fun childAges(childAges: kotlin.collections.List?) = apply { this.childAges = childAges } + + fun build(): LodgingOccupant { + val instance = + LodgingOccupant( + adults = adults, + childAges = childAges + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingOccupant) { + 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( + adults = adults, + childAges = childAges + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingPromotion.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingPromotion.kt new file mode 100644 index 000000000..e5bd5b15f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingPromotion.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingMoney +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param description The description of the promotion. + * @param amount + */ +data class LodgingPromotion( + // The description of the promotion. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + @JsonProperty("Amount") + @field:Valid + val amount: LodgingMoney? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var description: kotlin.String? = null, + private var amount: LodgingMoney? = null + ) { + fun description(description: kotlin.String?) = apply { this.description = description } + + fun amount(amount: LodgingMoney?) = apply { this.amount = amount } + + fun build(): LodgingPromotion { + val instance = + LodgingPromotion( + description = description, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingPromotion) { + 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( + description = description, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingQuotesResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingQuotesResponse.kt new file mode 100644 index 000000000..4d59f99a7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingQuotesResponse.kt @@ -0,0 +1,163 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingOccupant +import com.expediagroup.sdk.xap.models.LodgingStayDates +import com.expediagroup.sdk.xap.models.LodgingWarning +import com.expediagroup.sdk.xap.models.Property +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param warnings There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + * @param count The number of properties actually returned in the response. + * @param totalPropertyCount The number of properties requested. + * @param transactionId Unique identifier for the API transaction. + * @param stayDates + * @param lengthOfStay The number of stay nights. + * @param occupants Container for the list of room occupants. + * @param properties Container for all properties. + */ +data class LodgingQuotesResponse( + // There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + // The number of properties actually returned in the response. + @JsonProperty("Count") + val count: kotlin.Int? = null, + // The number of properties requested. + @JsonProperty("TotalPropertyCount") + val totalPropertyCount: kotlin.Int? = null, + // Unique identifier for the API transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null, + @JsonProperty("StayDates") + @field:Valid + val stayDates: LodgingStayDates? = null, + // The number of stay nights. + @JsonProperty("LengthOfStay") + val lengthOfStay: kotlin.Int? = null, + // Container for the list of room occupants. + @JsonProperty("Occupants") + @field:Valid + val occupants: kotlin.collections.List? = null, + // Container for all properties. + @JsonProperty("Properties") + @field:Valid + val properties: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var warnings: kotlin.collections.List? = null, + private var count: kotlin.Int? = null, + private var totalPropertyCount: kotlin.Int? = null, + private var transactionId: kotlin.String? = null, + private var stayDates: LodgingStayDates? = null, + private var lengthOfStay: kotlin.Int? = null, + private var occupants: kotlin.collections.List? = null, + private var properties: kotlin.collections.List? = null + ) { + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun count(count: kotlin.Int?) = apply { this.count = count } + + fun totalPropertyCount(totalPropertyCount: kotlin.Int?) = apply { this.totalPropertyCount = totalPropertyCount } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun stayDates(stayDates: LodgingStayDates?) = apply { this.stayDates = stayDates } + + fun lengthOfStay(lengthOfStay: kotlin.Int?) = apply { this.lengthOfStay = lengthOfStay } + + fun occupants(occupants: kotlin.collections.List?) = apply { this.occupants = occupants } + + fun properties(properties: kotlin.collections.List?) = apply { this.properties = properties } + + fun build(): LodgingQuotesResponse { + val instance = + LodgingQuotesResponse( + warnings = warnings, + count = count, + totalPropertyCount = totalPropertyCount, + transactionId = transactionId, + stayDates = stayDates, + lengthOfStay = lengthOfStay, + occupants = occupants, + properties = properties + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingQuotesResponse) { + 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( + warnings = warnings, + count = count, + totalPropertyCount = totalPropertyCount, + transactionId = transactionId, + stayDates = stayDates, + lengthOfStay = lengthOfStay, + occupants = occupants, + properties = properties + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRatePlan.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRatePlan.kt new file mode 100644 index 000000000..e06c7748b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRatePlan.kt @@ -0,0 +1,104 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingCancellationPolicy +import com.expediagroup.sdk.xap.models.LodgingPromotion +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for rate plan information. + * @param cancellationPolicy + * @param promotions All promotion information of the ratePlan. + */ +data class LodgingRatePlan( + @JsonProperty("CancellationPolicy") + @field:Valid + val cancellationPolicy: LodgingCancellationPolicy? = null, + // All promotion information of the ratePlan. + @JsonProperty("Promotions") + @field:Valid + val promotions: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var cancellationPolicy: LodgingCancellationPolicy? = null, + private var promotions: kotlin.collections.List? = null + ) { + fun cancellationPolicy(cancellationPolicy: LodgingCancellationPolicy?) = apply { this.cancellationPolicy = cancellationPolicy } + + fun promotions(promotions: kotlin.collections.List?) = apply { this.promotions = promotions } + + fun build(): LodgingRatePlan { + val instance = + LodgingRatePlan( + cancellationPolicy = cancellationPolicy, + promotions = promotions + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRatePlan) { + 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( + cancellationPolicy = cancellationPolicy, + promotions = promotions + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomType.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomType.kt new file mode 100644 index 000000000..8e46f1a6d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomType.kt @@ -0,0 +1,114 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingRatePlan +import com.expediagroup.sdk.xap.models.LodgingRoomTypeLinks +import com.expediagroup.sdk.xap.models.LodgingRoomTypePrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param ratePlans Container for rate plan information. + * @param price + * @param links + */ +data class LodgingRoomType( + // Container for rate plan information. + @JsonProperty("RatePlans") + @field:Valid + val ratePlans: kotlin.collections.List? = null, + @JsonProperty("Price") + @field:Valid + val price: LodgingRoomTypePrice? = null, + @JsonProperty("Links") + @field:Valid + val links: LodgingRoomTypeLinks? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var ratePlans: kotlin.collections.List? = null, + private var price: LodgingRoomTypePrice? = null, + private var links: LodgingRoomTypeLinks? = null + ) { + fun ratePlans(ratePlans: kotlin.collections.List?) = apply { this.ratePlans = ratePlans } + + fun price(price: LodgingRoomTypePrice?) = apply { this.price = price } + + fun links(links: LodgingRoomTypeLinks?) = apply { this.links = links } + + fun build(): LodgingRoomType { + val instance = + LodgingRoomType( + ratePlans = ratePlans, + price = price, + links = links + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomType) { + 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( + ratePlans = ratePlans, + price = price, + links = links + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinks.kt new file mode 100644 index 000000000..e1f92ed21 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinks.kt @@ -0,0 +1,104 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingLink +import com.expediagroup.sdk.xap.models.LodgingRoomTypeLinksWebDetails +import com.expediagroup.sdk.xap.models.LodgingRoomTypeLinksWebSearchResult +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for list of HATEOAS links to either Expedia website or additional Expedia APIs to complete booking of the selected offer. Which links are returned in this section are defined by the links parameter in the Search API query. Available links are: - WebDetails (link to web infosite) - WebSearchResult (link to web search result page) + * @param webSearchResult + * @param webDetails + */ +data class LodgingRoomTypeLinks( + @JsonProperty("WebSearchResult") + @field:Valid + val webSearchResult: LodgingRoomTypeLinksWebSearchResult? = null, + @JsonProperty("WebDetails") + @field:Valid + val webDetails: LodgingRoomTypeLinksWebDetails? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var webSearchResult: LodgingRoomTypeLinksWebSearchResult? = null, + private var webDetails: LodgingRoomTypeLinksWebDetails? = null + ) { + fun webSearchResult(webSearchResult: LodgingRoomTypeLinksWebSearchResult?) = apply { this.webSearchResult = webSearchResult } + + fun webDetails(webDetails: LodgingRoomTypeLinksWebDetails?) = apply { this.webDetails = webDetails } + + fun build(): LodgingRoomTypeLinks { + val instance = + LodgingRoomTypeLinks( + webSearchResult = webSearchResult, + webDetails = webDetails + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypeLinks) { + 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( + webSearchResult = webSearchResult, + webDetails = webDetails + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinksWebDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinksWebDetails.kt new file mode 100644 index 000000000..0c86902f4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinksWebDetails.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.xap.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 + +/** + * + * @param accept The Accept request header for API queries only. Note: this value will only be returned if the link is an API query, as website URLs do not require an `Accept` header. + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class LodgingRoomTypeLinksWebDetails( + // The Accept request header for API queries only. Note: this value will only be returned if the link is an API query, as website URLs do not require an `Accept` header. + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): LodgingRoomTypeLinksWebDetails { + val instance = + LodgingRoomTypeLinksWebDetails( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypeLinksWebDetails) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinksWebSearchResult.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinksWebSearchResult.kt new file mode 100644 index 000000000..95df79e67 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypeLinksWebSearchResult.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.xap.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 + +/** + * + * @param accept The Accept request header for API queries only. Note: this value will only be returned if the link is an API query, as website URLs do not require an `Accept` header. + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class LodgingRoomTypeLinksWebSearchResult( + // The Accept request header for API queries only. Note: this value will only be returned if the link is an API query, as website URLs do not require an `Accept` header. + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): LodgingRoomTypeLinksWebSearchResult { + val instance = + LodgingRoomTypeLinksWebSearchResult( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypeLinksWebSearchResult) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePrice.kt new file mode 100644 index 000000000..091372351 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePrice.kt @@ -0,0 +1,163 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceAvgNightlyRate +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceAvgNightlyRateWithFees +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceBaseRate +import com.expediagroup.sdk.xap.models.LodgingRoomTypePricePropertyMandatoryFees +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceRefundableDamageDeposit +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceTaxesAndFees +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceTotalPrice +import com.expediagroup.sdk.xap.models.LodgingRoomTypePriceTotalPriceWithPropertyFees +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for Price information. + * @param baseRate + * @param taxesAndFees + * @param totalPrice + * @param avgNightlyRate + * @param avgNightlyRateWithFees + * @param propertyMandatoryFees + * @param totalPriceWithPropertyFees + * @param refundableDamageDeposit + */ +data class LodgingRoomTypePrice( + @JsonProperty("BaseRate") + @field:Valid + val baseRate: LodgingRoomTypePriceBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: LodgingRoomTypePriceTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: LodgingRoomTypePriceTotalPrice? = null, + @JsonProperty("AvgNightlyRate") + @field:Valid + val avgNightlyRate: LodgingRoomTypePriceAvgNightlyRate? = null, + @JsonProperty("AvgNightlyRateWithFees") + @field:Valid + val avgNightlyRateWithFees: LodgingRoomTypePriceAvgNightlyRateWithFees? = null, + @JsonProperty("PropertyMandatoryFees") + @field:Valid + val propertyMandatoryFees: LodgingRoomTypePricePropertyMandatoryFees? = null, + @JsonProperty("TotalPriceWithPropertyFees") + @field:Valid + val totalPriceWithPropertyFees: LodgingRoomTypePriceTotalPriceWithPropertyFees? = null, + @JsonProperty("RefundableDamageDeposit") + @field:Valid + val refundableDamageDeposit: LodgingRoomTypePriceRefundableDamageDeposit? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var baseRate: LodgingRoomTypePriceBaseRate? = null, + private var taxesAndFees: LodgingRoomTypePriceTaxesAndFees? = null, + private var totalPrice: LodgingRoomTypePriceTotalPrice? = null, + private var avgNightlyRate: LodgingRoomTypePriceAvgNightlyRate? = null, + private var avgNightlyRateWithFees: LodgingRoomTypePriceAvgNightlyRateWithFees? = null, + private var propertyMandatoryFees: LodgingRoomTypePricePropertyMandatoryFees? = null, + private var totalPriceWithPropertyFees: LodgingRoomTypePriceTotalPriceWithPropertyFees? = null, + private var refundableDamageDeposit: LodgingRoomTypePriceRefundableDamageDeposit? = null + ) { + fun baseRate(baseRate: LodgingRoomTypePriceBaseRate?) = apply { this.baseRate = baseRate } + + fun taxesAndFees(taxesAndFees: LodgingRoomTypePriceTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun totalPrice(totalPrice: LodgingRoomTypePriceTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun avgNightlyRate(avgNightlyRate: LodgingRoomTypePriceAvgNightlyRate?) = apply { this.avgNightlyRate = avgNightlyRate } + + fun avgNightlyRateWithFees(avgNightlyRateWithFees: LodgingRoomTypePriceAvgNightlyRateWithFees?) = apply { this.avgNightlyRateWithFees = avgNightlyRateWithFees } + + fun propertyMandatoryFees(propertyMandatoryFees: LodgingRoomTypePricePropertyMandatoryFees?) = apply { this.propertyMandatoryFees = propertyMandatoryFees } + + fun totalPriceWithPropertyFees(totalPriceWithPropertyFees: LodgingRoomTypePriceTotalPriceWithPropertyFees?) = apply { this.totalPriceWithPropertyFees = totalPriceWithPropertyFees } + + fun refundableDamageDeposit(refundableDamageDeposit: LodgingRoomTypePriceRefundableDamageDeposit?) = apply { this.refundableDamageDeposit = refundableDamageDeposit } + + fun build(): LodgingRoomTypePrice { + val instance = + LodgingRoomTypePrice( + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyRateWithFees = avgNightlyRateWithFees, + propertyMandatoryFees = propertyMandatoryFees, + totalPriceWithPropertyFees = totalPriceWithPropertyFees, + refundableDamageDeposit = refundableDamageDeposit + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePrice) { + 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( + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyRateWithFees = avgNightlyRateWithFees, + propertyMandatoryFees = propertyMandatoryFees, + totalPriceWithPropertyFees = totalPriceWithPropertyFees, + refundableDamageDeposit = refundableDamageDeposit + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceAvgNightlyRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceAvgNightlyRate.kt new file mode 100644 index 000000000..30334c5f6 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceAvgNightlyRate.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The average nightly base rate per night per room of the rate plan, which is equal to the `BaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceAvgNightlyRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceAvgNightlyRate { + val instance = + LodgingRoomTypePriceAvgNightlyRate( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceAvgNightlyRate) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceAvgNightlyRateWithFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceAvgNightlyRateWithFees.kt new file mode 100644 index 000000000..0300b78dc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceAvgNightlyRateWithFees.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The average nightly rate per night per room of the room type, including all fees except those imposed by the government. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceAvgNightlyRateWithFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceAvgNightlyRateWithFees { + val instance = + LodgingRoomTypePriceAvgNightlyRateWithFees( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceAvgNightlyRateWithFees) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceBaseRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceBaseRate.kt new file mode 100644 index 000000000..f89218067 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceBaseRate.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The price of the rate plan for all occupants, excluding taxes and fees. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceBaseRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceBaseRate { + val instance = + LodgingRoomTypePriceBaseRate( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceBaseRate) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePricePropertyMandatoryFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePricePropertyMandatoryFees.kt new file mode 100644 index 000000000..df2af69c1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePricePropertyMandatoryFees.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The total mandatory fees which will be charged at the property for the rate plan. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePricePropertyMandatoryFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePricePropertyMandatoryFees { + val instance = + LodgingRoomTypePricePropertyMandatoryFees( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePricePropertyMandatoryFees) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceRefundableDamageDeposit.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceRefundableDamageDeposit.kt new file mode 100644 index 000000000..807018ac4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceRefundableDamageDeposit.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The refundable damage deposit. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceRefundableDamageDeposit( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceRefundableDamageDeposit { + val instance = + LodgingRoomTypePriceRefundableDamageDeposit( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceRefundableDamageDeposit) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTaxesAndFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTaxesAndFees.kt new file mode 100644 index 000000000..33e0db2f6 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTaxesAndFees.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The total amount of taxes and fees of the rate plan for all occupants. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceTaxesAndFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceTaxesAndFees { + val instance = + LodgingRoomTypePriceTaxesAndFees( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceTaxesAndFees) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTotalPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTotalPrice.kt new file mode 100644 index 000000000..63812c3e4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTotalPrice.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The total price of the rate plan, which is equal to the sum of `BaseRate` + `TaxesAndFees`. Property mandatory fees are not included in this value as these are paid at the property at checkout. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceTotalPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceTotalPrice { + val instance = + LodgingRoomTypePriceTotalPrice( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceTotalPrice) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTotalPriceWithPropertyFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTotalPriceWithPropertyFees.kt new file mode 100644 index 000000000..456c5aefb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingRoomTypePriceTotalPriceWithPropertyFees.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * The total price of the rate plan include property mandatory fees, which is equal to the sum of `BaseRate` + `TaxesAndFees` + `PropertyMandatoryFees`. **NOTE**: Since UK regulations require that `PropertyMandatoryFees` be included in this price, the quoted price will only be accurate for the day of quote. This is due to the fact that currency exchange fluctuations will change the exact amount of any `PropertyMandatoryFees` that are to be collected at the hotel during the guest's stay if the cost is converted into any other currency. **CMA Compliance Note (UK)**: Websites doing business in the UK should be displaying this value to be compliant with CMA requirements. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + */ +data class LodgingRoomTypePriceTotalPriceWithPropertyFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: 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(): LodgingRoomTypePriceTotalPriceWithPropertyFees { + val instance = + LodgingRoomTypePriceTotalPriceWithPropertyFees( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingRoomTypePriceTotalPriceWithPropertyFees) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingStayDates.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingStayDates.kt new file mode 100644 index 000000000..87bea51dd --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingStayDates.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 + +/** + * Container for requested dates of stay. + * @param checkInDate The initial day of the property stay in an ISO 8601 Date format [YYYY-MM-DD]. + * @param checkOutDate The final day of the property stay in an ISO 8601 Date format [YYYY-MM-DD]. + */ +data class LodgingStayDates( + // The initial day of the property stay in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("CheckInDate") + val checkInDate: java.time.LocalDate? = null, + // The final day of the property stay in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("CheckOutDate") + val checkOutDate: java.time.LocalDate? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var checkInDate: java.time.LocalDate? = null, + private var checkOutDate: java.time.LocalDate? = null + ) { + fun checkInDate(checkInDate: java.time.LocalDate?) = apply { this.checkInDate = checkInDate } + + fun checkOutDate(checkOutDate: java.time.LocalDate?) = apply { this.checkOutDate = checkOutDate } + + fun build(): LodgingStayDates { + val instance = + LodgingStayDates( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingStayDates) { + 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( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingWarning.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingWarning.kt new file mode 100644 index 000000000..9a7b84983 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/LodgingWarning.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param code The code of a warning. + * @param description A description of what caused the issues. + */ +data class LodgingWarning( + // The code of a warning. + @JsonProperty("Code") + @field:Valid + val code: kotlin.String? = null, + // A description of what caused the issues. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var description: kotlin.String? = null + ) { + fun code(code: kotlin.String?) = apply { this.code = code } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun build(): LodgingWarning { + val instance = + LodgingWarning( + code = code, + description = description + ) + + validate(instance) + + return instance + } + + private fun validate(instance: LodgingWarning) { + 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, + description = description + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/MandatoryFeesDetail.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/MandatoryFeesDetail.kt new file mode 100644 index 000000000..b33bcc200 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/MandatoryFeesDetail.kt @@ -0,0 +1,204 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.MandatoryFeesDetailAmount +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The breakdown for the taxes and fees that must be paid at the property. + * @param type Type of mandatory fee. + * @param amount + */ +data class MandatoryFeesDetail( + // Type of mandatory fee. + @JsonProperty("Type") + val type: MandatoryFeesDetail.Type? = null, + @JsonProperty("Amount") + @field:Valid + val amount: MandatoryFeesDetailAmount? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: MandatoryFeesDetail.Type? = null, + private var amount: MandatoryFeesDetailAmount? = null + ) { + fun type(type: MandatoryFeesDetail.Type?) = apply { this.type = type } + + fun amount(amount: MandatoryFeesDetailAmount?) = apply { this.amount = amount } + + fun build(): MandatoryFeesDetail { + val instance = + MandatoryFeesDetail( + type = type, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: MandatoryFeesDetail) { + 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( + type = type, + amount = amount + ) + + /** + * Type of mandatory fee. + * Values: CITY_LOCAL_TAX_AMT,CITY_LOCAL_TAX_PCNT,CLEANING_FEE_AMT,CLEANING_FEE_PCNT,CLUB_CARD_ADULT,CLUB_CARD_CHILD,DESTINATION_FEE_AMT,DESTINATION_FEE_PCNT,GALA_DINNER_ADULT,GALA_DINNER_CHILD,GALA_DINNER_CHINESE_NY_ADULT,GALA_DINNER_CHINESE_NY_CHILD,GALA_DINNER_NY_DAY_ADULT,GALA_DINNER_NY_DAY_CHILD,GALA_DINNER_NY_EVE_ADULT,GALA_DINNER_NY_EVE_CHILD,GALA_DINNER_VALENTINES_DAY_ADULT,GALA_DINNER_VALENTINES_DAY_CHILD,GALA_DINNER_XMAS_DAY_ADULT,GALA_DINNER_XMAS_DAY_CHILD,GALA_DINNER_XMAS_EVE_ADULT,GALA_DINNER_XMAS_EVE_CHILD,RESORT_FEE_AMT,RESORT_FEE_PCNT,SANITATION_FEE,SEASONAL_HEATING_FEE,TOURISM_FEE_AMT,TOURISM_FEE_PCNT,TOWEL_SHEETS_FEE_AMT,TRANSFER_FEE_AMT_ADULT,TRANSFER_FEE_AMT_CHILD,UTILITY_SURCHARGE + */ + enum class Type(val value: kotlin.String) { + @JsonProperty("City_LocalTax_Amt") + CITY_LOCAL_TAX_AMT("City_LocalTax_Amt"), + + @JsonProperty("City_LocalTax_Pcnt") + CITY_LOCAL_TAX_PCNT("City_LocalTax_Pcnt"), + + @JsonProperty("CleaningFee_Amt") + CLEANING_FEE_AMT("CleaningFee_Amt"), + + @JsonProperty("CleaningFee_Pcnt") + CLEANING_FEE_PCNT("CleaningFee_Pcnt"), + + @JsonProperty("ClubCardAdult") + CLUB_CARD_ADULT("ClubCardAdult"), + + @JsonProperty("ClubCardChild") + CLUB_CARD_CHILD("ClubCardChild"), + + @JsonProperty("DestinationFee_Amt") + DESTINATION_FEE_AMT("DestinationFee_Amt"), + + @JsonProperty("DestinationFee_Pcnt") + DESTINATION_FEE_PCNT("DestinationFee_Pcnt"), + + @JsonProperty("GalaDinnerAdult") + GALA_DINNER_ADULT("GalaDinnerAdult"), + + @JsonProperty("GalaDinnerChild") + GALA_DINNER_CHILD("GalaDinnerChild"), + + @JsonProperty("GalaDinnerChineseNYAdult") + GALA_DINNER_CHINESE_NY_ADULT("GalaDinnerChineseNYAdult"), + + @JsonProperty("GalaDinnerChineseNYChild") + GALA_DINNER_CHINESE_NY_CHILD("GalaDinnerChineseNYChild"), + + @JsonProperty("GalaDinnerNYDayAdult") + GALA_DINNER_NY_DAY_ADULT("GalaDinnerNYDayAdult"), + + @JsonProperty("GalaDinnerNYDayChild") + GALA_DINNER_NY_DAY_CHILD("GalaDinnerNYDayChild"), + + @JsonProperty("GalaDinnerNYEveAdult") + GALA_DINNER_NY_EVE_ADULT("GalaDinnerNYEveAdult"), + + @JsonProperty("GalaDinnerNYEveChild") + GALA_DINNER_NY_EVE_CHILD("GalaDinnerNYEveChild"), + + @JsonProperty("GalaDinnerValentinesDayAdult") + GALA_DINNER_VALENTINES_DAY_ADULT("GalaDinnerValentinesDayAdult"), + + @JsonProperty("GalaDinnerValentinesDayChild") + GALA_DINNER_VALENTINES_DAY_CHILD("GalaDinnerValentinesDayChild"), + + @JsonProperty("GalaDinnerXMASDayAdult") + GALA_DINNER_XMAS_DAY_ADULT("GalaDinnerXMASDayAdult"), + + @JsonProperty("GalaDinnerXMASDayChild") + GALA_DINNER_XMAS_DAY_CHILD("GalaDinnerXMASDayChild"), + + @JsonProperty("GalaDinnerXMASEveAdult") + GALA_DINNER_XMAS_EVE_ADULT("GalaDinnerXMASEveAdult"), + + @JsonProperty("GalaDinnerXMASEveChild") + GALA_DINNER_XMAS_EVE_CHILD("GalaDinnerXMASEveChild"), + + @JsonProperty("ResortFee_Amt") + RESORT_FEE_AMT("ResortFee_Amt"), + + @JsonProperty("ResortFee_Pcnt") + RESORT_FEE_PCNT("ResortFee_Pcnt"), + + @JsonProperty("SanitationFee") + SANITATION_FEE("SanitationFee"), + + @JsonProperty("SeasonalHeatingFee") + SEASONAL_HEATING_FEE("SeasonalHeatingFee"), + + @JsonProperty("TourismFee_Amt") + TOURISM_FEE_AMT("TourismFee_Amt"), + + @JsonProperty("TourismFee_Pcnt") + TOURISM_FEE_PCNT("TourismFee_Pcnt"), + + @JsonProperty("TowelSheetsFee_Amt") + TOWEL_SHEETS_FEE_AMT("TowelSheetsFee_Amt"), + + @JsonProperty("TransferFee_Amt_Adult") + TRANSFER_FEE_AMT_ADULT("TransferFee_Amt_Adult"), + + @JsonProperty("TransferFee_Amt_Child") + TRANSFER_FEE_AMT_CHILD("TransferFee_Amt_Child"), + + @JsonProperty("UtilitySurcharge") + UTILITY_SURCHARGE("UtilitySurcharge") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/MandatoryFeesDetailAmount.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/MandatoryFeesDetailAmount.kt new file mode 100644 index 000000000..4263b0be2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/MandatoryFeesDetailAmount.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class MandatoryFeesDetailAmount( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): MandatoryFeesDetailAmount { + val instance = + MandatoryFeesDetailAmount( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: MandatoryFeesDetailAmount) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Media.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Media.kt new file mode 100644 index 000000000..f04faf656 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Media.kt @@ -0,0 +1,131 @@ +/* + * 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.xap.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 + +/** + * Container for hotel images + * @param type Supported type of media. 1=Image. Only 1 is supported now. + * @param title Image title + * @param propertySize Image size. You can find a link to the complete list of Supported Images Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + * @param url Image URL + */ +data class Media( + // Supported type of media. 1=Image. Only 1 is supported now. + @JsonProperty("Type") + val type: Media.Type? = null, + // Image title + @JsonProperty("Title") + @field:Valid + val title: kotlin.String? = null, + // Image size. You can find a link to the complete list of Supported Images Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + @JsonProperty("Size") + @field:Valid + val propertySize: kotlin.String? = null, + // Image URL + @JsonProperty("Url") + @field:Valid + val url: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: Media.Type? = null, + private var title: kotlin.String? = null, + private var propertySize: kotlin.String? = null, + private var url: kotlin.String? = null + ) { + fun type(type: Media.Type?) = apply { this.type = type } + + fun title(title: kotlin.String?) = apply { this.title = title } + + fun propertySize(propertySize: kotlin.String?) = apply { this.propertySize = propertySize } + + fun url(url: kotlin.String?) = apply { this.url = url } + + fun build(): Media { + val instance = + Media( + type = type, + title = title, + propertySize = propertySize, + url = url + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Media) { + 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( + type = type, + title = title, + propertySize = propertySize, + url = url + ) + + /** + * Supported type of media. 1=Image. Only 1 is supported now. + * Values: _1 + */ + enum class Type(val value: kotlin.String) { + @JsonProperty("1") + _1("1") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Mileage.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Mileage.kt new file mode 100644 index 000000000..dcd643dec --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Mileage.kt @@ -0,0 +1,116 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsDistance +import com.expediagroup.sdk.xap.models.ExtraCostPerDistance +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 + +/** + * A list of charges to be levied based on the mileage driven. + * @param freeDistance + * @param freeDistanceRatePeriod Rate period for free distance. + * @param extraCostPerDistance + */ +data class Mileage( + @JsonProperty("FreeDistance") + @field:NotNull + @field:Valid + val freeDistance: CarsDistance, + // Rate period for free distance. + @JsonProperty("FreeDistanceRatePeriod") + @field:NotNull + @field:Valid + val freeDistanceRatePeriod: kotlin.String, + @JsonProperty("ExtraCostPerDistance") + @field:Valid + val extraCostPerDistance: ExtraCostPerDistance? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var freeDistance: CarsDistance? = null, + private var freeDistanceRatePeriod: kotlin.String? = null, + private var extraCostPerDistance: ExtraCostPerDistance? = null + ) { + fun freeDistance(freeDistance: CarsDistance) = apply { this.freeDistance = freeDistance } + + fun freeDistanceRatePeriod(freeDistanceRatePeriod: kotlin.String) = apply { this.freeDistanceRatePeriod = freeDistanceRatePeriod } + + fun extraCostPerDistance(extraCostPerDistance: ExtraCostPerDistance?) = apply { this.extraCostPerDistance = extraCostPerDistance } + + fun build(): Mileage { + val instance = + Mileage( + freeDistance = freeDistance!!, + freeDistanceRatePeriod = freeDistanceRatePeriod!!, + extraCostPerDistance = extraCostPerDistance + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Mileage) { + 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( + freeDistance = freeDistance!!, + freeDistanceRatePeriod = freeDistanceRatePeriod!!, + extraCostPerDistance = extraCostPerDistance + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Money.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Money.kt new file mode 100644 index 000000000..ca5a04bd5 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Money.kt @@ -0,0 +1,112 @@ +/* + * 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.xap.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 + +/** + * Pricing information of the stat date + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class Money( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): Money { + val instance = + Money( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Money) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Neighborhood.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Neighborhood.kt new file mode 100644 index 000000000..38f7ad11c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Neighborhood.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * Geography entities which are typically contained within a city. This includes the categories neighborhood and point of interest. Low level regions are not a formally defined concept in the geography model. + * @param id Neighborhood id. + * @param name Neighborhood name. + */ +data class Neighborhood( + // Neighborhood id. + @JsonProperty("Id") + @field:Valid + val id: kotlin.String? = null, + // Neighborhood name. + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: 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(): Neighborhood { + val instance = + Neighborhood( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Neighborhood) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NightlyRates.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NightlyRates.kt new file mode 100644 index 000000000..3d9cdfe50 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NightlyRates.kt @@ -0,0 +1,101 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param stayDate + * @param baseRate + */ +data class NightlyRates( + @JsonProperty("StayDate") + val stayDate: java.time.LocalDate? = null, + @JsonProperty("BaseRate") + @field:Valid + val baseRate: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var stayDate: java.time.LocalDate? = null, + private var baseRate: Money? = null + ) { + fun stayDate(stayDate: java.time.LocalDate?) = apply { this.stayDate = stayDate } + + fun baseRate(baseRate: Money?) = apply { this.baseRate = baseRate } + + fun build(): NightlyRates { + val instance = + NightlyRates( + stayDate = stayDate, + baseRate = baseRate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: NightlyRates) { + 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( + stayDate = stayDate, + baseRate = baseRate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NonCancellableDateTimeRange.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NonCancellableDateTimeRange.kt new file mode 100644 index 000000000..40acb6691 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NonCancellableDateTimeRange.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 + +/** + * Container for non-cancellable date and time range element + * @param startDateTime The time of this non-cancellable window starts + * @param endDateTime The time of this non-cancellable window ends + */ +data class NonCancellableDateTimeRange( + // The time of this non-cancellable window starts + @JsonProperty("StartDateTime") + val startDateTime: java.time.LocalDateTime, + // The time of this non-cancellable window ends + @JsonProperty("EndDateTime") + val endDateTime: java.time.LocalDateTime +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var startDateTime: java.time.LocalDateTime? = null, + private var endDateTime: java.time.LocalDateTime? = null + ) { + fun startDateTime(startDateTime: java.time.LocalDateTime) = apply { this.startDateTime = startDateTime } + + fun endDateTime(endDateTime: java.time.LocalDateTime) = apply { this.endDateTime = endDateTime } + + fun build(): NonCancellableDateTimeRange { + val instance = + NonCancellableDateTimeRange( + startDateTime = startDateTime!!, + endDateTime = endDateTime!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: NonCancellableDateTimeRange) { + 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( + startDateTime = startDateTime!!, + endDateTime = endDateTime!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NonRefundableDateRange.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NonRefundableDateRange.kt new file mode 100644 index 000000000..80f7c2bd6 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/NonRefundableDateRange.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 startDate Start date of a non-refundable date range. + * @param endDate End date of a non-refundable date range. + */ +data class NonRefundableDateRange( + // Start date of a non-refundable date range. + @JsonProperty("StartDate") + val startDate: java.time.LocalDate? = null, + // End date of a non-refundable date range. + @JsonProperty("EndDate") + val endDate: java.time.LocalDate? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var startDate: java.time.LocalDate? = null, + private var endDate: java.time.LocalDate? = null + ) { + fun startDate(startDate: java.time.LocalDate?) = apply { this.startDate = startDate } + + fun endDate(endDate: java.time.LocalDate?) = apply { this.endDate = endDate } + + fun build(): NonRefundableDateRange { + val instance = + NonRefundableDateRange( + startDate = startDate, + endDate = endDate + ) + + 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( + startDate = startDate, + endDate = endDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Occupant.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Occupant.kt new file mode 100644 index 000000000..37b9ba019 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Occupant.kt @@ -0,0 +1,102 @@ +/* + * 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.xap.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 + +/** + * Container for the list of room occupants. + * @param adults The number of adults in a room. + * @param childAges The ages of children in a room. + */ +data class Occupant( + // The number of adults in a room. + @JsonProperty("Adults") + val adults: kotlin.Int? = null, + // The ages of children in a room. + @JsonProperty("ChildAges") + @field:Valid + val childAges: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adults: kotlin.Int? = null, + private var childAges: kotlin.collections.List? = null + ) { + fun adults(adults: kotlin.Int?) = apply { this.adults = adults } + + fun childAges(childAges: kotlin.collections.List?) = apply { this.childAges = childAges } + + fun build(): Occupant { + val instance = + Occupant( + adults = adults, + childAges = childAges + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Occupant) { + 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( + adults = adults, + childAges = childAges + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PaymentSchedule.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PaymentSchedule.kt new file mode 100644 index 000000000..025044cdd --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PaymentSchedule.kt @@ -0,0 +1,102 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.PaymentSchedulePrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Contains information on the payment schedule. + * @param due Date/Time stamp when this installment/deposit should be paid by. + * @param price + */ +data class PaymentSchedule( + // Date/Time stamp when this installment/deposit should be paid by. + @JsonProperty("Due") + val due: java.time.LocalDate? = null, + @JsonProperty("Price") + @field:Valid + val price: PaymentSchedulePrice? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var due: java.time.LocalDate? = null, + private var price: PaymentSchedulePrice? = null + ) { + fun due(due: java.time.LocalDate?) = apply { this.due = due } + + fun price(price: PaymentSchedulePrice?) = apply { this.price = price } + + fun build(): PaymentSchedule { + val instance = + PaymentSchedule( + due = due, + price = price + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentSchedule) { + 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( + due = due, + price = price + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PaymentSchedulePrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PaymentSchedulePrice.kt new file mode 100644 index 000000000..84106a19e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PaymentSchedulePrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class PaymentSchedulePrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): PaymentSchedulePrice { + val instance = + PaymentSchedulePrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PaymentSchedulePrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PenaltyRule.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PenaltyRule.kt new file mode 100644 index 000000000..19c7a22ce --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PenaltyRule.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.PenaltyType +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 + +/** + * Container for penalty rules + * @param penalty + * @param startDateTime The time when this penalty window starts + * @param endDateTime The time when this penalty window ends + */ +data class PenaltyRule( + @JsonProperty("Penalty") + @field:NotNull + @field:Valid + val penalty: PenaltyType, + // The time when this penalty window starts + @JsonProperty("StartDateTime") + val startDateTime: java.time.LocalDateTime, + // The time when this penalty window ends + @JsonProperty("EndDateTime") + val endDateTime: java.time.LocalDateTime +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var penalty: PenaltyType? = null, + private var startDateTime: java.time.LocalDateTime? = null, + private var endDateTime: java.time.LocalDateTime? = null + ) { + fun penalty(penalty: PenaltyType) = apply { this.penalty = penalty } + + fun startDateTime(startDateTime: java.time.LocalDateTime) = apply { this.startDateTime = startDateTime } + + fun endDateTime(endDateTime: java.time.LocalDateTime) = apply { this.endDateTime = endDateTime } + + fun build(): PenaltyRule { + val instance = + PenaltyRule( + penalty = penalty!!, + startDateTime = startDateTime!!, + endDateTime = endDateTime!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PenaltyRule) { + 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( + penalty = penalty!!, + startDateTime = startDateTime!!, + endDateTime = endDateTime!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PenaltyType.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PenaltyType.kt new file mode 100644 index 000000000..5896c61fc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PenaltyType.kt @@ -0,0 +1,117 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Container for no show penalty element + * @param type What the penalty amount is based on. should be one of the following values:AMOUNT : it means the user is charged a fixed amount specified in the value node. Say 50$ for example.PERCENT : it means the user is charged a percentage of the base rate/total rate.PERDAY : it means the user is charged Per Day Price. For eg.., if the value is 2, it means the penalty amount will the Per day price of 2 days. + * @param `value` Value to indicate how many/much of the type listed above is going to be charged as a penalty. + * @param currency The currency of the amount, only valid when Type=AMOUNT + */ +data class PenaltyType( + // What the penalty amount is based on. should be one of the following values:AMOUNT : it means the user is charged a fixed amount specified in the value node. Say 50$ for example.PERCENT : it means the user is charged a percentage of the base rate/total rate.PERDAY : it means the user is charged Per Day Price. For eg.., if the value is 2, it means the penalty amount will the Per day price of 2 days. + @JsonProperty("Type") + @field:NotNull + @field:Valid + val type: kotlin.String, + // Value to indicate how many/much of the type listed above is going to be charged as a penalty. + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String, + // The currency of the amount, only valid when Type=AMOUNT + @JsonProperty("Currency") + @field:NotNull + @field:Valid + val currency: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: kotlin.String? = null, + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null + ) { + fun type(type: kotlin.String) = apply { this.type = type } + + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + fun build(): PenaltyType { + val instance = + PenaltyType( + type = type!!, + `value` = `value`!!, + currency = currency!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PenaltyType) { + 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( + type = type!!, + `value` = `value`!!, + currency = currency!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Phone.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Phone.kt new file mode 100644 index 000000000..34966455d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Phone.kt @@ -0,0 +1,123 @@ +/* + * 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.xap.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 + +/** + * + * @param countryCode The designated country calling code. + * @param areaCode The phone's area code. + * @param number The phone's local number. + * @param extensionNumber Optional extension number, if required to reach the hotel. + */ +data class Phone( + // The designated country calling code. + @JsonProperty("CountryCode") + @field:Valid + val countryCode: kotlin.String? = null, + // The phone's area code. + @JsonProperty("AreaCode") + @field:Valid + val areaCode: kotlin.String? = null, + // The phone's local number. + @JsonProperty("Number") + @field:Valid + val number: kotlin.String? = null, + // Optional extension number, if required to reach the hotel. + @JsonProperty("ExtensionNumber") + @field:Valid + val extensionNumber: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var countryCode: kotlin.String? = null, + private var areaCode: kotlin.String? = null, + private var number: kotlin.String? = null, + private var extensionNumber: kotlin.String? = null + ) { + fun countryCode(countryCode: kotlin.String?) = apply { this.countryCode = countryCode } + + fun areaCode(areaCode: kotlin.String?) = apply { this.areaCode = areaCode } + + fun number(number: kotlin.String?) = apply { this.number = number } + + fun extensionNumber(extensionNumber: kotlin.String?) = apply { this.extensionNumber = extensionNumber } + + fun build(): Phone { + val instance = + Phone( + countryCode = countryCode, + areaCode = areaCode, + number = number, + extensionNumber = extensionNumber + ) + + 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}" } + ) + } + } + } + + fun toBuilder() = + Builder( + countryCode = countryCode, + areaCode = areaCode, + number = number, + extensionNumber = extensionNumber + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PresignedUrlResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PresignedUrlResponse.kt new file mode 100644 index 000000000..7b09f4df8 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PresignedUrlResponse.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. + */ +/** + * + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Fault +import com.expediagroup.sdk.xap.models.FileInfo +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param transactionId Unique identifier for each API response. + * @param error + * @param warning + * @param bestMatchedFile + * @param otherFileOptions Container for file Pre-signed download URL and informations. + */ +data class PresignedUrlResponse( + // Unique identifier for each API response. + @JsonProperty("transactionId") + @field:Valid + val transactionId: kotlin.String? = null, + @JsonProperty("error") + @field:Valid + val error: Fault? = null, + @JsonProperty("warning") + @field:Valid + val warning: Fault? = null, + @JsonProperty("bestMatchedFile") + @field:Valid + val bestMatchedFile: FileInfo? = null, + // Container for file Pre-signed download URL and informations. + @JsonProperty("otherFileOptions") + @field:Valid + val otherFileOptions: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var transactionId: kotlin.String? = null, + private var error: Fault? = null, + private var warning: Fault? = null, + private var bestMatchedFile: FileInfo? = null, + private var otherFileOptions: kotlin.collections.List? = null + ) { + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun error(error: Fault?) = apply { this.error = error } + + fun warning(warning: Fault?) = apply { this.warning = warning } + + fun bestMatchedFile(bestMatchedFile: FileInfo?) = apply { this.bestMatchedFile = bestMatchedFile } + + fun otherFileOptions(otherFileOptions: kotlin.collections.List?) = apply { this.otherFileOptions = otherFileOptions } + + fun build(): PresignedUrlResponse { + val instance = + PresignedUrlResponse( + transactionId = transactionId, + error = error, + warning = warning, + bestMatchedFile = bestMatchedFile, + otherFileOptions = otherFileOptions + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PresignedUrlResponse) { + 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( + transactionId = transactionId, + error = error, + warning = warning, + bestMatchedFile = bestMatchedFile, + otherFileOptions = otherFileOptions + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Price.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Price.kt new file mode 100644 index 000000000..a756e2b3a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Price.kt @@ -0,0 +1,131 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsMoney +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 + +/** + * Pricing information for the rental. + * @param totalPrice + * @param ratePeriodUnitPrice + * @param basePrice + * @param taxesAndFees + * @param totalPriceDueAtBooking + */ +data class Price( + @JsonProperty("TotalPrice") + @field:NotNull + @field:Valid + val totalPrice: CarsMoney, + @JsonProperty("RatePeriodUnitPrice") + @field:Valid + val ratePeriodUnitPrice: CarsMoney? = null, + @JsonProperty("BasePrice") + @field:Valid + val basePrice: CarsMoney? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: CarsMoney? = null, + @JsonProperty("TotalPriceDueAtBooking") + @field:Valid + val totalPriceDueAtBooking: CarsMoney? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var totalPrice: CarsMoney? = null, + private var ratePeriodUnitPrice: CarsMoney? = null, + private var basePrice: CarsMoney? = null, + private var taxesAndFees: CarsMoney? = null, + private var totalPriceDueAtBooking: CarsMoney? = null + ) { + fun totalPrice(totalPrice: CarsMoney) = apply { this.totalPrice = totalPrice } + + fun ratePeriodUnitPrice(ratePeriodUnitPrice: CarsMoney?) = apply { this.ratePeriodUnitPrice = ratePeriodUnitPrice } + + fun basePrice(basePrice: CarsMoney?) = apply { this.basePrice = basePrice } + + fun taxesAndFees(taxesAndFees: CarsMoney?) = apply { this.taxesAndFees = taxesAndFees } + + fun totalPriceDueAtBooking(totalPriceDueAtBooking: CarsMoney?) = apply { this.totalPriceDueAtBooking = totalPriceDueAtBooking } + + fun build(): Price { + val instance = + Price( + totalPrice = totalPrice!!, + ratePeriodUnitPrice = ratePeriodUnitPrice, + basePrice = basePrice, + taxesAndFees = taxesAndFees, + totalPriceDueAtBooking = totalPriceDueAtBooking + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Price) { + 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( + totalPrice = totalPrice!!, + ratePeriodUnitPrice = ratePeriodUnitPrice, + basePrice = basePrice, + taxesAndFees = taxesAndFees, + totalPriceDueAtBooking = totalPriceDueAtBooking + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Promotion.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Promotion.kt new file mode 100644 index 000000000..0939d422c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Promotion.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.PromotionAmount +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param description The description of the promotion. + * @param amount + */ +data class Promotion( + // The description of the promotion. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + @JsonProperty("Amount") + @field:Valid + val amount: PromotionAmount? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var description: kotlin.String? = null, + private var amount: PromotionAmount? = null + ) { + fun description(description: kotlin.String?) = apply { this.description = description } + + fun amount(amount: PromotionAmount?) = apply { this.amount = amount } + + fun build(): Promotion { + val instance = + Promotion( + description = description, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Promotion) { + 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( + description = description, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PromotionAmount.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PromotionAmount.kt new file mode 100644 index 000000000..58152aba5 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PromotionAmount.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class PromotionAmount( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): PromotionAmount { + val instance = + PromotionAmount( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PromotionAmount) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Property.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Property.kt new file mode 100644 index 000000000..b5f444a48 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Property.kt @@ -0,0 +1,143 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.LodgingRoomType +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for information on each offered hotel. + * @param id The unique property identifier used to designate a single property. + * @param status Represents whether the offer is currently available. + * @param roomTypes Container for all of available room types. + */ +data class Property( + // The unique property identifier used to designate a single property. + @JsonProperty("Id") + @field:Valid + val id: kotlin.String? = null, + // Represents whether the offer is currently available. + @JsonProperty("Status") + val status: Property.Status? = null, + // Container for all of available room types. + @JsonProperty("RoomTypes") + @field:Valid + val roomTypes: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.String? = null, + private var status: Property.Status? = null, + private var roomTypes: kotlin.collections.List? = null + ) { + fun id(id: kotlin.String?) = apply { this.id = id } + + fun status(status: Property.Status?) = apply { this.status = status } + + fun roomTypes(roomTypes: kotlin.collections.List?) = apply { this.roomTypes = roomTypes } + + fun build(): Property { + val instance = + Property( + id = id, + status = status, + roomTypes = roomTypes + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Property) { + 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, + status = status, + roomTypes = roomTypes + ) + + /** + * Represents whether the offer is currently available. + * Values: AVAILABLE,NOT_AVAILABLE,ERROR,NUMBER_OF_ADULTS_NOT_ACCEPTED,NUMBER_OF_CHILDREN_NOT_ACCEPTED,NUMBER_OF_INFANTS_NOT_ACCEPTED,NUMBER_OF_PERSONS_NOT_ACCEPTED,CHECK_IN_AGE_NOT_ACCEPTED + */ + enum class Status(val value: kotlin.String) { + @JsonProperty("AVAILABLE") + AVAILABLE("AVAILABLE"), + + @JsonProperty("NOT_AVAILABLE") + NOT_AVAILABLE("NOT_AVAILABLE"), + + @JsonProperty("ERROR") + ERROR("ERROR"), + + @JsonProperty("NUMBER_OF_ADULTS_NOT_ACCEPTED") + NUMBER_OF_ADULTS_NOT_ACCEPTED("NUMBER_OF_ADULTS_NOT_ACCEPTED"), + + @JsonProperty("NUMBER_OF_CHILDREN_NOT_ACCEPTED") + NUMBER_OF_CHILDREN_NOT_ACCEPTED("NUMBER_OF_CHILDREN_NOT_ACCEPTED"), + + @JsonProperty("NUMBER_OF_INFANTS_NOT_ACCEPTED") + NUMBER_OF_INFANTS_NOT_ACCEPTED("NUMBER_OF_INFANTS_NOT_ACCEPTED"), + + @JsonProperty("NUMBER_OF_PERSONS_NOT_ACCEPTED") + NUMBER_OF_PERSONS_NOT_ACCEPTED("NUMBER_OF_PERSONS_NOT_ACCEPTED"), + + @JsonProperty("CHECK_IN_AGE_NOT_ACCEPTED") + CHECK_IN_AGE_NOT_ACCEPTED("CHECK_IN_AGE_NOT_ACCEPTED") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PropertyDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PropertyDetails.kt new file mode 100644 index 000000000..9d3c6b357 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PropertyDetails.kt @@ -0,0 +1,150 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.PropertyManager +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for information about the hotel property detail. It will be shown for Vacation Rental hotel only. + * @param propertyRegistryNumber The registry number of property. + * @param hostLanguages The languages the host of property will speak. + * @param maxOccupancy The maximum number of guests allowed to stay in the property. + * @param numberOfBedrooms The number of bedrooms in the property. + * @param numberOfBathrooms The number of bathrooms in the property. + * @param squareFeet Property area in square feet. + * @param propertyManager + */ +data class PropertyDetails( + // The registry number of property. + @JsonProperty("PropertyRegistryNumber") + @field:Valid + val propertyRegistryNumber: kotlin.String? = null, + // The languages the host of property will speak. + @JsonProperty("HostLanguages") + @field:Valid + val hostLanguages: kotlin.collections.List? = null, + // The maximum number of guests allowed to stay in the property. + @JsonProperty("MaxOccupancy") + val maxOccupancy: kotlin.Int? = null, + // The number of bedrooms in the property. + @JsonProperty("NumberOfBedrooms") + val numberOfBedrooms: kotlin.Int? = null, + // The number of bathrooms in the property. + @JsonProperty("NumberOfBathrooms") + val numberOfBathrooms: kotlin.Int? = null, + // Property area in square feet. + @JsonProperty("SquareFeet") + @field:Valid + val squareFeet: kotlin.String? = null, + @JsonProperty("PropertyManager") + @field:Valid + val propertyManager: PropertyManager? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var propertyRegistryNumber: kotlin.String? = null, + private var hostLanguages: kotlin.collections.List? = null, + private var maxOccupancy: kotlin.Int? = null, + private var numberOfBedrooms: kotlin.Int? = null, + private var numberOfBathrooms: kotlin.Int? = null, + private var squareFeet: kotlin.String? = null, + private var propertyManager: PropertyManager? = null + ) { + fun propertyRegistryNumber(propertyRegistryNumber: kotlin.String?) = apply { this.propertyRegistryNumber = propertyRegistryNumber } + + fun hostLanguages(hostLanguages: kotlin.collections.List?) = apply { this.hostLanguages = hostLanguages } + + fun maxOccupancy(maxOccupancy: kotlin.Int?) = apply { this.maxOccupancy = maxOccupancy } + + fun numberOfBedrooms(numberOfBedrooms: kotlin.Int?) = apply { this.numberOfBedrooms = numberOfBedrooms } + + fun numberOfBathrooms(numberOfBathrooms: kotlin.Int?) = apply { this.numberOfBathrooms = numberOfBathrooms } + + fun squareFeet(squareFeet: kotlin.String?) = apply { this.squareFeet = squareFeet } + + fun propertyManager(propertyManager: PropertyManager?) = apply { this.propertyManager = propertyManager } + + fun build(): PropertyDetails { + val instance = + PropertyDetails( + propertyRegistryNumber = propertyRegistryNumber, + hostLanguages = hostLanguages, + maxOccupancy = maxOccupancy, + numberOfBedrooms = numberOfBedrooms, + numberOfBathrooms = numberOfBathrooms, + squareFeet = squareFeet, + propertyManager = propertyManager + ) + + validate(instance) + + return instance + } + + private fun validate(instance: PropertyDetails) { + 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( + propertyRegistryNumber = propertyRegistryNumber, + hostLanguages = hostLanguages, + maxOccupancy = maxOccupancy, + numberOfBedrooms = numberOfBedrooms, + numberOfBathrooms = numberOfBathrooms, + squareFeet = squareFeet, + propertyManager = propertyManager + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PropertyManager.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PropertyManager.kt new file mode 100644 index 000000000..7ea7695e4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/PropertyManager.kt @@ -0,0 +1,112 @@ +/* + * 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.xap.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 + +/** + * Container for information about the property manager. It will be shown for Vacation Rental hotel only. + * @param name The name of the property manager. + * @param calendarLastUpdated The latest updated date. + * @param photoUrl The URL for property manager's photo. + */ +data class PropertyManager( + // The name of the property manager. + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null, + // The latest updated date. + @JsonProperty("CalendarLastUpdated") + val calendarLastUpdated: java.time.LocalDate? = null, + // The URL for property manager's photo. + @JsonProperty("PhotoUrl") + @field:Valid + val photoUrl: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var name: kotlin.String? = null, + private var calendarLastUpdated: java.time.LocalDate? = null, + private var photoUrl: kotlin.String? = null + ) { + fun name(name: kotlin.String?) = apply { this.name = name } + + fun calendarLastUpdated(calendarLastUpdated: java.time.LocalDate?) = apply { this.calendarLastUpdated = calendarLastUpdated } + + fun photoUrl(photoUrl: kotlin.String?) = apply { this.photoUrl = photoUrl } + + fun build(): PropertyManager { + val instance = + PropertyManager( + name = name, + calendarLastUpdated = calendarLastUpdated, + photoUrl = photoUrl + ) + + 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, + calendarLastUpdated = calendarLastUpdated, + photoUrl = photoUrl + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendar.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendar.kt new file mode 100644 index 000000000..6d569d02b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendar.kt @@ -0,0 +1,147 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RateCalendarPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The lowest rate information of requested days + * @param stayDate Stay date for which the price is returned. + * @param price + * @param priceLevel Indicates how that day's price compares to the other lowest price for that hotel over the searched date range. Prices will be bucketed into LOW/MEDIUM/HIGH. Here are the details for each `PriceLevel`: - HIGH: 65th percentile+ - MEDIUM: 30th Percentile+ - LOW: Anything lower than 30th percentile + * @param status Represents whether the offer is currently available. + */ +data class RateCalendar( + // Stay date for which the price is returned. + @JsonProperty("StayDate") + val stayDate: java.time.LocalDate? = null, + @JsonProperty("Price") + @field:Valid + val price: RateCalendarPrice? = null, + // Indicates how that day's price compares to the other lowest price for that hotel over the searched date range. Prices will be bucketed into LOW/MEDIUM/HIGH. Here are the details for each `PriceLevel`: - HIGH: 65th percentile+ - MEDIUM: 30th Percentile+ - LOW: Anything lower than 30th percentile + @JsonProperty("PriceLevel") + val priceLevel: RateCalendar.PriceLevel? = null, + // Represents whether the offer is currently available. + @JsonProperty("Status") + val status: RateCalendar.Status? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var stayDate: java.time.LocalDate? = null, + private var price: RateCalendarPrice? = null, + private var priceLevel: RateCalendar.PriceLevel? = null, + private var status: RateCalendar.Status? = null + ) { + fun stayDate(stayDate: java.time.LocalDate?) = apply { this.stayDate = stayDate } + + fun price(price: RateCalendarPrice?) = apply { this.price = price } + + fun priceLevel(priceLevel: RateCalendar.PriceLevel?) = apply { this.priceLevel = priceLevel } + + fun status(status: RateCalendar.Status?) = apply { this.status = status } + + fun build(): RateCalendar { + val instance = + RateCalendar( + stayDate = stayDate, + price = price, + priceLevel = priceLevel, + status = status + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateCalendar) { + 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( + stayDate = stayDate, + price = price, + priceLevel = priceLevel, + status = status + ) + + /** + * Indicates how that day's price compares to the other lowest price for that hotel over the searched date range. Prices will be bucketed into LOW/MEDIUM/HIGH. Here are the details for each `PriceLevel`: - HIGH: 65th percentile+ - MEDIUM: 30th Percentile+ - LOW: Anything lower than 30th percentile + * Values: HIGH,MEDIUM,LOW + */ + enum class PriceLevel(val value: kotlin.String) { + @JsonProperty("HIGH") + HIGH("HIGH"), + + @JsonProperty("MEDIUM") + MEDIUM("MEDIUM"), + + @JsonProperty("LOW") + LOW("LOW") + } + + /** + * Represents whether the offer is currently available. + * Values: AVAILABLE,NOT_AVAILABLE + */ + enum class Status(val value: kotlin.String) { + @JsonProperty("AVAILABLE") + AVAILABLE("AVAILABLE"), + + @JsonProperty("NOT_AVAILABLE") + NOT_AVAILABLE("NOT_AVAILABLE") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarPrice.kt new file mode 100644 index 000000000..6b55c8a57 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The total price of the corresponding date. + * @param currency The ISO 4217 Currency Code that the Value is expressed in. See [Global Currency Codes](https://developers.expediagroup.com/xap/products/xap/lodging/references/global-currency-codes) for a full list of supported currencies. + * @param localCurrencyPrice + */ +data class RateCalendarPrice( + // The total price of the corresponding date. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.Any? = null, + // The ISO 4217 Currency Code that the Value is expressed in. See [Global Currency Codes](https://developers.expediagroup.com/xap/products/xap/lodging/references/global-currency-codes) for a full list of supported currencies. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.Any? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.Any? = null, + private var currency: kotlin.Any? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.Any?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.Any?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RateCalendarPrice { + val instance = + RateCalendarPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateCalendarPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarPriceAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarPriceAllOf.kt new file mode 100644 index 000000000..4dbbf2fb6 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarPriceAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param `value` The total price of the corresponding date. + * @param currency The ISO 4217 Currency Code that the Value is expressed in. See [Global Currency Codes](https://developers.expediagroup.com/xap/products/xap/lodging/references/global-currency-codes) for a full list of supported currencies. + */ +data class RateCalendarPriceAllOf( + // The total price of the corresponding date. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.Any? = null, + // The ISO 4217 Currency Code that the Value is expressed in. See [Global Currency Codes](https://developers.expediagroup.com/xap/products/xap/lodging/references/global-currency-codes) for a full list of supported currencies. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.Any? = null, + private var currency: kotlin.Any? = null + ) { + fun `value`(`value`: kotlin.Any?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.Any?) = apply { this.currency = currency } + + fun build(): RateCalendarPriceAllOf { + val instance = + RateCalendarPriceAllOf( + `value` = `value`, + currency = currency + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateCalendarPriceAllOf) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarResponse.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarResponse.kt new file mode 100644 index 000000000..978111dab --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateCalendarResponse.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.HotelRateCalendar +import com.expediagroup.sdk.xap.models.Warning +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param warnings There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + * @param transactionId Unique identifier for the transaction. + * @param rateCalendars Container for all hotel rate calendar data. + */ +data class RateCalendarResponse( + // There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + @JsonProperty("Warnings") + @field:Valid + val warnings: kotlin.collections.List? = null, + // Unique identifier for the transaction. + @JsonProperty("TransactionId") + @field:Valid + val transactionId: kotlin.String? = null, + // Container for all hotel rate calendar data. + @JsonProperty("RateCalendars") + @field:Valid + val rateCalendars: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var warnings: kotlin.collections.List? = null, + private var transactionId: kotlin.String? = null, + private var rateCalendars: kotlin.collections.List? = null + ) { + fun warnings(warnings: kotlin.collections.List?) = apply { this.warnings = warnings } + + fun transactionId(transactionId: kotlin.String?) = apply { this.transactionId = transactionId } + + fun rateCalendars(rateCalendars: kotlin.collections.List?) = apply { this.rateCalendars = rateCalendars } + + fun build(): RateCalendarResponse { + val instance = + RateCalendarResponse( + warnings = warnings, + transactionId = transactionId, + rateCalendars = rateCalendars + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateCalendarResponse) { + 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( + warnings = warnings, + transactionId = transactionId, + rateCalendars = rateCalendars + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateDetails.kt new file mode 100644 index 000000000..c9c9c5dbe --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RateDetails.kt @@ -0,0 +1,159 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Discount +import com.expediagroup.sdk.xap.models.Mileage +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 + +/** + * The rate detail information for a car offer. + * @param ratePeriod Rate period. Supported values: Daily,Weekly,Monthly,Trip,Weekend + * @param rateCode Rate plan identifier. + * @param prePay Indicates whether this reservation should be paid at the time of booking (true) or at time of rental return (false). + * @param creditCardRequired Indicates whether credit card is required for booking. + * @param discounts List of discount information. + * @param mileages A list of charges to be levied based on the mileage driven. + * @param mobileRate Indicates whether car offer is mobile rate. + */ +data class RateDetails( + // Rate period. Supported values: Daily,Weekly,Monthly,Trip,Weekend + @JsonProperty("RatePeriod") + @field:NotNull + @field:Valid + val ratePeriod: kotlin.String, + // Rate plan identifier. + @JsonProperty("RateCode") + @field:NotNull + @field:Valid + val rateCode: kotlin.String, + // Indicates whether this reservation should be paid at the time of booking (true) or at time of rental return (false). + @JsonProperty("PrePay") + @field:NotNull + @field:Valid + val prePay: kotlin.Boolean, + // Indicates whether credit card is required for booking. + @JsonProperty("CreditCardRequired") + @field:Valid + val creditCardRequired: kotlin.Boolean? = null, + // List of discount information. + @JsonProperty("Discounts") + @field:Valid + val discounts: kotlin.collections.List? = null, + // A list of charges to be levied based on the mileage driven. + @JsonProperty("Mileages") + @field:Valid + val mileages: kotlin.collections.List? = null, + // Indicates whether car offer is mobile rate. + @JsonProperty("MobileRate") + @field:Valid + val mobileRate: kotlin.Boolean? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var ratePeriod: kotlin.String? = null, + private var rateCode: kotlin.String? = null, + private var prePay: kotlin.Boolean? = null, + private var creditCardRequired: kotlin.Boolean? = null, + private var discounts: kotlin.collections.List? = null, + private var mileages: kotlin.collections.List? = null, + private var mobileRate: kotlin.Boolean? = null + ) { + fun ratePeriod(ratePeriod: kotlin.String) = apply { this.ratePeriod = ratePeriod } + + fun rateCode(rateCode: kotlin.String) = apply { this.rateCode = rateCode } + + fun prePay(prePay: kotlin.Boolean) = apply { this.prePay = prePay } + + fun creditCardRequired(creditCardRequired: kotlin.Boolean?) = apply { this.creditCardRequired = creditCardRequired } + + fun discounts(discounts: kotlin.collections.List?) = apply { this.discounts = discounts } + + fun mileages(mileages: kotlin.collections.List?) = apply { this.mileages = mileages } + + fun mobileRate(mobileRate: kotlin.Boolean?) = apply { this.mobileRate = mobileRate } + + fun build(): RateDetails { + val instance = + RateDetails( + ratePeriod = ratePeriod!!, + rateCode = rateCode!!, + prePay = prePay!!, + creditCardRequired = creditCardRequired, + discounts = discounts, + mileages = mileages, + mobileRate = mobileRate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RateDetails) { + 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( + ratePeriod = ratePeriod!!, + rateCode = rateCode!!, + prePay = prePay!!, + creditCardRequired = creditCardRequired, + discounts = discounts, + mileages = mileages, + mobileRate = mobileRate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlan.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlan.kt new file mode 100644 index 000000000..f644328f8 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlan.kt @@ -0,0 +1,390 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CancellationPolicy +import com.expediagroup.sdk.xap.models.PaymentSchedule +import com.expediagroup.sdk.xap.models.Promotion +import com.expediagroup.sdk.xap.models.RatePlanAmenitiesInner +import com.expediagroup.sdk.xap.models.RatePlanPrice +import com.expediagroup.sdk.xap.models.RatePlanStandalonePrice +import com.expediagroup.sdk.xap.models.StayDates +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for information on each rate plan. + * @param roomTypeId The room type identifier. + * @param ratePlanId The rate plan identifier. + * @param rateRuleId The identifier of rate rule. + * @param inventorySourceId The identification number of the source that provides the rate plan. + * @param inventorySourceCode The source name that provided the rate plan. + * @param stayDates + * @param remainingCount The number of rooms remaining through Expedia for this room type. **NOTE**: This value does NOT represent the total number of rooms remaining at the hotel property, only the number of rooms allocated to Expedia for sale by the property that currently remain in Expedia's inventory. When a hotel is listed as 'sold out' by Expedia there may still be rooms available for sale by the hotel through other channels. Also note that the `RemainingCount` response element has a maximum returned value of 100, even if there are more than 100 rooms available within bookable Expedia inventory. **CMA Compliance Note (UK)**: websites in the UK that display `remainingCount` should make it clear to consumers that this count refers to the number of rooms remaining within Expedia inventory - NOT the number remaining at the property. + * @param price + * @param memberOnlyDeal Indicates whether the rate is for member only. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + * @param promotions All promotion information of the `ratePlan`. + * @param standalonePrice + * @param taxesAndFeesInclusive Indicates whether taxes and fees are included in base rate. + * @param guaranteeText Text description for any deposit information provide by the property (if applicable). + * @param paymentMethod Room payment information. The available options are: - Online: Pay at the time of booking - Hotel: Could either be paid at the hotel during the time of stay or paid at the time indicated by `PaymentTime` and `PaymentSchedule` + * @param paymentTime The time when the booking amount will be charged on the traveler’s credit card. Valid values are as follows: - UponBooking - PayLater - SupplierDiscretion + * @param fullDepositUponBooking It will be true if PaymentSchedule has one installment and the value of \"Due\" is booking date, otherwise, it will be false. + * @param paymentSchedule Contains information on the payment schedule. + * @param reserveWithDeposit Indicates whether this rate plan need deposit to reserve. + * @param freeInternet Indicates whether the price of the room includes free Internet. (either wireless or wired) + * @param freeWiFi Indicates whether the price of the room includes free wireless Internet access. + * @param freeInternetDetails The localized details for the free internet amenity (only shown when FreeInternet = true). You can find a link to the complete list of Free Internet Details in [Lodging Free Breakfast and Internet Details](https://developers.expediagroup.com/xap/products/xap/lodging/references/free-breakfast-and-internet-details). + * @param freeParking Indicates whether the price of the room includes free parking. + * @param freeBreakfast Indicates whether the price of the room includes free breakfast. + * @param freeBreakfastDetails The localized details for the free breakfast amenity (only shown when FreeBreakfast = true). You can find a link to the complete list of Free Breakfast Details in [Lodging Free Breakfast and Internet Details](https://developers.expediagroup.com/xap/products/xap/lodging/references/free-breakfast-and-internet-details). + * @param hcomRewardsEarn Indicate whether the room qualifies for Hcom Rewards Earn. (Hotels.com partners only) + * @param hcomRewardsBurn Indicate whether the room qualifies for Hcom Rewards Burn. (Hotels.com partners only) + * @param cancellationPolicy + * @param amenities The amenities of the `rateplan`. + */ +data class RatePlan( + // The room type identifier. + @JsonProperty("RoomTypeId") + @field:Valid + val roomTypeId: kotlin.String? = null, + // The rate plan identifier. + @JsonProperty("RatePlanId") + @field:Valid + val ratePlanId: kotlin.String? = null, + // The identifier of rate rule. + @JsonProperty("RateRuleId") + @field:Valid + val rateRuleId: kotlin.String? = null, + // The identification number of the source that provides the rate plan. + @JsonProperty("InventorySourceId") + @field:Valid + val inventorySourceId: kotlin.String? = null, + // The source name that provided the rate plan. + @JsonProperty("InventorySourceCode") + @field:Valid + val inventorySourceCode: kotlin.String? = null, + @JsonProperty("StayDates") + @field:Valid + val stayDates: StayDates? = null, + // The number of rooms remaining through Expedia for this room type. **NOTE**: This value does NOT represent the total number of rooms remaining at the hotel property, only the number of rooms allocated to Expedia for sale by the property that currently remain in Expedia's inventory. When a hotel is listed as 'sold out' by Expedia there may still be rooms available for sale by the hotel through other channels. Also note that the `RemainingCount` response element has a maximum returned value of 100, even if there are more than 100 rooms available within bookable Expedia inventory. **CMA Compliance Note (UK)**: websites in the UK that display `remainingCount` should make it clear to consumers that this count refers to the number of rooms remaining within Expedia inventory - NOT the number remaining at the property. + @JsonProperty("RemainingCount") + val remainingCount: kotlin.Int? = null, + @JsonProperty("Price") + @field:Valid + val price: RatePlanPrice? = null, + // Indicates whether the rate is for member only. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + @JsonProperty("MemberOnlyDeal") + @field:Valid + val memberOnlyDeal: kotlin.Boolean? = null, + // All promotion information of the `ratePlan`. + @JsonProperty("Promotions") + @field:Valid + val promotions: kotlin.collections.List? = null, + @JsonProperty("StandalonePrice") + @field:Valid + val standalonePrice: RatePlanStandalonePrice? = null, + // Indicates whether taxes and fees are included in base rate. + @JsonProperty("TaxesAndFeesInclusive") + @field:Valid + val taxesAndFeesInclusive: kotlin.Boolean? = null, + // Text description for any deposit information provide by the property (if applicable). + @JsonProperty("GuaranteeText") + @field:Valid + val guaranteeText: kotlin.String? = null, + // Room payment information. The available options are: - Online: Pay at the time of booking - Hotel: Could either be paid at the hotel during the time of stay or paid at the time indicated by `PaymentTime` and `PaymentSchedule` + @JsonProperty("PaymentMethod") + val paymentMethod: RatePlan.PaymentMethod? = null, + // The time when the booking amount will be charged on the traveler’s credit card. Valid values are as follows: - UponBooking - PayLater - SupplierDiscretion + @JsonProperty("PaymentTime") + val paymentTime: RatePlan.PaymentTime? = null, + // It will be true if PaymentSchedule has one installment and the value of \"Due\" is booking date, otherwise, it will be false. + @JsonProperty("FullDepositUponBooking") + @field:Valid + val fullDepositUponBooking: kotlin.Boolean? = null, + // Contains information on the payment schedule. + @JsonProperty("PaymentSchedule") + @field:Valid + val paymentSchedule: kotlin.collections.List? = null, + // Indicates whether this rate plan need deposit to reserve. + @JsonProperty("ReserveWithDeposit") + @field:Valid + val reserveWithDeposit: kotlin.Boolean? = null, + // Indicates whether the price of the room includes free Internet. (either wireless or wired) + @JsonProperty("FreeInternet") + @field:Valid + val freeInternet: kotlin.Boolean? = null, + // Indicates whether the price of the room includes free wireless Internet access. + @JsonProperty("FreeWiFi") + @field:Valid + val freeWiFi: kotlin.Boolean? = null, + // The localized details for the free internet amenity (only shown when FreeInternet = true). You can find a link to the complete list of Free Internet Details in [Lodging Free Breakfast and Internet Details](https://developers.expediagroup.com/xap/products/xap/lodging/references/free-breakfast-and-internet-details). + @JsonProperty("FreeInternetDetails") + @field:Valid + val freeInternetDetails: kotlin.collections.List? = null, + // Indicates whether the price of the room includes free parking. + @JsonProperty("FreeParking") + @field:Valid + val freeParking: kotlin.Boolean? = null, + // Indicates whether the price of the room includes free breakfast. + @JsonProperty("FreeBreakfast") + @field:Valid + val freeBreakfast: kotlin.Boolean? = null, + // The localized details for the free breakfast amenity (only shown when FreeBreakfast = true). You can find a link to the complete list of Free Breakfast Details in [Lodging Free Breakfast and Internet Details](https://developers.expediagroup.com/xap/products/xap/lodging/references/free-breakfast-and-internet-details). + @JsonProperty("FreeBreakfastDetails") + @field:Valid + val freeBreakfastDetails: kotlin.collections.List? = null, + // Indicate whether the room qualifies for Hcom Rewards Earn. (Hotels.com partners only) + @JsonProperty("HcomRewardsEarn") + @field:Valid + val hcomRewardsEarn: kotlin.Boolean? = null, + // Indicate whether the room qualifies for Hcom Rewards Burn. (Hotels.com partners only) + @JsonProperty("HcomRewardsBurn") + @field:Valid + val hcomRewardsBurn: kotlin.Boolean? = null, + @JsonProperty("CancellationPolicy") + @field:Valid + val cancellationPolicy: CancellationPolicy? = null, + // The amenities of the `rateplan`. + @JsonProperty("Amenities") + @field:Valid + val amenities: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var roomTypeId: kotlin.String? = null, + private var ratePlanId: kotlin.String? = null, + private var rateRuleId: kotlin.String? = null, + private var inventorySourceId: kotlin.String? = null, + private var inventorySourceCode: kotlin.String? = null, + private var stayDates: StayDates? = null, + private var remainingCount: kotlin.Int? = null, + private var price: RatePlanPrice? = null, + private var memberOnlyDeal: kotlin.Boolean? = null, + private var promotions: kotlin.collections.List? = null, + private var standalonePrice: RatePlanStandalonePrice? = null, + private var taxesAndFeesInclusive: kotlin.Boolean? = null, + private var guaranteeText: kotlin.String? = null, + private var paymentMethod: RatePlan.PaymentMethod? = null, + private var paymentTime: RatePlan.PaymentTime? = null, + private var fullDepositUponBooking: kotlin.Boolean? = null, + private var paymentSchedule: kotlin.collections.List? = null, + private var reserveWithDeposit: kotlin.Boolean? = null, + private var freeInternet: kotlin.Boolean? = null, + private var freeWiFi: kotlin.Boolean? = null, + private var freeInternetDetails: kotlin.collections.List? = null, + private var freeParking: kotlin.Boolean? = null, + private var freeBreakfast: kotlin.Boolean? = null, + private var freeBreakfastDetails: kotlin.collections.List? = null, + private var hcomRewardsEarn: kotlin.Boolean? = null, + private var hcomRewardsBurn: kotlin.Boolean? = null, + private var cancellationPolicy: CancellationPolicy? = null, + private var amenities: kotlin.collections.List? = null + ) { + fun roomTypeId(roomTypeId: kotlin.String?) = apply { this.roomTypeId = roomTypeId } + + fun ratePlanId(ratePlanId: kotlin.String?) = apply { this.ratePlanId = ratePlanId } + + fun rateRuleId(rateRuleId: kotlin.String?) = apply { this.rateRuleId = rateRuleId } + + fun inventorySourceId(inventorySourceId: kotlin.String?) = apply { this.inventorySourceId = inventorySourceId } + + fun inventorySourceCode(inventorySourceCode: kotlin.String?) = apply { this.inventorySourceCode = inventorySourceCode } + + fun stayDates(stayDates: StayDates?) = apply { this.stayDates = stayDates } + + fun remainingCount(remainingCount: kotlin.Int?) = apply { this.remainingCount = remainingCount } + + fun price(price: RatePlanPrice?) = apply { this.price = price } + + fun memberOnlyDeal(memberOnlyDeal: kotlin.Boolean?) = apply { this.memberOnlyDeal = memberOnlyDeal } + + fun promotions(promotions: kotlin.collections.List?) = apply { this.promotions = promotions } + + fun standalonePrice(standalonePrice: RatePlanStandalonePrice?) = apply { this.standalonePrice = standalonePrice } + + fun taxesAndFeesInclusive(taxesAndFeesInclusive: kotlin.Boolean?) = apply { this.taxesAndFeesInclusive = taxesAndFeesInclusive } + + fun guaranteeText(guaranteeText: kotlin.String?) = apply { this.guaranteeText = guaranteeText } + + fun paymentMethod(paymentMethod: RatePlan.PaymentMethod?) = apply { this.paymentMethod = paymentMethod } + + fun paymentTime(paymentTime: RatePlan.PaymentTime?) = apply { this.paymentTime = paymentTime } + + fun fullDepositUponBooking(fullDepositUponBooking: kotlin.Boolean?) = apply { this.fullDepositUponBooking = fullDepositUponBooking } + + fun paymentSchedule(paymentSchedule: kotlin.collections.List?) = apply { this.paymentSchedule = paymentSchedule } + + fun reserveWithDeposit(reserveWithDeposit: kotlin.Boolean?) = apply { this.reserveWithDeposit = reserveWithDeposit } + + fun freeInternet(freeInternet: kotlin.Boolean?) = apply { this.freeInternet = freeInternet } + + fun freeWiFi(freeWiFi: kotlin.Boolean?) = apply { this.freeWiFi = freeWiFi } + + fun freeInternetDetails(freeInternetDetails: kotlin.collections.List?) = apply { this.freeInternetDetails = freeInternetDetails } + + fun freeParking(freeParking: kotlin.Boolean?) = apply { this.freeParking = freeParking } + + fun freeBreakfast(freeBreakfast: kotlin.Boolean?) = apply { this.freeBreakfast = freeBreakfast } + + fun freeBreakfastDetails(freeBreakfastDetails: kotlin.collections.List?) = apply { this.freeBreakfastDetails = freeBreakfastDetails } + + fun hcomRewardsEarn(hcomRewardsEarn: kotlin.Boolean?) = apply { this.hcomRewardsEarn = hcomRewardsEarn } + + fun hcomRewardsBurn(hcomRewardsBurn: kotlin.Boolean?) = apply { this.hcomRewardsBurn = hcomRewardsBurn } + + fun cancellationPolicy(cancellationPolicy: CancellationPolicy?) = apply { this.cancellationPolicy = cancellationPolicy } + + fun amenities(amenities: kotlin.collections.List?) = apply { this.amenities = amenities } + + fun build(): RatePlan { + val instance = + RatePlan( + roomTypeId = roomTypeId, + ratePlanId = ratePlanId, + rateRuleId = rateRuleId, + inventorySourceId = inventorySourceId, + inventorySourceCode = inventorySourceCode, + stayDates = stayDates, + remainingCount = remainingCount, + price = price, + memberOnlyDeal = memberOnlyDeal, + promotions = promotions, + standalonePrice = standalonePrice, + taxesAndFeesInclusive = taxesAndFeesInclusive, + guaranteeText = guaranteeText, + paymentMethod = paymentMethod, + paymentTime = paymentTime, + fullDepositUponBooking = fullDepositUponBooking, + paymentSchedule = paymentSchedule, + reserveWithDeposit = reserveWithDeposit, + freeInternet = freeInternet, + freeWiFi = freeWiFi, + freeInternetDetails = freeInternetDetails, + freeParking = freeParking, + freeBreakfast = freeBreakfast, + freeBreakfastDetails = freeBreakfastDetails, + hcomRewardsEarn = hcomRewardsEarn, + hcomRewardsBurn = hcomRewardsBurn, + cancellationPolicy = cancellationPolicy, + amenities = amenities + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlan) { + 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( + roomTypeId = roomTypeId, + ratePlanId = ratePlanId, + rateRuleId = rateRuleId, + inventorySourceId = inventorySourceId, + inventorySourceCode = inventorySourceCode, + stayDates = stayDates, + remainingCount = remainingCount, + price = price, + memberOnlyDeal = memberOnlyDeal, + promotions = promotions, + standalonePrice = standalonePrice, + taxesAndFeesInclusive = taxesAndFeesInclusive, + guaranteeText = guaranteeText, + paymentMethod = paymentMethod, + paymentTime = paymentTime, + fullDepositUponBooking = fullDepositUponBooking, + paymentSchedule = paymentSchedule, + reserveWithDeposit = reserveWithDeposit, + freeInternet = freeInternet, + freeWiFi = freeWiFi, + freeInternetDetails = freeInternetDetails, + freeParking = freeParking, + freeBreakfast = freeBreakfast, + freeBreakfastDetails = freeBreakfastDetails, + hcomRewardsEarn = hcomRewardsEarn, + hcomRewardsBurn = hcomRewardsBurn, + cancellationPolicy = cancellationPolicy, + amenities = amenities + ) + + /** + * Room payment information. The available options are: - Online: Pay at the time of booking - Hotel: Could either be paid at the hotel during the time of stay or paid at the time indicated by `PaymentTime` and `PaymentSchedule` + * Values: ONLINE,HOTEL + */ + enum class PaymentMethod(val value: kotlin.String) { + @JsonProperty("Online") + ONLINE("Online"), + + @JsonProperty("Hotel") + HOTEL("Hotel") + } + + /** + * The time when the booking amount will be charged on the traveler’s credit card. Valid values are as follows: - UponBooking - PayLater - SupplierDiscretion + * Values: UPON_BOOKING,PAY_LATER,SUPPLIER_DISCRETION + */ + enum class PaymentTime(val value: kotlin.String) { + @JsonProperty("UponBooking") + UPON_BOOKING("UponBooking"), + + @JsonProperty("PayLater") + PAY_LATER("PayLater"), + + @JsonProperty("SupplierDiscretion") + SUPPLIER_DISCRETION("SupplierDiscretion") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanAmenitiesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanAmenitiesInner.kt new file mode 100644 index 000000000..e573e018d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanAmenitiesInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id Amenity ID. + * @param name Amenity Name. + */ +data class RatePlanAmenitiesInner( + // Amenity ID. + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // Amenity Name. + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): RatePlanAmenitiesInner { + val instance = + RatePlanAmenitiesInner( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanAmenitiesInner) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanAmenitiesInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanAmenitiesInnerAllOf.kt new file mode 100644 index 000000000..eb8caff62 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanAmenitiesInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id Amenity ID. + * @param name Amenity Name. + */ +data class RatePlanAmenitiesInnerAllOf( + // Amenity ID. + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // Amenity Name. + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): RatePlanAmenitiesInnerAllOf { + val instance = + RatePlanAmenitiesInnerAllOf( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanAmenitiesInnerAllOf) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPrice.kt new file mode 100644 index 000000000..e50b26b92 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPrice.kt @@ -0,0 +1,196 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RatePlanPriceAvgNightlyRate +import com.expediagroup.sdk.xap.models.RatePlanPriceAvgNightlyStrikeOutRate +import com.expediagroup.sdk.xap.models.RatePlanPriceBaseRate +import com.expediagroup.sdk.xap.models.RatePlanPriceHotelMandatoryFees +import com.expediagroup.sdk.xap.models.RatePlanPriceNightlyRatesInner +import com.expediagroup.sdk.xap.models.RatePlanPriceRefundableDamageDeposit +import com.expediagroup.sdk.xap.models.RatePlanPriceRoomRatesInner +import com.expediagroup.sdk.xap.models.RatePlanPriceTaxesAndFees +import com.expediagroup.sdk.xap.models.RatePlanPriceTaxesAndFeesDetailsInner +import com.expediagroup.sdk.xap.models.RatePlanPriceTotalPrice +import com.expediagroup.sdk.xap.models.RatePlanPriceTotalStrikeOutPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for all price components of the rate plan. + * @param baseRate + * @param taxesAndFees + * @param totalPrice + * @param totalStrikeOutPrice + * @param avgNightlyRate + * @param avgNightlyStrikeOutRate + * @param hotelMandatoryFees + * @param refundableDamageDeposit + * @param nightlyRates Nightly base rate of the rate plan. + * @param taxesAndFeesDetails Container for taxes and fees detail information. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + * @param roomRates Container for the rate information of all rooms. This is only returned in Lodging Details API. + */ +data class RatePlanPrice( + @JsonProperty("BaseRate") + @field:Valid + val baseRate: RatePlanPriceBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: RatePlanPriceTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: RatePlanPriceTotalPrice? = null, + @JsonProperty("TotalStrikeOutPrice") + @field:Valid + val totalStrikeOutPrice: RatePlanPriceTotalStrikeOutPrice? = null, + @JsonProperty("AvgNightlyRate") + @field:Valid + val avgNightlyRate: RatePlanPriceAvgNightlyRate? = null, + @JsonProperty("AvgNightlyStrikeOutRate") + @field:Valid + val avgNightlyStrikeOutRate: RatePlanPriceAvgNightlyStrikeOutRate? = null, + @JsonProperty("HotelMandatoryFees") + @field:Valid + val hotelMandatoryFees: RatePlanPriceHotelMandatoryFees? = null, + @JsonProperty("RefundableDamageDeposit") + @field:Valid + val refundableDamageDeposit: RatePlanPriceRefundableDamageDeposit? = null, + // Nightly base rate of the rate plan. + @JsonProperty("NightlyRates") + @field:Valid + val nightlyRates: kotlin.collections.List? = null, + // Container for taxes and fees detail information. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + @JsonProperty("TaxesAndFeesDetails") + @field:Valid + val taxesAndFeesDetails: kotlin.collections.List? = null, + // Container for the rate information of all rooms. This is only returned in Lodging Details API. + @JsonProperty("RoomRates") + @field:Valid + val roomRates: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var baseRate: RatePlanPriceBaseRate? = null, + private var taxesAndFees: RatePlanPriceTaxesAndFees? = null, + private var totalPrice: RatePlanPriceTotalPrice? = null, + private var totalStrikeOutPrice: RatePlanPriceTotalStrikeOutPrice? = null, + private var avgNightlyRate: RatePlanPriceAvgNightlyRate? = null, + private var avgNightlyStrikeOutRate: RatePlanPriceAvgNightlyStrikeOutRate? = null, + private var hotelMandatoryFees: RatePlanPriceHotelMandatoryFees? = null, + private var refundableDamageDeposit: RatePlanPriceRefundableDamageDeposit? = null, + private var nightlyRates: kotlin.collections.List? = null, + private var taxesAndFeesDetails: kotlin.collections.List? = null, + private var roomRates: kotlin.collections.List? = null + ) { + fun baseRate(baseRate: RatePlanPriceBaseRate?) = apply { this.baseRate = baseRate } + + fun taxesAndFees(taxesAndFees: RatePlanPriceTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun totalPrice(totalPrice: RatePlanPriceTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun totalStrikeOutPrice(totalStrikeOutPrice: RatePlanPriceTotalStrikeOutPrice?) = apply { this.totalStrikeOutPrice = totalStrikeOutPrice } + + fun avgNightlyRate(avgNightlyRate: RatePlanPriceAvgNightlyRate?) = apply { this.avgNightlyRate = avgNightlyRate } + + fun avgNightlyStrikeOutRate(avgNightlyStrikeOutRate: RatePlanPriceAvgNightlyStrikeOutRate?) = apply { this.avgNightlyStrikeOutRate = avgNightlyStrikeOutRate } + + fun hotelMandatoryFees(hotelMandatoryFees: RatePlanPriceHotelMandatoryFees?) = apply { this.hotelMandatoryFees = hotelMandatoryFees } + + fun refundableDamageDeposit(refundableDamageDeposit: RatePlanPriceRefundableDamageDeposit?) = apply { this.refundableDamageDeposit = refundableDamageDeposit } + + fun nightlyRates(nightlyRates: kotlin.collections.List?) = apply { this.nightlyRates = nightlyRates } + + fun taxesAndFeesDetails(taxesAndFeesDetails: kotlin.collections.List?) = apply { this.taxesAndFeesDetails = taxesAndFeesDetails } + + fun roomRates(roomRates: kotlin.collections.List?) = apply { this.roomRates = roomRates } + + fun build(): RatePlanPrice { + val instance = + RatePlanPrice( + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + hotelMandatoryFees = hotelMandatoryFees, + refundableDamageDeposit = refundableDamageDeposit, + nightlyRates = nightlyRates, + taxesAndFeesDetails = taxesAndFeesDetails, + roomRates = roomRates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPrice) { + 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( + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + hotelMandatoryFees = hotelMandatoryFees, + refundableDamageDeposit = refundableDamageDeposit, + nightlyRates = nightlyRates, + taxesAndFeesDetails = taxesAndFeesDetails, + roomRates = roomRates + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceAvgNightlyRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceAvgNightlyRate.kt new file mode 100644 index 000000000..0b1c4f127 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceAvgNightlyRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average nightly base rate per night per room of the rate plan, which is equal to the `BaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceAvgNightlyRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceAvgNightlyRate { + val instance = + RatePlanPriceAvgNightlyRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceAvgNightlyRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceAvgNightlyStrikeOutRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceAvgNightlyStrikeOutRate.kt new file mode 100644 index 000000000..6b948ad35 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceAvgNightlyStrikeOutRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average nightly strike out price per night per room of the rate plan, which is equal to the strike out of `BaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceAvgNightlyStrikeOutRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceAvgNightlyStrikeOutRate { + val instance = + RatePlanPriceAvgNightlyStrikeOutRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceAvgNightlyStrikeOutRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceBaseRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceBaseRate.kt new file mode 100644 index 000000000..845f676bf --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceBaseRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The price of the rate plan for all occupants, excluding taxes and fees. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceBaseRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceBaseRate { + val instance = + RatePlanPriceBaseRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceBaseRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceHotelMandatoryFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceHotelMandatoryFees.kt new file mode 100644 index 000000000..be55341fb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceHotelMandatoryFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total mandatory fees which will be charged at the hotel for the rate plan. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceHotelMandatoryFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceHotelMandatoryFees { + val instance = + RatePlanPriceHotelMandatoryFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceHotelMandatoryFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceNightlyRatesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceNightlyRatesInner.kt new file mode 100644 index 000000000..2149da0c4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceNightlyRatesInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param stayDate A single night during the requested stay. + * @param baseRate Container for nightly base rate. + */ +data class RatePlanPriceNightlyRatesInner( + // A single night during the requested stay. + @JsonProperty("StayDate") + @field:Valid + val stayDate: kotlin.Any? = null, + // Container for nightly base rate. + @JsonProperty("BaseRate") + @field:Valid + val baseRate: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var stayDate: kotlin.Any? = null, + private var baseRate: kotlin.Any? = null + ) { + fun stayDate(stayDate: kotlin.Any?) = apply { this.stayDate = stayDate } + + fun baseRate(baseRate: kotlin.Any?) = apply { this.baseRate = baseRate } + + fun build(): RatePlanPriceNightlyRatesInner { + val instance = + RatePlanPriceNightlyRatesInner( + stayDate = stayDate, + baseRate = baseRate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceNightlyRatesInner) { + 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( + stayDate = stayDate, + baseRate = baseRate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceNightlyRatesInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceNightlyRatesInnerAllOf.kt new file mode 100644 index 000000000..a20247e9a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceNightlyRatesInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param stayDate A single night during the requested stay. + * @param baseRate Container for nightly base rate. + */ +data class RatePlanPriceNightlyRatesInnerAllOf( + // A single night during the requested stay. + @JsonProperty("StayDate") + @field:Valid + val stayDate: kotlin.Any? = null, + // Container for nightly base rate. + @JsonProperty("BaseRate") + @field:Valid + val baseRate: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var stayDate: kotlin.Any? = null, + private var baseRate: kotlin.Any? = null + ) { + fun stayDate(stayDate: kotlin.Any?) = apply { this.stayDate = stayDate } + + fun baseRate(baseRate: kotlin.Any?) = apply { this.baseRate = baseRate } + + fun build(): RatePlanPriceNightlyRatesInnerAllOf { + val instance = + RatePlanPriceNightlyRatesInnerAllOf( + stayDate = stayDate, + baseRate = baseRate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceNightlyRatesInnerAllOf) { + 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( + stayDate = stayDate, + baseRate = baseRate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceRefundableDamageDeposit.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceRefundableDamageDeposit.kt new file mode 100644 index 000000000..c64b17ba3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceRefundableDamageDeposit.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The refundable damage deposit. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceRefundableDamageDeposit( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceRefundableDamageDeposit { + val instance = + RatePlanPriceRefundableDamageDeposit( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceRefundableDamageDeposit) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceRoomRatesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceRoomRatesInner.kt new file mode 100644 index 000000000..58f63dc10 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceRoomRatesInner.kt @@ -0,0 +1,165 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.MandatoryFeesDetail +import com.expediagroup.sdk.xap.models.RoomRatesBaseRate +import com.expediagroup.sdk.xap.models.RoomRatesNightlyRatesInner +import com.expediagroup.sdk.xap.models.RoomRatesTaxesAndFees +import com.expediagroup.sdk.xap.models.RoomRatesTaxesAndFeesDetailsInner +import com.expediagroup.sdk.xap.models.RoomRatesTotalPrice +import com.expediagroup.sdk.xap.models.RoomRatesTotalStrikeOutPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param roomIndex Index of which of the requested rooms this entry refers to. + * @param baseRate + * @param taxesAndFees + * @param totalPrice + * @param totalStrikeOutPrice + * @param taxesAndFeesDetails The breakdown for taxes and fees for this room for the entire stay. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + * @param mandatoryFeesDetails The breakdown for the taxes and fees that must be paid at the property. + * @param nightlyRates Container for the nightly rate of current room. + */ +data class RatePlanPriceRoomRatesInner( + // Index of which of the requested rooms this entry refers to. + @JsonProperty("RoomIndex") + val roomIndex: kotlin.Int? = null, + @JsonProperty("BaseRate") + @field:Valid + val baseRate: RoomRatesBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: RoomRatesTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: RoomRatesTotalPrice? = null, + @JsonProperty("TotalStrikeOutPrice") + @field:Valid + val totalStrikeOutPrice: RoomRatesTotalStrikeOutPrice? = null, + // The breakdown for taxes and fees for this room for the entire stay. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + @JsonProperty("TaxesAndFeesDetails") + @field:Valid + val taxesAndFeesDetails: kotlin.collections.List? = null, + // The breakdown for the taxes and fees that must be paid at the property. + @JsonProperty("MandatoryFeesDetails") + @field:Valid + val mandatoryFeesDetails: kotlin.collections.List? = null, + // Container for the nightly rate of current room. + @JsonProperty("NightlyRates") + @field:Valid + val nightlyRates: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var roomIndex: kotlin.Int? = null, + private var baseRate: RoomRatesBaseRate? = null, + private var taxesAndFees: RoomRatesTaxesAndFees? = null, + private var totalPrice: RoomRatesTotalPrice? = null, + private var totalStrikeOutPrice: RoomRatesTotalStrikeOutPrice? = null, + private var taxesAndFeesDetails: kotlin.collections.List? = null, + private var mandatoryFeesDetails: kotlin.collections.List? = null, + private var nightlyRates: kotlin.collections.List? = null + ) { + fun roomIndex(roomIndex: kotlin.Int?) = apply { this.roomIndex = roomIndex } + + fun baseRate(baseRate: RoomRatesBaseRate?) = apply { this.baseRate = baseRate } + + fun taxesAndFees(taxesAndFees: RoomRatesTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun totalPrice(totalPrice: RoomRatesTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun totalStrikeOutPrice(totalStrikeOutPrice: RoomRatesTotalStrikeOutPrice?) = apply { this.totalStrikeOutPrice = totalStrikeOutPrice } + + fun taxesAndFeesDetails(taxesAndFeesDetails: kotlin.collections.List?) = apply { this.taxesAndFeesDetails = taxesAndFeesDetails } + + fun mandatoryFeesDetails(mandatoryFeesDetails: kotlin.collections.List?) = apply { this.mandatoryFeesDetails = mandatoryFeesDetails } + + fun nightlyRates(nightlyRates: kotlin.collections.List?) = apply { this.nightlyRates = nightlyRates } + + fun build(): RatePlanPriceRoomRatesInner { + val instance = + RatePlanPriceRoomRatesInner( + roomIndex = roomIndex, + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + taxesAndFeesDetails = taxesAndFeesDetails, + mandatoryFeesDetails = mandatoryFeesDetails, + nightlyRates = nightlyRates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceRoomRatesInner) { + 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( + roomIndex = roomIndex, + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + taxesAndFeesDetails = taxesAndFeesDetails, + mandatoryFeesDetails = mandatoryFeesDetails, + nightlyRates = nightlyRates + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFees.kt new file mode 100644 index 000000000..abe8bca24 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total rate of taxes and fees of the rate plan for all occupants. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceTaxesAndFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceTaxesAndFees { + val instance = + RatePlanPriceTaxesAndFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceTaxesAndFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFeesDetailsInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFeesDetailsInner.kt new file mode 100644 index 000000000..39cdae6df --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFeesDetailsInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param categoryCode Category ID of this specific tax or fee. + * @param amount The value of this specific tax or fee. + */ +data class RatePlanPriceTaxesAndFeesDetailsInner( + // Category ID of this specific tax or fee. + @JsonProperty("CategoryCode") + @field:Valid + val categoryCode: kotlin.Any? = null, + // The value of this specific tax or fee. + @JsonProperty("Amount") + @field:Valid + val amount: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var categoryCode: kotlin.Any? = null, + private var amount: kotlin.Any? = null + ) { + fun categoryCode(categoryCode: kotlin.Any?) = apply { this.categoryCode = categoryCode } + + fun amount(amount: kotlin.Any?) = apply { this.amount = amount } + + fun build(): RatePlanPriceTaxesAndFeesDetailsInner { + val instance = + RatePlanPriceTaxesAndFeesDetailsInner( + categoryCode = categoryCode, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceTaxesAndFeesDetailsInner) { + 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( + categoryCode = categoryCode, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFeesDetailsInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFeesDetailsInnerAllOf.kt new file mode 100644 index 000000000..e64d779c9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTaxesAndFeesDetailsInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param categoryCode Category ID of this specific tax or fee. + * @param amount The value of this specific tax or fee. + */ +data class RatePlanPriceTaxesAndFeesDetailsInnerAllOf( + // Category ID of this specific tax or fee. + @JsonProperty("CategoryCode") + @field:Valid + val categoryCode: kotlin.Any? = null, + // The value of this specific tax or fee. + @JsonProperty("Amount") + @field:Valid + val amount: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var categoryCode: kotlin.Any? = null, + private var amount: kotlin.Any? = null + ) { + fun categoryCode(categoryCode: kotlin.Any?) = apply { this.categoryCode = categoryCode } + + fun amount(amount: kotlin.Any?) = apply { this.amount = amount } + + fun build(): RatePlanPriceTaxesAndFeesDetailsInnerAllOf { + val instance = + RatePlanPriceTaxesAndFeesDetailsInnerAllOf( + categoryCode = categoryCode, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceTaxesAndFeesDetailsInnerAllOf) { + 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( + categoryCode = categoryCode, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTotalPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTotalPrice.kt new file mode 100644 index 000000000..f9a09b8e9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTotalPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total price of the rate plan, which is equal to the sum of `BaseRate` + `TaxesAndFees`. Hotel mandatory fees are not included in this value as these are paid at the hotel at checkout. Promotion amount have been deducted from the `TotalPrice` value. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceTotalPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceTotalPrice { + val instance = + RatePlanPriceTotalPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceTotalPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTotalStrikeOutPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTotalStrikeOutPrice.kt new file mode 100644 index 000000000..6ca234123 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanPriceTotalStrikeOutPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total amount to strikeout price. This value is the sum of the pre-discount `BaseRate` + the pre-discount `TaxesAndFees`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanPriceTotalStrikeOutPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanPriceTotalStrikeOutPrice { + val instance = + RatePlanPriceTotalStrikeOutPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanPriceTotalStrikeOutPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePrice.kt new file mode 100644 index 000000000..f4a1ec8d7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePrice.kt @@ -0,0 +1,187 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceAvgNightlyRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceAvgNightlyStrikeOutRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceBaseRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceHotelMandatoryFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceStrikeOutBaseRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceStrikeOutHotelMandatoryFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceStrikeOutTaxesAndFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceTaxesAndFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceTotalPrice +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceTotalStrikeOutPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The corresponded standalone price to the package rate plan (to show the `strikethrough`). Only returned when the returned `rateplan` is being used as part of a package. + * @param baseRate + * @param strikeOutBaseRate + * @param taxesAndFees + * @param strikeOutTaxesAndFees + * @param totalPrice + * @param totalStrikeOutPrice + * @param avgNightlyRate + * @param avgNightlyStrikeOutRate + * @param hotelMandatoryFees + * @param strikeOutHotelMandatoryFees + */ +data class RatePlanStandalonePrice( + @JsonProperty("BaseRate") + @field:Valid + val baseRate: RatePlanStandalonePriceBaseRate? = null, + @JsonProperty("StrikeOutBaseRate") + @field:Valid + val strikeOutBaseRate: RatePlanStandalonePriceStrikeOutBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: RatePlanStandalonePriceTaxesAndFees? = null, + @JsonProperty("StrikeOutTaxesAndFees") + @field:Valid + val strikeOutTaxesAndFees: RatePlanStandalonePriceStrikeOutTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: RatePlanStandalonePriceTotalPrice? = null, + @JsonProperty("TotalStrikeOutPrice") + @field:Valid + val totalStrikeOutPrice: RatePlanStandalonePriceTotalStrikeOutPrice? = null, + @JsonProperty("AvgNightlyRate") + @field:Valid + val avgNightlyRate: RatePlanStandalonePriceAvgNightlyRate? = null, + @JsonProperty("AvgNightlyStrikeOutRate") + @field:Valid + val avgNightlyStrikeOutRate: RatePlanStandalonePriceAvgNightlyStrikeOutRate? = null, + @JsonProperty("HotelMandatoryFees") + @field:Valid + val hotelMandatoryFees: RatePlanStandalonePriceHotelMandatoryFees? = null, + @JsonProperty("StrikeOutHotelMandatoryFees") + @field:Valid + val strikeOutHotelMandatoryFees: RatePlanStandalonePriceStrikeOutHotelMandatoryFees? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var baseRate: RatePlanStandalonePriceBaseRate? = null, + private var strikeOutBaseRate: RatePlanStandalonePriceStrikeOutBaseRate? = null, + private var taxesAndFees: RatePlanStandalonePriceTaxesAndFees? = null, + private var strikeOutTaxesAndFees: RatePlanStandalonePriceStrikeOutTaxesAndFees? = null, + private var totalPrice: RatePlanStandalonePriceTotalPrice? = null, + private var totalStrikeOutPrice: RatePlanStandalonePriceTotalStrikeOutPrice? = null, + private var avgNightlyRate: RatePlanStandalonePriceAvgNightlyRate? = null, + private var avgNightlyStrikeOutRate: RatePlanStandalonePriceAvgNightlyStrikeOutRate? = null, + private var hotelMandatoryFees: RatePlanStandalonePriceHotelMandatoryFees? = null, + private var strikeOutHotelMandatoryFees: RatePlanStandalonePriceStrikeOutHotelMandatoryFees? = null + ) { + fun baseRate(baseRate: RatePlanStandalonePriceBaseRate?) = apply { this.baseRate = baseRate } + + fun strikeOutBaseRate(strikeOutBaseRate: RatePlanStandalonePriceStrikeOutBaseRate?) = apply { this.strikeOutBaseRate = strikeOutBaseRate } + + fun taxesAndFees(taxesAndFees: RatePlanStandalonePriceTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun strikeOutTaxesAndFees(strikeOutTaxesAndFees: RatePlanStandalonePriceStrikeOutTaxesAndFees?) = apply { this.strikeOutTaxesAndFees = strikeOutTaxesAndFees } + + fun totalPrice(totalPrice: RatePlanStandalonePriceTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun totalStrikeOutPrice(totalStrikeOutPrice: RatePlanStandalonePriceTotalStrikeOutPrice?) = apply { this.totalStrikeOutPrice = totalStrikeOutPrice } + + fun avgNightlyRate(avgNightlyRate: RatePlanStandalonePriceAvgNightlyRate?) = apply { this.avgNightlyRate = avgNightlyRate } + + fun avgNightlyStrikeOutRate(avgNightlyStrikeOutRate: RatePlanStandalonePriceAvgNightlyStrikeOutRate?) = apply { this.avgNightlyStrikeOutRate = avgNightlyStrikeOutRate } + + fun hotelMandatoryFees(hotelMandatoryFees: RatePlanStandalonePriceHotelMandatoryFees?) = apply { this.hotelMandatoryFees = hotelMandatoryFees } + + fun strikeOutHotelMandatoryFees(strikeOutHotelMandatoryFees: RatePlanStandalonePriceStrikeOutHotelMandatoryFees?) = + apply { + this.strikeOutHotelMandatoryFees = + strikeOutHotelMandatoryFees + } + + fun build(): RatePlanStandalonePrice { + val instance = + RatePlanStandalonePrice( + baseRate = baseRate, + strikeOutBaseRate = strikeOutBaseRate, + taxesAndFees = taxesAndFees, + strikeOutTaxesAndFees = strikeOutTaxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + hotelMandatoryFees = hotelMandatoryFees, + strikeOutHotelMandatoryFees = strikeOutHotelMandatoryFees + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePrice) { + 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( + baseRate = baseRate, + strikeOutBaseRate = strikeOutBaseRate, + taxesAndFees = taxesAndFees, + strikeOutTaxesAndFees = strikeOutTaxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + hotelMandatoryFees = hotelMandatoryFees, + strikeOutHotelMandatoryFees = strikeOutHotelMandatoryFees + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceAvgNightlyRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceAvgNightlyRate.kt new file mode 100644 index 000000000..f420ce0d1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceAvgNightlyRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average standalone nightly base rate per night per room of the rate plan, which is equal to the `BaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceAvgNightlyRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceAvgNightlyRate { + val instance = + RatePlanStandalonePriceAvgNightlyRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceAvgNightlyRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceAvgNightlyStrikeOutRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceAvgNightlyStrikeOutRate.kt new file mode 100644 index 000000000..61d776320 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceAvgNightlyStrikeOutRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average strikeout of the base rate in the standalone shopping path, which is per night per room and is equal to `StrikeOutBaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceAvgNightlyStrikeOutRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceAvgNightlyStrikeOutRate { + val instance = + RatePlanStandalonePriceAvgNightlyStrikeOutRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceAvgNightlyStrikeOutRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceBaseRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceBaseRate.kt new file mode 100644 index 000000000..731322a14 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceBaseRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The standalone price of the rate plan for all occupants, excluding taxes and fees. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceBaseRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceBaseRate { + val instance = + RatePlanStandalonePriceBaseRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceBaseRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceHotelMandatoryFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceHotelMandatoryFees.kt new file mode 100644 index 000000000..fca3776fc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceHotelMandatoryFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total standalone mandatory fees. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceHotelMandatoryFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceHotelMandatoryFees { + val instance = + RatePlanStandalonePriceHotelMandatoryFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceHotelMandatoryFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutBaseRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutBaseRate.kt new file mode 100644 index 000000000..074cbd2e0 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutBaseRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The base rate strikeout in the standalone shopping path. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceStrikeOutBaseRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceStrikeOutBaseRate { + val instance = + RatePlanStandalonePriceStrikeOutBaseRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceStrikeOutBaseRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutHotelMandatoryFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutHotelMandatoryFees.kt new file mode 100644 index 000000000..a2d729701 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutHotelMandatoryFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The strikeout of the mandatory fees in the standalone shopping path. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceStrikeOutHotelMandatoryFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceStrikeOutHotelMandatoryFees { + val instance = + RatePlanStandalonePriceStrikeOutHotelMandatoryFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceStrikeOutHotelMandatoryFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutTaxesAndFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutTaxesAndFees.kt new file mode 100644 index 000000000..51fee932a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceStrikeOutTaxesAndFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The taxes and fees strikeout in the standalone shopping path. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceStrikeOutTaxesAndFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceStrikeOutTaxesAndFees { + val instance = + RatePlanStandalonePriceStrikeOutTaxesAndFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceStrikeOutTaxesAndFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTaxesAndFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTaxesAndFees.kt new file mode 100644 index 000000000..61764d1e2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTaxesAndFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total standalone rate of taxes and fees of the rate plan for all occupants. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceTaxesAndFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceTaxesAndFees { + val instance = + RatePlanStandalonePriceTaxesAndFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceTaxesAndFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTotalPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTotalPrice.kt new file mode 100644 index 000000000..da20178e9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTotalPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total standalone price of the rate plan, which is equal to the sum of `BaseRate` and `TaxesAndFees`. Hotel mandatory fees are not included as these are paid at the hotel at checkout. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceTotalPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceTotalPrice { + val instance = + RatePlanStandalonePriceTotalPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceTotalPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTotalStrikeOutPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTotalStrikeOutPrice.kt new file mode 100644 index 000000000..953de54d9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatePlanStandalonePriceTotalStrikeOutPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total strikeout in the standalone shopping path, which is equal to the sum of `StrikeOutBaseRate` and `StrikeOutTaxesAndFees`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RatePlanStandalonePriceTotalStrikeOutPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RatePlanStandalonePriceTotalStrikeOutPrice { + val instance = + RatePlanStandalonePriceTotalStrikeOutPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatePlanStandalonePriceTotalStrikeOutPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Rating.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Rating.kt new file mode 100644 index 000000000..561c4766b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Rating.kt @@ -0,0 +1,117 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RatingDetails +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 + +/** + * The rating of the car being offered. + * @param ratingPercentage The percentage of rating. + * @param ratingCount The total count of rating. + * @param ratingDetails List of all the details of rating. + */ +data class Rating( + // The percentage of rating. + @JsonProperty("RatingPercentage") + @field:NotNull + @field:Valid + val ratingPercentage: kotlin.String, + // The total count of rating. + @JsonProperty("RatingCount") + @field:NotNull + @field:Valid + val ratingCount: kotlin.String, + // List of all the details of rating. + @JsonProperty("RatingDetails") + @field:Valid + val ratingDetails: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var ratingPercentage: kotlin.String? = null, + private var ratingCount: kotlin.String? = null, + private var ratingDetails: kotlin.collections.List? = null + ) { + fun ratingPercentage(ratingPercentage: kotlin.String) = apply { this.ratingPercentage = ratingPercentage } + + fun ratingCount(ratingCount: kotlin.String) = apply { this.ratingCount = ratingCount } + + fun ratingDetails(ratingDetails: kotlin.collections.List?) = apply { this.ratingDetails = ratingDetails } + + fun build(): Rating { + val instance = + Rating( + ratingPercentage = ratingPercentage!!, + ratingCount = ratingCount!!, + ratingDetails = ratingDetails + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Rating) { + 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( + ratingPercentage = ratingPercentage!!, + ratingCount = ratingCount!!, + ratingDetails = ratingDetails + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatingDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatingDetails.kt new file mode 100644 index 000000000..28e075cb8 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatingDetails.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * List of all the details of rating. + * @param category The category of rating detail. + * @param percentage The percentage of rating detail category. + */ +data class RatingDetails( + // The category of rating detail. + @JsonProperty("Category") + @field:NotNull + @field:Valid + val category: kotlin.String, + // The percentage of rating detail category. + @JsonProperty("Percentage") + @field:NotNull + @field:Valid + val percentage: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var category: kotlin.String? = null, + private var percentage: kotlin.String? = null + ) { + fun category(category: kotlin.String) = apply { this.category = category } + + fun percentage(percentage: kotlin.String) = apply { this.percentage = percentage } + + fun build(): RatingDetails { + val instance = + RatingDetails( + category = category!!, + percentage = percentage!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatingDetails) { + 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( + category = category!!, + percentage = percentage!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatingWithoutDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatingWithoutDetails.kt new file mode 100644 index 000000000..184f6d22a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RatingWithoutDetails.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * The rating of the car being offered. + * @param ratingPercentage The percentage of rating. + * @param ratingCount The total count of rating. + */ +data class RatingWithoutDetails( + // The percentage of rating. + @JsonProperty("RatingPercentage") + @field:NotNull + @field:Valid + val ratingPercentage: kotlin.String, + // The total count of rating. + @JsonProperty("RatingCount") + @field:NotNull + @field:Valid + val ratingCount: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var ratingPercentage: kotlin.String? = null, + private var ratingCount: kotlin.String? = null + ) { + fun ratingPercentage(ratingPercentage: kotlin.String) = apply { this.ratingPercentage = ratingPercentage } + + fun ratingCount(ratingCount: kotlin.String) = apply { this.ratingCount = ratingCount } + + fun build(): RatingWithoutDetails { + val instance = + RatingWithoutDetails( + ratingPercentage = ratingPercentage!!, + ratingCount = ratingCount!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RatingWithoutDetails) { + 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( + ratingPercentage = ratingPercentage!!, + ratingCount = ratingCount!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RentalLimits.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RentalLimits.kt new file mode 100644 index 000000000..2764c1589 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RentalLimits.kt @@ -0,0 +1,105 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Duration +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 + +/** + * Limitations that are part of this rental agreement. + * @param minDuration + * @param maxDuration + */ +data class RentalLimits( + @JsonProperty("MinDuration") + @field:NotNull + @field:Valid + val minDuration: Duration, + @JsonProperty("MaxDuration") + @field:NotNull + @field:Valid + val maxDuration: Duration +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var minDuration: Duration? = null, + private var maxDuration: Duration? = null + ) { + fun minDuration(minDuration: Duration) = apply { this.minDuration = minDuration } + + fun maxDuration(maxDuration: Duration) = apply { this.maxDuration = maxDuration } + + fun build(): RentalLimits { + val instance = + RentalLimits( + minDuration = minDuration!!, + maxDuration = maxDuration!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RentalLimits) { + 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( + minDuration = minDuration!!, + maxDuration = maxDuration!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Room.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Room.kt new file mode 100644 index 000000000..3b86043e9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Room.kt @@ -0,0 +1,41 @@ +/* + * 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.xap.models + +data class Room( + val adults: Long?, + val childAges: List? +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var adults: Long? = null, + private var childAges: List? = null + ) { + fun adults(adults: Long?) = apply { this.adults = adults } + + fun childAges(childAges: List?) = apply { this.childAges = childAges } + + fun build(): Room = + Room( + adults = this.adults, + childAges = this.childAges + ) + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomOccupancyPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomOccupancyPolicy.kt new file mode 100644 index 000000000..784bbeea1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomOccupancyPolicy.kt @@ -0,0 +1,130 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.AgeClassRestriction +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Room occupancy policy. + * @param maxGuestCount The maximum number of guests allowed to stay in a room. + * @param minCheckInAge The minimum age required for check-in. + * @param includedGuestCount The number of guests included in base rate. + * @param minGuestAge The minimum age required for any guest staying in the room. + * @param ageClassRestrictions Container for room occupancy rules based on the age of the guests. + */ +data class RoomOccupancyPolicy( + // The maximum number of guests allowed to stay in a room. + @JsonProperty("MaxGuestCount") + val maxGuestCount: kotlin.Int? = null, + // The minimum age required for check-in. + @JsonProperty("MinCheckInAge") + val minCheckInAge: kotlin.Int? = null, + // The number of guests included in base rate. + @JsonProperty("IncludedGuestCount") + val includedGuestCount: kotlin.Int? = null, + // The minimum age required for any guest staying in the room. + @JsonProperty("MinGuestAge") + val minGuestAge: kotlin.Int? = null, + // Container for room occupancy rules based on the age of the guests. + @JsonProperty("AgeClassRestrictions") + @field:Valid + val ageClassRestrictions: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var maxGuestCount: kotlin.Int? = null, + private var minCheckInAge: kotlin.Int? = null, + private var includedGuestCount: kotlin.Int? = null, + private var minGuestAge: kotlin.Int? = null, + private var ageClassRestrictions: kotlin.collections.List? = null + ) { + fun maxGuestCount(maxGuestCount: kotlin.Int?) = apply { this.maxGuestCount = maxGuestCount } + + fun minCheckInAge(minCheckInAge: kotlin.Int?) = apply { this.minCheckInAge = minCheckInAge } + + fun includedGuestCount(includedGuestCount: kotlin.Int?) = apply { this.includedGuestCount = includedGuestCount } + + fun minGuestAge(minGuestAge: kotlin.Int?) = apply { this.minGuestAge = minGuestAge } + + fun ageClassRestrictions(ageClassRestrictions: kotlin.collections.List?) = apply { this.ageClassRestrictions = ageClassRestrictions } + + fun build(): RoomOccupancyPolicy { + val instance = + RoomOccupancyPolicy( + maxGuestCount = maxGuestCount, + minCheckInAge = minCheckInAge, + includedGuestCount = includedGuestCount, + minGuestAge = minGuestAge, + ageClassRestrictions = ageClassRestrictions + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomOccupancyPolicy) { + 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( + maxGuestCount = maxGuestCount, + minCheckInAge = minCheckInAge, + includedGuestCount = includedGuestCount, + minGuestAge = minGuestAge, + ageClassRestrictions = ageClassRestrictions + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomPreference.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomPreference.kt new file mode 100644 index 000000000..1ff685628 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomPreference.kt @@ -0,0 +1,114 @@ +/* + * 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.xap.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 + +/** + * Container for room preferences. + * @param type The type of preference. Options are: SmokingPreference Bed + * @param `value` The value of the room preference. For SmokingPreference, options are SmokingOrNonSmoking Smoking NonSmoking For supported Bed Types, please refer to the Related Links section at the bottom of the page. + */ +data class RoomPreference( + // The type of preference. Options are: SmokingPreference Bed + @JsonProperty("Type") + val type: RoomPreference.Type? = null, + // The value of the room preference. For SmokingPreference, options are SmokingOrNonSmoking Smoking NonSmoking For supported Bed Types, please refer to the Related Links section at the bottom of the page. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: RoomPreference.Type? = null, + private var `value`: kotlin.String? = null + ) { + fun type(type: RoomPreference.Type?) = apply { this.type = type } + + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun build(): RoomPreference { + val instance = + RoomPreference( + type = type, + `value` = `value` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomPreference) { + 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( + type = type, + `value` = `value` + ) + + /** + * The type of preference. Options are: SmokingPreference Bed + * Values: SMOKING_PREFERENCE,BED + */ + enum class Type(val value: kotlin.String) { + @JsonProperty("SmokingPreference") + SMOKING_PREFERENCE("SmokingPreference"), + + @JsonProperty("Bed") + BED("Bed") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRates.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRates.kt new file mode 100644 index 000000000..4c7b21ab3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRates.kt @@ -0,0 +1,165 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.MandatoryFeesDetail +import com.expediagroup.sdk.xap.models.RoomRatesBaseRate +import com.expediagroup.sdk.xap.models.RoomRatesNightlyRatesInner +import com.expediagroup.sdk.xap.models.RoomRatesTaxesAndFees +import com.expediagroup.sdk.xap.models.RoomRatesTaxesAndFeesDetailsInner +import com.expediagroup.sdk.xap.models.RoomRatesTotalPrice +import com.expediagroup.sdk.xap.models.RoomRatesTotalStrikeOutPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param roomIndex Index of which of the requested rooms this entry refers to. + * @param baseRate + * @param taxesAndFees + * @param totalPrice + * @param totalStrikeOutPrice + * @param taxesAndFeesDetails The breakdown for taxes and fees for this room for the entire stay. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + * @param mandatoryFeesDetails The breakdown for the taxes and fees that must be paid at the property. + * @param nightlyRates Container for the nightly rate of current room. + */ +data class RoomRates( + // Index of which of the requested rooms this entry refers to. + @JsonProperty("RoomIndex") + val roomIndex: kotlin.Int? = null, + @JsonProperty("BaseRate") + @field:Valid + val baseRate: RoomRatesBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: RoomRatesTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: RoomRatesTotalPrice? = null, + @JsonProperty("TotalStrikeOutPrice") + @field:Valid + val totalStrikeOutPrice: RoomRatesTotalStrikeOutPrice? = null, + // The breakdown for taxes and fees for this room for the entire stay. Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + @JsonProperty("TaxesAndFeesDetails") + @field:Valid + val taxesAndFeesDetails: kotlin.collections.List? = null, + // The breakdown for the taxes and fees that must be paid at the property. + @JsonProperty("MandatoryFeesDetails") + @field:Valid + val mandatoryFeesDetails: kotlin.collections.List? = null, + // Container for the nightly rate of current room. + @JsonProperty("NightlyRates") + @field:Valid + val nightlyRates: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var roomIndex: kotlin.Int? = null, + private var baseRate: RoomRatesBaseRate? = null, + private var taxesAndFees: RoomRatesTaxesAndFees? = null, + private var totalPrice: RoomRatesTotalPrice? = null, + private var totalStrikeOutPrice: RoomRatesTotalStrikeOutPrice? = null, + private var taxesAndFeesDetails: kotlin.collections.List? = null, + private var mandatoryFeesDetails: kotlin.collections.List? = null, + private var nightlyRates: kotlin.collections.List? = null + ) { + fun roomIndex(roomIndex: kotlin.Int?) = apply { this.roomIndex = roomIndex } + + fun baseRate(baseRate: RoomRatesBaseRate?) = apply { this.baseRate = baseRate } + + fun taxesAndFees(taxesAndFees: RoomRatesTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun totalPrice(totalPrice: RoomRatesTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun totalStrikeOutPrice(totalStrikeOutPrice: RoomRatesTotalStrikeOutPrice?) = apply { this.totalStrikeOutPrice = totalStrikeOutPrice } + + fun taxesAndFeesDetails(taxesAndFeesDetails: kotlin.collections.List?) = apply { this.taxesAndFeesDetails = taxesAndFeesDetails } + + fun mandatoryFeesDetails(mandatoryFeesDetails: kotlin.collections.List?) = apply { this.mandatoryFeesDetails = mandatoryFeesDetails } + + fun nightlyRates(nightlyRates: kotlin.collections.List?) = apply { this.nightlyRates = nightlyRates } + + fun build(): RoomRates { + val instance = + RoomRates( + roomIndex = roomIndex, + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + taxesAndFeesDetails = taxesAndFeesDetails, + mandatoryFeesDetails = mandatoryFeesDetails, + nightlyRates = nightlyRates + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRates) { + 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( + roomIndex = roomIndex, + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + taxesAndFeesDetails = taxesAndFeesDetails, + mandatoryFeesDetails = mandatoryFeesDetails, + nightlyRates = nightlyRates + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesBaseRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesBaseRate.kt new file mode 100644 index 000000000..d394ff996 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesBaseRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomRatesBaseRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomRatesBaseRate { + val instance = + RoomRatesBaseRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesBaseRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesNightlyRatesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesNightlyRatesInner.kt new file mode 100644 index 000000000..343dd3abc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesNightlyRatesInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param stayDate One date of the property stay + * @param baseRate Nightly Base Rate for the selected date of stay. + */ +data class RoomRatesNightlyRatesInner( + // One date of the property stay + @JsonProperty("StayDate") + @field:Valid + val stayDate: kotlin.Any? = null, + // Nightly Base Rate for the selected date of stay. + @JsonProperty("BaseRate") + @field:Valid + val baseRate: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var stayDate: kotlin.Any? = null, + private var baseRate: kotlin.Any? = null + ) { + fun stayDate(stayDate: kotlin.Any?) = apply { this.stayDate = stayDate } + + fun baseRate(baseRate: kotlin.Any?) = apply { this.baseRate = baseRate } + + fun build(): RoomRatesNightlyRatesInner { + val instance = + RoomRatesNightlyRatesInner( + stayDate = stayDate, + baseRate = baseRate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesNightlyRatesInner) { + 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( + stayDate = stayDate, + baseRate = baseRate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesNightlyRatesInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesNightlyRatesInnerAllOf.kt new file mode 100644 index 000000000..2120e407b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesNightlyRatesInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param stayDate One date of the property stay + * @param baseRate Nightly Base Rate for the selected date of stay. + */ +data class RoomRatesNightlyRatesInnerAllOf( + // One date of the property stay + @JsonProperty("StayDate") + @field:Valid + val stayDate: kotlin.Any? = null, + // Nightly Base Rate for the selected date of stay. + @JsonProperty("BaseRate") + @field:Valid + val baseRate: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var stayDate: kotlin.Any? = null, + private var baseRate: kotlin.Any? = null + ) { + fun stayDate(stayDate: kotlin.Any?) = apply { this.stayDate = stayDate } + + fun baseRate(baseRate: kotlin.Any?) = apply { this.baseRate = baseRate } + + fun build(): RoomRatesNightlyRatesInnerAllOf { + val instance = + RoomRatesNightlyRatesInnerAllOf( + stayDate = stayDate, + baseRate = baseRate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesNightlyRatesInnerAllOf) { + 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( + stayDate = stayDate, + baseRate = baseRate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFees.kt new file mode 100644 index 000000000..c954065d2 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomRatesTaxesAndFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomRatesTaxesAndFees { + val instance = + RoomRatesTaxesAndFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesTaxesAndFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFeesDetailsInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFeesDetailsInner.kt new file mode 100644 index 000000000..e7f4b0ae5 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFeesDetailsInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param categoryCode Tax or fee category code. + * @param amount Tax or fee value. + */ +data class RoomRatesTaxesAndFeesDetailsInner( + // Tax or fee category code. + @JsonProperty("CategoryCode") + @field:Valid + val categoryCode: kotlin.Any? = null, + // Tax or fee value. + @JsonProperty("Amount") + @field:Valid + val amount: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var categoryCode: kotlin.Any? = null, + private var amount: kotlin.Any? = null + ) { + fun categoryCode(categoryCode: kotlin.Any?) = apply { this.categoryCode = categoryCode } + + fun amount(amount: kotlin.Any?) = apply { this.amount = amount } + + fun build(): RoomRatesTaxesAndFeesDetailsInner { + val instance = + RoomRatesTaxesAndFeesDetailsInner( + categoryCode = categoryCode, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesTaxesAndFeesDetailsInner) { + 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( + categoryCode = categoryCode, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFeesDetailsInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFeesDetailsInnerAllOf.kt new file mode 100644 index 000000000..ad1bc49e8 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTaxesAndFeesDetailsInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param categoryCode Tax or fee category code. + * @param amount Tax or fee value. + */ +data class RoomRatesTaxesAndFeesDetailsInnerAllOf( + // Tax or fee category code. + @JsonProperty("CategoryCode") + @field:Valid + val categoryCode: kotlin.Any? = null, + // Tax or fee value. + @JsonProperty("Amount") + @field:Valid + val amount: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var categoryCode: kotlin.Any? = null, + private var amount: kotlin.Any? = null + ) { + fun categoryCode(categoryCode: kotlin.Any?) = apply { this.categoryCode = categoryCode } + + fun amount(amount: kotlin.Any?) = apply { this.amount = amount } + + fun build(): RoomRatesTaxesAndFeesDetailsInnerAllOf { + val instance = + RoomRatesTaxesAndFeesDetailsInnerAllOf( + categoryCode = categoryCode, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesTaxesAndFeesDetailsInnerAllOf) { + 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( + categoryCode = categoryCode, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTotalPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTotalPrice.kt new file mode 100644 index 000000000..1505b956c --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTotalPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomRatesTotalPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomRatesTotalPrice { + val instance = + RoomRatesTotalPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesTotalPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTotalStrikeOutPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTotalStrikeOutPrice.kt new file mode 100644 index 000000000..536d30cbd --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomRatesTotalStrikeOutPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomRatesTotalStrikeOutPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomRatesTotalStrikeOutPrice { + val instance = + RoomRatesTotalStrikeOutPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomRatesTotalStrikeOutPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomType.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomType.kt new file mode 100644 index 000000000..5b42f0176 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomType.kt @@ -0,0 +1,282 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.BedType +import com.expediagroup.sdk.xap.models.Promotion +import com.expediagroup.sdk.xap.models.RatePlan +import com.expediagroup.sdk.xap.models.RoomOccupancyPolicy +import com.expediagroup.sdk.xap.models.RoomTypeAmenitiesInner +import com.expediagroup.sdk.xap.models.RoomTypeLinks +import com.expediagroup.sdk.xap.models.RoomTypeMediaInner +import com.expediagroup.sdk.xap.models.RoomTypePrice +import com.expediagroup.sdk.xap.models.RoomTypeStandalonePrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param description Text description of the room type. + * @param roomKey An encrypted string which includes the information that could be used to address the current room type. `RoomKey` has been renamed as `OfferId`. + * @param offerId An encrypted string which includes the information that could be used to address the current room type. + * @param merchantName Name of Merchant that did the initial Authentication. + * @param ratePlanType Indicate the room type is sold as package or standalone. + * @param ratePlans Container for rate plan information. + * @param price + * @param standalonePrice + * @param promotionsDeprecated All promotion information of the room. **Note**: The node has been moved to `RatePlan` node, and will be deprecated soon. + * @param links + * @param smokingOption The smoking options available for the room type. + * @param bedTypeOptions Statement of bed types available for this offer. A room may have several bed type options available. **NOTE**: due to the large number of bed type options available, we no longer publish a list of available bed types. More information is available in [Lodging Bed Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/bed-types). + * @param roomOccupancyPolicy + * @param amenities Container for all room amenities. + * @param descriptiveAmenities Container for all room amenities in group. The key is amenity category, the values are the amenity information. The category for grouped amenities in room level will be: - ACCESSIBILITY - BATHROOM - BEDROOM - CLUB_EXEC - FAMILY_FRIENDLY - ENTERTAINMENT - FOOD_AND_DRINK - INTERNET - MORE - OUTDOOR_SPACE - SAFETY + * @param media Container for Media elements. + */ +data class RoomType( + // Text description of the room type. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + // An encrypted string which includes the information that could be used to address the current room type. `RoomKey` has been renamed as `OfferId`. + @Deprecated(message = "This property is deprecated.") + @JsonProperty("RoomKey") + @field:Valid + val roomKey: kotlin.String? = null, + // An encrypted string which includes the information that could be used to address the current room type. + @JsonProperty("OfferId") + @field:Valid + val offerId: kotlin.String? = null, + // Name of Merchant that did the initial Authentication. + @JsonProperty("MerchantName") + @field:Valid + val merchantName: kotlin.String? = null, + // Indicate the room type is sold as package or standalone. + @JsonProperty("RatePlanType") + val ratePlanType: RoomType.RatePlanType? = null, + // Container for rate plan information. + @JsonProperty("RatePlans") + @field:Valid + val ratePlans: kotlin.collections.List? = null, + @JsonProperty("Price") + @field:Valid + val price: RoomTypePrice? = null, + @JsonProperty("StandalonePrice") + @field:Valid + val standalonePrice: RoomTypeStandalonePrice? = null, + // All promotion information of the room. **Note**: The node has been moved to `RatePlan` node, and will be deprecated soon. + @Deprecated(message = "This property is deprecated.") + @JsonProperty("Promotions [deprecated]") + @field:Valid + val promotionsDeprecated: kotlin.collections.List? = null, + @JsonProperty("Links") + @field:Valid + val links: RoomTypeLinks? = null, + // The smoking options available for the room type. + @JsonProperty("SmokingOption") + val smokingOption: RoomType.SmokingOption? = null, + // Statement of bed types available for this offer. A room may have several bed type options available. **NOTE**: due to the large number of bed type options available, we no longer publish a list of available bed types. More information is available in [Lodging Bed Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/bed-types). + @JsonProperty("BedTypeOptions") + @field:Valid + val bedTypeOptions: kotlin.collections.List? = null, + @JsonProperty("RoomOccupancyPolicy") + @field:Valid + val roomOccupancyPolicy: RoomOccupancyPolicy? = null, + // Container for all room amenities. + @JsonProperty("Amenities") + @field:Valid + val amenities: kotlin.collections.List? = null, + // Container for all room amenities in group. The key is amenity category, the values are the amenity information. The category for grouped amenities in room level will be: - ACCESSIBILITY - BATHROOM - BEDROOM - CLUB_EXEC - FAMILY_FRIENDLY - ENTERTAINMENT - FOOD_AND_DRINK - INTERNET - MORE - OUTDOOR_SPACE - SAFETY + @JsonProperty("DescriptiveAmenities") + @field:Valid + val descriptiveAmenities: kotlin.collections.Map>? = null, + // Container for Media elements. + @JsonProperty("Media") + @field:Valid + val media: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var description: kotlin.String? = null, + private var roomKey: kotlin.String? = null, + private var offerId: kotlin.String? = null, + private var merchantName: kotlin.String? = null, + private var ratePlanType: RoomType.RatePlanType? = null, + private var ratePlans: kotlin.collections.List? = null, + private var price: RoomTypePrice? = null, + private var standalonePrice: RoomTypeStandalonePrice? = null, + private var promotionsDeprecated: kotlin.collections.List? = null, + private var links: RoomTypeLinks? = null, + private var smokingOption: RoomType.SmokingOption? = null, + private var bedTypeOptions: kotlin.collections.List? = null, + private var roomOccupancyPolicy: RoomOccupancyPolicy? = null, + private var amenities: kotlin.collections.List? = null, + private var descriptiveAmenities: kotlin.collections.Map>? = null, + private var media: kotlin.collections.List? = null + ) { + fun description(description: kotlin.String?) = apply { this.description = description } + + fun roomKey(roomKey: kotlin.String?) = apply { this.roomKey = roomKey } + + fun offerId(offerId: kotlin.String?) = apply { this.offerId = offerId } + + fun merchantName(merchantName: kotlin.String?) = apply { this.merchantName = merchantName } + + fun ratePlanType(ratePlanType: RoomType.RatePlanType?) = apply { this.ratePlanType = ratePlanType } + + fun ratePlans(ratePlans: kotlin.collections.List?) = apply { this.ratePlans = ratePlans } + + fun price(price: RoomTypePrice?) = apply { this.price = price } + + fun standalonePrice(standalonePrice: RoomTypeStandalonePrice?) = apply { this.standalonePrice = standalonePrice } + + fun promotionsDeprecated(promotionsDeprecated: kotlin.collections.List?) = apply { this.promotionsDeprecated = promotionsDeprecated } + + fun links(links: RoomTypeLinks?) = apply { this.links = links } + + fun smokingOption(smokingOption: RoomType.SmokingOption?) = apply { this.smokingOption = smokingOption } + + fun bedTypeOptions(bedTypeOptions: kotlin.collections.List?) = apply { this.bedTypeOptions = bedTypeOptions } + + fun roomOccupancyPolicy(roomOccupancyPolicy: RoomOccupancyPolicy?) = apply { this.roomOccupancyPolicy = roomOccupancyPolicy } + + fun amenities(amenities: kotlin.collections.List?) = apply { this.amenities = amenities } + + fun descriptiveAmenities(descriptiveAmenities: kotlin.collections.Map>?) = + apply { + this.descriptiveAmenities = + descriptiveAmenities + } + + fun media(media: kotlin.collections.List?) = apply { this.media = media } + + fun build(): RoomType { + val instance = + RoomType( + description = description, + roomKey = roomKey, + offerId = offerId, + merchantName = merchantName, + ratePlanType = ratePlanType, + ratePlans = ratePlans, + price = price, + standalonePrice = standalonePrice, + promotionsDeprecated = promotionsDeprecated, + links = links, + smokingOption = smokingOption, + bedTypeOptions = bedTypeOptions, + roomOccupancyPolicy = roomOccupancyPolicy, + amenities = amenities, + descriptiveAmenities = descriptiveAmenities, + media = media + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomType) { + 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( + description = description, + roomKey = roomKey, + offerId = offerId, + merchantName = merchantName, + ratePlanType = ratePlanType, + ratePlans = ratePlans, + price = price, + standalonePrice = standalonePrice, + promotionsDeprecated = promotionsDeprecated, + links = links, + smokingOption = smokingOption, + bedTypeOptions = bedTypeOptions, + roomOccupancyPolicy = roomOccupancyPolicy, + amenities = amenities, + descriptiveAmenities = descriptiveAmenities, + media = media + ) + + /** + * Indicate the room type is sold as package or standalone. + * Values: STANDALONE,PACKAGE,WHOLESALE + */ + enum class RatePlanType(val value: kotlin.String) { + @JsonProperty("standalone") + STANDALONE("standalone"), + + @JsonProperty("package") + PACKAGE("package"), + + @JsonProperty("wholesale") + WHOLESALE("wholesale") + } + + /** + * The smoking options available for the room type. + * Values: SMOKING_OR_NON_SMOKING,SMOKING,NON_SMOKING + */ + enum class SmokingOption(val value: kotlin.String) { + @JsonProperty("SmokingOrNonSmoking") + SMOKING_OR_NON_SMOKING("SmokingOrNonSmoking"), + + @JsonProperty("Smoking") + SMOKING("Smoking"), + + @JsonProperty("NonSmoking") + NON_SMOKING("NonSmoking") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeAmenitiesInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeAmenitiesInner.kt new file mode 100644 index 000000000..7e419fa50 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeAmenitiesInner.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id Amenity id + * @param name Amenity name + */ +data class RoomTypeAmenitiesInner( + // Amenity id + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // Amenity name + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): RoomTypeAmenitiesInner { + val instance = + RoomTypeAmenitiesInner( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeAmenitiesInner) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeAmenitiesInnerAllOf.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeAmenitiesInnerAllOf.kt new file mode 100644 index 000000000..fefe33cec --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeAmenitiesInnerAllOf.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * + * @param id Amenity id + * @param name Amenity name + */ +data class RoomTypeAmenitiesInnerAllOf( + // Amenity id + @JsonProperty("Id") + @field:Valid + val id: kotlin.Any? = null, + // Amenity name + @JsonProperty("Name") + @field:Valid + val name: kotlin.Any? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.Any? = null, + private var name: kotlin.Any? = null + ) { + fun id(id: kotlin.Any?) = apply { this.id = id } + + fun name(name: kotlin.Any?) = apply { this.name = name } + + fun build(): RoomTypeAmenitiesInnerAllOf { + val instance = + RoomTypeAmenitiesInnerAllOf( + id = id, + name = name + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeAmenitiesInnerAllOf) { + 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 + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinks.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinks.kt new file mode 100644 index 000000000..20e424b4b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinks.kt @@ -0,0 +1,114 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.HotelLinksWebSearchResult +import com.expediagroup.sdk.xap.models.Link +import com.expediagroup.sdk.xap.models.RoomTypeLinksApiDetails +import com.expediagroup.sdk.xap.models.RoomTypeLinksWebDetails +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container for list of HATEOAS links to either Expedia website or additional Expedia APIs to complete booking of the selected offer. Which links are returned in this section are defined by the `links` parameter in the Search API query. Available links are: - WebSearchResult (link to web search result page) - WebDetails (link to web infosite) - ApiDetails (link for details API) + * @param webSearchResult + * @param webDetails + * @param apiDetails + */ +data class RoomTypeLinks( + @JsonProperty("WebSearchResult") + @field:Valid + val webSearchResult: HotelLinksWebSearchResult? = null, + @JsonProperty("WebDetails") + @field:Valid + val webDetails: RoomTypeLinksWebDetails? = null, + @JsonProperty("ApiDetails") + @field:Valid + val apiDetails: RoomTypeLinksApiDetails? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var webSearchResult: HotelLinksWebSearchResult? = null, + private var webDetails: RoomTypeLinksWebDetails? = null, + private var apiDetails: RoomTypeLinksApiDetails? = null + ) { + fun webSearchResult(webSearchResult: HotelLinksWebSearchResult?) = apply { this.webSearchResult = webSearchResult } + + fun webDetails(webDetails: RoomTypeLinksWebDetails?) = apply { this.webDetails = webDetails } + + fun apiDetails(apiDetails: RoomTypeLinksApiDetails?) = apply { this.apiDetails = apiDetails } + + fun build(): RoomTypeLinks { + val instance = + RoomTypeLinks( + webSearchResult = webSearchResult, + webDetails = webDetails, + apiDetails = apiDetails + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeLinks) { + 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( + webSearchResult = webSearchResult, + webDetails = webDetails, + apiDetails = apiDetails + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinksApiDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinksApiDetails.kt new file mode 100644 index 000000000..510b729bc --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinksApiDetails.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.xap.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 + +/** + * + * @param accept The Accept request header (for API queries only - not included for page URLs). + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class RoomTypeLinksApiDetails( + // The Accept request header (for API queries only - not included for page URLs). + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): RoomTypeLinksApiDetails { + val instance = + RoomTypeLinksApiDetails( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeLinksApiDetails) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinksWebDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinksWebDetails.kt new file mode 100644 index 000000000..90367647f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeLinksWebDetails.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.xap.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 + +/** + * + * @param accept The Accept request header (for API queries only - not included for page URLs). + * @param method Method of request. + * @param href The URL of the destination web page or API query. + */ +data class RoomTypeLinksWebDetails( + // The Accept request header (for API queries only - not included for page URLs). + @JsonProperty("Accept") + @field:Valid + val accept: kotlin.String? = null, + // Method of request. + @JsonProperty("Method") + @field:Valid + val method: kotlin.String? = null, + // The URL of the destination web page or API query. + @JsonProperty("Href") + @field:Valid + val href: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var accept: kotlin.String? = null, + private var method: kotlin.String? = null, + private var href: kotlin.String? = null + ) { + fun accept(accept: kotlin.String?) = apply { this.accept = accept } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun href(href: kotlin.String?) = apply { this.href = href } + + fun build(): RoomTypeLinksWebDetails { + val instance = + RoomTypeLinksWebDetails( + accept = accept, + method = method, + href = href + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeLinksWebDetails) { + 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( + accept = accept, + method = method, + href = href + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeMediaInner.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeMediaInner.kt new file mode 100644 index 000000000..c70093121 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeMediaInner.kt @@ -0,0 +1,131 @@ +/* + * 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.xap.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 + +/** + * + * @param type Supported type of media. 1=Image. Only 1 is supported now. + * @param title Image title + * @param propertySize Image size. You can find a link to the complete list of Supported Images Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + * @param url Image URL + */ +data class RoomTypeMediaInner( + // Supported type of media. 1=Image. Only 1 is supported now. + @JsonProperty("Type") + val type: RoomTypeMediaInner.Type? = null, + // Image title + @JsonProperty("Title") + @field:Valid + val title: kotlin.String? = null, + // Image size. You can find a link to the complete list of Supported Images Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + @JsonProperty("Size") + @field:Valid + val propertySize: kotlin.String? = null, + // Image URL + @JsonProperty("Url") + @field:Valid + val url: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: RoomTypeMediaInner.Type? = null, + private var title: kotlin.String? = null, + private var propertySize: kotlin.String? = null, + private var url: kotlin.String? = null + ) { + fun type(type: RoomTypeMediaInner.Type?) = apply { this.type = type } + + fun title(title: kotlin.String?) = apply { this.title = title } + + fun propertySize(propertySize: kotlin.String?) = apply { this.propertySize = propertySize } + + fun url(url: kotlin.String?) = apply { this.url = url } + + fun build(): RoomTypeMediaInner { + val instance = + RoomTypeMediaInner( + type = type, + title = title, + propertySize = propertySize, + url = url + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeMediaInner) { + 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( + type = type, + title = title, + propertySize = propertySize, + url = url + ) + + /** + * Supported type of media. 1=Image. Only 1 is supported now. + * Values: _1 + */ + enum class Type(val value: kotlin.String) { + @JsonProperty("1") + _1("1") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePrice.kt new file mode 100644 index 000000000..d2fbf24c9 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePrice.kt @@ -0,0 +1,197 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RatePlanPriceBaseRate +import com.expediagroup.sdk.xap.models.RatePlanPriceHotelMandatoryFees +import com.expediagroup.sdk.xap.models.RatePlanPriceTaxesAndFees +import com.expediagroup.sdk.xap.models.RoomTypePriceAvgNightlyRate +import com.expediagroup.sdk.xap.models.RoomTypePriceAvgNightlyRateWithFees +import com.expediagroup.sdk.xap.models.RoomTypePriceAvgNightlyStrikeOutRate +import com.expediagroup.sdk.xap.models.RoomTypePriceAvgNightlyStrikeoutRateWithFees +import com.expediagroup.sdk.xap.models.RoomTypePriceRefundableDamageDeposit +import com.expediagroup.sdk.xap.models.RoomTypePriceTotalPrice +import com.expediagroup.sdk.xap.models.RoomTypePriceTotalPriceWithHotelFees +import com.expediagroup.sdk.xap.models.RoomTypePriceTotalStrikeOutPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * Container of all price components of the room. + * @param baseRate + * @param taxesAndFees + * @param totalPrice + * @param totalStrikeOutPrice + * @param avgNightlyRate + * @param avgNightlyStrikeOutRate + * @param avgNightlyRateWithFees + * @param avgNightlyStrikeoutRateWithFees + * @param hotelMandatoryFees + * @param totalPriceWithHotelFees + * @param refundableDamageDeposit + */ +data class RoomTypePrice( + @JsonProperty("BaseRate") + @field:Valid + val baseRate: RatePlanPriceBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: RatePlanPriceTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: RoomTypePriceTotalPrice? = null, + @JsonProperty("TotalStrikeOutPrice") + @field:Valid + val totalStrikeOutPrice: RoomTypePriceTotalStrikeOutPrice? = null, + @JsonProperty("AvgNightlyRate") + @field:Valid + val avgNightlyRate: RoomTypePriceAvgNightlyRate? = null, + @JsonProperty("AvgNightlyStrikeOutRate") + @field:Valid + val avgNightlyStrikeOutRate: RoomTypePriceAvgNightlyStrikeOutRate? = null, + @JsonProperty("AvgNightlyRateWithFees") + @field:Valid + val avgNightlyRateWithFees: RoomTypePriceAvgNightlyRateWithFees? = null, + @JsonProperty("AvgNightlyStrikeoutRateWithFees") + @field:Valid + val avgNightlyStrikeoutRateWithFees: RoomTypePriceAvgNightlyStrikeoutRateWithFees? = null, + @JsonProperty("HotelMandatoryFees") + @field:Valid + val hotelMandatoryFees: RatePlanPriceHotelMandatoryFees? = null, + @JsonProperty("TotalPriceWithHotelFees") + @field:Valid + val totalPriceWithHotelFees: RoomTypePriceTotalPriceWithHotelFees? = null, + @JsonProperty("RefundableDamageDeposit") + @field:Valid + val refundableDamageDeposit: RoomTypePriceRefundableDamageDeposit? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var baseRate: RatePlanPriceBaseRate? = null, + private var taxesAndFees: RatePlanPriceTaxesAndFees? = null, + private var totalPrice: RoomTypePriceTotalPrice? = null, + private var totalStrikeOutPrice: RoomTypePriceTotalStrikeOutPrice? = null, + private var avgNightlyRate: RoomTypePriceAvgNightlyRate? = null, + private var avgNightlyStrikeOutRate: RoomTypePriceAvgNightlyStrikeOutRate? = null, + private var avgNightlyRateWithFees: RoomTypePriceAvgNightlyRateWithFees? = null, + private var avgNightlyStrikeoutRateWithFees: RoomTypePriceAvgNightlyStrikeoutRateWithFees? = null, + private var hotelMandatoryFees: RatePlanPriceHotelMandatoryFees? = null, + private var totalPriceWithHotelFees: RoomTypePriceTotalPriceWithHotelFees? = null, + private var refundableDamageDeposit: RoomTypePriceRefundableDamageDeposit? = null + ) { + fun baseRate(baseRate: RatePlanPriceBaseRate?) = apply { this.baseRate = baseRate } + + fun taxesAndFees(taxesAndFees: RatePlanPriceTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun totalPrice(totalPrice: RoomTypePriceTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun totalStrikeOutPrice(totalStrikeOutPrice: RoomTypePriceTotalStrikeOutPrice?) = apply { this.totalStrikeOutPrice = totalStrikeOutPrice } + + fun avgNightlyRate(avgNightlyRate: RoomTypePriceAvgNightlyRate?) = apply { this.avgNightlyRate = avgNightlyRate } + + fun avgNightlyStrikeOutRate(avgNightlyStrikeOutRate: RoomTypePriceAvgNightlyStrikeOutRate?) = apply { this.avgNightlyStrikeOutRate = avgNightlyStrikeOutRate } + + fun avgNightlyRateWithFees(avgNightlyRateWithFees: RoomTypePriceAvgNightlyRateWithFees?) = apply { this.avgNightlyRateWithFees = avgNightlyRateWithFees } + + fun avgNightlyStrikeoutRateWithFees(avgNightlyStrikeoutRateWithFees: RoomTypePriceAvgNightlyStrikeoutRateWithFees?) = + apply { + this.avgNightlyStrikeoutRateWithFees = + avgNightlyStrikeoutRateWithFees + } + + fun hotelMandatoryFees(hotelMandatoryFees: RatePlanPriceHotelMandatoryFees?) = apply { this.hotelMandatoryFees = hotelMandatoryFees } + + fun totalPriceWithHotelFees(totalPriceWithHotelFees: RoomTypePriceTotalPriceWithHotelFees?) = apply { this.totalPriceWithHotelFees = totalPriceWithHotelFees } + + fun refundableDamageDeposit(refundableDamageDeposit: RoomTypePriceRefundableDamageDeposit?) = apply { this.refundableDamageDeposit = refundableDamageDeposit } + + fun build(): RoomTypePrice { + val instance = + RoomTypePrice( + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + avgNightlyRateWithFees = avgNightlyRateWithFees, + avgNightlyStrikeoutRateWithFees = avgNightlyStrikeoutRateWithFees, + hotelMandatoryFees = hotelMandatoryFees, + totalPriceWithHotelFees = totalPriceWithHotelFees, + refundableDamageDeposit = refundableDamageDeposit + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePrice) { + 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( + baseRate = baseRate, + taxesAndFees = taxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + avgNightlyRateWithFees = avgNightlyRateWithFees, + avgNightlyStrikeoutRateWithFees = avgNightlyStrikeoutRateWithFees, + hotelMandatoryFees = hotelMandatoryFees, + totalPriceWithHotelFees = totalPriceWithHotelFees, + refundableDamageDeposit = refundableDamageDeposit + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyRate.kt new file mode 100644 index 000000000..88210c328 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average nightly base rate per night per room of the room type, which is equal to the `BaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceAvgNightlyRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceAvgNightlyRate { + val instance = + RoomTypePriceAvgNightlyRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceAvgNightlyRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyRateWithFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyRateWithFees.kt new file mode 100644 index 000000000..837173151 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyRateWithFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average nightly rate per night per room of the room type, including all fees except those imposed by the government. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceAvgNightlyRateWithFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceAvgNightlyRateWithFees { + val instance = + RoomTypePriceAvgNightlyRateWithFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceAvgNightlyRateWithFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyStrikeOutRate.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyStrikeOutRate.kt new file mode 100644 index 000000000..c1137a3b7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyStrikeOutRate.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average nightly strike out rate per night per room of the room type, which is equal to the strike out of `BaseRate` divided by `StayDates` and by `room number`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceAvgNightlyStrikeOutRate( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceAvgNightlyStrikeOutRate { + val instance = + RoomTypePriceAvgNightlyStrikeOutRate( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceAvgNightlyStrikeOutRate) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyStrikeoutRateWithFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyStrikeoutRateWithFees.kt new file mode 100644 index 000000000..05a62a690 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceAvgNightlyStrikeoutRateWithFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The average nightly strike out rate per night per room of the room type, including all fees except those imposed by the government. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceAvgNightlyStrikeoutRateWithFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceAvgNightlyStrikeoutRateWithFees { + val instance = + RoomTypePriceAvgNightlyStrikeoutRateWithFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceAvgNightlyStrikeoutRateWithFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceRefundableDamageDeposit.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceRefundableDamageDeposit.kt new file mode 100644 index 000000000..b579bee8b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceRefundableDamageDeposit.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The refundable damage deposit for the rate plan. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceRefundableDamageDeposit( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceRefundableDamageDeposit { + val instance = + RoomTypePriceRefundableDamageDeposit( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceRefundableDamageDeposit) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalPrice.kt new file mode 100644 index 000000000..b77edc08d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total price of the rate plan, which is equal to the sum of `BaseRate` and `TaxesAndFees`. Hotel mandatory fees are not included as these are paid at the hotel at checkout. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceTotalPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceTotalPrice { + val instance = + RoomTypePriceTotalPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceTotalPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalPriceWithHotelFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalPriceWithHotelFees.kt new file mode 100644 index 000000000..ff1db94d0 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalPriceWithHotelFees.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total combined price that includes `TotalPrice` that will be charged by Expedia (`BaseRate` + `TaxesAndFees`) combined with any `HotelMandatoryFees` that will be charged at hotel. **NOTE**: Since UK regulations require that `HotelMandatoryFees` be included in this price, the quoted price will only be accurate for the day of quote. This is due to the fact that currency exchange fluctuations will change the exact amount of any `HotelMandatoryFees` that are to be collected at the hotel during the guest's stay if the cost is converted into any other currency. **CMA Compliance Note (UK)**: Websites doing business in the UK should be displaying this value to be compliant with CMA requirements. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceTotalPriceWithHotelFees( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceTotalPriceWithHotelFees { + val instance = + RoomTypePriceTotalPriceWithHotelFees( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceTotalPriceWithHotelFees) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalStrikeOutPrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalStrikeOutPrice.kt new file mode 100644 index 000000000..5e044604d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypePriceTotalStrikeOutPrice.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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The total strike out price of the rate plan, which is equal to the sum of `BaseRate`'s `totalStrikeOut` and `TaxesAndFees`'s `totalStrikeOut`. + * @param `value` The value of the element being defined. + * @param currency The ISO 4217 Currency Code that the value is expressed in. + * @param localCurrencyPrice + */ +data class RoomTypePriceTotalStrikeOutPrice( + // The value of the element being defined. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null, + // The ISO 4217 Currency Code that the value is expressed in. + @JsonProperty("Currency") + @field:Valid + val currency: kotlin.String? = null, + @JsonProperty("LocalCurrencyPrice") + @field:Valid + val localCurrencyPrice: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var `value`: kotlin.String? = null, + private var currency: kotlin.String? = null, + private var localCurrencyPrice: Money? = null + ) { + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun currency(currency: kotlin.String?) = apply { this.currency = currency } + + fun localCurrencyPrice(localCurrencyPrice: Money?) = apply { this.localCurrencyPrice = localCurrencyPrice } + + fun build(): RoomTypePriceTotalStrikeOutPrice { + val instance = + RoomTypePriceTotalStrikeOutPrice( + `value` = `value`, + currency = currency, + localCurrencyPrice = localCurrencyPrice + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypePriceTotalStrikeOutPrice) { + 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, + localCurrencyPrice = localCurrencyPrice + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeStandalonePrice.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeStandalonePrice.kt new file mode 100644 index 000000000..2d55a3109 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/RoomTypeStandalonePrice.kt @@ -0,0 +1,187 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceAvgNightlyRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceAvgNightlyStrikeOutRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceBaseRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceHotelMandatoryFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceStrikeOutBaseRate +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceStrikeOutHotelMandatoryFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceStrikeOutTaxesAndFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceTaxesAndFees +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceTotalPrice +import com.expediagroup.sdk.xap.models.RatePlanStandalonePriceTotalStrikeOutPrice +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * The corresponded standalone price to the package rate plan (to show the `strikethrough`). Only returned when this is a package rate plan. + * @param baseRate + * @param strikeOutBaseRate + * @param taxesAndFees + * @param strikeOutTaxesAndFees + * @param totalPrice + * @param totalStrikeOutPrice + * @param avgNightlyRate + * @param avgNightlyStrikeOutRate + * @param hotelMandatoryFees + * @param strikeOutHotelMandatoryFees + */ +data class RoomTypeStandalonePrice( + @JsonProperty("BaseRate") + @field:Valid + val baseRate: RatePlanStandalonePriceBaseRate? = null, + @JsonProperty("StrikeOutBaseRate") + @field:Valid + val strikeOutBaseRate: RatePlanStandalonePriceStrikeOutBaseRate? = null, + @JsonProperty("TaxesAndFees") + @field:Valid + val taxesAndFees: RatePlanStandalonePriceTaxesAndFees? = null, + @JsonProperty("StrikeOutTaxesAndFees") + @field:Valid + val strikeOutTaxesAndFees: RatePlanStandalonePriceStrikeOutTaxesAndFees? = null, + @JsonProperty("TotalPrice") + @field:Valid + val totalPrice: RatePlanStandalonePriceTotalPrice? = null, + @JsonProperty("TotalStrikeOutPrice") + @field:Valid + val totalStrikeOutPrice: RatePlanStandalonePriceTotalStrikeOutPrice? = null, + @JsonProperty("AvgNightlyRate") + @field:Valid + val avgNightlyRate: RatePlanStandalonePriceAvgNightlyRate? = null, + @JsonProperty("AvgNightlyStrikeOutRate") + @field:Valid + val avgNightlyStrikeOutRate: RatePlanStandalonePriceAvgNightlyStrikeOutRate? = null, + @JsonProperty("HotelMandatoryFees") + @field:Valid + val hotelMandatoryFees: RatePlanStandalonePriceHotelMandatoryFees? = null, + @JsonProperty("StrikeOutHotelMandatoryFees") + @field:Valid + val strikeOutHotelMandatoryFees: RatePlanStandalonePriceStrikeOutHotelMandatoryFees? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var baseRate: RatePlanStandalonePriceBaseRate? = null, + private var strikeOutBaseRate: RatePlanStandalonePriceStrikeOutBaseRate? = null, + private var taxesAndFees: RatePlanStandalonePriceTaxesAndFees? = null, + private var strikeOutTaxesAndFees: RatePlanStandalonePriceStrikeOutTaxesAndFees? = null, + private var totalPrice: RatePlanStandalonePriceTotalPrice? = null, + private var totalStrikeOutPrice: RatePlanStandalonePriceTotalStrikeOutPrice? = null, + private var avgNightlyRate: RatePlanStandalonePriceAvgNightlyRate? = null, + private var avgNightlyStrikeOutRate: RatePlanStandalonePriceAvgNightlyStrikeOutRate? = null, + private var hotelMandatoryFees: RatePlanStandalonePriceHotelMandatoryFees? = null, + private var strikeOutHotelMandatoryFees: RatePlanStandalonePriceStrikeOutHotelMandatoryFees? = null + ) { + fun baseRate(baseRate: RatePlanStandalonePriceBaseRate?) = apply { this.baseRate = baseRate } + + fun strikeOutBaseRate(strikeOutBaseRate: RatePlanStandalonePriceStrikeOutBaseRate?) = apply { this.strikeOutBaseRate = strikeOutBaseRate } + + fun taxesAndFees(taxesAndFees: RatePlanStandalonePriceTaxesAndFees?) = apply { this.taxesAndFees = taxesAndFees } + + fun strikeOutTaxesAndFees(strikeOutTaxesAndFees: RatePlanStandalonePriceStrikeOutTaxesAndFees?) = apply { this.strikeOutTaxesAndFees = strikeOutTaxesAndFees } + + fun totalPrice(totalPrice: RatePlanStandalonePriceTotalPrice?) = apply { this.totalPrice = totalPrice } + + fun totalStrikeOutPrice(totalStrikeOutPrice: RatePlanStandalonePriceTotalStrikeOutPrice?) = apply { this.totalStrikeOutPrice = totalStrikeOutPrice } + + fun avgNightlyRate(avgNightlyRate: RatePlanStandalonePriceAvgNightlyRate?) = apply { this.avgNightlyRate = avgNightlyRate } + + fun avgNightlyStrikeOutRate(avgNightlyStrikeOutRate: RatePlanStandalonePriceAvgNightlyStrikeOutRate?) = apply { this.avgNightlyStrikeOutRate = avgNightlyStrikeOutRate } + + fun hotelMandatoryFees(hotelMandatoryFees: RatePlanStandalonePriceHotelMandatoryFees?) = apply { this.hotelMandatoryFees = hotelMandatoryFees } + + fun strikeOutHotelMandatoryFees(strikeOutHotelMandatoryFees: RatePlanStandalonePriceStrikeOutHotelMandatoryFees?) = + apply { + this.strikeOutHotelMandatoryFees = + strikeOutHotelMandatoryFees + } + + fun build(): RoomTypeStandalonePrice { + val instance = + RoomTypeStandalonePrice( + baseRate = baseRate, + strikeOutBaseRate = strikeOutBaseRate, + taxesAndFees = taxesAndFees, + strikeOutTaxesAndFees = strikeOutTaxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + hotelMandatoryFees = hotelMandatoryFees, + strikeOutHotelMandatoryFees = strikeOutHotelMandatoryFees + ) + + validate(instance) + + return instance + } + + private fun validate(instance: RoomTypeStandalonePrice) { + 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( + baseRate = baseRate, + strikeOutBaseRate = strikeOutBaseRate, + taxesAndFees = taxesAndFees, + strikeOutTaxesAndFees = strikeOutTaxesAndFees, + totalPrice = totalPrice, + totalStrikeOutPrice = totalStrikeOutPrice, + avgNightlyRate = avgNightlyRate, + avgNightlyStrikeOutRate = avgNightlyStrikeOutRate, + hotelMandatoryFees = hotelMandatoryFees, + strikeOutHotelMandatoryFees = strikeOutHotelMandatoryFees + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/SdpAPIMError.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/SdpAPIMError.kt new file mode 100644 index 000000000..f38340930 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/SdpAPIMError.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.xap.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 + +/** + * Error from the APIM. + * @param message Error from the APIM. + */ +data class SdpAPIMError( + // Error from the APIM. + @JsonProperty("message") + @field:Valid + val message: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var message: kotlin.String? = null + ) { + fun message(message: kotlin.String?) = apply { this.message = message } + + fun build(): SdpAPIMError { + val instance = + SdpAPIMError( + message = message + ) + + validate(instance) + + return instance + } + + private fun validate(instance: SdpAPIMError) { + 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( + message = message + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/SdpLink.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/SdpLink.kt new file mode 100644 index 000000000..ff2c3747a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/SdpLink.kt @@ -0,0 +1,103 @@ +/* + * 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.xap.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 + +/** + * Contains link information, including link address, request method. Only provided if FileInfo is in OtherFileOptions. + * @param href a link address. + * @param method Request method, it will support `GET`, `POST`, `DELETE` and `PUT` etc... + */ +data class SdpLink( + // a link address. + @JsonProperty("href") + @field:Valid + val href: kotlin.String? = null, + // Request method, it will support `GET`, `POST`, `DELETE` and `PUT` etc... + @JsonProperty("method") + @field:Valid + val method: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var href: kotlin.String? = null, + private var method: kotlin.String? = null + ) { + fun href(href: kotlin.String?) = apply { this.href = href } + + fun method(method: kotlin.String?) = apply { this.method = method } + + fun build(): SdpLink { + val instance = + SdpLink( + href = href, + method = method + ) + + validate(instance) + + return instance + } + + private fun validate(instance: SdpLink) { + 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( + href = href, + method = method + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/StayDates.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/StayDates.kt new file mode 100644 index 000000000..c999f33de --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/StayDates.kt @@ -0,0 +1,100 @@ +/* + * 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.xap.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 + +/** + * Container for information for the stay dates of the rate plan. + * @param checkInDate The initial day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + * @param checkOutDate The final day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + */ +data class StayDates( + // The initial day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("CheckInDate") + val checkInDate: java.time.LocalDate? = null, + // The final day of the hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. + @JsonProperty("CheckOutDate") + val checkOutDate: java.time.LocalDate? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var checkInDate: java.time.LocalDate? = null, + private var checkOutDate: java.time.LocalDate? = null + ) { + fun checkInDate(checkInDate: java.time.LocalDate?) = apply { this.checkInDate = checkInDate } + + fun checkOutDate(checkOutDate: java.time.LocalDate?) = apply { this.checkOutDate = checkOutDate } + + fun build(): StayDates { + val instance = + StayDates( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) + + validate(instance) + + return instance + } + + private fun validate(instance: StayDates) { + 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( + checkInDate = checkInDate, + checkOutDate = checkOutDate + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Supplier.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Supplier.kt new file mode 100644 index 000000000..74f9bba8e --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Supplier.kt @@ -0,0 +1,127 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * The supplier of the car being offered. + * @param id Supplier ID. + * @param name Supplier Name. + * @param code Supplier Code. + * @param logoImageUrl Supplier Logo Image Url. + */ +data class Supplier( + // Supplier ID. + @JsonProperty("Id") + @field:NotNull + @field:Valid + val id: kotlin.String, + // Supplier Name. + @JsonProperty("Name") + @field:NotNull + @field:Valid + val name: kotlin.String, + // Supplier Code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Supplier Logo Image Url. + @JsonProperty("LogoImageUrl") + @field:Valid + val logoImageUrl: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var id: kotlin.String? = null, + private var name: kotlin.String? = null, + private var code: kotlin.String? = null, + private var logoImageUrl: kotlin.String? = null + ) { + fun id(id: kotlin.String) = apply { this.id = id } + + fun name(name: kotlin.String) = apply { this.name = name } + + fun code(code: kotlin.String) = apply { this.code = code } + + fun logoImageUrl(logoImageUrl: kotlin.String?) = apply { this.logoImageUrl = logoImageUrl } + + fun build(): Supplier { + val instance = + Supplier( + id = id!!, + name = name!!, + code = code!!, + logoImageUrl = logoImageUrl + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Supplier) { + 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!!, + code = code!!, + logoImageUrl = logoImageUrl + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TaxesAndFees.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TaxesAndFees.kt new file mode 100644 index 000000000..37d1118a7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TaxesAndFees.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsMoney +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 + +/** + * List of TaxesAndFees Details + * @param description TaxesAndFees description + * @param amount + */ +data class TaxesAndFees( + // TaxesAndFees description + @JsonProperty("Description") + @field:NotNull + @field:Valid + val description: kotlin.String, + @JsonProperty("Amount") + @field:NotNull + @field:Valid + val amount: CarsMoney +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var description: kotlin.String? = null, + private var amount: CarsMoney? = null + ) { + fun description(description: kotlin.String) = apply { this.description = description } + + fun amount(amount: CarsMoney) = apply { this.amount = amount } + + fun build(): TaxesAndFees { + val instance = + TaxesAndFees( + description = description!!, + amount = amount!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: TaxesAndFees) { + 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( + description = description!!, + amount = amount!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TaxesAndFeesDetail.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TaxesAndFeesDetail.kt new file mode 100644 index 000000000..e1b99baf7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TaxesAndFeesDetail.kt @@ -0,0 +1,102 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * + * @param categoryCode + * @param amount + */ +data class TaxesAndFeesDetail( + @JsonProperty("CategoryCode") + @field:Valid + val categoryCode: kotlin.String? = null, + @JsonProperty("Amount") + @field:Valid + val amount: Money? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var categoryCode: kotlin.String? = null, + private var amount: Money? = null + ) { + fun categoryCode(categoryCode: kotlin.String?) = apply { this.categoryCode = categoryCode } + + fun amount(amount: Money?) = apply { this.amount = amount } + + fun build(): TaxesAndFeesDetail { + val instance = + TaxesAndFeesDetail( + categoryCode = categoryCode, + amount = amount + ) + + validate(instance) + + return instance + } + + private fun validate(instance: TaxesAndFeesDetail) { + 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( + categoryCode = categoryCode, + amount = amount + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TimeRange.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TimeRange.kt new file mode 100644 index 000000000..9366c8573 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TimeRange.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * A list of time range to indicate the operation hours of the date range. + * @param startTime Start time at pickup location of the date range. + * @param endTime End time at pickup location of the date range. + */ +data class TimeRange( + // Start time at pickup location of the date range. + @JsonProperty("StartTime") + @field:NotNull + @field:Valid + val startTime: kotlin.String, + // End time at pickup location of the date range. + @JsonProperty("EndTime") + @field:NotNull + @field:Valid + val endTime: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var startTime: kotlin.String? = null, + private var endTime: kotlin.String? = null + ) { + fun startTime(startTime: kotlin.String) = apply { this.startTime = startTime } + + fun endTime(endTime: kotlin.String) = apply { this.endTime = endTime } + + fun build(): TimeRange { + val instance = + TimeRange( + startTime = startTime!!, + endTime = endTime!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: TimeRange) { + 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( + startTime = startTime!!, + endTime = endTime!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TransmissionDrive.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TransmissionDrive.kt new file mode 100644 index 000000000..1fc2fa112 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/TransmissionDrive.kt @@ -0,0 +1,106 @@ +/* + * 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.xap.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 +import javax.validation.constraints.NotNull + +/** + * Car transmission and drive. Please find list of Car Transmission Drive Codes in https://expediaintegration.zendesk.com/hc/en-us/articles/115005380028 + * @param code Car transmission and drive code. + * @param `value` Car transmission and drive value. + */ +data class TransmissionDrive( + // Car transmission and drive code. + @JsonProperty("Code") + @field:NotNull + @field:Valid + val code: kotlin.String, + // Car transmission and drive value. + @JsonProperty("Value") + @field:NotNull + @field:Valid + val `value`: kotlin.String +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var `value`: kotlin.String? = null + ) { + fun code(code: kotlin.String) = apply { this.code = code } + + fun `value`(`value`: kotlin.String) = apply { this.`value` = `value` } + + fun build(): TransmissionDrive { + val instance = + TransmissionDrive( + code = code!!, + `value` = `value`!! + ) + + validate(instance) + + return instance + } + + private fun validate(instance: TransmissionDrive) { + 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!!, + `value` = `value`!! + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ValidFormsOfPayment.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ValidFormsOfPayment.kt new file mode 100644 index 000000000..6310bb6fb --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/ValidFormsOfPayment.kt @@ -0,0 +1,125 @@ +/* + * 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.xap.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 + +/** + * Container for hotel supported payment information. + * @param paymentMethod The payment method. + * @param name The brand name of the payment sub-method to be displayed to the customer. + * @param paymentSubMethod The payment sub-method. + * @param brandName The brand name of the payment sub-method to be displayed to the customer. In many cases it will be the same as the payment sub-method, but \"Visa/Carte Blanche\" and \"Visa/Delta\" are some of the exceptions. + */ +data class ValidFormsOfPayment( + // The payment method. + @JsonProperty("PaymentMethod") + @field:Valid + val paymentMethod: kotlin.String? = null, + // The brand name of the payment sub-method to be displayed to the customer. + @JsonProperty("Name") + @field:Valid + val name: kotlin.String? = null, + // The payment sub-method. + @Deprecated(message = "This property is deprecated.") + @JsonProperty("PaymentSubMethod") + @field:Valid + val paymentSubMethod: kotlin.String? = null, + // The brand name of the payment sub-method to be displayed to the customer. In many cases it will be the same as the payment sub-method, but \"Visa/Carte Blanche\" and \"Visa/Delta\" are some of the exceptions. + @Deprecated(message = "This property is deprecated.") + @JsonProperty("BrandName") + @field:Valid + val brandName: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var paymentMethod: kotlin.String? = null, + private var name: kotlin.String? = null, + private var paymentSubMethod: kotlin.String? = null, + private var brandName: kotlin.String? = null + ) { + fun paymentMethod(paymentMethod: kotlin.String?) = apply { this.paymentMethod = paymentMethod } + + fun name(name: kotlin.String?) = apply { this.name = name } + + fun paymentSubMethod(paymentSubMethod: kotlin.String?) = apply { this.paymentSubMethod = paymentSubMethod } + + fun brandName(brandName: kotlin.String?) = apply { this.brandName = brandName } + + fun build(): ValidFormsOfPayment { + val instance = + ValidFormsOfPayment( + paymentMethod = paymentMethod, + name = name, + paymentSubMethod = paymentSubMethod, + brandName = brandName + ) + + validate(instance) + + return instance + } + + private fun validate(instance: ValidFormsOfPayment) { + 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( + paymentMethod = paymentMethod, + name = name, + paymentSubMethod = paymentSubMethod, + brandName = brandName + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/VehicleDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/VehicleDetails.kt new file mode 100644 index 000000000..8c3675c28 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/VehicleDetails.kt @@ -0,0 +1,187 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Capacity +import com.expediagroup.sdk.xap.models.CarCategory +import com.expediagroup.sdk.xap.models.CarType +import com.expediagroup.sdk.xap.models.FuelAC +import com.expediagroup.sdk.xap.models.TransmissionDrive +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 + +/** + * Specific information for a car. + * @param carClass Car category and type. + * @param carCategory + * @param carType + * @param transmissionDrive + * @param fuelAC + * @param make Car manufacturer and model. + * @param minDoors Minimal car door count. + * @param maxDoors Maximal car door count. + * @param fuelLevel Car fuel information. + * @param capacity + */ +data class VehicleDetails( + // Car category and type. + @JsonProperty("CarClass") + @field:NotNull + @field:Valid + val carClass: kotlin.String, + @JsonProperty("CarCategory") + @field:NotNull + @field:Valid + val carCategory: CarCategory, + @JsonProperty("CarType") + @field:NotNull + @field:Valid + val carType: CarType, + @JsonProperty("TransmissionDrive") + @field:NotNull + @field:Valid + val transmissionDrive: TransmissionDrive, + @JsonProperty("FuelAC") + @field:NotNull + @field:Valid + val fuelAC: FuelAC, + // Car manufacturer and model. + @JsonProperty("Make") + @field:Valid + val make: kotlin.String? = null, + // Minimal car door count. + @JsonProperty("MinDoors") + val minDoors: kotlin.Int? = null, + // Maximal car door count. + @JsonProperty("MaxDoors") + val maxDoors: kotlin.Int? = null, + // Car fuel information. + @JsonProperty("FuelLevel") + @field:Valid + val fuelLevel: kotlin.String? = null, + @JsonProperty("Capacity") + @field:Valid + val capacity: Capacity? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var carClass: kotlin.String? = null, + private var carCategory: CarCategory? = null, + private var carType: CarType? = null, + private var transmissionDrive: TransmissionDrive? = null, + private var fuelAC: FuelAC? = null, + private var make: kotlin.String? = null, + private var minDoors: kotlin.Int? = null, + private var maxDoors: kotlin.Int? = null, + private var fuelLevel: kotlin.String? = null, + private var capacity: Capacity? = null + ) { + fun carClass(carClass: kotlin.String) = apply { this.carClass = carClass } + + fun carCategory(carCategory: CarCategory) = apply { this.carCategory = carCategory } + + fun carType(carType: CarType) = apply { this.carType = carType } + + fun transmissionDrive(transmissionDrive: TransmissionDrive) = apply { this.transmissionDrive = transmissionDrive } + + fun fuelAC(fuelAC: FuelAC) = apply { this.fuelAC = fuelAC } + + fun make(make: kotlin.String?) = apply { this.make = make } + + fun minDoors(minDoors: kotlin.Int?) = apply { this.minDoors = minDoors } + + fun maxDoors(maxDoors: kotlin.Int?) = apply { this.maxDoors = maxDoors } + + fun fuelLevel(fuelLevel: kotlin.String?) = apply { this.fuelLevel = fuelLevel } + + fun capacity(capacity: Capacity?) = apply { this.capacity = capacity } + + fun build(): VehicleDetails { + val instance = + VehicleDetails( + carClass = carClass!!, + carCategory = carCategory!!, + carType = carType!!, + transmissionDrive = transmissionDrive!!, + fuelAC = fuelAC!!, + make = make, + minDoors = minDoors, + maxDoors = maxDoors, + fuelLevel = fuelLevel, + capacity = capacity + ) + + validate(instance) + + return instance + } + + private fun validate(instance: VehicleDetails) { + 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( + carClass = carClass!!, + carCategory = carCategory!!, + carType = carType!!, + transmissionDrive = transmissionDrive!!, + fuelAC = fuelAC!!, + make = make, + minDoors = minDoors, + maxDoors = maxDoors, + fuelLevel = fuelLevel, + capacity = capacity + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/VendorLocationDetails.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/VendorLocationDetails.kt new file mode 100644 index 000000000..2a05c1f50 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/VendorLocationDetails.kt @@ -0,0 +1,135 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.CarsDistance +import com.expediagroup.sdk.xap.models.CarsLocation +import com.expediagroup.sdk.xap.models.DateTimePeriod +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 + +/** + * Drop off information + * @param dateTime Pickup date and time. + * @param location + * @param shuttleCategory The category of shuttle from the terminal to the rental car counter. Please find list of Shuttle Categories in the Related Links Section below. + * @param distance + * @param openSchedule A List of date time periods to indicate the vendor business hours for the pickup time. + */ +data class VendorLocationDetails( + // Pickup date and time. + @JsonProperty("DateTime") + val dateTime: java.time.LocalDateTime, + @JsonProperty("Location") + @field:NotNull + @field:Valid + val location: CarsLocation, + // The category of shuttle from the terminal to the rental car counter. Please find list of Shuttle Categories in the Related Links Section below. + @JsonProperty("ShuttleCategory") + @field:Valid + val shuttleCategory: kotlin.String? = null, + @JsonProperty("Distance") + @field:Valid + val distance: CarsDistance? = null, + // A List of date time periods to indicate the vendor business hours for the pickup time. + @JsonProperty("OpenSchedule") + @field:Valid + val openSchedule: kotlin.collections.List? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var dateTime: java.time.LocalDateTime? = null, + private var location: CarsLocation? = null, + private var shuttleCategory: kotlin.String? = null, + private var distance: CarsDistance? = null, + private var openSchedule: kotlin.collections.List? = null + ) { + fun dateTime(dateTime: java.time.LocalDateTime) = apply { this.dateTime = dateTime } + + fun location(location: CarsLocation) = apply { this.location = location } + + fun shuttleCategory(shuttleCategory: kotlin.String?) = apply { this.shuttleCategory = shuttleCategory } + + fun distance(distance: CarsDistance?) = apply { this.distance = distance } + + fun openSchedule(openSchedule: kotlin.collections.List?) = apply { this.openSchedule = openSchedule } + + fun build(): VendorLocationDetails { + val instance = + VendorLocationDetails( + dateTime = dateTime!!, + location = location!!, + shuttleCategory = shuttleCategory, + distance = distance, + openSchedule = openSchedule + ) + + validate(instance) + + return instance + } + + private fun validate(instance: VendorLocationDetails) { + 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( + dateTime = dateTime!!, + location = location!!, + shuttleCategory = shuttleCategory, + distance = distance, + openSchedule = openSchedule + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/WaiverPolicy.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/WaiverPolicy.kt new file mode 100644 index 000000000..4d0bb5d15 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/WaiverPolicy.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.xap.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 + +/** + * + * @param waiverPolicyDescription The localized waiver policy description, which could be put in front of cancellation policy description. + */ +data class WaiverPolicy( + // The localized waiver policy description, which could be put in front of cancellation policy description. + @JsonProperty("WaiverPolicyDescription") + @field:Valid + val waiverPolicyDescription: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var waiverPolicyDescription: kotlin.String? = null + ) { + fun waiverPolicyDescription(waiverPolicyDescription: kotlin.String?) = apply { this.waiverPolicyDescription = waiverPolicyDescription } + + fun build(): WaiverPolicy { + val instance = + WaiverPolicy( + waiverPolicyDescription = waiverPolicyDescription + ) + + validate(instance) + + return instance + } + + private fun validate(instance: WaiverPolicy) { + 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( + waiverPolicyDescription = waiverPolicyDescription + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Warning.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Warning.kt new file mode 100644 index 000000000..86b7d77b1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/Warning.kt @@ -0,0 +1,141 @@ +/* + * 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.xap.models + +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.models.Money +import com.fasterxml.jackson.annotation.JsonProperty +import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator +import javax.validation.Valid +import javax.validation.Validation + +/** + * There were some errors or events during the transaction, but the API has still returned a response. Container for all warnings. + * @param code The code of a warning. + * @param description A detail information of what happened. + * @param originalPrice + * @param newPrice + * @param changedAmount + * @param changedPercentage The changed percentage. In the sample 2.97 means the changed percentage is 2.97%. + */ +data class Warning( + // The code of a warning. + @JsonProperty("Code") + @field:Valid + val code: kotlin.String? = null, + // A detail information of what happened. + @JsonProperty("Description") + @field:Valid + val description: kotlin.String? = null, + @JsonProperty("OriginalPrice") + @field:Valid + val originalPrice: Money? = null, + @JsonProperty("NewPrice") + @field:Valid + val newPrice: Money? = null, + @JsonProperty("ChangedAmount") + @field:Valid + val changedAmount: Money? = null, + // The changed percentage. In the sample 2.97 means the changed percentage is 2.97%. + @JsonProperty("ChangedPercentage") + @field:Valid + val changedPercentage: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var code: kotlin.String? = null, + private var description: kotlin.String? = null, + private var originalPrice: Money? = null, + private var newPrice: Money? = null, + private var changedAmount: Money? = null, + private var changedPercentage: kotlin.String? = null + ) { + fun code(code: kotlin.String?) = apply { this.code = code } + + fun description(description: kotlin.String?) = apply { this.description = description } + + fun originalPrice(originalPrice: Money?) = apply { this.originalPrice = originalPrice } + + fun newPrice(newPrice: Money?) = apply { this.newPrice = newPrice } + + fun changedAmount(changedAmount: Money?) = apply { this.changedAmount = changedAmount } + + fun changedPercentage(changedPercentage: kotlin.String?) = apply { this.changedPercentage = changedPercentage } + + fun build(): Warning { + val instance = + Warning( + code = code, + description = description, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount, + changedPercentage = changedPercentage + ) + + validate(instance) + + return instance + } + + private fun validate(instance: Warning) { + 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, + description = description, + originalPrice = originalPrice, + newPrice = newPrice, + changedAmount = changedAmount, + changedPercentage = changedPercentage + ) +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/When.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/When.kt new file mode 100644 index 000000000..f1a5224c1 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/When.kt @@ -0,0 +1,117 @@ +/* + * 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.xap.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 + +/** + * Indicate when to pay. + * @param type Indicates the time of the deposit collection. Options are: UPON_BOOKING The customer must pay the deposit when booking the property. DAYS_PRIOR The customer must pay the deposit a number of days before arriving at the property. UPON_ARRIVAL The customer must pay the deposit upon arriving at the property. + * @param `value` This value will only be shown when Deposit Type is DAYS_PRIOR to indicate the number of days prior to check in when the deposit will be collected. + */ +data class When( + // Indicates the time of the deposit collection. Options are: UPON_BOOKING The customer must pay the deposit when booking the property. DAYS_PRIOR The customer must pay the deposit a number of days before arriving at the property. UPON_ARRIVAL The customer must pay the deposit upon arriving at the property. + @JsonProperty("Type") + val type: When.Type? = null, + // This value will only be shown when Deposit Type is DAYS_PRIOR to indicate the number of days prior to check in when the deposit will be collected. + @JsonProperty("Value") + @field:Valid + val `value`: kotlin.String? = null +) { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + private var type: When.Type? = null, + private var `value`: kotlin.String? = null + ) { + fun type(type: When.Type?) = apply { this.type = type } + + fun `value`(`value`: kotlin.String?) = apply { this.`value` = `value` } + + fun build(): When { + val instance = + When( + type = type, + `value` = `value` + ) + + validate(instance) + + return instance + } + + private fun validate(instance: When) { + 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( + type = type, + `value` = `value` + ) + + /** + * Indicates the time of the deposit collection. Options are: UPON_BOOKING The customer must pay the deposit when booking the property. DAYS_PRIOR The customer must pay the deposit a number of days before arriving at the property. UPON_ARRIVAL The customer must pay the deposit upon arriving at the property. + * Values: UPON_BOOKING,DAYS_PRIOR,UPON_ARRIVAL + */ + enum class Type(val value: kotlin.String) { + @JsonProperty("UPON_BOOKING") + UPON_BOOKING("UPON_BOOKING"), + + @JsonProperty("DAYS_PRIOR") + DAYS_PRIOR("DAYS_PRIOR"), + + @JsonProperty("UPON_ARRIVAL") + UPON_ARRIVAL("UPON_ARRIVAL") + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/models/exception/ApiException.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/exception/ApiException.kt new file mode 100644 index 000000000..6a67cbdb4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/models/exception/ApiException.kt @@ -0,0 +1,257 @@ +/* + * 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.xap.models.exception + +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupApiException +import com.expediagroup.sdk.core.model.exception.service.ExpediaGroupServiceDefaultErrorException +import com.expediagroup.sdk.core.model.getTransactionId +import com.expediagroup.sdk.xap.models.* +import io.ktor.client.call.body +import io.ktor.client.statement.HttpResponse +import io.ktor.client.statement.bodyAsText +import io.ktor.client.statement.request +import kotlinx.coroutines.runBlocking + +internal open class HttpStatusCodeRange( + private val statusCode: String, + val getException: (HttpResponse) -> ExpediaGroupApiException +) : Comparable { + 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) +} + +internal object DefaultHttpStatusCodeRange : HttpStatusCodeRange( + "DefaultHttpStatusCodeRange", + { ExpediaGroupServiceDefaultErrorException(it.status.value, runBlocking { it.bodyAsText() }, it.request.headers.getTransactionId()) } +) { + override fun matches(statusCode: String): Boolean = true + + override fun isRangeDefinition(): Boolean = true +} + +internal object ErrorObjectMapper { + private val defaultHttpStatusCodeRanges = listOf(DefaultHttpStatusCodeRange) + private val httpStatusCodeRanges: Map> = + mapOf( + Pair( + "getCarDetails", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiCarsErrorsException(it.status.value, fetchErrorObject(it) as CarsErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { ExpediaGroupApiCarsErrorsException(it.status.value, fetchErrorObject(it) as CarsErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getCarsListings", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiCarsErrorsException(it.status.value, fetchErrorObject(it) as CarsErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { ExpediaGroupApiAPIMErrorException(it.status.value, fetchErrorObject(it) as APIMError, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getFeedDownloadUrl", + listOf( + HttpStatusCodeRange("400") { + ExpediaGroupApiPresignedUrlResponseException(it.status.value, fetchErrorObject(it) as PresignedUrlResponse, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("401") { ExpediaGroupApiSdpAPIMErrorException(it.status.value, fetchErrorObject(it) as SdpAPIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("403") { ExpediaGroupApiSdpAPIMErrorException(it.status.value, fetchErrorObject(it) as SdpAPIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("404") { ExpediaGroupApiSdpAPIMErrorException(it.status.value, fetchErrorObject(it) as SdpAPIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { ExpediaGroupApiSdpAPIMErrorException(it.status.value, fetchErrorObject(it) as SdpAPIMError, it.headers.getTransactionId()) }, + HttpStatusCodeRange("500") { + ExpediaGroupApiPresignedUrlResponseException(it.status.value, fetchErrorObject(it) as PresignedUrlResponse, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("503") { ExpediaGroupApiSdpAPIMErrorException(it.status.value, fetchErrorObject(it) as SdpAPIMError, it.headers.getTransactionId()) }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getLodgingAvailabilityCalendars", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiLodgingErrorsException(it.status.value, fetchErrorObject(it) as LodgingErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("403") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("429") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("500") { ExpediaGroupApiLodgingErrorsException(it.status.value, fetchErrorObject(it) as LodgingErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("504") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getLodgingDetails", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("403") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("429") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("504") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getLodgingListings", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("403") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("429") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("504") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getLodgingQuotes", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiLodgingErrorsException(it.status.value, fetchErrorObject(it) as LodgingErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("403") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("429") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("500") { ExpediaGroupApiLodgingErrorsException(it.status.value, fetchErrorObject(it) as LodgingErrors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("504") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + DefaultHttpStatusCodeRange + ) + ), + Pair( + "getLodgingRateCalendar", + listOf( + HttpStatusCodeRange("400") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("401") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("403") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("409") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("429") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("500") { ExpediaGroupApiErrorsException(it.status.value, fetchErrorObject(it) as Errors, it.headers.getTransactionId()) }, + HttpStatusCodeRange("503") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + HttpStatusCodeRange("504") { + ExpediaGroupApiAPIGatewayErrorException(it.status.value, fetchErrorObject(it) as APIGatewayError, it.headers.getTransactionId()) + }, + DefaultHttpStatusCodeRange + ) + ) + ) + + fun process( + httpResponse: HttpResponse, + operationId: String + ): ExpediaGroupApiException = + 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()) } + } +} + +class ExpediaGroupApiCarsErrorsException(code: Int, override val errorObject: CarsErrors, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) + +class ExpediaGroupApiAPIMErrorException(code: Int, override val errorObject: APIMError, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) + +class ExpediaGroupApiPresignedUrlResponseException(code: Int, override val errorObject: PresignedUrlResponse, transactionId: String?) : ExpediaGroupApiException( + code, + errorObject, + transactionId +) + +class ExpediaGroupApiSdpAPIMErrorException(code: Int, override val errorObject: SdpAPIMError, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) + +class ExpediaGroupApiLodgingErrorsException(code: Int, override val errorObject: LodgingErrors, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) + +class ExpediaGroupApiAPIGatewayErrorException(code: Int, override val errorObject: APIGatewayError, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) + +class ExpediaGroupApiErrorsException(code: Int, override val errorObject: Errors, transactionId: String?) : ExpediaGroupApiException(code, errorObject, transactionId) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarDetailsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarDetailsOperation.kt new file mode 100644 index 000000000..69021e83d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarDetailsOperation.kt @@ -0,0 +1,44 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation +import org.apache.commons.text.StringSubstitutor + +/** + * Get Extended information with a single car offer + * @property params [GetCarDetailsOperationParams] + */ +class GetCarDetailsOperation( + params: GetCarDetailsOperationParams +) : Operation< + Nothing + >( + url(params), + "GET", + "getCarDetails", + null, + params + ) { + companion object { + fun url(params: GetCarDetailsOperationParams): String { + val url = "/cars/details/{offerToken}" + val substitutor = StringSubstitutor(params.getPathParams(), "{", "}") + return substitutor.replace(url) + } + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarDetailsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarDetailsOperationParams.kt new file mode 100644 index 000000000..e7d897da3 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarDetailsOperationParams.kt @@ -0,0 +1,162 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +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 offerToken car offer token + * @property partnerTransactionId [Not consumed by Expedia] Partner-generated identifier. + * @property price The total price for the product. + * @property currency Price currency code + * @property source source mobile - The value mobile represents that the client is mobile. + */ +@JsonDeserialize(builder = GetCarDetailsOperationParams.Builder::class) +data class GetCarDetailsOperationParams( + @field:NotNull + @field:Valid + val offerToken: kotlin.String, + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:NotNull + @field:Valid + val price: kotlin.String, + @field:NotNull + @field:Valid + val currency: kotlin.String, + @field:Valid + val source: kotlin.String? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + @JsonProperty("offerToken") private var offerToken: kotlin.String? = null, + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("price") private var price: kotlin.String? = null, + @JsonProperty("currency") private var currency: kotlin.String? = null, + @JsonProperty("source") private var source: kotlin.String? = null + ) { + /** + * @param offerToken car offer token + */ + fun offerToken(offerToken: kotlin.String) = apply { this.offerToken = offerToken } + + /** + * @param partnerTransactionId [Not consumed by Expedia] Partner-generated identifier. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param price The total price for the product. + */ + fun price(price: kotlin.String) = apply { this.price = price } + + /** + * @param currency Price currency code + */ + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + /** + * @param source source mobile - The value mobile represents that the client is mobile. + */ + fun source(source: kotlin.String) = apply { this.source = source } + + fun build(): GetCarDetailsOperationParams { + val params = + GetCarDetailsOperationParams( + offerToken = offerToken!!, + partnerTransactionId = partnerTransactionId!!, + price = price!!, + currency = currency!!, + source = source + ) + + validate(params) + + return params + } + + private fun validate(params: GetCarDetailsOperationParams) { + 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( + offerToken = offerToken, + partnerTransactionId = partnerTransactionId, + price = price, + currency = currency, + source = source + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-car.v3+json,application/vnd.exp-car.v3+xml") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + price?.let { + append("price", it) + } + currency?.let { + append("currency", it) + } + source?.let { + append("source", it) + } + } + + override fun getPathParams(): Map = + buildMap { + offerToken?.also { + put("offerToken", offerToken) + } + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarsListingsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarsListingsOperation.kt new file mode 100644 index 000000000..8e61afc6b --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarsListingsOperation.kt @@ -0,0 +1,35 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation + +/** + * Search Expedia car inventory + * @property params [GetCarsListingsOperationParams] + */ +class GetCarsListingsOperation( + params: GetCarsListingsOperationParams +) : Operation< + Nothing + >( + "/cars/listings", + "GET", + "getCarsListings", + null, + params + ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarsListingsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarsListingsOperationParams.kt new file mode 100644 index 000000000..e2d314963 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetCarsListingsOperationParams.kt @@ -0,0 +1,585 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +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 java.time.temporal.ChronoUnit +import javax.validation.Valid +import javax.validation.Validation +import javax.validation.constraints.NotNull + +/** + * @property partnerTransactionId [Not consumed by Expedia] Partner-generated identifier. + * @property pickupAirport Three letter code for the airport at which the customer would like to pick up the car.Supported values: standard 3 letter IATA Airport Code.Please see a full list of Car Vendor Codes and Airport Codes in the Related Links Section below.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + * @property pickupCity The name of the city in which the customer would like to pick up the car.Search results will include up to 40 rental locations that are closest to the center point of the search.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + * @property pickupAddress The address of a car rental location where the customer would like to pick up the car.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + * @property pickupGeoLocation The latitude and longitude that defines where the customer would like to pick up the car.Latitude and longitude are separated by comma.South latitudes and West longitudes are represented by negative values.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + * @property pickupRadius Radius used in conjunction with a point to define the search area when searching by lat/ long, city or address.See ' unit' parameter below to select miles or kilometers.If no value is specified a default value of 25 will be assumed. + * @property dropOffAirport Three letter code for the airport at which the customer would like to drop off the car.Supported values: standard 3 letter IATA Airport Code.Please see a full list of Car Vendor Codes and Airport Codes in the Related Links Section below.Cannot coexist with other drop off parameters, only one drop off parameter is allowed per request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + * @property dropOffCity City name for the location at which the customer would like to drop off the car.Cannot coexist with other drop off parameters, only one drop off parameter is allowed in a request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + * @property dropOffAddress Address for the location at which the customer would like to drop off the car.Cannot coexist with other drop off parameters, only one drop off parameter is allowed in a request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + * @property dropOffGeoLocation Latitude and longitude for the location at which the customer would like to drop off the car.Latitude and longitude are separated by comma.South latitudes and West longitudes are represented by negative values.Cannot coexist with other drop off parameters, only one drop off parameter is allowed per request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + * @property dropOffRadius Radius used in conjunction with a point to define the search area when searching by lat/ long, city or address.See ' unit' parameter below to select miles or kilometers.If no value is specified a default value of 25 will be assumed.Note: The pickup radius value will be used (instead of the the drop-off radius) when the requested pickup and drop-off city/address are exactly the same. + * @property pickupTime Requested car pickup date and time.Date should be ISO8601 Date format.The default TIME is 10:30:00.The supported search window is today to 330 days in the future.(Note that each rental counter has different hours of operation. If you select a time in the middle of the night there may be no inventory available as all locations may be closed.) + * @property dropOffTime Requested car drop off date and time. Date should be ISO8601 Date format.The supported search window is today to 330 days in the future.Note: The dropOffTime must be at least 2 hours later than the pickupTime for the request to be valid. + * @property sortType Method of sorting the car search results.Supported value: Price.If no value is present a sort by 'price' will be assumed. + * @property sortOrder Order of sorting the car search results.Supported values: ASC, DESCIf no value is present a sort order of 'ascending' will be assumed. + * @property limit The maximum number of search results that will be returned by the query. + * @property suppliers A list of supplier ids or supplier names to be used to filter search results.Multiple supplier names or ids may be separated by comma.Please see a full list of Expedia Vendor Codes & Names in the Related Links Section below.The max count of suppliers requested is limited to 20.Note: while you may filter using either supplier name or supplier ID, it is recommended that you use supplier ID, as this value will remain consistent in the event of a merger or other name change by the supplier. + * @property carClasses A list of car classes to be used to filter search results.Multiple car classes may be separated by comma.Please see Class List in the Related Links Section below for all options. + * @property discount1Supplier Name or ID of the supplier who issued a coupon or discount code.NOTE: Only ONE discount code per transaction is currently supported by the API. If you enter more than one discount code, only the first one will be honored.Please see a full list of Expedia Vendor Codes & Names in the Related Links Section below. + * @property discount1Type The type of discount to be applied.Supported values: CorpDiscount | Coupon. + * @property discount1Code The code of the discount to be applied. + * @property transmissions A list of car transmission drive codes to be used to filter search results.Multiple car classes may be separated by a comma.Please see a full list of Transmission Drive Codes in the Related Links Section below. + * @property airConditioning Specify whether to filter for cars that include or exclude air conditioning. + * @property carTypes A list of car types to be used to filter search results.Multiple car types may be separated by comma.Please see a full list of Car Type Codes in the Related Links Section below. + * @property unit The distance unit for the radius of a location-based search, or the distance between the center point of a search and the vendor location.Supported values: KM | MI.Default value: KM. + * @property driverAge The age of the driver that will be renting the car.This value is required in the UK and optional elsewhere. + * @property links WS = WebSearch, AD = ApiDetails, WD = WebDetails + * @property source Indicates the source where the request is coming from.The available values for the source as below:browser - The value \"browser\" represents that the client is traditional website.mobile - The value \"mobile\" represents that the client is mobile.all - The value \"all\" indicates that the client includes both browser and mobile.Only one source value may be used at a time. + */ +@JsonDeserialize(builder = GetCarsListingsOperationParams.Builder::class) +data class GetCarsListingsOperationParams( + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:Valid + val pickupAirport: kotlin.String? = + null, + @field:Valid + val pickupCity: kotlin.String? = + null, + @field:Valid + val pickupAddress: kotlin.String? = + null, + @field:Valid + val pickupGeoLocation: kotlin.String? = + null, + @field:Valid + val pickupRadius: kotlin.Int? = + null, + @field:Valid + val dropOffAirport: kotlin.String? = + null, + @field:Valid + val dropOffCity: kotlin.String? = + null, + @field:Valid + val dropOffAddress: kotlin.String? = + null, + @field:Valid + val dropOffGeoLocation: kotlin.String? = + null, + @field:Valid + val dropOffRadius: kotlin.Int? = + null, + @field:NotNull + @field:Valid + val pickupTime: java.time.LocalDateTime, + @field:NotNull + @field:Valid + val dropOffTime: java.time.LocalDateTime, + val sortType: GetCarsListingsOperationParams.SortType? = + null, + val sortOrder: GetCarsListingsOperationParams.SortOrder? = + null, + @field:Valid + val limit: kotlin.Int? = + null, + @field:Valid + val suppliers: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val carClasses: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val discount1Supplier: kotlin.String? = + null, + val discount1Type: GetCarsListingsOperationParams.Discount1Type? = + null, + @field:Valid + val discount1Code: kotlin.String? = + null, + @field:Valid + val transmissions: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val airConditioning: kotlin.Boolean? = + null, + @field:Valid + val carTypes: kotlin.collections.Set< + kotlin.String + >? = + null, + val unit: GetCarsListingsOperationParams.Unit? = + null, + @field:Valid + val driverAge: kotlin.Int? = + null, + val links: kotlin.collections.List< + GetCarsListingsOperationParams.Links + >? = + null, + val source: GetCarsListingsOperationParams.Source? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + enum class SortType( + val value: kotlin.String + ) { + PRICE("Price") + } + + enum class SortOrder( + val value: kotlin.String + ) { + ASC("ASC"), + DESC("DESC") + } + + enum class Discount1Type( + val value: kotlin.String + ) { + CORP_DISCOUNT("CorpDiscount"), + COUPON("Coupon") + } + + enum class Unit( + val value: kotlin.String + ) { + KM("KM"), + MI("MI") + } + + enum class Links( + val value: kotlin.String + ) { + WS("WS"), + AD("AD"), + WD("WD") + } + + enum class Source( + val value: kotlin.String + ) { + BROWSER("browser"), + MOBILE("mobile"), + ALL("all") + } + + class Builder( + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("pickup.airport") private var pickupAirport: kotlin.String? = null, + @JsonProperty("pickup.city") private var pickupCity: kotlin.String? = null, + @JsonProperty("pickup.address") private var pickupAddress: kotlin.String? = null, + @JsonProperty("pickup.geoLocation") private var pickupGeoLocation: kotlin.String? = null, + @JsonProperty("pickup.radius") private var pickupRadius: kotlin.Int? = null, + @JsonProperty("dropOff.airport") private var dropOffAirport: kotlin.String? = null, + @JsonProperty("dropOff.city") private var dropOffCity: kotlin.String? = null, + @JsonProperty("dropOff.address") private var dropOffAddress: kotlin.String? = null, + @JsonProperty("dropOff.geoLocation") private var dropOffGeoLocation: kotlin.String? = null, + @JsonProperty("dropOff.radius") private var dropOffRadius: kotlin.Int? = null, + @JsonProperty("pickupTime") private var pickupTime: java.time.LocalDateTime? = null, + @JsonProperty("dropOffTime") private var dropOffTime: java.time.LocalDateTime? = null, + @JsonProperty("sortType") private var sortType: GetCarsListingsOperationParams.SortType? = null, + @JsonProperty("sortOrder") private var sortOrder: GetCarsListingsOperationParams.SortOrder? = null, + @JsonProperty("limit") private var limit: kotlin.Int? = null, + @JsonProperty("suppliers") private var suppliers: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("carClasses") private var carClasses: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("discount1.supplier") private var discount1Supplier: kotlin.String? = null, + @JsonProperty("discount1.type") private var discount1Type: GetCarsListingsOperationParams.Discount1Type? = null, + @JsonProperty("discount1.code") private var discount1Code: kotlin.String? = null, + @JsonProperty("transmissions") private var transmissions: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("airConditioning") private var airConditioning: kotlin.Boolean? = null, + @JsonProperty("carTypes") private var carTypes: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("unit") private var unit: GetCarsListingsOperationParams.Unit? = null, + @JsonProperty("driverAge") private var driverAge: kotlin.Int? = null, + @JsonProperty("links") private var links: kotlin.collections.List< + GetCarsListingsOperationParams.Links + >? = null, + @JsonProperty("source") private var source: GetCarsListingsOperationParams.Source? = null + ) { + /** + * @param partnerTransactionId [Not consumed by Expedia] Partner-generated identifier. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param pickupAirport Three letter code for the airport at which the customer would like to pick up the car.Supported values: standard 3 letter IATA Airport Code.Please see a full list of Car Vendor Codes and Airport Codes in the Related Links Section below.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + */ + fun pickupAirport(pickupAirport: kotlin.String) = apply { this.pickupAirport = pickupAirport } + + /** + * @param pickupCity The name of the city in which the customer would like to pick up the car.Search results will include up to 40 rental locations that are closest to the center point of the search.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + */ + fun pickupCity(pickupCity: kotlin.String) = apply { this.pickupCity = pickupCity } + + /** + * @param pickupAddress The address of a car rental location where the customer would like to pick up the car.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + */ + fun pickupAddress(pickupAddress: kotlin.String) = apply { this.pickupAddress = pickupAddress } + + /** + * @param pickupGeoLocation The latitude and longitude that defines where the customer would like to pick up the car.Latitude and longitude are separated by comma.South latitudes and West longitudes are represented by negative values.Cannot coexist with other pickup parameters, only one pickup parameter is allowed per request. + */ + fun pickupGeoLocation(pickupGeoLocation: kotlin.String) = apply { this.pickupGeoLocation = pickupGeoLocation } + + /** + * @param pickupRadius Radius used in conjunction with a point to define the search area when searching by lat/ long, city or address.See ' unit' parameter below to select miles or kilometers.If no value is specified a default value of 25 will be assumed. + */ + fun pickupRadius(pickupRadius: kotlin.Int) = apply { this.pickupRadius = pickupRadius } + + /** + * @param dropOffAirport Three letter code for the airport at which the customer would like to drop off the car.Supported values: standard 3 letter IATA Airport Code.Please see a full list of Car Vendor Codes and Airport Codes in the Related Links Section below.Cannot coexist with other drop off parameters, only one drop off parameter is allowed per request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + */ + fun dropOffAirport(dropOffAirport: kotlin.String) = apply { this.dropOffAirport = dropOffAirport } + + /** + * @param dropOffCity City name for the location at which the customer would like to drop off the car.Cannot coexist with other drop off parameters, only one drop off parameter is allowed in a request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + */ + fun dropOffCity(dropOffCity: kotlin.String) = apply { this.dropOffCity = dropOffCity } + + /** + * @param dropOffAddress Address for the location at which the customer would like to drop off the car.Cannot coexist with other drop off parameters, only one drop off parameter is allowed in a request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + */ + fun dropOffAddress(dropOffAddress: kotlin.String) = apply { this.dropOffAddress = dropOffAddress } + + /** + * @param dropOffGeoLocation Latitude and longitude for the location at which the customer would like to drop off the car.Latitude and longitude are separated by comma.South latitudes and West longitudes are represented by negative values.Cannot coexist with other drop off parameters, only one drop off parameter is allowed per request.If no drop off location is specified, it is assumed that the customer will be dropping the car off at the same location at which they picked it up. + */ + fun dropOffGeoLocation(dropOffGeoLocation: kotlin.String) = apply { this.dropOffGeoLocation = dropOffGeoLocation } + + /** + * @param dropOffRadius Radius used in conjunction with a point to define the search area when searching by lat/ long, city or address.See ' unit' parameter below to select miles or kilometers.If no value is specified a default value of 25 will be assumed.Note: The pickup radius value will be used (instead of the the drop-off radius) when the requested pickup and drop-off city/address are exactly the same. + */ + fun dropOffRadius(dropOffRadius: kotlin.Int) = apply { this.dropOffRadius = dropOffRadius } + + /** + * @param pickupTime Requested car pickup date and time.Date should be ISO8601 Date format.The default TIME is 10:30:00.The supported search window is today to 330 days in the future.(Note that each rental counter has different hours of operation. If you select a time in the middle of the night there may be no inventory available as all locations may be closed.) + */ + fun pickupTime(pickupTime: java.time.LocalDateTime) = apply { this.pickupTime = pickupTime } + + /** + * @param dropOffTime Requested car drop off date and time. Date should be ISO8601 Date format.The supported search window is today to 330 days in the future.Note: The dropOffTime must be at least 2 hours later than the pickupTime for the request to be valid. + */ + fun dropOffTime(dropOffTime: java.time.LocalDateTime) = apply { this.dropOffTime = dropOffTime } + + /** + * @param sortType Method of sorting the car search results.Supported value: Price.If no value is present a sort by 'price' will be assumed. + */ + fun sortType(sortType: GetCarsListingsOperationParams.SortType) = apply { this.sortType = sortType } + + /** + * @param sortOrder Order of sorting the car search results.Supported values: ASC, DESCIf no value is present a sort order of 'ascending' will be assumed. + */ + fun sortOrder(sortOrder: GetCarsListingsOperationParams.SortOrder) = apply { this.sortOrder = sortOrder } + + /** + * @param limit The maximum number of search results that will be returned by the query. + */ + fun limit(limit: kotlin.Int) = apply { this.limit = limit } + + /** + * @param suppliers A list of supplier ids or supplier names to be used to filter search results.Multiple supplier names or ids may be separated by comma.Please see a full list of Expedia Vendor Codes & Names in the Related Links Section below.The max count of suppliers requested is limited to 20.Note: while you may filter using either supplier name or supplier ID, it is recommended that you use supplier ID, as this value will remain consistent in the event of a merger or other name change by the supplier. + */ + fun suppliers( + suppliers: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.suppliers = suppliers } + + /** + * @param carClasses A list of car classes to be used to filter search results.Multiple car classes may be separated by comma.Please see Class List in the Related Links Section below for all options. + */ + fun carClasses( + carClasses: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.carClasses = carClasses } + + /** + * @param discount1Supplier Name or ID of the supplier who issued a coupon or discount code.NOTE: Only ONE discount code per transaction is currently supported by the API. If you enter more than one discount code, only the first one will be honored.Please see a full list of Expedia Vendor Codes & Names in the Related Links Section below. + */ + fun discount1Supplier(discount1Supplier: kotlin.String) = apply { this.discount1Supplier = discount1Supplier } + + /** + * @param discount1Type The type of discount to be applied.Supported values: CorpDiscount | Coupon. + */ + fun discount1Type(discount1Type: GetCarsListingsOperationParams.Discount1Type) = apply { this.discount1Type = discount1Type } + + /** + * @param discount1Code The code of the discount to be applied. + */ + fun discount1Code(discount1Code: kotlin.String) = apply { this.discount1Code = discount1Code } + + /** + * @param transmissions A list of car transmission drive codes to be used to filter search results.Multiple car classes may be separated by a comma.Please see a full list of Transmission Drive Codes in the Related Links Section below. + */ + fun transmissions( + transmissions: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.transmissions = transmissions } + + /** + * @param airConditioning Specify whether to filter for cars that include or exclude air conditioning. + */ + fun airConditioning(airConditioning: kotlin.Boolean) = apply { this.airConditioning = airConditioning } + + /** + * @param carTypes A list of car types to be used to filter search results.Multiple car types may be separated by comma.Please see a full list of Car Type Codes in the Related Links Section below. + */ + fun carTypes( + carTypes: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.carTypes = carTypes } + + /** + * @param unit The distance unit for the radius of a location-based search, or the distance between the center point of a search and the vendor location.Supported values: KM | MI.Default value: KM. + */ + fun unit(unit: GetCarsListingsOperationParams.Unit) = apply { this.unit = unit } + + /** + * @param driverAge The age of the driver that will be renting the car.This value is required in the UK and optional elsewhere. + */ + fun driverAge(driverAge: kotlin.Int) = apply { this.driverAge = driverAge } + + /** + * @param links WS = WebSearch, AD = ApiDetails, WD = WebDetails + */ + fun links( + links: kotlin.collections.List< + GetCarsListingsOperationParams.Links + > + ) = apply { this.links = links } + + /** + * @param source Indicates the source where the request is coming from.The available values for the source as below:browser - The value \"browser\" represents that the client is traditional website.mobile - The value \"mobile\" represents that the client is mobile.all - The value \"all\" indicates that the client includes both browser and mobile.Only one source value may be used at a time. + */ + fun source(source: GetCarsListingsOperationParams.Source) = apply { this.source = source } + + fun build(): GetCarsListingsOperationParams { + val params = + GetCarsListingsOperationParams( + partnerTransactionId = partnerTransactionId!!, + pickupAirport = pickupAirport, + pickupCity = pickupCity, + pickupAddress = pickupAddress, + pickupGeoLocation = pickupGeoLocation, + pickupRadius = pickupRadius, + dropOffAirport = dropOffAirport, + dropOffCity = dropOffCity, + dropOffAddress = dropOffAddress, + dropOffGeoLocation = dropOffGeoLocation, + dropOffRadius = dropOffRadius, + pickupTime = pickupTime!!, + dropOffTime = dropOffTime!!, + sortType = sortType, + sortOrder = sortOrder, + limit = limit, + suppliers = suppliers, + carClasses = carClasses, + discount1Supplier = discount1Supplier, + discount1Type = discount1Type, + discount1Code = discount1Code, + transmissions = transmissions, + airConditioning = airConditioning, + carTypes = carTypes, + unit = unit, + driverAge = driverAge, + links = links, + source = source + ) + + validate(params) + + return params + } + + private fun validate(params: GetCarsListingsOperationParams) { + 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( + partnerTransactionId = partnerTransactionId, + pickupAirport = pickupAirport, + pickupCity = pickupCity, + pickupAddress = pickupAddress, + pickupGeoLocation = pickupGeoLocation, + pickupRadius = pickupRadius, + dropOffAirport = dropOffAirport, + dropOffCity = dropOffCity, + dropOffAddress = dropOffAddress, + dropOffGeoLocation = dropOffGeoLocation, + dropOffRadius = dropOffRadius, + pickupTime = pickupTime, + dropOffTime = dropOffTime, + sortType = sortType, + sortOrder = sortOrder, + limit = limit, + suppliers = suppliers, + carClasses = carClasses, + discount1Supplier = discount1Supplier, + discount1Type = discount1Type, + discount1Code = discount1Code, + transmissions = transmissions, + airConditioning = airConditioning, + carTypes = carTypes, + unit = unit, + driverAge = driverAge, + links = links, + source = source + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-car.v3+json,application/vnd.exp-car.v3+xml") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + pickupAirport?.let { + append("pickup.airport", it) + } + pickupCity?.let { + append("pickup.city", it) + } + pickupAddress?.let { + append("pickup.address", it) + } + pickupGeoLocation?.let { + append("pickup.geoLocation", it) + } + pickupRadius?.let { + append("pickup.radius", it.toString()) + } + dropOffAirport?.let { + append("dropOff.airport", it) + } + dropOffCity?.let { + append("dropOff.city", it) + } + dropOffAddress?.let { + append("dropOff.address", it) + } + dropOffGeoLocation?.let { + append("dropOff.geoLocation", it) + } + dropOffRadius?.let { + append("dropOff.radius", it.toString()) + } + pickupTime?.let { + append("pickupTime", it.truncatedTo(ChronoUnit.MINUTES).toString()) + } + dropOffTime?.let { + append("dropOffTime", it.truncatedTo(ChronoUnit.MINUTES).toString()) + } + sortType?.let { + append("sortType", it.value) + } + sortOrder?.let { + append("sortOrder", it.value) + } + limit?.let { + append("limit", it.toString()) + } + suppliers?.let { + appendAll("suppliers", toMultiValue(it, "csv")) + } + carClasses?.let { + appendAll("carClasses", toMultiValue(it, "csv")) + } + discount1Supplier?.let { + append("discount1.supplier", it) + } + discount1Type?.let { + append("discount1.type", it.value) + } + discount1Code?.let { + append("discount1.code", it) + } + transmissions?.let { + appendAll("transmissions", toMultiValue(it, "csv")) + } + airConditioning?.let { + append("airConditioning", it.toString()) + } + carTypes?.let { + appendAll("carTypes", toMultiValue(it, "csv")) + } + unit?.let { + append("unit", it.value) + } + driverAge?.let { + append("driverAge", it.toString()) + } + links?.let { + appendAll("links", toMultiValue(it.map { item -> item.value }, "csv")) + } + source?.let { + append("source", it.value) + } + } + + override fun getPathParams(): Map = + buildMap { + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetFeedDownloadUrlOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetFeedDownloadUrlOperation.kt new file mode 100644 index 000000000..87d5a5ab7 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetFeedDownloadUrlOperation.kt @@ -0,0 +1,35 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation + +/** + * + * @property params [GetFeedDownloadUrlOperationParams] + */ +class GetFeedDownloadUrlOperation( + params: GetFeedDownloadUrlOperationParams +) : Operation< + Nothing + >( + "/feed/v1/download-url", + "GET", + "getFeedDownloadUrl", + null, + params + ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetFeedDownloadUrlOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetFeedDownloadUrlOperationParams.kt new file mode 100644 index 000000000..23b3a47ba --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetFeedDownloadUrlOperationParams.kt @@ -0,0 +1,211 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +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 type The type of file, used to get files by type. + * @property locale Follow ISO-3166 Country Codes and ISO-639 Language Codes, format: \"{LanguageCode}-{CountryCode}\".Support multiple values, for the feed files that support localization, Use this parameter to help filter out the localization files you want to download. If not using this parameter, then this API will return all locales files for specified type. If the specified type of file is not supported localization, there is no file will be returned. + * @property pointOfSupply The point of supply means a country generally. The downloadable files provided after specifying will only contain properties' information for that country. + * @property lodgingType The lodging type also means structure type, it only can be `CL`(Conventional Lodging) and `VR`(Vacation Rental). The downloadable files provided after specifying will only contain property information for that lodging type. + * @property brand The downloadable files provided after specifying will only contain property information for that brand. + */ +@JsonDeserialize(builder = GetFeedDownloadUrlOperationParams.Builder::class) +data class GetFeedDownloadUrlOperationParams( + @field:NotNull + val type: GetFeedDownloadUrlOperationParams.Type, + @field:Valid + val locale: kotlin.String? = + null, + val pointOfSupply: GetFeedDownloadUrlOperationParams.PointOfSupply? = + null, + val lodgingType: GetFeedDownloadUrlOperationParams.LodgingType? = + null, + val brand: GetFeedDownloadUrlOperationParams.Brand? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + enum class Type( + val value: kotlin.String + ) { + DESTINATION("DESTINATION"), + VENDORLOGO("VENDORLOGO"), + SUMMARY("SUMMARY"), + LISTINGS("LISTINGS"), + IMAGES("IMAGES"), + AMENITIES("AMENITIES"), + LOCATIONS("LOCATIONS"), + DESCRIPTIONS("DESCRIPTIONS"), + POLICIES("POLICIES"), + GUEST_REVIEW("GUEST_REVIEW"), + VACATION_RENTAL("VACATION_RENTAL"), + ALL_REGIONS("ALL_REGIONS"), + BOUNDING_POLYGON("BOUNDING_POLYGON"), + HOTEL_TO_REGION_HIERARCHY("HOTEL_TO_REGION_HIERARCHY") + } + + enum class PointOfSupply( + val value: kotlin.String + ) { + US("US"), + AT("AT"), + BR("BR"), + CA("CA"), + FR("FR"), + DE("DE"), + GR("GR"), + IT("IT"), + JA("JA"), + KR("KR"), + MX("MX"), + PT("PT"), + ES("ES"), + TR("TR"), + AE("AE"), + GB("GB") + } + + enum class LodgingType( + val value: kotlin.String + ) { + CL("CL"), + VR("VR") + } + + enum class Brand( + val value: kotlin.String + ) { + VRBO("VRBO") + } + + class Builder( + @JsonProperty("type") private var type: GetFeedDownloadUrlOperationParams.Type? = null, + @JsonProperty("locale") private var locale: kotlin.String? = null, + @JsonProperty("pointOfSupply") private var pointOfSupply: GetFeedDownloadUrlOperationParams.PointOfSupply? = null, + @JsonProperty("lodgingType") private var lodgingType: GetFeedDownloadUrlOperationParams.LodgingType? = null, + @JsonProperty("brand") private var brand: GetFeedDownloadUrlOperationParams.Brand? = null + ) { + /** + * @param type The type of file, used to get files by type. + */ + fun type(type: GetFeedDownloadUrlOperationParams.Type) = apply { this.type = type } + + /** + * @param locale Follow ISO-3166 Country Codes and ISO-639 Language Codes, format: \"{LanguageCode}-{CountryCode}\".Support multiple values, for the feed files that support localization, Use this parameter to help filter out the localization files you want to download. If not using this parameter, then this API will return all locales files for specified type. If the specified type of file is not supported localization, there is no file will be returned. + */ + fun locale(locale: kotlin.String) = apply { this.locale = locale } + + /** + * @param pointOfSupply The point of supply means a country generally. The downloadable files provided after specifying will only contain properties' information for that country. + */ + fun pointOfSupply(pointOfSupply: GetFeedDownloadUrlOperationParams.PointOfSupply) = apply { this.pointOfSupply = pointOfSupply } + + /** + * @param lodgingType The lodging type also means structure type, it only can be `CL`(Conventional Lodging) and `VR`(Vacation Rental). The downloadable files provided after specifying will only contain property information for that lodging type. + */ + fun lodgingType(lodgingType: GetFeedDownloadUrlOperationParams.LodgingType) = apply { this.lodgingType = lodgingType } + + /** + * @param brand The downloadable files provided after specifying will only contain property information for that brand. + */ + fun brand(brand: GetFeedDownloadUrlOperationParams.Brand) = apply { this.brand = brand } + + fun build(): GetFeedDownloadUrlOperationParams { + val params = + GetFeedDownloadUrlOperationParams( + type = type!!, + locale = locale, + pointOfSupply = pointOfSupply, + lodgingType = lodgingType, + brand = brand + ) + + validate(params) + + return params + } + + private fun validate(params: GetFeedDownloadUrlOperationParams) { + 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( + type = type, + locale = locale, + pointOfSupply = pointOfSupply, + lodgingType = lodgingType, + brand = brand + ) + + override fun getHeaders(): Headers = + Headers.build { + append("Accept", "application/vnd.exp-lodging.v1+json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + type?.let { + append("type", it.value) + } + locale?.let { + append("locale", it) + } + pointOfSupply?.let { + append("pointOfSupply", it.value) + } + lodgingType?.let { + append("lodgingType", it.value) + } + brand?.let { + append("brand", it.value) + } + } + + override fun getPathParams(): Map = + buildMap { + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingAvailabilityCalendarsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingAvailabilityCalendarsOperation.kt new file mode 100644 index 000000000..4878aee01 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingAvailabilityCalendarsOperation.kt @@ -0,0 +1,35 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation + +/** + * Get availability calendars of properties + * @property params [GetLodgingAvailabilityCalendarsOperationParams] + */ +class GetLodgingAvailabilityCalendarsOperation( + params: GetLodgingAvailabilityCalendarsOperationParams +) : Operation< + Nothing + >( + "/lodging/availabilityCalendars", + "GET", + "getLodgingAvailabilityCalendars", + null, + params + ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingAvailabilityCalendarsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingAvailabilityCalendarsOperationParams.kt new file mode 100644 index 000000000..08363b387 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingAvailabilityCalendarsOperationParams.kt @@ -0,0 +1,125 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +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 partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + * @property propertyIds Comma-separated list of Expedia Property IDs. The API request supports a maximum of 50 Property IDs in a single request. + */ +@JsonDeserialize(builder = GetLodgingAvailabilityCalendarsOperationParams.Builder::class) +data class GetLodgingAvailabilityCalendarsOperationParams( + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:Valid + val propertyIds: kotlin.collections.Set< + kotlin.String + >? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("propertyIds") private var propertyIds: kotlin.collections.Set< + kotlin.String + >? = null + ) { + /** + * @param partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param propertyIds Comma-separated list of Expedia Property IDs. The API request supports a maximum of 50 Property IDs in a single request. + */ + fun propertyIds( + propertyIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.propertyIds = propertyIds } + + fun build(): GetLodgingAvailabilityCalendarsOperationParams { + val params = + GetLodgingAvailabilityCalendarsOperationParams( + partnerTransactionId = partnerTransactionId!!, + propertyIds = propertyIds + ) + + validate(params) + + return params + } + + private fun validate(params: GetLodgingAvailabilityCalendarsOperationParams) { + 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( + partnerTransactionId = partnerTransactionId, + propertyIds = propertyIds + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-lodging.v3+json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + propertyIds?.let { + appendAll("propertyIds", toMultiValue(it, "csv")) + } + } + + override fun getPathParams(): Map = + buildMap { + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingDetailsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingDetailsOperation.kt new file mode 100644 index 000000000..3c8b9b0a4 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingDetailsOperation.kt @@ -0,0 +1,44 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation +import org.apache.commons.text.StringSubstitutor + +/** + * Get Extended information with a single property offer + * @property params [GetLodgingDetailsOperationParams] + */ +class GetLodgingDetailsOperation( + params: GetLodgingDetailsOperationParams +) : Operation< + Nothing + >( + url(params), + "GET", + "getLodgingDetails", + null, + params + ) { + companion object { + fun url(params: GetLodgingDetailsOperationParams): String { + val url = "/hotels/details/{offerToken}" + val substitutor = StringSubstitutor(params.getPathParams(), "{", "}") + return substitutor.replace(url) + } + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingDetailsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingDetailsOperationParams.kt new file mode 100644 index 000000000..44403bb61 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingDetailsOperationParams.kt @@ -0,0 +1,201 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +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 offerToken A Hotel Natural Key from the Lodging Search API -> Hotels -> RoomTypes -> OfferId. It is a concatenated string of multiple values that defines a hotel offer. + * @property partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + * @property price The total price of the selected property. This value will be used to determine if there is a price change between the details and booking request. The `price` element will be automatically included in the ApiDetails HATEOAS link which is returned along with the Lodging Details API response. + * @property currency Value should be a standard ISO 3 letter currency code. The currency code that is associated to the `TotalPrice` element for the selected property's rate plan from the Lodging Listing API response. The `currency` element will be automatically included in the ApiDetails HATEOAS link which is returned along with the Lodging Details response. + * @property locale `locale` is composed of language identifier and region identifier, connected by \"_\" that specifies the language in which the response will be returned. The `locale` value used in the Lodging Details API query should match the `locale` value that was used in the Lodging Search API query. + * @property imageSizes Indicate what size of image will be returned. The available image sizes are: - t : Thumbnail - s : Small - b : Big - y : 500x500v - z : 1000x1000v Resolution from smallest to largest is t < s < b < y < z. If no `imageSizes` is specified, the t size images will be returned. If an image is missing in one size, we will try to fall back to the same image with lower resolution. (If image \"_z\" is not available, we will try to return image \"_y\", and if it is also unavailable, we will return image \"_b\", and so on.) Only one image size is allowed. + * @property groupedAmenities Specifies whether to return the grouped amenities. If `groupedAmenities` is true, `DescriptiveAmenities` node will be returned in response, otherwise `Amenities` node will be returned. + */ +@JsonDeserialize(builder = GetLodgingDetailsOperationParams.Builder::class) +data class GetLodgingDetailsOperationParams( + @field:NotNull + @field:Valid + val offerToken: kotlin.String, + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:Valid + val price: kotlin.String? = + null, + @field:Valid + val currency: kotlin.String? = + null, + @field:Valid + val locale: kotlin.String? = + null, + val imageSizes: GetLodgingDetailsOperationParams.ImageSizes? = + ImageSizes.T, + @field:Valid + val groupedAmenities: kotlin.Boolean? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + enum class ImageSizes( + val value: kotlin.String + ) { + T("t"), + S("s"), + B("b"), + Y("y"), + Z("z") + } + + class Builder( + @JsonProperty("offerToken") private var offerToken: kotlin.String? = null, + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("price") private var price: kotlin.String? = null, + @JsonProperty("currency") private var currency: kotlin.String? = null, + @JsonProperty("locale") private var locale: kotlin.String? = null, + @JsonProperty("imageSizes") private var imageSizes: GetLodgingDetailsOperationParams.ImageSizes? = null, + @JsonProperty("groupedAmenities") private var groupedAmenities: kotlin.Boolean? = null + ) { + /** + * @param offerToken A Hotel Natural Key from the Lodging Search API -> Hotels -> RoomTypes -> OfferId. It is a concatenated string of multiple values that defines a hotel offer. + */ + fun offerToken(offerToken: kotlin.String) = apply { this.offerToken = offerToken } + + /** + * @param partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param price The total price of the selected property. This value will be used to determine if there is a price change between the details and booking request. The `price` element will be automatically included in the ApiDetails HATEOAS link which is returned along with the Lodging Details API response. + */ + fun price(price: kotlin.String) = apply { this.price = price } + + /** + * @param currency Value should be a standard ISO 3 letter currency code. The currency code that is associated to the `TotalPrice` element for the selected property's rate plan from the Lodging Listing API response. The `currency` element will be automatically included in the ApiDetails HATEOAS link which is returned along with the Lodging Details response. + */ + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + /** + * @param locale `locale` is composed of language identifier and region identifier, connected by \"_\" that specifies the language in which the response will be returned. The `locale` value used in the Lodging Details API query should match the `locale` value that was used in the Lodging Search API query. + */ + fun locale(locale: kotlin.String) = apply { this.locale = locale } + + /** + * @param imageSizes Indicate what size of image will be returned. The available image sizes are: - t : Thumbnail - s : Small - b : Big - y : 500x500v - z : 1000x1000v Resolution from smallest to largest is t < s < b < y < z. If no `imageSizes` is specified, the t size images will be returned. If an image is missing in one size, we will try to fall back to the same image with lower resolution. (If image \"_z\" is not available, we will try to return image \"_y\", and if it is also unavailable, we will return image \"_b\", and so on.) Only one image size is allowed. + */ + fun imageSizes(imageSizes: GetLodgingDetailsOperationParams.ImageSizes) = apply { this.imageSizes = imageSizes } + + /** + * @param groupedAmenities Specifies whether to return the grouped amenities. If `groupedAmenities` is true, `DescriptiveAmenities` node will be returned in response, otherwise `Amenities` node will be returned. + */ + fun groupedAmenities(groupedAmenities: kotlin.Boolean) = apply { this.groupedAmenities = groupedAmenities } + + fun build(): GetLodgingDetailsOperationParams { + val params = + GetLodgingDetailsOperationParams( + offerToken = offerToken!!, + partnerTransactionId = partnerTransactionId!!, + price = price, + currency = currency, + locale = locale, + imageSizes = imageSizes, + groupedAmenities = groupedAmenities + ) + + validate(params) + + return params + } + + private fun validate(params: GetLodgingDetailsOperationParams) { + 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( + offerToken = offerToken, + partnerTransactionId = partnerTransactionId, + price = price, + currency = currency, + locale = locale, + imageSizes = imageSizes, + groupedAmenities = groupedAmenities + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-hotel.v3+json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + price?.let { + append("price", it) + } + currency?.let { + append("currency", it) + } + locale?.let { + append("locale", it) + } + imageSizes?.let { + append("imageSizes", it.value) + } + groupedAmenities?.let { + append("groupedAmenities", it.toString()) + } + } + + override fun getPathParams(): Map = + buildMap { + offerToken?.also { + put("offerToken", offerToken) + } + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingListingsOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingListingsOperation.kt new file mode 100644 index 000000000..8c1263988 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingListingsOperation.kt @@ -0,0 +1,35 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation + +/** + * Search lodging inventory + * @property params [GetLodgingListingsOperationParams] + */ +class GetLodgingListingsOperation( + params: GetLodgingListingsOperationParams +) : Operation< + Nothing + >( + "/hotels/listings", + "GET", + "getLodgingListings", + null, + params + ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingListingsOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingListingsOperationParams.kt new file mode 100644 index 000000000..e8661f32f --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingListingsOperationParams.kt @@ -0,0 +1,1022 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +import com.expediagroup.sdk.xap.models.Room +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 partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + * @property ecomHotelIds Comma-separated list of Expedia hotel IDs. There can be no spaces between parameters. + * @property hcomHotelIds Comma-separated list of Hotels.com hotel IDs. There can be no spaces between parameters. + * @property geoLocation The latitude and longitude values identifying the center point of a search radius (circle). North latitude will be represented by a positive value. South latitude by a negative value. East longitude will be represented by a positive value. West longitude by a negative value. The latitude and longitude values are joined together with a comma (,) character. There can be no spaces between parameters. This parameter should be used in combination with the radius and unit parameters below. + * @property radius The size of the search radius around a specified point when searching by `geoLocation`, `locationKeyword`, or `regionids`. `radius` is optional and the default value is 25 km for `geoLocation` and `locationKeyword` if not specified. `radius` must be less than 200 km or 124 mi. This parameter should be used in combination with the `unit` and `geoLocation`, `locationKeyword`, or `regionids` parameters.\" + * @property unit The unit of measure for searches performed via `geoLocation`, `locationKeyword`, or `regionids`. Valid units are `km` and `mi`. This parameter should be used in combination with the `radius` and `geoLocation`, `locationKeyword`, or `regionids`. + * @property locationKeyword A keyword search for a location. The keyword can be a city, address, airport or a landmark. This parameter should be used in combination with the `radius` and `unit` parameters above to define a circle around the landmark. The default radius value is 25 if not specified. Combined search is not supported, if more than one search method is included in the request, an error will be returned. + * @property regionIds Comma-separated list of Expedia Region IDs. There can be no spaces between parameters. Search returns set of all hotels in the combined regions. You may search using a string of 1 - 10 Region ID's. More than 10 Region ID's are not supported and will generate and error. You can get the complete list of Expedia Region IDs from [Static Data Platform ALL_REGIONS file](https://developers.expediagroup.com/xap/products/xap/static-data-platform/download-url-api/download-url-api-v1). This parameter could be used in combination with the `radius` and `unit` parameters above to define a circle around the `regionIds`. The default radius value is 0 if not specified. + * @property checkIn Check-in date for hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkOut` parameter. If `checkIn` and `checkOut` are not included, a dateless search will be conducted which returns a `Featured Offer` for each of the hotels found. If one of `checkIn` and `checkOut` is not included, an error will be returned. The maximum advanced search window is 500 days in the future, and the maximum length of stay is 28. + * @property checkOut Checkout date for hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkIn` parameter. If `checkIn` and `checkOut` are not included, a dateless search will be conducted which returns a `Featured Offer` for each of the hotels found. If one of `checkIn` and `checkOut` is not included, an error will be returned. The maximum advanced search window is 500 days in the future, and the maximum length of stay is 28. + * @property locale `locale` is composed of language identifier and region identifier, connected by \"_\" that specifies the language in which the response will be returned. You can find a link to the complete list of `locales` along with the Point of Sale List in [Supported Points of Sale](https://developers.expediagroup.com/xap/products/xap/lodging/references/supported-points-of-sale). Note that even though the Listings API supports localization for all `locales` listed in the list, all `locales` are not valid for all Points of Sale. For example, Ecom US POS supports `en_US`, `es_MX` and `zh_CN`. For Ecom US POS, the Listings API will respond with content in Spanish for requests with either `locale=es_MX` or `es_US`. However, only the deeplinks for `locale=es_MX` should work properly and switch the website to Spanish, while the ones for locale=es_US will be fallen back to English. If not specified in the query, the native language for that POS will be returned. And if more than one language is supported, the response will be returned in the first language depending on the language setting of the POS. + * @property currency Value should be a standard ISO 3 letter currency code. + * @property source Indicate the source where the request is coming from. + * @property travelWithPets Indicates if the search should include pet-friendly properties. If set to \"True\" only properties that allow pets are returned. Pet fees, if available, are included in TaxesAndFees. The parameter is only applicable to the Vrbo brand. + * @property contentDetails This parameter is optional and can be specified as the following values. - lowest - low (default) - medium - high ### *lowest* Returns the absolute minimum response for up to 1,000 hotels: - Count(Count of hotels that are actually returned) - TotalHotelCount(Count of hotels that are requested) - TransactionId - StayDates - LengthOfStay - NumberOfRooms - Occupants - ***Hotels*** - Id - Status - Links - ***RoomTypes*** - RoomKey [Deprecated] - OfferId - RatePlanType - ***RatePlans*** - RoomTypeId - RatePlanId - RateRuleId - InventorySourceId - RemainingCount - Price - MemberOnlyDeal - Promotions - PaymentMethod - FullDepositUponBooking - PaymentSchedule - CancellationPolicy - Price - BaseRate - TaxesAndFees - TotalPrice - TotalStrikeOutPrice - AvgNightlyRate - AvgNightlyStrikeOutRate - AvgNightlyRateWithFees - AvgNightlyStrikeOutRateWithFees - HotelMandatoryFees - TotalPriceWithHotelFees - NightlyRates - TaxesAndFeesDetails - RefundableDamageDeposit This minimal response is the best for partners that store static hotel location data locally, and who would like to have the smallest and fastest API response. ### *low* Returns basic hotel information in response for up to 1,000 hotels. Includes all elements returned when `contentDetails=lowest` plus: - ***Hotels*** - Name - PropertyType - PropertyDetails - LocalCurrencyCode - Location - Distance - Description(may not be localized) - ChainAndBrandInfo - ThumbnailUrl - StarRating - GuestRating - GuestReviewCount - PetFriendly - LgbtqiaFriendly - ImportantNotices - ***RoomTypes*** - Description - ***RatePlans*** - InventorySourceCode - PaymentTime - ReserveWithDeposit - FreeInternet - FreeWiFi - FreeParking - FreeBreakfast ### *medium* Returns more complete hotel information in response for up to 200 hotels. Includes all elements returned when `contentDetails=low` plus: - ***Hotels*** - HotelAmenities - RoomAmenities - ***RoomTypes*** - ***RatePlans*** - FreeInternetDetails - FreeBreakfastDetails - Amenities - Amenities **Note**: Setting the `contentDetails` to `medium` will automatically limit your response size to 200 hotels. ### *high* Returns extended hotel information in response for up to 5 hotels. Includes all elements returned when `contentDetails=medium` plus: - ***Hotels*** - RenovationsAndClosures - Policies - OptionalExtras - Media - Accessibility - ***RoomTypes*** - SmokingOption - BedTypeOptions - RoomOccupancyPolicy - Media **Note**: Setting the `contentDetails` to `high` will automatically limit your response size to 5 hotels. + * @property allRoomTypes Returns all available rate plans for the selected hotels. This parameter requires that a `checkIn` date and `checkOut` date be supplied, as the API cannot return additional room rates on a dateless search. Including `allRoomTypes=true` in your query will automatically limit your response size to no more than 200 hotels. Including `allRoomTypes=true` and `contentDetails=high` will limit your response size to no more than 5 hotels. + * @property links Comma-separated list to specify the types of deep links. - WD (link to Web Details site) - WS (link to Web Search Result page) - AD (link for Details API) - RC (link for RateCalendar API) - WEB (include all website links) - API (links for Details and RateCalendar API) There are two level of links returned in the API response: Property-level deeplinks and room-level deeplinks. When requesting API deeplinks you will receive both a RateCalendar API link at the property level, and Details API links at the room level, since the Lodging Details API only displays information on rate plan offers. When requesting AD deeplinks, you will only receive Details API links at the room level. `Links` node in property-level will be omitted. If you are looking for more complete details on a single property via the API, you should do another search in the Lodging API for the single Hotel ID, with `contentDetails=high` to get all details back in return (note that you can only get back a maximum of 5 hotels when `contentDetails` is set to `high`). **NOTE**: dateless searches will not return Details API links, since the Lodging Details API will only return details on a specific room offer for specific dates. + * @property minStarRating The minimum star rating for hotels returned in the response. + * @property maxStarRating The maximum star rating for hotels returned in the response. + * @property limit The maximum number of hotels returned in the response. Must be an integer greater than 0. If the value is greater than 1000, only the first 1000 hotels are returned. Settings on `contentDetails` and `allRoomTypes` parameters may cause this value to be overridden and a lower number of hotels to be returned. The `limit` parameter is intended to be used to control the response size, but partners should be careful about combining it with other filter parameters, as each parameter that you add will shrink the response, even to the point where you may even get a \"no hotel found\" error if none of the hotels in the base response meet the combined filter requirements. Filters are cumulative in effect, and results must meet all filter requirements to be displayed. + * @property queryText Query text is used for a full text search of hotel data. Text search based on hotel name, description, address, promotion description, amenities description. + * @property availOnly Specifies whether to return only available hotels in the search results. If the value of this parameter is true, the search results will only return hotels that have availability during the requested dates. If there are no hotels with availability in your search then an empty record set will be returned. This parameter is ignored for dateless searches. + * @property smokingPreference Specifies smoking preference. + * @property rateType Indicate which type of `paymentMethod` for each room will be returned. + * @property imageSizes Indicates what size images will be displayed for `hotelPhotos` and `roomPhotos` are returned when `contentDetails=high`. The available image sizes are: - t : Thumbnail - s : Small - b : Big - y : 500x500v - z : 1000x1000v Resolution from smallest to largest is t < s < b < y < z. If no `imageSizes` is specified, the t size images will be returned. If an image is missing in one size, we will try to fall back to the same image with lower resolution. (If image \"_z\" is not available, we will try to return image \"_y\", and if it is also unavailable, we will return image \"_b\", and so on.) Only one image size is allowed. + * @property thumbnailImageSize Indicate what size of image will be used for the single `thumbnail` image that is returned when `contentDetails` is set to `low`, `medium` or `high`. The available thumbnail image sizes are: - t : Thumbnail - s : Small - b : Big - y : 500x500v - z : 1000x1000v Resolution from smallest to largest is t < s < b < y < z. If no `thumbnailImageSize` is specified, the t size images will be returned. if no thumbnail image found, it would not return thumbnail image. Only one thumbnail image size is allowed. + * @property includedPropertyTypeIds Only return hotels where the `PropertyType` ID is one of the IDs in the `includedPropertyTypeIds` field. If the API query includes the parameter `contentDetail=lowest` the `PropertyType` parameter will not be returned in the response. Even in this case, the filtering is still being applied, even though there is no `PropertyType` parameter in the response with which to validate. `includedPropertyTypeIds` and `excludedPropertyTypeIds` fields are mutually exclusive - which means that each query may contain **one** of the parameters, or **neither** of the parameters, but the query may not contain **both** of the parameters. A complete list of supported Expedia Property Types can be found in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + * @property excludedPropertyTypeIds Return all hotels **except** those whose `PropertyType` ID is in the `excludedPropertyTypeIds` field. If the API query includes the parameter `contentDetail=lowest` the `PropertyType` parameter will not be returned in the response. Even in this case, the filtering is still being applied, even though there is no `PropertyType` parameter in the response with which to validate. `includedPropertyTypeIds` and `excludedPropertyTypeIds` fields are mutually exclusive - which means that each query may contain **one** of the parameters, or **neither** of the parameters, but the query may not contain **both** of the parameters. A complete list of supported Expedia Property Types can be found in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + * @property includedInventorySourceIds Querying with no `includedInventorySourceIds` parameter will return listings from all available inventory sources. Query with the `includedInventorySourceIds` parameter included will only return listings from the requested inventory sources. All others will be left out. `includedInventorySourceId=24` will return only Expedia lodging inventory. `includedInventorySourceId=83` will return only Vrbo lodging inventory. `includedInventorySourceId=24,83` will return both Expedia and Vrbo lodging inventory. + * @property freeCancellation Specifies whether to return only free cancelable room rates in the search results. If the value of this parameter is true, the search results will only return hotels that have free cancelable room rates during the requested dates. If there are no hotels with free cancelable room rates in your search then an empty record set will be returned. Default value is false, if query without this parameter or the value of this parameter is false, all available room rates will be returned. This parameter is ignored for dateless searches. + * @property groupedAmenities Specifies whether to return the grouped amenities. If `groupedAmenities` is true, `DescriptiveAmenities` node will be returned in response, otherwise `Amenities` node will be returned. + * @property blockFullDepositRateplan Specifies whether to return `rateplan` with `FullDepositUponBooking` as true. If `blockFullDepositRateplans` is true, the search results will not return `rateplan` with `FullDepositUponBooking` as true. The default value is false, if query without this parameter or the value of this parameter is false, all available rateplan will be returned. This parameter is ignored for dateless search. + * @property ratePlanType **Note**: This parameter is visible to partners only by configuration. Please contact your Expedia Account Manager if you need this parameter. To specify the desired rate plan types. The options are: - standalone : Ask for standalone rates - package : Ask for package rates, but standalone rate also may be returned if available. Otherwise only standalone rate plans will be returned. `WebSearchResult` and `WebDetails` links won't be returned for package rate. + * @property sortType Specifies the field that the search results will be ordered by. To be used in conjunction with sortOrder parameter below. **CMA Compliance Note (UK)**: partners doing business in the UK should be sorting their search results using the `totalpricewithfees` parameter in their query string so that the sorting complies with CMA regulations. + * @property sortOrder Specifies the sort order of search results. If no sort order is specified, the default is `asc`. But for deals sorting, it only supports `desc`. To be used in conjunction with the `sortType` parameter above. + * @property room1Adults Specifies the number of adults staying in a specific room. Default value is one room with 2 adults. Example: `room1.adults` is used to specify the number of adults in the first room. + * @property room1ChildAges Comma-separated list that specifies the age(s) for each of the children in each of the rooms. Example: `room2.childAges=1,3` means two children (1-year old and 3-year old) are staying in room #2. Children must be accompanied by an adult. + * @property room2Adults Specifies the number of adults staying in second room. + * @property room2ChildAges Comma-separated list that specifies the age(s) for each of the children in second room. + * @property room3Adults Specifies the number of adults staying in third room. + * @property room3ChildAges Comma-separated list that specifies the age(s) for each of the children in third room. + * @property room4Adults Specifies the number of adults staying in fourth room. + * @property room4ChildAges Comma-separated list that specifies the age(s) for each of the children in fourth room. + * @property room5Adults Specifies the number of adults staying in fifth room. + * @property room5ChildAges Comma-separated list that specifies the age(s) for each of the children in fifth room. + * @property room6Adults Specifies the number of adults staying in sixth room. + * @property room6ChildAges Comma-separated list that specifies the age(s) for each of the children in sixth room. + * @property room7Adults Specifies the number of adults staying in seventh room. + * @property room7ChildAges Comma-separated list that specifies the age(s) for each of the children in seventh room. + * @property room8Adults Specifies the number of adults staying in eighth room. + * @property room8ChildAges Comma-separated list that specifies the age(s) for each of the children in eighth room. + */ +@JsonDeserialize(builder = GetLodgingListingsOperationParams.Builder::class) +data class GetLodgingListingsOperationParams( + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:Valid + val ecomHotelIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val hcomHotelIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val geoLocation: kotlin.String? = + null, + @field:Valid + val radius: kotlin.Long? = + 25L, + val unit: GetLodgingListingsOperationParams.Unit? = + Unit.KM, + @field:Valid + val locationKeyword: kotlin.String? = + null, + @field:Valid + val regionIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val checkIn: java.time.LocalDate? = + null, + @field:Valid + val checkOut: java.time.LocalDate? = + null, + @field:Valid + val locale: kotlin.String? = + null, + @field:Valid + val currency: kotlin.String? = + null, + val source: GetLodgingListingsOperationParams.Source? = + Source.BROWSER, + @field:Valid + val travelWithPets: kotlin.Boolean? = + false, + val contentDetails: GetLodgingListingsOperationParams.ContentDetails? = + ContentDetails.LOW, + @field:Valid + val allRoomTypes: kotlin.Boolean? = + false, + val links: kotlin.collections.List< + GetLodgingListingsOperationParams.Links + >? = + null, + val minStarRating: GetLodgingListingsOperationParams.MinStarRating? = + null, + val maxStarRating: GetLodgingListingsOperationParams.MaxStarRating? = + null, + @field:Valid + val limit: kotlin.Long? = + null, + @field:Valid + val queryText: kotlin.String? = + null, + @field:Valid + val availOnly: kotlin.Boolean? = + null, + val smokingPreference: GetLodgingListingsOperationParams.SmokingPreference? = + null, + val rateType: GetLodgingListingsOperationParams.RateType? = + null, + val imageSizes: GetLodgingListingsOperationParams.ImageSizes? = + null, + val thumbnailImageSize: GetLodgingListingsOperationParams.ThumbnailImageSize? = + null, + @field:Valid + val includedPropertyTypeIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val excludedPropertyTypeIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val includedInventorySourceIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val freeCancellation: kotlin.Boolean? = + null, + @field:Valid + val groupedAmenities: kotlin.Boolean? = + null, + @field:Valid + val blockFullDepositRateplan: kotlin.Boolean? = + false, + val ratePlanType: GetLodgingListingsOperationParams.RatePlanType? = + null, + val sortType: GetLodgingListingsOperationParams.SortType? = + null, + val sortOrder: GetLodgingListingsOperationParams.SortOrder? = + SortOrder.ASC, + @field:Valid + val room1Adults: kotlin.Long? = + null, + @field:Valid + val room1ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room2Adults: kotlin.Long? = + null, + @field:Valid + val room2ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room3Adults: kotlin.Long? = + null, + @field:Valid + val room3ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room4Adults: kotlin.Long? = + null, + @field:Valid + val room4ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room5Adults: kotlin.Long? = + null, + @field:Valid + val room5ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room6Adults: kotlin.Long? = + null, + @field:Valid + val room6ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room7Adults: kotlin.Long? = + null, + @field:Valid + val room7ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room8Adults: kotlin.Long? = + null, + @field:Valid + val room8ChildAges: kotlin.collections.List< + kotlin.String + >? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + enum class Unit( + val value: kotlin.String + ) { + KM("km"), + MI("mi") + } + + enum class Source( + val value: kotlin.String + ) { + BROWSER("browser"), + MOBILEAPP("mobileapp") + } + + enum class ContentDetails( + val value: kotlin.String + ) { + LOWEST("lowest"), + LOW("low"), + MEDIUM("medium"), + HIGH("high") + } + + enum class Links( + val value: kotlin.String + ) { + WD("WD"), + WS("WS"), + AD("AD"), + RC("RC"), + WEB("WEB"), + API("API") + } + + enum class MinStarRating( + val value: kotlin.String + ) { + _1_PERIOD0("1.0"), + _1_PERIOD5("1.5"), + _2_PERIOD0("2.0"), + _2_PERIOD5("2.5"), + _3_PERIOD0("3.0"), + _3_PERIOD5("3.5"), + _4_PERIOD0("4.0"), + _4_PERIOD5("4.5"), + _5_PERIOD0("5.0") + } + + enum class MaxStarRating( + val value: kotlin.String + ) { + _1_PERIOD0("1.0"), + _1_PERIOD5("1.5"), + _2_PERIOD0("2.0"), + _2_PERIOD5("2.5"), + _3_PERIOD0("3.0"), + _3_PERIOD5("3.5"), + _4_PERIOD0("4.0"), + _4_PERIOD5("4.5"), + _5_PERIOD0("5.0") + } + + enum class SmokingPreference( + val value: kotlin.String + ) { + SMOKING("smoking"), + NONSMOKING("nonsmoking"), + BOTH("both") + } + + enum class RateType( + val value: kotlin.String + ) { + PAYONLINE("payonline"), + PAYHOTEL("payhotel"), + ALL("all") + } + + enum class ImageSizes( + val value: kotlin.String + ) { + T("t"), + S("s"), + B("b"), + Y("y"), + Z("z") + } + + enum class ThumbnailImageSize( + val value: kotlin.String + ) { + T("t"), + S("s"), + B("b"), + Y("y"), + Z("z") + } + + enum class RatePlanType( + val value: kotlin.String + ) { + STANDALONE("standalone"), + PACKAGE("package") + } + + enum class SortType( + val value: kotlin.String + ) { + PRICE("price"), + STARRATING("starrating"), + AVGRATE("avgrate"), + DEALS("deals"), + GUESTRATING("guestrating"), + HOTELNAME("hotelname"), + DISTANCE("distance"), + TOTALPRICEWITHFEES("totalpricewithfees") + } + + enum class SortOrder( + val value: kotlin.String + ) { + ASC("asc"), + DESC("desc") + } + + class Builder( + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("ecomHotelIds") private var ecomHotelIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("hcomHotelIds") private var hcomHotelIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("geoLocation") private var geoLocation: kotlin.String? = null, + @JsonProperty("radius") private var radius: kotlin.Long? = null, + @JsonProperty("unit") private var unit: GetLodgingListingsOperationParams.Unit? = null, + @JsonProperty("locationKeyword") private var locationKeyword: kotlin.String? = null, + @JsonProperty("regionIds") private var regionIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("checkIn") private var checkIn: java.time.LocalDate? = null, + @JsonProperty("checkOut") private var checkOut: java.time.LocalDate? = null, + @JsonProperty("locale") private var locale: kotlin.String? = null, + @JsonProperty("currency") private var currency: kotlin.String? = null, + @JsonProperty("source") private var source: GetLodgingListingsOperationParams.Source? = null, + @JsonProperty("travelWithPets") private var travelWithPets: kotlin.Boolean? = null, + @JsonProperty("contentDetails") private var contentDetails: GetLodgingListingsOperationParams.ContentDetails? = null, + @JsonProperty("allRoomTypes") private var allRoomTypes: kotlin.Boolean? = null, + @JsonProperty("links") private var links: kotlin.collections.List< + GetLodgingListingsOperationParams.Links + >? = null, + @JsonProperty("minStarRating") private var minStarRating: GetLodgingListingsOperationParams.MinStarRating? = null, + @JsonProperty("maxStarRating") private var maxStarRating: GetLodgingListingsOperationParams.MaxStarRating? = null, + @JsonProperty("limit") private var limit: kotlin.Long? = null, + @JsonProperty("queryText") private var queryText: kotlin.String? = null, + @JsonProperty("availOnly") private var availOnly: kotlin.Boolean? = null, + @JsonProperty("smokingPreference") private var smokingPreference: GetLodgingListingsOperationParams.SmokingPreference? = null, + @JsonProperty("rateType") private var rateType: GetLodgingListingsOperationParams.RateType? = null, + @JsonProperty("imageSizes") private var imageSizes: GetLodgingListingsOperationParams.ImageSizes? = null, + @JsonProperty("thumbnailImageSize") private var thumbnailImageSize: GetLodgingListingsOperationParams.ThumbnailImageSize? = null, + @JsonProperty("includedPropertyTypeIds") private var includedPropertyTypeIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("excludedPropertyTypeIds") private var excludedPropertyTypeIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("includedInventorySourceIds") private var includedInventorySourceIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("freeCancellation") private var freeCancellation: kotlin.Boolean? = null, + @JsonProperty("groupedAmenities") private var groupedAmenities: kotlin.Boolean? = null, + @JsonProperty("blockFullDepositRateplan") private var blockFullDepositRateplan: kotlin.Boolean? = null, + @JsonProperty("ratePlanType") private var ratePlanType: GetLodgingListingsOperationParams.RatePlanType? = null, + @JsonProperty("sortType") private var sortType: GetLodgingListingsOperationParams.SortType? = null, + @JsonProperty("sortOrder") private var sortOrder: GetLodgingListingsOperationParams.SortOrder? = null, + @JsonProperty("room1.adults") private var room1Adults: kotlin.Long? = null, + @JsonProperty("room1.childAges") private var room1ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room2.adults") private var room2Adults: kotlin.Long? = null, + @JsonProperty("room2.childAges") private var room2ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room3.adults") private var room3Adults: kotlin.Long? = null, + @JsonProperty("room3.childAges") private var room3ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room4.adults") private var room4Adults: kotlin.Long? = null, + @JsonProperty("room4.childAges") private var room4ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room5.adults") private var room5Adults: kotlin.Long? = null, + @JsonProperty("room5.childAges") private var room5ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room6.adults") private var room6Adults: kotlin.Long? = null, + @JsonProperty("room6.childAges") private var room6ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room7.adults") private var room7Adults: kotlin.Long? = null, + @JsonProperty("room7.childAges") private var room7ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room8.adults") private var room8Adults: kotlin.Long? = null, + @JsonProperty("room8.childAges") private var room8ChildAges: kotlin.collections.List< + kotlin.String + >? = null + ) { + /** + * @param partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param ecomHotelIds Comma-separated list of Expedia hotel IDs. There can be no spaces between parameters. + */ + fun ecomHotelIds( + ecomHotelIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.ecomHotelIds = ecomHotelIds } + + /** + * @param hcomHotelIds Comma-separated list of Hotels.com hotel IDs. There can be no spaces between parameters. + */ + fun hcomHotelIds( + hcomHotelIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.hcomHotelIds = hcomHotelIds } + + /** + * @param geoLocation The latitude and longitude values identifying the center point of a search radius (circle). North latitude will be represented by a positive value. South latitude by a negative value. East longitude will be represented by a positive value. West longitude by a negative value. The latitude and longitude values are joined together with a comma (,) character. There can be no spaces between parameters. This parameter should be used in combination with the radius and unit parameters below. + */ + fun geoLocation(geoLocation: kotlin.String) = apply { this.geoLocation = geoLocation } + + /** + * @param radius The size of the search radius around a specified point when searching by `geoLocation`, `locationKeyword`, or `regionids`. `radius` is optional and the default value is 25 km for `geoLocation` and `locationKeyword` if not specified. `radius` must be less than 200 km or 124 mi. This parameter should be used in combination with the `unit` and `geoLocation`, `locationKeyword`, or `regionids` parameters.\" + */ + fun radius(radius: kotlin.Long) = apply { this.radius = radius } + + /** + * @param unit The unit of measure for searches performed via `geoLocation`, `locationKeyword`, or `regionids`. Valid units are `km` and `mi`. This parameter should be used in combination with the `radius` and `geoLocation`, `locationKeyword`, or `regionids`. + */ + fun unit(unit: GetLodgingListingsOperationParams.Unit) = apply { this.unit = unit } + + /** + * @param locationKeyword A keyword search for a location. The keyword can be a city, address, airport or a landmark. This parameter should be used in combination with the `radius` and `unit` parameters above to define a circle around the landmark. The default radius value is 25 if not specified. Combined search is not supported, if more than one search method is included in the request, an error will be returned. + */ + fun locationKeyword(locationKeyword: kotlin.String) = apply { this.locationKeyword = locationKeyword } + + /** + * @param regionIds Comma-separated list of Expedia Region IDs. There can be no spaces between parameters. Search returns set of all hotels in the combined regions. You may search using a string of 1 - 10 Region ID's. More than 10 Region ID's are not supported and will generate and error. You can get the complete list of Expedia Region IDs from [Static Data Platform ALL_REGIONS file](https://developers.expediagroup.com/xap/products/xap/static-data-platform/download-url-api/download-url-api-v1). This parameter could be used in combination with the `radius` and `unit` parameters above to define a circle around the `regionIds`. The default radius value is 0 if not specified. + */ + fun regionIds( + regionIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.regionIds = regionIds } + + /** + * @param checkIn Check-in date for hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkOut` parameter. If `checkIn` and `checkOut` are not included, a dateless search will be conducted which returns a `Featured Offer` for each of the hotels found. If one of `checkIn` and `checkOut` is not included, an error will be returned. The maximum advanced search window is 500 days in the future, and the maximum length of stay is 28. + */ + fun checkIn(checkIn: java.time.LocalDate) = apply { this.checkIn = checkIn } + + /** + * @param checkOut Checkout date for hotel stay in an ISO 8601 Date format [YYYY-MM-DD]. This parameter should be used in combination with the `checkIn` parameter. If `checkIn` and `checkOut` are not included, a dateless search will be conducted which returns a `Featured Offer` for each of the hotels found. If one of `checkIn` and `checkOut` is not included, an error will be returned. The maximum advanced search window is 500 days in the future, and the maximum length of stay is 28. + */ + fun checkOut(checkOut: java.time.LocalDate) = apply { this.checkOut = checkOut } + + /** + * @param locale `locale` is composed of language identifier and region identifier, connected by \"_\" that specifies the language in which the response will be returned. You can find a link to the complete list of `locales` along with the Point of Sale List in [Supported Points of Sale](https://developers.expediagroup.com/xap/products/xap/lodging/references/supported-points-of-sale). Note that even though the Listings API supports localization for all `locales` listed in the list, all `locales` are not valid for all Points of Sale. For example, Ecom US POS supports `en_US`, `es_MX` and `zh_CN`. For Ecom US POS, the Listings API will respond with content in Spanish for requests with either `locale=es_MX` or `es_US`. However, only the deeplinks for `locale=es_MX` should work properly and switch the website to Spanish, while the ones for locale=es_US will be fallen back to English. If not specified in the query, the native language for that POS will be returned. And if more than one language is supported, the response will be returned in the first language depending on the language setting of the POS. + */ + fun locale(locale: kotlin.String) = apply { this.locale = locale } + + /** + * @param currency Value should be a standard ISO 3 letter currency code. + */ + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + /** + * @param source Indicate the source where the request is coming from. + */ + fun source(source: GetLodgingListingsOperationParams.Source) = apply { this.source = source } + + /** + * @param travelWithPets Indicates if the search should include pet-friendly properties. If set to \"True\" only properties that allow pets are returned. Pet fees, if available, are included in TaxesAndFees. The parameter is only applicable to the Vrbo brand. + */ + fun travelWithPets(travelWithPets: kotlin.Boolean) = apply { this.travelWithPets = travelWithPets } + + /** + * @param contentDetails This parameter is optional and can be specified as the following values. - lowest - low (default) - medium - high ### *lowest* Returns the absolute minimum response for up to 1,000 hotels: - Count(Count of hotels that are actually returned) - TotalHotelCount(Count of hotels that are requested) - TransactionId - StayDates - LengthOfStay - NumberOfRooms - Occupants - ***Hotels*** - Id - Status - Links - ***RoomTypes*** - RoomKey [Deprecated] - OfferId - RatePlanType - ***RatePlans*** - RoomTypeId - RatePlanId - RateRuleId - InventorySourceId - RemainingCount - Price - MemberOnlyDeal - Promotions - PaymentMethod - FullDepositUponBooking - PaymentSchedule - CancellationPolicy - Price - BaseRate - TaxesAndFees - TotalPrice - TotalStrikeOutPrice - AvgNightlyRate - AvgNightlyStrikeOutRate - AvgNightlyRateWithFees - AvgNightlyStrikeOutRateWithFees - HotelMandatoryFees - TotalPriceWithHotelFees - NightlyRates - TaxesAndFeesDetails - RefundableDamageDeposit This minimal response is the best for partners that store static hotel location data locally, and who would like to have the smallest and fastest API response. ### *low* Returns basic hotel information in response for up to 1,000 hotels. Includes all elements returned when `contentDetails=lowest` plus: - ***Hotels*** - Name - PropertyType - PropertyDetails - LocalCurrencyCode - Location - Distance - Description(may not be localized) - ChainAndBrandInfo - ThumbnailUrl - StarRating - GuestRating - GuestReviewCount - PetFriendly - LgbtqiaFriendly - ImportantNotices - ***RoomTypes*** - Description - ***RatePlans*** - InventorySourceCode - PaymentTime - ReserveWithDeposit - FreeInternet - FreeWiFi - FreeParking - FreeBreakfast ### *medium* Returns more complete hotel information in response for up to 200 hotels. Includes all elements returned when `contentDetails=low` plus: - ***Hotels*** - HotelAmenities - RoomAmenities - ***RoomTypes*** - ***RatePlans*** - FreeInternetDetails - FreeBreakfastDetails - Amenities - Amenities **Note**: Setting the `contentDetails` to `medium` will automatically limit your response size to 200 hotels. ### *high* Returns extended hotel information in response for up to 5 hotels. Includes all elements returned when `contentDetails=medium` plus: - ***Hotels*** - RenovationsAndClosures - Policies - OptionalExtras - Media - Accessibility - ***RoomTypes*** - SmokingOption - BedTypeOptions - RoomOccupancyPolicy - Media **Note**: Setting the `contentDetails` to `high` will automatically limit your response size to 5 hotels. + */ + fun contentDetails(contentDetails: GetLodgingListingsOperationParams.ContentDetails) = apply { this.contentDetails = contentDetails } + + /** + * @param allRoomTypes Returns all available rate plans for the selected hotels. This parameter requires that a `checkIn` date and `checkOut` date be supplied, as the API cannot return additional room rates on a dateless search. Including `allRoomTypes=true` in your query will automatically limit your response size to no more than 200 hotels. Including `allRoomTypes=true` and `contentDetails=high` will limit your response size to no more than 5 hotels. + */ + fun allRoomTypes(allRoomTypes: kotlin.Boolean) = apply { this.allRoomTypes = allRoomTypes } + + /** + * @param links Comma-separated list to specify the types of deep links. - WD (link to Web Details site) - WS (link to Web Search Result page) - AD (link for Details API) - RC (link for RateCalendar API) - WEB (include all website links) - API (links for Details and RateCalendar API) There are two level of links returned in the API response: Property-level deeplinks and room-level deeplinks. When requesting API deeplinks you will receive both a RateCalendar API link at the property level, and Details API links at the room level, since the Lodging Details API only displays information on rate plan offers. When requesting AD deeplinks, you will only receive Details API links at the room level. `Links` node in property-level will be omitted. If you are looking for more complete details on a single property via the API, you should do another search in the Lodging API for the single Hotel ID, with `contentDetails=high` to get all details back in return (note that you can only get back a maximum of 5 hotels when `contentDetails` is set to `high`). **NOTE**: dateless searches will not return Details API links, since the Lodging Details API will only return details on a specific room offer for specific dates. + */ + fun links( + links: kotlin.collections.List< + GetLodgingListingsOperationParams.Links + > + ) = apply { this.links = links } + + /** + * @param minStarRating The minimum star rating for hotels returned in the response. + */ + fun minStarRating(minStarRating: GetLodgingListingsOperationParams.MinStarRating) = apply { this.minStarRating = minStarRating } + + /** + * @param maxStarRating The maximum star rating for hotels returned in the response. + */ + fun maxStarRating(maxStarRating: GetLodgingListingsOperationParams.MaxStarRating) = apply { this.maxStarRating = maxStarRating } + + /** + * @param limit The maximum number of hotels returned in the response. Must be an integer greater than 0. If the value is greater than 1000, only the first 1000 hotels are returned. Settings on `contentDetails` and `allRoomTypes` parameters may cause this value to be overridden and a lower number of hotels to be returned. The `limit` parameter is intended to be used to control the response size, but partners should be careful about combining it with other filter parameters, as each parameter that you add will shrink the response, even to the point where you may even get a \"no hotel found\" error if none of the hotels in the base response meet the combined filter requirements. Filters are cumulative in effect, and results must meet all filter requirements to be displayed. + */ + fun limit(limit: kotlin.Long) = apply { this.limit = limit } + + /** + * @param queryText Query text is used for a full text search of hotel data. Text search based on hotel name, description, address, promotion description, amenities description. + */ + fun queryText(queryText: kotlin.String) = apply { this.queryText = queryText } + + /** + * @param availOnly Specifies whether to return only available hotels in the search results. If the value of this parameter is true, the search results will only return hotels that have availability during the requested dates. If there are no hotels with availability in your search then an empty record set will be returned. This parameter is ignored for dateless searches. + */ + fun availOnly(availOnly: kotlin.Boolean) = apply { this.availOnly = availOnly } + + /** + * @param smokingPreference Specifies smoking preference. + */ + fun smokingPreference(smokingPreference: GetLodgingListingsOperationParams.SmokingPreference) = apply { this.smokingPreference = smokingPreference } + + /** + * @param rateType Indicate which type of `paymentMethod` for each room will be returned. + */ + fun rateType(rateType: GetLodgingListingsOperationParams.RateType) = apply { this.rateType = rateType } + + /** + * @param imageSizes Indicates what size images will be displayed for `hotelPhotos` and `roomPhotos` are returned when `contentDetails=high`. The available image sizes are: - t : Thumbnail - s : Small - b : Big - y : 500x500v - z : 1000x1000v Resolution from smallest to largest is t < s < b < y < z. If no `imageSizes` is specified, the t size images will be returned. If an image is missing in one size, we will try to fall back to the same image with lower resolution. (If image \"_z\" is not available, we will try to return image \"_y\", and if it is also unavailable, we will return image \"_b\", and so on.) Only one image size is allowed. + */ + fun imageSizes(imageSizes: GetLodgingListingsOperationParams.ImageSizes) = apply { this.imageSizes = imageSizes } + + /** + * @param thumbnailImageSize Indicate what size of image will be used for the single `thumbnail` image that is returned when `contentDetails` is set to `low`, `medium` or `high`. The available thumbnail image sizes are: - t : Thumbnail - s : Small - b : Big - y : 500x500v - z : 1000x1000v Resolution from smallest to largest is t < s < b < y < z. If no `thumbnailImageSize` is specified, the t size images will be returned. if no thumbnail image found, it would not return thumbnail image. Only one thumbnail image size is allowed. + */ + fun thumbnailImageSize(thumbnailImageSize: GetLodgingListingsOperationParams.ThumbnailImageSize) = apply { this.thumbnailImageSize = thumbnailImageSize } + + /** + * @param includedPropertyTypeIds Only return hotels where the `PropertyType` ID is one of the IDs in the `includedPropertyTypeIds` field. If the API query includes the parameter `contentDetail=lowest` the `PropertyType` parameter will not be returned in the response. Even in this case, the filtering is still being applied, even though there is no `PropertyType` parameter in the response with which to validate. `includedPropertyTypeIds` and `excludedPropertyTypeIds` fields are mutually exclusive - which means that each query may contain **one** of the parameters, or **neither** of the parameters, but the query may not contain **both** of the parameters. A complete list of supported Expedia Property Types can be found in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + */ + fun includedPropertyTypeIds( + includedPropertyTypeIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.includedPropertyTypeIds = includedPropertyTypeIds } + + /** + * @param excludedPropertyTypeIds Return all hotels **except** those whose `PropertyType` ID is in the `excludedPropertyTypeIds` field. If the API query includes the parameter `contentDetail=lowest` the `PropertyType` parameter will not be returned in the response. Even in this case, the filtering is still being applied, even though there is no `PropertyType` parameter in the response with which to validate. `includedPropertyTypeIds` and `excludedPropertyTypeIds` fields are mutually exclusive - which means that each query may contain **one** of the parameters, or **neither** of the parameters, but the query may not contain **both** of the parameters. A complete list of supported Expedia Property Types can be found in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + */ + fun excludedPropertyTypeIds( + excludedPropertyTypeIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.excludedPropertyTypeIds = excludedPropertyTypeIds } + + /** + * @param includedInventorySourceIds Querying with no `includedInventorySourceIds` parameter will return listings from all available inventory sources. Query with the `includedInventorySourceIds` parameter included will only return listings from the requested inventory sources. All others will be left out. `includedInventorySourceId=24` will return only Expedia lodging inventory. `includedInventorySourceId=83` will return only Vrbo lodging inventory. `includedInventorySourceId=24,83` will return both Expedia and Vrbo lodging inventory. + */ + fun includedInventorySourceIds( + includedInventorySourceIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.includedInventorySourceIds = includedInventorySourceIds } + + /** + * @param freeCancellation Specifies whether to return only free cancelable room rates in the search results. If the value of this parameter is true, the search results will only return hotels that have free cancelable room rates during the requested dates. If there are no hotels with free cancelable room rates in your search then an empty record set will be returned. Default value is false, if query without this parameter or the value of this parameter is false, all available room rates will be returned. This parameter is ignored for dateless searches. + */ + fun freeCancellation(freeCancellation: kotlin.Boolean) = apply { this.freeCancellation = freeCancellation } + + /** + * @param groupedAmenities Specifies whether to return the grouped amenities. If `groupedAmenities` is true, `DescriptiveAmenities` node will be returned in response, otherwise `Amenities` node will be returned. + */ + fun groupedAmenities(groupedAmenities: kotlin.Boolean) = apply { this.groupedAmenities = groupedAmenities } + + /** + * @param blockFullDepositRateplan Specifies whether to return `rateplan` with `FullDepositUponBooking` as true. If `blockFullDepositRateplans` is true, the search results will not return `rateplan` with `FullDepositUponBooking` as true. The default value is false, if query without this parameter or the value of this parameter is false, all available rateplan will be returned. This parameter is ignored for dateless search. + */ + fun blockFullDepositRateplan(blockFullDepositRateplan: kotlin.Boolean) = apply { this.blockFullDepositRateplan = blockFullDepositRateplan } + + /** + * @param ratePlanType **Note**: This parameter is visible to partners only by configuration. Please contact your Expedia Account Manager if you need this parameter. To specify the desired rate plan types. The options are: - standalone : Ask for standalone rates - package : Ask for package rates, but standalone rate also may be returned if available. Otherwise only standalone rate plans will be returned. `WebSearchResult` and `WebDetails` links won't be returned for package rate. + */ + fun ratePlanType(ratePlanType: GetLodgingListingsOperationParams.RatePlanType) = apply { this.ratePlanType = ratePlanType } + + /** + * @param sortType Specifies the field that the search results will be ordered by. To be used in conjunction with sortOrder parameter below. **CMA Compliance Note (UK)**: partners doing business in the UK should be sorting their search results using the `totalpricewithfees` parameter in their query string so that the sorting complies with CMA regulations. + */ + fun sortType(sortType: GetLodgingListingsOperationParams.SortType) = apply { this.sortType = sortType } + + /** + * @param sortOrder Specifies the sort order of search results. If no sort order is specified, the default is `asc`. But for deals sorting, it only supports `desc`. To be used in conjunction with the `sortType` parameter above. + */ + fun sortOrder(sortOrder: GetLodgingListingsOperationParams.SortOrder) = apply { this.sortOrder = sortOrder } + + fun rooms(rooms: List) = + apply { + if (rooms.size > 8) { + throw PropertyConstraintViolationException( + constraintViolations = listOf("rooms: size must be between 0 and 8") + ) + } + + rooms.elementAtOrNull(0)?.let { + this.room1Adults = it.adults + this.room1ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(1)?.let { + this.room2Adults = it.adults + this.room2ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(2)?.let { + this.room3Adults = it.adults + this.room3ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(3)?.let { + this.room4Adults = it.adults + this.room4ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(4)?.let { + this.room5Adults = it.adults + this.room5ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(5)?.let { + this.room6Adults = it.adults + this.room6ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(6)?.let { + this.room7Adults = it.adults + this.room7ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(7)?.let { + this.room8Adults = it.adults + this.room8ChildAges = it.childAges?.map { item -> item.toString() } + } + } + + fun build(): GetLodgingListingsOperationParams { + val params = + GetLodgingListingsOperationParams( + partnerTransactionId = partnerTransactionId!!, + ecomHotelIds = ecomHotelIds, + hcomHotelIds = hcomHotelIds, + geoLocation = geoLocation, + radius = radius, + unit = unit, + locationKeyword = locationKeyword, + regionIds = regionIds, + checkIn = checkIn, + checkOut = checkOut, + locale = locale, + currency = currency, + source = source, + travelWithPets = travelWithPets, + contentDetails = contentDetails, + allRoomTypes = allRoomTypes, + links = links, + minStarRating = minStarRating, + maxStarRating = maxStarRating, + limit = limit, + queryText = queryText, + availOnly = availOnly, + smokingPreference = smokingPreference, + rateType = rateType, + imageSizes = imageSizes, + thumbnailImageSize = thumbnailImageSize, + includedPropertyTypeIds = includedPropertyTypeIds, + excludedPropertyTypeIds = excludedPropertyTypeIds, + includedInventorySourceIds = includedInventorySourceIds, + freeCancellation = freeCancellation, + groupedAmenities = groupedAmenities, + blockFullDepositRateplan = blockFullDepositRateplan, + ratePlanType = ratePlanType, + sortType = sortType, + sortOrder = sortOrder, + room1Adults = room1Adults, + room1ChildAges = room1ChildAges, + room2Adults = room2Adults, + room2ChildAges = room2ChildAges, + room3Adults = room3Adults, + room3ChildAges = room3ChildAges, + room4Adults = room4Adults, + room4ChildAges = room4ChildAges, + room5Adults = room5Adults, + room5ChildAges = room5ChildAges, + room6Adults = room6Adults, + room6ChildAges = room6ChildAges, + room7Adults = room7Adults, + room7ChildAges = room7ChildAges, + room8Adults = room8Adults, + room8ChildAges = room8ChildAges + ) + + validate(params) + + return params + } + + private fun validate(params: GetLodgingListingsOperationParams) { + 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( + partnerTransactionId = partnerTransactionId, + ecomHotelIds = ecomHotelIds, + hcomHotelIds = hcomHotelIds, + geoLocation = geoLocation, + radius = radius, + unit = unit, + locationKeyword = locationKeyword, + regionIds = regionIds, + checkIn = checkIn, + checkOut = checkOut, + locale = locale, + currency = currency, + source = source, + travelWithPets = travelWithPets, + contentDetails = contentDetails, + allRoomTypes = allRoomTypes, + links = links, + minStarRating = minStarRating, + maxStarRating = maxStarRating, + limit = limit, + queryText = queryText, + availOnly = availOnly, + smokingPreference = smokingPreference, + rateType = rateType, + imageSizes = imageSizes, + thumbnailImageSize = thumbnailImageSize, + includedPropertyTypeIds = includedPropertyTypeIds, + excludedPropertyTypeIds = excludedPropertyTypeIds, + includedInventorySourceIds = includedInventorySourceIds, + freeCancellation = freeCancellation, + groupedAmenities = groupedAmenities, + blockFullDepositRateplan = blockFullDepositRateplan, + ratePlanType = ratePlanType, + sortType = sortType, + sortOrder = sortOrder, + room1Adults = room1Adults, + room1ChildAges = room1ChildAges, + room2Adults = room2Adults, + room2ChildAges = room2ChildAges, + room3Adults = room3Adults, + room3ChildAges = room3ChildAges, + room4Adults = room4Adults, + room4ChildAges = room4ChildAges, + room5Adults = room5Adults, + room5ChildAges = room5ChildAges, + room6Adults = room6Adults, + room6ChildAges = room6ChildAges, + room7Adults = room7Adults, + room7ChildAges = room7ChildAges, + room8Adults = room8Adults, + room8ChildAges = room8ChildAges + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-hotel.v3+json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + ecomHotelIds?.let { + appendAll("ecomHotelIds", toMultiValue(it, "csv")) + } + hcomHotelIds?.let { + appendAll("hcomHotelIds", toMultiValue(it, "csv")) + } + geoLocation?.let { + append("geoLocation", it) + } + radius?.let { + append("radius", it.toString()) + } + unit?.let { + append("unit", it.value) + } + locationKeyword?.let { + append("locationKeyword", it) + } + regionIds?.let { + appendAll("regionIds", toMultiValue(it, "csv")) + } + checkIn?.let { + append("checkIn", it.toString()) + } + checkOut?.let { + append("checkOut", it.toString()) + } + locale?.let { + append("locale", it) + } + currency?.let { + append("currency", it) + } + source?.let { + append("source", it.value) + } + travelWithPets?.let { + append("travelWithPets", it.toString()) + } + contentDetails?.let { + append("contentDetails", it.value) + } + allRoomTypes?.let { + append("allRoomTypes", it.toString()) + } + links?.let { + appendAll("links", toMultiValue(it.map { item -> item.value }, "csv")) + } + minStarRating?.let { + append("minStarRating", it.value) + } + maxStarRating?.let { + append("maxStarRating", it.value) + } + limit?.let { + append("limit", it.toString()) + } + queryText?.let { + append("queryText", it) + } + availOnly?.let { + append("availOnly", it.toString()) + } + smokingPreference?.let { + append("smokingPreference", it.value) + } + rateType?.let { + append("rateType", it.value) + } + imageSizes?.let { + append("imageSizes", it.value) + } + thumbnailImageSize?.let { + append("thumbnailImageSize", it.value) + } + includedPropertyTypeIds?.let { + appendAll("includedPropertyTypeIds", toMultiValue(it, "csv")) + } + excludedPropertyTypeIds?.let { + appendAll("excludedPropertyTypeIds", toMultiValue(it, "csv")) + } + includedInventorySourceIds?.let { + appendAll("includedInventorySourceIds", toMultiValue(it, "csv")) + } + freeCancellation?.let { + append("freeCancellation", it.toString()) + } + groupedAmenities?.let { + append("groupedAmenities", it.toString()) + } + blockFullDepositRateplan?.let { + append("blockFullDepositRateplan", it.toString()) + } + ratePlanType?.let { + append("ratePlanType", it.value) + } + sortType?.let { + append("sortType", it.value) + } + sortOrder?.let { + append("sortOrder", it.value) + } + room1Adults?.let { + append("room1.adults", it.toString()) + } + room1ChildAges?.let { + appendAll("room1.childAges", toMultiValue(it, "csv")) + } + room2Adults?.let { + append("room2.adults", it.toString()) + } + room2ChildAges?.let { + appendAll("room2.childAges", toMultiValue(it, "csv")) + } + room3Adults?.let { + append("room3.adults", it.toString()) + } + room3ChildAges?.let { + appendAll("room3.childAges", toMultiValue(it, "csv")) + } + room4Adults?.let { + append("room4.adults", it.toString()) + } + room4ChildAges?.let { + appendAll("room4.childAges", toMultiValue(it, "csv")) + } + room5Adults?.let { + append("room5.adults", it.toString()) + } + room5ChildAges?.let { + appendAll("room5.childAges", toMultiValue(it, "csv")) + } + room6Adults?.let { + append("room6.adults", it.toString()) + } + room6ChildAges?.let { + appendAll("room6.childAges", toMultiValue(it, "csv")) + } + room7Adults?.let { + append("room7.adults", it.toString()) + } + room7ChildAges?.let { + appendAll("room7.childAges", toMultiValue(it, "csv")) + } + room8Adults?.let { + append("room8.adults", it.toString()) + } + room8ChildAges?.let { + appendAll("room8.childAges", toMultiValue(it, "csv")) + } + } + + override fun getPathParams(): Map = + buildMap { + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingQuotesOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingQuotesOperation.kt new file mode 100644 index 000000000..88996be23 --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingQuotesOperation.kt @@ -0,0 +1,35 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation + +/** + * Get properties price and availability information + * @property params [GetLodgingQuotesOperationParams] + */ +class GetLodgingQuotesOperation( + params: GetLodgingQuotesOperationParams +) : Operation< + Nothing + >( + "/lodging/quotes", + "GET", + "getLodgingQuotes", + null, + params + ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingQuotesOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingQuotesOperationParams.kt new file mode 100644 index 000000000..ecf9284fe --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingQuotesOperationParams.kt @@ -0,0 +1,457 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +import com.expediagroup.sdk.xap.models.Room +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 partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + * @property propertyIds Comma-separated list of Expedia Property IDs. ***NOTE**: This API supports Expedia property IDs only by design – HCOM and Vrbo property IDs are not supported.* *For optimal performance, limiting your request to a maximum of 200 properties is recommended.* + * @property checkIn Check-in date for property stay in an ISO 8601 Date format. This parameter should be used in combination with the checkOut parameter. The maximum advanced search window is 1000 days in the future, and the maximum length of stay is 732. + * @property checkOut Check-out date for property stay in an ISO 8601 Date format This parameter should be used in combination with the checkIn parameter. The maximum advanced search window is 1000 days in the future, and the maximum length of stay is 732. + * @property currency The requested currency expressed according to ISO 4217. PoS default currency will be passed if another currency is not specified in the request. + * @property links Comma-separated list to specify the types of deep links. - WD (link to web infosite) - WS (link to web search result page) - WEB (include all website links) + * @property travelWithPets Indicates if the search should include pet-friendly properties. If set to \"True\" only properties that allow pets are returned. Pet fees, if available, are included in TaxesAndFees. The parameter is only applicable to the Vrbo brand. + * @property room1Adults Specifies the number of adults staying in a specific room. Example: `room1.adults` is used to specify the number of adults in the first room. ***NOTE***: multiple room request is only supported for conventional lodging hotels. Request for Vrbo properties should only include one room. e.g. 3 adults in room 1 and 3 in room 2, \"room1.adults\" is 6. + * @property room1ChildAges Comma-separated list that specifies the age(s) for each of the children in each of the rooms. Example: `room2.childAges=1,3` means two children (1-year old and 3-year old) are staying in room #2. Children must be accompanied by an adult. Total number of children is indicated by the number of childAges included. If there are no children in the party then this value should not be included. ***NOTE***: multiple room request is only supported for conventional lodging hotels. Request for Vrbo properties should include the ages of all the children in the first room. e.g. 1 child age 10 in room #1 and 1 child age 11 in room #2, \"room1.childAges\" is 10,11. + * @property room2Adults Specifies the number of adults staying in second room. + * @property room2ChildAges Comma-separated list that specifies the age(s) for each of the children in second room. + * @property room3Adults Specifies the number of adults staying in third room. + * @property room3ChildAges Comma-separated list that specifies the age(s) for each of the children in third room. + * @property room4Adults Specifies the number of adults staying in fourth room. + * @property room4ChildAges Comma-separated list that specifies the age(s) for each of the children in fourth room. + * @property room5Adults Specifies the number of adults staying in fifth room. + * @property room5ChildAges Comma-separated list that specifies the age(s) for each of the children in fifth room. + * @property room6Adults Specifies the number of adults staying in sixth room. + * @property room6ChildAges Comma-separated list that specifies the age(s) for each of the children in sixth room. + * @property room7Adults Specifies the number of adults staying in seventh room. + * @property room7ChildAges Comma-separated list that specifies the age(s) for each of the children in seventh room. + * @property room8Adults Specifies the number of adults staying in eighth room. + * @property room8ChildAges Comma-separated list that specifies the age(s) for each of the children in eighth room. + */ +@JsonDeserialize(builder = GetLodgingQuotesOperationParams.Builder::class) +data class GetLodgingQuotesOperationParams( + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:Valid + val propertyIds: kotlin.collections.Set< + kotlin.String + >? = + null, + @field:Valid + val checkIn: java.time.LocalDate? = + null, + @field:Valid + val checkOut: java.time.LocalDate? = + null, + @field:Valid + val currency: kotlin.String? = + null, + val links: kotlin.collections.List< + GetLodgingQuotesOperationParams.Links + >? = + null, + @field:Valid + val travelWithPets: kotlin.Boolean? = + false, + @field:Valid + val room1Adults: kotlin.Long? = + null, + @field:Valid + val room1ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room2Adults: kotlin.Long? = + null, + @field:Valid + val room2ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room3Adults: kotlin.Long? = + null, + @field:Valid + val room3ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room4Adults: kotlin.Long? = + null, + @field:Valid + val room4ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room5Adults: kotlin.Long? = + null, + @field:Valid + val room5ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room6Adults: kotlin.Long? = + null, + @field:Valid + val room6ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room7Adults: kotlin.Long? = + null, + @field:Valid + val room7ChildAges: kotlin.collections.List< + kotlin.String + >? = + null, + @field:Valid + val room8Adults: kotlin.Long? = + null, + @field:Valid + val room8ChildAges: kotlin.collections.List< + kotlin.String + >? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + enum class Links( + val value: kotlin.String + ) { + WD("WD"), + WS("WS"), + WEB("WEB") + } + + class Builder( + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("propertyIds") private var propertyIds: kotlin.collections.Set< + kotlin.String + >? = null, + @JsonProperty("checkIn") private var checkIn: java.time.LocalDate? = null, + @JsonProperty("checkOut") private var checkOut: java.time.LocalDate? = null, + @JsonProperty("currency") private var currency: kotlin.String? = null, + @JsonProperty("links") private var links: kotlin.collections.List< + GetLodgingQuotesOperationParams.Links + >? = null, + @JsonProperty("travelWithPets") private var travelWithPets: kotlin.Boolean? = null, + @JsonProperty("room1.adults") private var room1Adults: kotlin.Long? = null, + @JsonProperty("room1.childAges") private var room1ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room2.adults") private var room2Adults: kotlin.Long? = null, + @JsonProperty("room2.childAges") private var room2ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room3.adults") private var room3Adults: kotlin.Long? = null, + @JsonProperty("room3.childAges") private var room3ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room4.adults") private var room4Adults: kotlin.Long? = null, + @JsonProperty("room4.childAges") private var room4ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room5.adults") private var room5Adults: kotlin.Long? = null, + @JsonProperty("room5.childAges") private var room5ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room6.adults") private var room6Adults: kotlin.Long? = null, + @JsonProperty("room6.childAges") private var room6ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room7.adults") private var room7Adults: kotlin.Long? = null, + @JsonProperty("room7.childAges") private var room7ChildAges: kotlin.collections.List< + kotlin.String + >? = null, + @JsonProperty("room8.adults") private var room8Adults: kotlin.Long? = null, + @JsonProperty("room8.childAges") private var room8ChildAges: kotlin.collections.List< + kotlin.String + >? = null + ) { + /** + * @param partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param propertyIds Comma-separated list of Expedia Property IDs. ***NOTE**: This API supports Expedia property IDs only by design – HCOM and Vrbo property IDs are not supported.* *For optimal performance, limiting your request to a maximum of 200 properties is recommended.* + */ + fun propertyIds( + propertyIds: kotlin.collections.Set< + kotlin.String + > + ) = apply { this.propertyIds = propertyIds } + + /** + * @param checkIn Check-in date for property stay in an ISO 8601 Date format. This parameter should be used in combination with the checkOut parameter. The maximum advanced search window is 1000 days in the future, and the maximum length of stay is 732. + */ + fun checkIn(checkIn: java.time.LocalDate) = apply { this.checkIn = checkIn } + + /** + * @param checkOut Check-out date for property stay in an ISO 8601 Date format This parameter should be used in combination with the checkIn parameter. The maximum advanced search window is 1000 days in the future, and the maximum length of stay is 732. + */ + fun checkOut(checkOut: java.time.LocalDate) = apply { this.checkOut = checkOut } + + /** + * @param currency The requested currency expressed according to ISO 4217. PoS default currency will be passed if another currency is not specified in the request. + */ + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + /** + * @param links Comma-separated list to specify the types of deep links. - WD (link to web infosite) - WS (link to web search result page) - WEB (include all website links) + */ + fun links( + links: kotlin.collections.List< + GetLodgingQuotesOperationParams.Links + > + ) = apply { this.links = links } + + /** + * @param travelWithPets Indicates if the search should include pet-friendly properties. If set to \"True\" only properties that allow pets are returned. Pet fees, if available, are included in TaxesAndFees. The parameter is only applicable to the Vrbo brand. + */ + fun travelWithPets(travelWithPets: kotlin.Boolean) = apply { this.travelWithPets = travelWithPets } + + fun rooms(rooms: List) = + apply { + if (rooms.size > 8) { + throw PropertyConstraintViolationException( + constraintViolations = listOf("rooms: size must be between 0 and 8") + ) + } + + rooms.elementAtOrNull(0)?.let { + this.room1Adults = it.adults + this.room1ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(1)?.let { + this.room2Adults = it.adults + this.room2ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(2)?.let { + this.room3Adults = it.adults + this.room3ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(3)?.let { + this.room4Adults = it.adults + this.room4ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(4)?.let { + this.room5Adults = it.adults + this.room5ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(5)?.let { + this.room6Adults = it.adults + this.room6ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(6)?.let { + this.room7Adults = it.adults + this.room7ChildAges = it.childAges?.map { item -> item.toString() } + } + + rooms.elementAtOrNull(7)?.let { + this.room8Adults = it.adults + this.room8ChildAges = it.childAges?.map { item -> item.toString() } + } + } + + fun build(): GetLodgingQuotesOperationParams { + val params = + GetLodgingQuotesOperationParams( + partnerTransactionId = partnerTransactionId!!, + propertyIds = propertyIds, + checkIn = checkIn, + checkOut = checkOut, + currency = currency, + links = links, + travelWithPets = travelWithPets, + room1Adults = room1Adults, + room1ChildAges = room1ChildAges, + room2Adults = room2Adults, + room2ChildAges = room2ChildAges, + room3Adults = room3Adults, + room3ChildAges = room3ChildAges, + room4Adults = room4Adults, + room4ChildAges = room4ChildAges, + room5Adults = room5Adults, + room5ChildAges = room5ChildAges, + room6Adults = room6Adults, + room6ChildAges = room6ChildAges, + room7Adults = room7Adults, + room7ChildAges = room7ChildAges, + room8Adults = room8Adults, + room8ChildAges = room8ChildAges + ) + + validate(params) + + return params + } + + private fun validate(params: GetLodgingQuotesOperationParams) { + 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( + partnerTransactionId = partnerTransactionId, + propertyIds = propertyIds, + checkIn = checkIn, + checkOut = checkOut, + currency = currency, + links = links, + travelWithPets = travelWithPets, + room1Adults = room1Adults, + room1ChildAges = room1ChildAges, + room2Adults = room2Adults, + room2ChildAges = room2ChildAges, + room3Adults = room3Adults, + room3ChildAges = room3ChildAges, + room4Adults = room4Adults, + room4ChildAges = room4ChildAges, + room5Adults = room5Adults, + room5ChildAges = room5ChildAges, + room6Adults = room6Adults, + room6ChildAges = room6ChildAges, + room7Adults = room7Adults, + room7ChildAges = room7ChildAges, + room8Adults = room8Adults, + room8ChildAges = room8ChildAges + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-lodging.v3+json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + propertyIds?.let { + appendAll("propertyIds", toMultiValue(it, "csv")) + } + checkIn?.let { + append("checkIn", it.toString()) + } + checkOut?.let { + append("checkOut", it.toString()) + } + currency?.let { + append("currency", it) + } + links?.let { + appendAll("links", toMultiValue(it.map { item -> item.value }, "csv")) + } + travelWithPets?.let { + append("travelWithPets", it.toString()) + } + room1Adults?.let { + append("room1.adults", it.toString()) + } + room1ChildAges?.let { + appendAll("room1.childAges", toMultiValue(it, "csv")) + } + room2Adults?.let { + append("room2.adults", it.toString()) + } + room2ChildAges?.let { + appendAll("room2.childAges", toMultiValue(it, "csv")) + } + room3Adults?.let { + append("room3.adults", it.toString()) + } + room3ChildAges?.let { + appendAll("room3.childAges", toMultiValue(it, "csv")) + } + room4Adults?.let { + append("room4.adults", it.toString()) + } + room4ChildAges?.let { + appendAll("room4.childAges", toMultiValue(it, "csv")) + } + room5Adults?.let { + append("room5.adults", it.toString()) + } + room5ChildAges?.let { + appendAll("room5.childAges", toMultiValue(it, "csv")) + } + room6Adults?.let { + append("room6.adults", it.toString()) + } + room6ChildAges?.let { + appendAll("room6.childAges", toMultiValue(it, "csv")) + } + room7Adults?.let { + append("room7.adults", it.toString()) + } + room7ChildAges?.let { + appendAll("room7.childAges", toMultiValue(it, "csv")) + } + room8Adults?.let { + append("room8.adults", it.toString()) + } + room8ChildAges?.let { + appendAll("room8.childAges", toMultiValue(it, "csv")) + } + } + + override fun getPathParams(): Map = + buildMap { + } +} diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingRateCalendarOperation.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingRateCalendarOperation.kt new file mode 100644 index 000000000..a375d6b7d --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingRateCalendarOperation.kt @@ -0,0 +1,35 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.Nothing +import com.expediagroup.sdk.core.model.Operation + +/** + * Get rate calendar of a property + * @property params [GetLodgingRateCalendarOperationParams] + */ +class GetLodgingRateCalendarOperation( + params: GetLodgingRateCalendarOperationParams +) : Operation< + Nothing + >( + "/hotels/rateCalendar", + "GET", + "getLodgingRateCalendar", + null, + params + ) diff --git a/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingRateCalendarOperationParams.kt b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingRateCalendarOperationParams.kt new file mode 100644 index 000000000..c3f4b290a --- /dev/null +++ b/code/src/main/kotlin/com/expediagroup/sdk/xap/operations/GetLodgingRateCalendarOperationParams.kt @@ -0,0 +1,192 @@ +/* + * 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.xap.operations + +import com.expediagroup.sdk.core.model.OperationParams +import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException +import com.expediagroup.sdk.xap.infrastructure.* +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 partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + * @property ecomHotelId The Expedia hotel ID for which the calendar is being requested. **Note**: Either an Expedia Hotel ID or a Hotels.com Hotel ID must be included in the request. You may use one or the other, but not both. + * @property hcomHotelId The Hotel.com hotel ID for which the calendar is being requested. **Note**: Either an Expedia Hotel ID or a Hotels.com Hotel ID must be included in the request. You may use one or the other, but not both. + * @property startDate Start date for check-in search range in an ISO 8601 Date format [YYYY-MM-DD]. **Note**: The start date may not be in the past. + * @property endDate End date for check-in search range in an ISO 8601 Date format [YYYY-MM-DD]. **Note**: The end date must be after the start date. The maximum supported search range is 180 days. + * @property lengthOfStay The length of stay to retrieve the lowest price for. + * @property currency The requested currency expressed according to ISO 4217. + */ +@JsonDeserialize(builder = GetLodgingRateCalendarOperationParams.Builder::class) +data class GetLodgingRateCalendarOperationParams( + @field:NotNull + @field:Valid + val partnerTransactionId: kotlin.String, + @field:Valid + val ecomHotelId: kotlin.String? = + null, + @field:Valid + val hcomHotelId: kotlin.String? = + null, + @field:NotNull + @field:Valid + val startDate: java.time.LocalDate, + @field:NotNull + @field:Valid + val endDate: java.time.LocalDate, + @field:Valid + val lengthOfStay: kotlin.Int? = + 1, + @field:Valid + val currency: kotlin.String? = + null +) : OperationParams { + companion object { + @JvmStatic + fun builder() = Builder() + } + + class Builder( + @JsonProperty("Partner-Transaction-Id") private var partnerTransactionId: kotlin.String? = null, + @JsonProperty("ecomHotelId") private var ecomHotelId: kotlin.String? = null, + @JsonProperty("hcomHotelId") private var hcomHotelId: kotlin.String? = null, + @JsonProperty("startDate") private var startDate: java.time.LocalDate? = null, + @JsonProperty("endDate") private var endDate: java.time.LocalDate? = null, + @JsonProperty("lengthOfStay") private var lengthOfStay: kotlin.Int? = null, + @JsonProperty("currency") private var currency: kotlin.String? = null + ) { + /** + * @param partnerTransactionId The `Partner-Transaction-ID` is a required API request header element that is not consumed by Expedia. It will be required in all XAP v3 API request headers and will be mirrored back to the partner in the corresponding API response header. The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + */ + fun partnerTransactionId(partnerTransactionId: kotlin.String) = apply { this.partnerTransactionId = partnerTransactionId } + + /** + * @param ecomHotelId The Expedia hotel ID for which the calendar is being requested. **Note**: Either an Expedia Hotel ID or a Hotels.com Hotel ID must be included in the request. You may use one or the other, but not both. + */ + fun ecomHotelId(ecomHotelId: kotlin.String) = apply { this.ecomHotelId = ecomHotelId } + + /** + * @param hcomHotelId The Hotel.com hotel ID for which the calendar is being requested. **Note**: Either an Expedia Hotel ID or a Hotels.com Hotel ID must be included in the request. You may use one or the other, but not both. + */ + fun hcomHotelId(hcomHotelId: kotlin.String) = apply { this.hcomHotelId = hcomHotelId } + + /** + * @param startDate Start date for check-in search range in an ISO 8601 Date format [YYYY-MM-DD]. **Note**: The start date may not be in the past. + */ + fun startDate(startDate: java.time.LocalDate) = apply { this.startDate = startDate } + + /** + * @param endDate End date for check-in search range in an ISO 8601 Date format [YYYY-MM-DD]. **Note**: The end date must be after the start date. The maximum supported search range is 180 days. + */ + fun endDate(endDate: java.time.LocalDate) = apply { this.endDate = endDate } + + /** + * @param lengthOfStay The length of stay to retrieve the lowest price for. + */ + fun lengthOfStay(lengthOfStay: kotlin.Int) = apply { this.lengthOfStay = lengthOfStay } + + /** + * @param currency The requested currency expressed according to ISO 4217. + */ + fun currency(currency: kotlin.String) = apply { this.currency = currency } + + fun build(): GetLodgingRateCalendarOperationParams { + val params = + GetLodgingRateCalendarOperationParams( + partnerTransactionId = partnerTransactionId!!, + ecomHotelId = ecomHotelId, + hcomHotelId = hcomHotelId, + startDate = startDate!!, + endDate = endDate!!, + lengthOfStay = lengthOfStay, + currency = currency + ) + + validate(params) + + return params + } + + private fun validate(params: GetLodgingRateCalendarOperationParams) { + 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( + partnerTransactionId = partnerTransactionId, + ecomHotelId = ecomHotelId, + hcomHotelId = hcomHotelId, + startDate = startDate, + endDate = endDate, + lengthOfStay = lengthOfStay, + currency = currency + ) + + override fun getHeaders(): Headers = + Headers.build { + partnerTransactionId?.let { + append("Partner-Transaction-Id", it) + } + append("Accept", "application/vnd.exp-hotel.v3+json") + } + + override fun getQueryParams(): Parameters = + Parameters.build { + ecomHotelId?.let { + append("ecomHotelId", it) + } + hcomHotelId?.let { + append("hcomHotelId", it) + } + startDate?.let { + append("startDate", it.toString()) + } + endDate?.let { + append("endDate", it.toString()) + } + lengthOfStay?.let { + append("lengthOfStay", it.toString()) + } + currency?.let { + append("currency", it) + } + } + + override fun getPathParams(): Map = + buildMap { + } +} diff --git a/code/transformedSpecs.yaml b/code/transformedSpecs.yaml new file mode 100644 index 000000000..e7e089dbf --- /dev/null +++ b/code/transformedSpecs.yaml @@ -0,0 +1,7070 @@ +openapi: 3.0.3 +info: + title: EWSHotel API + description: > + The XAP Lodging Search APIs can be used by partners both booking via an + Expedia website, or by partners that + + will be booking via the XAP APIs. Each API also provides pre-configured links to the Expedia website, + + the XAP Booking API, or both. + contact: + name: PartnerAPIs + url: https://confluence.expedia.biz/display/EWS/EWSHotel + email: dreamweaver@expedia.com + version: v3 + x-eg-lifecycle: LIVE + x-eg-tags: + - Partner + - EWS + - XAP + - EWSHotel + - Hotel + - Lodging + - LodgingListings + - LodgingDetails + - LodgingRateCalendar +servers: + - url: https://apim.expedia.com + description: Production Server +security: + - BasicAuth: [] +tags: + - name: Lodging Listing + - name: Lodging Details + - name: Lodging Rate Calendar + - name: Lodging Quotes + - name: Lodging Availability Calendars + - name: Cars Listings + - name: Cars Detail + - name: download-url +paths: + "/hotels/details/{offerToken}": + get: + tags: + - get-lodging-details + summary: Get Extended information with a single property offer + description: Extended information about the rate, charges, fees, and financial + terms associated with booking a single lodging rate plan offer. + operationId: get-lodging-details + parameters: + - name: Partner-Transaction-Id + in: header + description: > + The `Partner-Transaction-ID` is a required API request header + element that is not consumed + + by Expedia. It will be required in all XAP v3 API request headers and will be mirrored + + back to the partner in the corresponding API response header. + + + The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + required: true + schema: + type: string + example: Partner123 + - name: offerToken + in: path + description: > + A Hotel Natural Key from the Lodging Search API -> Hotels -> + RoomTypes -> OfferId. It is a concatenated + + string of multiple values that defines a hotel offer. + required: true + schema: + type: string + - name: price + in: query + description: > + The total price of the selected property. + + + This value will be used to determine if there is a price change between the details and booking request. + + + The `price` element will be automatically included in the ApiDetails HATEOAS link which is returned + + along with the Lodging Details API response. + schema: + type: string + - name: currency + in: query + description: > + Value should be a standard ISO 3 letter currency code. + + + The currency code that is associated to the `TotalPrice` element for the selected property's rate plan from + + the Lodging Listing API response. + + + The `currency` element will be automatically included in the ApiDetails HATEOAS link which is returned + + along with the Lodging Details response. + schema: + type: string + - name: locale + in: query + description: > + `locale` is composed of language identifier and region identifier, + connected by "_" that specifies the + + language in which the response will be returned. + + + The `locale` value used in the Lodging Details API query should match the `locale` value that was used in + + the Lodging Search API query. + schema: + type: string + - name: imageSizes + in: query + description: > + Indicate what size of image will be returned. + + + The available image sizes are: + + - t : Thumbnail + + - s : Small + + - b : Big + + - y : 500x500v + + - z : 1000x1000v + + + Resolution from smallest to largest is t < s < b < y < z. + + + If no `imageSizes` is specified, the t size images will be returned. + + + If an image is missing in one size, we will try to fall back to the same image with lower resolution. + + + (If image "_z" is not available, we will try to return image "_y", and if it is also unavailable, we will return image "_b", and so on.) + + + Only one image size is allowed. + schema: + type: string + enum: + - t + - s + - b + - y + - z + default: t + - name: groupedAmenities + in: query + description: > + Specifies whether to return the grouped amenities. If + `groupedAmenities` is true, `DescriptiveAmenities` + + node will be returned in response, otherwise `Amenities` node will be returned. + schema: + type: boolean + responses: + "200": + description: Normal Response + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/HotelDetailsResponse" + "400": + description: User Fault + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + example: + Errors: + - Code: INVALID_NATURAL_KEY + Description: Invalid natural key. Malformed hotel natural key detected. + TransactionId: e883f530-9776-4011-a14d-3cc089feb6cf + "401": + description: Invalid authentication credentials. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Unauthorized + "403": + description: You cannot consume this service. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: You cannot consume this service + "429": + description: API rate limit exceeded. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: API rate limit exceeded. + "500": + description: Service Error + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + example: + Errors: + - Code: APPLICATION_ERROR + Description: Application error. + TransactionId: 1f497fa0-a996-4796-b97e-3ad269bf7624 + "503": + description: Service unavailable. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Name resolution failed. + "504": + description: API time out. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: The upstream server is timing out + security: + - Authorization: [] + /hotels/listings: + get: + tags: + - get-lodging-listings + summary: Search lodging inventory + description: > + Search Expedia lodging inventory by Location Keyword, Region ID, + Lat/Long, or Hotel ID(s) and return + + up to 1,000 offers in response. + + + Provides deeplink to Expedia site to book, or rate plan info to enable API booking. + operationId: get-lodging-listings + parameters: + - name: Partner-Transaction-Id + in: header + description: > + The `Partner-Transaction-ID` is a required API request header + element that is not consumed + + by Expedia. It will be required in all XAP v3 API request headers and will be mirrored + + back to the partner in the corresponding API response header. + + + The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + required: true + schema: + type: string + example: Partner123 + - name: ecomHotelIds + in: query + description: Comma-separated list of Expedia hotel IDs. There can be no spaces + between parameters. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + example: + - 28082 + - 11133 + - name: hcomHotelIds + in: query + description: Comma-separated list of Hotels.com hotel IDs. There can be no + spaces between parameters. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: geoLocation + in: query + description: > + The latitude and longitude values identifying the center point of a + search radius (circle). + + + North latitude will be represented by a positive value. South latitude by a negative value. + + + East longitude will be represented by a positive value. West longitude by a negative value. + + + The latitude and longitude values are joined together with a comma (,) character. + + There can be no spaces between parameters. + + + This parameter should be used in combination with the radius and unit parameters below. + schema: + type: string + - name: radius + in: query + description: > + The size of the search radius around a specified point when + searching by + + `geoLocation`, `locationKeyword`, or `regionids`. + + + `radius` is optional and the default value is 25 km for `geoLocation` and `locationKeyword` + + if not specified. `radius` must be less than 200 km or 124 mi. + + + This parameter should be used in combination with the `unit` and `geoLocation`, `locationKeyword`, + + or `regionids` parameters." + schema: + type: integer + format: int64 + default: 25 + - name: unit + in: query + description: > + The unit of measure for searches performed via `geoLocation`, + `locationKeyword`, or `regionids`. + + + Valid units are `km` and `mi`. + + + This parameter should be used in combination with the `radius` and `geoLocation`, `locationKeyword`, + + or `regionids`. + schema: + type: string + default: km + enum: + - km + - mi + - name: locationKeyword + in: query + description: > + A keyword search for a location. The keyword can be a city, address, + airport or a landmark. + + + This parameter should be used in combination with the `radius` and `unit` parameters above to define + + a circle around the landmark. + + + The default radius value is 25 if not specified. + + + Combined search is not supported, if more than one search method is included in the request, an error + + will be returned. + schema: + type: string + - name: regionIds + in: query + description: > + Comma-separated list of Expedia Region IDs. There can be no spaces + between parameters. + + Search returns set of all hotels in the combined regions. + + + You may search using a string of 1 - 10 Region ID's. + + More than 10 Region ID's are not supported and will generate and error. + + + You can get the complete list of Expedia Region IDs from + + [Static Data Platform ALL_REGIONS file](https://developers.expediagroup.com/xap/products/xap/static-data-platform/download-url-api/download-url-api-v1). + + + This parameter could be used in combination with the `radius` and `unit` parameters above to define + + a circle around the `regionIds`. The default radius value is 0 if not specified. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: checkIn + in: query + description: > + Check-in date for hotel stay in an ISO 8601 Date format + [YYYY-MM-DD]. + + + This parameter should be used in combination with the `checkOut` parameter. + + + If `checkIn` and `checkOut` are not included, a dateless search will be conducted which returns + + a `Featured Offer` for each of the hotels found. + + + If one of `checkIn` and `checkOut` is not included, an error will be returned. + + + The maximum advanced search window is 500 days in the future, and the maximum length of stay is 28. + schema: + type: string + format: date + example: 2023-09-12 + - name: checkOut + in: query + description: > + Checkout date for hotel stay in an ISO 8601 Date format + [YYYY-MM-DD]. + + + This parameter should be used in combination with the `checkIn` parameter. + + + If `checkIn` and `checkOut` are not included, a dateless search will be conducted which returns + + a `Featured Offer` for each of the hotels found. + + + If one of `checkIn` and `checkOut` is not included, an error will be returned. + + + The maximum advanced search window is 500 days in the future, and the maximum length of stay is 28. + schema: + type: string + format: date + example: 2023-09-14 + - name: locale + in: query + description: > + `locale` is composed of language identifier and region identifier, + connected by "_" that specifies + + the language in which the response will be returned. + + + You can find a link to the complete list of `locales` along with the Point of Sale List in [Supported Points of Sale](https://developers.expediagroup.com/xap/products/xap/lodging/references/supported-points-of-sale). Note that even though the Listings API supports localization for all `locales` listed in the list, all `locales` are not valid for all Points of Sale. + + + For example, Ecom US POS supports `en_US`, `es_MX` and `zh_CN`. For Ecom US POS, the Listings API will respond with content in Spanish for requests with either `locale=es_MX` or `es_US`. However, only the deeplinks for `locale=es_MX` should work properly and switch the website to Spanish, while the ones for locale=es_US will be fallen back to English. + + + If not specified in the query, the native language for that POS will be returned. + + And if more than one language is supported, the response will be returned in the first language + + depending on the language setting of the POS. + schema: + type: string + example: en_US + - name: currency + in: query + description: Value should be a standard ISO 3 letter currency code. + schema: + type: string + example: USD + - name: source + in: query + description: Indicate the source where the request is coming from. + schema: + type: string + enum: + - browser + - mobileapp + default: browser + - name: travelWithPets + in: query + description: > + Indicates if the search should include pet-friendly properties. + + + If set to "True" only properties that allow pets are returned. Pet fees, if available, are included in TaxesAndFees. + + + The parameter is only applicable to the Vrbo brand. + schema: + type: boolean + default: false + - name: contentDetails + in: query + description: > + This parameter is optional and can be specified as the following + values. + + - lowest + + - low (default) + + - medium + + - high + + + ### *lowest* + + Returns the absolute minimum response for up to 1,000 hotels: + + - Count(Count of hotels that are actually returned) + + - TotalHotelCount(Count of hotels that are requested) + + - TransactionId + + - StayDates + + - LengthOfStay + + - NumberOfRooms + + - Occupants + + - ***Hotels*** + - Id + - Status + - Links + - ***RoomTypes*** + - RoomKey [Deprecated] + - OfferId + - RatePlanType + - ***RatePlans*** + - RoomTypeId + - RatePlanId + - RateRuleId + - InventorySourceId + - RemainingCount + - Price + - MemberOnlyDeal + - Promotions + - PaymentMethod + - FullDepositUponBooking + - PaymentSchedule + - CancellationPolicy + - Price + - BaseRate + - TaxesAndFees + - TotalPrice + - TotalStrikeOutPrice + - AvgNightlyRate + - AvgNightlyStrikeOutRate + - AvgNightlyRateWithFees + - AvgNightlyStrikeOutRateWithFees + - HotelMandatoryFees + - TotalPriceWithHotelFees + - NightlyRates + - TaxesAndFeesDetails + - RefundableDamageDeposit + + This minimal response is the best for partners that store static hotel location data locally, + + and who would like to have the smallest and fastest API response. + + + ### *low* + + Returns basic hotel information in response for up to 1,000 hotels. + + + Includes all elements returned when `contentDetails=lowest` plus: + + - ***Hotels*** + - Name + - PropertyType + - PropertyDetails + - LocalCurrencyCode + - Location + - Distance + - Description(may not be localized) + - ChainAndBrandInfo + - ThumbnailUrl + - StarRating + - GuestRating + - GuestReviewCount + - PetFriendly + - LgbtqiaFriendly + - ImportantNotices + - ***RoomTypes*** + - Description + - ***RatePlans*** + - InventorySourceCode + - PaymentTime + - ReserveWithDeposit + - FreeInternet + - FreeWiFi + - FreeParking + - FreeBreakfast + + ### *medium* + + Returns more complete hotel information in response for up to 200 hotels. + + + Includes all elements returned when `contentDetails=low` plus: + + - ***Hotels*** + - HotelAmenities + - RoomAmenities + - ***RoomTypes*** + - ***RatePlans*** + - FreeInternetDetails + - FreeBreakfastDetails + - Amenities + - Amenities + + **Note**: Setting the `contentDetails` to `medium` will automatically limit your response size to 200 hotels. + + + ### *high* + + Returns extended hotel information in response for up to 5 hotels. + + + Includes all elements returned when `contentDetails=medium` plus: + + - ***Hotels*** + - RenovationsAndClosures + - Policies + - OptionalExtras + - Media + - Accessibility + - ***RoomTypes*** + - SmokingOption + - BedTypeOptions + - RoomOccupancyPolicy + - Media + + **Note**: Setting the `contentDetails` to `high` will automatically limit your response size to 5 hotels. + schema: + type: string + enum: + - lowest + - low + - medium + - high + default: low + - name: allRoomTypes + in: query + description: > + Returns all available rate plans for the selected hotels. + + + This parameter requires that a `checkIn` date and `checkOut` date be supplied, as the API cannot return additional room rates on a dateless search. + + + Including `allRoomTypes=true` in your query will automatically limit your response size to no more than 200 hotels. + + + Including `allRoomTypes=true` and `contentDetails=high` will limit your response size to no more than 5 hotels. + schema: + type: boolean + default: false + - name: links + in: query + description: > + + Comma-separated list to specify the types of deep links. + + - WD (link to Web Details site) + + - WS (link to Web Search Result page) + + - AD (link for Details API) + + - RC (link for RateCalendar API) + + - WEB (include all website links) + + - API (links for Details and RateCalendar API) + + + There are two level of links returned in the API response: Property-level deeplinks and room-level deeplinks. + + + When requesting API deeplinks you will receive both a RateCalendar API link at the property level, + + and Details API links at the room level, since the Lodging Details API only displays information + + on rate plan offers. + + + When requesting AD deeplinks, you will only receive Details API links at the room level. + + `Links` node in property-level will be omitted. + + + If you are looking for more complete details on a single property via the API, you should do another search + + in the Lodging API for the single Hotel ID, with `contentDetails=high` to get all details back in return + + (note that you can only get back a maximum of 5 hotels when `contentDetails` is set to `high`). + + + **NOTE**: dateless searches will not return Details API links, since the Lodging Details API will only + + return details on a specific room offer for specific dates. + explode: false + schema: + type: array + items: + type: string + enum: + - WD + - WS + - AD + - RC + - WEB + - API + - name: minStarRating + in: query + description: The minimum star rating for hotels returned in the response. + schema: + type: string + enum: + - "1.0" + - "1.5" + - "2.0" + - "2.5" + - "3.0" + - "3.5" + - "4.0" + - "4.5" + - "5.0" + - name: maxStarRating + in: query + description: The maximum star rating for hotels returned in the response. + schema: + type: string + enum: + - "1.0" + - "1.5" + - "2.0" + - "2.5" + - "3.0" + - "3.5" + - "4.0" + - "4.5" + - "5.0" + - name: limit + in: query + description: > + The maximum number of hotels returned in the response. Must be an + integer greater than 0. + + + If the value is greater than 1000, only the first 1000 hotels are returned. + + + Settings on `contentDetails` and `allRoomTypes` parameters may cause this value to be overridden + + and a lower number of hotels to be returned. + + + The `limit` parameter is intended to be used to control the response size, but partners should be careful + + about combining it with other filter parameters, as each parameter that you add will shrink the response, + + even to the point where you may even get a "no hotel found" error if none of the hotels in the base response + + meet the combined filter requirements. + + + Filters are cumulative in effect, and results must meet all filter requirements to be displayed. + schema: + type: integer + format: int64 + - name: queryText + in: query + description: > + Query text is used for a full text search of hotel data. + + + Text search based on hotel name, description, address, promotion description, amenities description. + schema: + type: string + - name: availOnly + in: query + description: > + Specifies whether to return only available hotels in the search + results. + + + If the value of this parameter is true, the search results will only return hotels that have availability + + during the requested dates. + + + If there are no hotels with availability in your search then an empty record set will be returned. + + + This parameter is ignored for dateless searches. + schema: + type: boolean + - name: smokingPreference + in: query + description: Specifies smoking preference. + schema: + type: string + enum: + - smoking + - nonsmoking + - both + - name: rateType + in: query + description: Indicate which type of `paymentMethod` for each room will be + returned. + schema: + type: string + enum: + - payonline + - payhotel + - all + - name: imageSizes + in: query + description: > + Indicates what size images will be displayed for `hotelPhotos` and + `roomPhotos` are returned when + + `contentDetails=high`. + + + The available image sizes are: + + - t : Thumbnail + + - s : Small + + - b : Big + + - y : 500x500v + + - z : 1000x1000v + + + Resolution from smallest to largest is t < s < b < y < z. + + + If no `imageSizes` is specified, the t size images will be returned. + + + If an image is missing in one size, we will try to fall back to the same image with lower resolution. + + + (If image "_z" is not available, we will try to return image "_y", and if it is also unavailable, we will return image "_b", and so on.) + + + Only one image size is allowed. + schema: + type: string + enum: + - t + - s + - b + - y + - z + - name: thumbnailImageSize + in: query + description: > + Indicate what size of image will be used for the single `thumbnail` + image that is returned when + + `contentDetails` is set to `low`, `medium` or `high`. + + + The available thumbnail image sizes are: + + - t : Thumbnail + + - s : Small + + - b : Big + + - y : 500x500v + + - z : 1000x1000v + + + Resolution from smallest to largest is t < s < b < y < z. + + + If no `thumbnailImageSize` is specified, the t size images will be returned. + + + if no thumbnail image found, it would not return thumbnail image. + + + Only one thumbnail image size is allowed. + schema: + type: string + enum: + - t + - s + - b + - y + - z + - name: includedPropertyTypeIds + in: query + description: > + Only return hotels where the `PropertyType` ID is one of the IDs in + the `includedPropertyTypeIds` field. + + + If the API query includes the parameter `contentDetail=lowest` the `PropertyType` parameter will not + + be returned in the response. Even in this case, the filtering is still being applied, even though there is + + no `PropertyType` parameter in the response with which to validate. + + + `includedPropertyTypeIds` and `excludedPropertyTypeIds` fields are mutually exclusive - which means that + + each query may contain **one** of the parameters, or **neither** of the parameters, but the query may not + + contain **both** of the parameters. + + + A complete list of supported Expedia Property Types can be found in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: excludedPropertyTypeIds + in: query + description: > + Return all hotels **except** those whose `PropertyType` ID is in the + `excludedPropertyTypeIds` field. + + + If the API query includes the parameter `contentDetail=lowest` the `PropertyType` parameter will not + + be returned in the response. Even in this case, the filtering is still being applied, even though there is + + no `PropertyType` parameter in the response with which to validate. + + + `includedPropertyTypeIds` and `excludedPropertyTypeIds` fields are mutually exclusive - which means that + + each query may contain **one** of the parameters, or **neither** of the parameters, but the query may not + + contain **both** of the parameters. + + + A complete list of supported Expedia Property Types can be found in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: includedInventorySourceIds + in: query + description: > + Querying with no `includedInventorySourceIds` parameter will return + listings from all available inventory + + sources. + + + Query with the `includedInventorySourceIds` parameter included will only return listings from the requested + + inventory sources. All others will be left out. + + + `includedInventorySourceId=24` will return only Expedia lodging inventory. + + + `includedInventorySourceId=83` will return only Vrbo lodging inventory. + + + `includedInventorySourceId=24,83` will return both Expedia and Vrbo lodging inventory. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: freeCancellation + in: query + description: > + Specifies whether to return only free cancelable room rates in the + search results. + + + If the value of this parameter is true, the search results will only return hotels that have free cancelable room rates during the requested dates. + + + If there are no hotels with free cancelable room rates in your search then an empty record set will be returned. + + + Default value is false, if query without this parameter or the value of this parameter is false, all available room rates will be returned. + + + This parameter is ignored for dateless searches. + schema: + type: boolean + - name: groupedAmenities + in: query + description: > + Specifies whether to return the grouped amenities. If + `groupedAmenities` is true, `DescriptiveAmenities` + + node will be returned in response, otherwise `Amenities` node will be returned. + schema: + type: boolean + - name: blockFullDepositRateplan + in: query + description: > + Specifies whether to return `rateplan` with `FullDepositUponBooking` + as true. + + + If `blockFullDepositRateplans` is true, the search results will not return `rateplan` with `FullDepositUponBooking` as true. + + + The default value is false, if query without this parameter or the value of this parameter is false, all available rateplan will be returned. + + + This parameter is ignored for dateless search. + schema: + type: boolean + default: false + - name: ratePlanType + in: query + description: > + **Note**: This parameter is visible to partners only by + configuration. Please contact your Expedia Account + + Manager if you need this parameter. + + + To specify the desired rate plan types. The options are: + + - standalone : Ask for standalone rates + + - package : Ask for package rates, but standalone rate also may be returned if available. + + + Otherwise only standalone rate plans will be returned. + + + `WebSearchResult` and `WebDetails` links won't be returned for package rate. + schema: + type: string + enum: + - standalone + - package + - name: sortType + in: query + description: > + Specifies the field that the search results will be ordered by. + + + To be used in conjunction with sortOrder parameter below. + + + **CMA Compliance Note (UK)**: partners doing business in the UK should be sorting their search results using + + the `totalpricewithfees` parameter in their query string so that the sorting complies with CMA regulations. + schema: + type: string + enum: + - price + - starrating + - avgrate + - deals + - guestrating + - hotelname + - distance + - totalpricewithfees + - name: sortOrder + in: query + description: > + Specifies the sort order of search results. + + + If no sort order is specified, the default is `asc`. But for deals sorting, it only supports `desc`. + + + To be used in conjunction with the `sortType` parameter above. + schema: + type: string + enum: + - asc + - desc + default: asc + - name: room1.adults + in: query + description: > + Specifies the number of adults staying in a specific room. + + + Default value is one room with 2 adults. + + + Example: `room1.adults` is used to specify the number of adults in the first room. + schema: + type: integer + format: int64 + example: 2 + - name: room1.childAges + in: query + description: > + Comma-separated list that specifies the age(s) for each of the + children in each of the rooms. + + + Example: `room2.childAges=1,3` means two children (1-year old and 3-year old) are staying in room #2. + + + Children must be accompanied by an adult. + explode: false + schema: + type: array + items: + type: string + example: + - 8 + - 10 + - name: room2.adults + in: query + description: Specifies the number of adults staying in second room. + schema: + type: integer + format: int64 + - name: room2.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in second room. + explode: false + schema: + type: array + items: + type: string + - name: room3.adults + in: query + description: Specifies the number of adults staying in third room. + schema: + type: integer + format: int64 + - name: room3.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in third room. + explode: false + schema: + type: array + items: + type: string + - name: room4.adults + in: query + description: Specifies the number of adults staying in fourth room. + schema: + type: integer + format: int64 + - name: room4.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in fourth room. + explode: false + schema: + type: array + items: + type: string + - name: room5.adults + in: query + description: Specifies the number of adults staying in fifth room. + schema: + type: integer + format: int64 + - name: room5.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in fifth room. + explode: false + schema: + type: array + items: + type: string + - name: room6.adults + in: query + description: Specifies the number of adults staying in sixth room. + schema: + type: integer + format: int64 + - name: room6.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in sixth room. + explode: false + schema: + type: array + items: + type: string + - name: room7.adults + in: query + description: Specifies the number of adults staying in seventh room. + schema: + type: integer + format: int64 + - name: room7.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in seventh room. + explode: false + schema: + type: array + items: + type: string + - name: room8.adults + in: query + description: Specifies the number of adults staying in eighth room. + schema: + type: integer + format: int64 + - name: room8.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in eighth room. + explode: false + schema: + type: array + items: + type: string + responses: + "200": + description: Normal Response + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/HotelListingsResponse" + "400": + description: User Fault or DisambiguationResponse Fault + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + examples: + DisambiguationResponse: + description: DisambiguationResponse + value: + TransactionId: f06edfa3-27f4-44e6-838c-b8dd3d0a3210 + Errors: + - Code: AMBIGUOUS_LOCATION + DetailCode: MULTIPLE_AMBIGUOUS_LOCATION + Description: More than one location found + LocationKeyword: dublin + LocationOptions: + - Type: MULTICITY + RegionID: 178256 + ShortName: Dublin (and vicinity) + AirportCode: DUB + Address: Dublin (and vicinity), Ireland + Country: + Name: Ireland + IsoCode2: IE + IsoCode3: IRL + GeoLocation: + Latitude: 53.34402 + Longitude: -6.26146 + - Type: POI + RegionID: 553248621563220200 + ShortName: Market On Madison + AirportCode: MCN + Address: Market On Madison, Dublin, Georgia, United States of America + Country: + Name: United States of America + IsoCode2: US + IsoCode3: USA + GeoLocation: + Latitude: 32.539313 + Longitude: -82.902537 + UserFault: + description: UserFault + value: + Errors: + - Code: COMBINED_HOTEL_SELECT_CRITERIA + Description: > + Combined hotel search is not supported. Please specify + either one of the following search + + criteria: [geoLocation, regionIds, ecomHotelIds, hcomHotelIds, locationKeyword, hnk, offerId]. + TransactionId: 242d7a77-4063-439b-a9d0-12da0ff5116e + "401": + description: Invalid authentication credentials. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Unauthorized + "403": + description: You cannot consume this service. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: You cannot consume this service + "429": + description: API rate limit exceeded. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: API rate limit exceeded. + "500": + description: Service Error + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + example: + Errors: + - Code: APPLICATION_ERROR + Description: Application error. + TransactionId: 1490a74b-4c90-4e78-983d-4ede360ce52a + "503": + description: Service unavailable. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: name resolution failed + "504": + description: API time out. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: The upstream server is timing out + security: + - Authorization: [] + /hotels/rateCalendar: + get: + tags: + - get-lodging-rate-calendar + summary: Get rate calendar of a property + description: The Rate Calendar API will return the lowest rate plan for a range + of days for one selected Expedia lodging property. + operationId: get-lodging-rate-calendar + parameters: + - name: Partner-Transaction-Id + in: header + description: > + The `Partner-Transaction-ID` is a required API request header + element that is not consumed + + by Expedia. It will be required in all XAP v3 API request headers and will be mirrored + + back to the partner in the corresponding API response header. + + + The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + required: true + schema: + type: string + example: Partner123 + - name: ecomHotelId + in: query + description: > + The Expedia hotel ID for which the calendar is being requested. + + + **Note**: Either an Expedia Hotel ID or a Hotels.com Hotel ID must be included in the request. + + You may use one or the other, but not both. + schema: + type: string + - name: hcomHotelId + in: query + description: > + The Hotel.com hotel ID for which the calendar is being requested. + + + **Note**: Either an Expedia Hotel ID or a Hotels.com Hotel ID must be included in the request. + + You may use one or the other, but not both. + schema: + type: string + - name: startDate + in: query + description: > + Start date for check-in search range in an ISO 8601 Date format + [YYYY-MM-DD]. + + + **Note**: The start date may not be in the past. + required: true + schema: + type: string + format: date + example: 2022-09-12T00:00:00.000Z + - name: endDate + in: query + description: > + End date for check-in search range in an ISO 8601 Date format + [YYYY-MM-DD]. + + + **Note**: The end date must be after the start date. The maximum supported search range is 180 days. + required: true + schema: + type: string + format: date + example: 2022-09-14T00:00:00.000Z + - name: lengthOfStay + in: query + description: The length of stay to retrieve the lowest price for. + schema: + type: integer + format: int32 + default: 1 + - name: currency + in: query + description: The requested currency expressed according to ISO 4217. + schema: + type: string + responses: + "200": + description: Normal Response + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/RateCalendarResponse" + "400": + description: User Fault + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + example: + Errors: + - Code: INVALID_HCOMHOTELID + Description: The hcomHotelId is invalid. Please specify correct Hcom hotel id. + TransactionId: 97da7aa5-175e-4fdf-8bbd-32e997b6faa8 + "401": + description: Invalid authentication credentials. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Unauthorized + "403": + description: You cannot consume this service. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: You cannot consume this service + "409": + description: NO_RESULTS_FOUND + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + example: + Errors: + - Code: NO_RESULTS_FOUND + Description: > + Sorry, your query appears to be correctly formatted, but + the inventory for which you are seeking + + details is now unavailable. + TransactionId: 2423025a-916f-4994-972a-68ee2e6b1e92 + "429": + description: API rate limit exceeded. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: API rate limit exceeded. + "500": + description: Service Error + content: + application/vnd.exp-hotel.v3+json: + schema: + $ref: "#/components/schemas/Errors" + example: + Errors: + - Code: APPLICATION_ERROR + Description: Application error. + TransactionId: b2f16375-9fe3-43e3-b524-fb5e0498460b + "503": + description: Service unavailable. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Name resolution failed. + "504": + description: API time out. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: The upstream server is timing out. + security: + - Authorization: [] + /lodging/quotes: + get: + tags: + - get-lodging-quotes + summary: Get properties price and availability information + description: > + The Lodging Quotes API will return the price and availability + information for given Expedia lodging property ID(s). + operationId: get-lodging-quotes + parameters: + - name: Partner-Transaction-Id + in: header + description: > + The `Partner-Transaction-ID` is a required API request header + element that is not consumed + + by Expedia. It will be required in all XAP v3 API request headers and will be mirrored + + back to the partner in the corresponding API response header. + + + The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + required: true + schema: + type: string + example: Partner123 + - name: propertyIds + in: query + description: > + Comma-separated list of Expedia Property IDs. + + + ***NOTE**: This API supports Expedia property IDs only by design – HCOM and Vrbo property IDs are + + not supported.* + + + *For optimal performance, limiting your request to a maximum of 200 properties is recommended.* + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: checkIn + in: query + description: > + Check-in date for property stay in an ISO 8601 Date format. + + + This parameter should be used in combination with the checkOut parameter. + + + The maximum advanced search window is 1000 days in the future, and the maximum length of stay is 732. + schema: + type: string + format: date + example: 2023-10-12 + - name: checkOut + in: query + description: > + Check-out date for property stay in an ISO 8601 Date format + + + This parameter should be used in combination with the checkIn parameter. + + + The maximum advanced search window is 1000 days in the future, and the maximum length of stay is 732. + schema: + type: string + format: date + example: 2023-10-14 + - name: currency + in: query + description: > + The requested currency expressed according to ISO 4217. + + + PoS default currency will be passed if another currency is not specified in the request. + schema: + type: string + - name: links + in: query + description: | + Comma-separated list to specify the types of deep links. + - WD (link to web infosite) + - WS (link to web search result page) + - WEB (include all website links) + explode: false + schema: + type: array + items: + type: string + enum: + - WD + - WS + - WEB + - name: travelWithPets + in: query + description: > + Indicates if the search should include pet-friendly properties. + + + If set to "True" only properties that allow pets are returned. Pet fees, if available, are included in TaxesAndFees. + + + The parameter is only applicable to the Vrbo brand. + schema: + type: boolean + default: false + - name: room1.adults + in: query + description: > + Specifies the number of adults staying in a specific room. + + + Example: `room1.adults` is used to specify the number of adults in the first room. + + + ***NOTE***: multiple room request is only supported for conventional lodging hotels. Request for Vrbo + + properties should only include one room. e.g. 3 adults in room 1 and 3 in room 2, "room1.adults" is 6. + schema: + type: integer + format: int64 + example: 2 + - name: room1.childAges + in: query + description: > + Comma-separated list that specifies the age(s) for each of the + children in each of the rooms. + + + Example: `room2.childAges=1,3` means two children (1-year old and 3-year old) are staying in room #2. + + + Children must be accompanied by an adult. + + + Total number of children is indicated by the number of childAges included. + + + If there are no children in the party then this value should not be included. + + + ***NOTE***: multiple room request is only supported for conventional lodging hotels. Request for Vrbo + + properties should include the ages of all the children in the first room. e.g. 1 child age 10 in room #1 + + and 1 child age 11 in room #2, "room1.childAges" is 10,11. + explode: false + schema: + type: array + items: + type: string + example: + - 8 + - 10 + - name: room2.adults + in: query + description: Specifies the number of adults staying in second room. + schema: + type: integer + format: int64 + - name: room2.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in second room. + explode: false + schema: + type: array + items: + type: string + - name: room3.adults + in: query + description: Specifies the number of adults staying in third room. + schema: + type: integer + format: int64 + - name: room3.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in third room. + explode: false + schema: + type: array + items: + type: string + - name: room4.adults + in: query + description: Specifies the number of adults staying in fourth room. + schema: + type: integer + format: int64 + - name: room4.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in fourth room. + explode: false + schema: + type: array + items: + type: string + - name: room5.adults + in: query + description: Specifies the number of adults staying in fifth room. + schema: + type: integer + format: int64 + - name: room5.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in fifth room. + explode: false + schema: + type: array + items: + type: string + - name: room6.adults + in: query + description: Specifies the number of adults staying in sixth room. + schema: + type: integer + format: int64 + - name: room6.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in sixth room. + explode: false + schema: + type: array + items: + type: string + - name: room7.adults + in: query + description: Specifies the number of adults staying in seventh room. + schema: + type: integer + format: int64 + - name: room7.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in seventh room. + explode: false + schema: + type: array + items: + type: string + - name: room8.adults + in: query + description: Specifies the number of adults staying in eighth room. + schema: + type: integer + format: int64 + - name: room8.childAges + in: query + description: Comma-separated list that specifies the age(s) for each of the + children in eighth room. + explode: false + schema: + type: array + items: + type: string + responses: + "200": + description: Normal Response + content: + application/vnd.exp-lodging.v3+json: + schema: + $ref: "#/components/schemas/LodgingQuotesResponse" + examples: + Lodging Quotes Response: + value: >- + { + "Count": 1, + "TotalPropertyCount": 1, + "TransactionId": "0e1d7193-2289-481c-bdf9-b7ac0b0b3bfe", + "StayDates": { + "CheckInDate": "2024-11-29", + "CheckOutDate": "2024-12-04" + }, + "LengthOfStay": 5, + "Occupants": [ + { + "Adults": 2 + } + ], + "Properties": [ + { + "Id": "87704892", + "Status": "AVAILABLE", + "RoomTypes": [ + { + "RatePlans": [ + { + "CancellationPolicy": { + "Refundable": true, + "FreeCancellation": true, + "FreeCancellationEndDateTime": "2024-11-15T23:59:00-08:00", + "CancellationPenaltyRules": [ + { + "PenaltyPercentOfStay": "50.00", + "PenaltyStartDateTime": "2024-11-15T23:59:00-08:00", + "PenaltyEndDateTime": "2024-11-22T23:59:00-08:00" + }, + { + "PenaltyPercentOfStay": "100", + "PenaltyStartDateTime": "2024-11-22T23:59:00-08:00", + "PenaltyEndDateTime": "2024-11-29T00:00:00-08:00" + } + ] + } + } + ], + "Price": { + "BaseRate": { + "Value": "790.00", + "Currency": "USD" + }, + "TaxesAndFees": { + "Value": "348.48", + "Currency": "USD" + }, + "TotalPrice": { + "Value": "1138.48", + "Currency": "USD" + }, + "AvgNightlyRate": { + "Value": "158.00", + "Currency": "USD" + }, + "AvgNightlyRateWithFees": { + "Value": "198.80", + "Currency": "USD" + }, + "TotalPriceWithPropertyFees": { + "Value": "1138.48", + "Currency": "USD" + } + }, + "Links": { + "WebSearchResult": { + "Method": "GET", + "Href": "https://www.vrbo.com/search?selected=87704892&startDate=2024-11-29&endDate=2024-12-04&adults=2&tpid=9001&eapid=1&mpa=790.00&mpb=348.48&mpd=USD&mctc=15" + }, + "WebDetails": { + "Method": "GET", + "Href": "https://www.vrbo.com/3032772?adults=2&startDate=2024-11-29&endDate=2024-12-04&mpa=790.00&mpb=348.48&mpd=USD&mpe=1721730597" + } + } + } + ] + } + ] + } + "400": + description: User Fault + content: + application/vnd.exp-lodging.v3+json: + schema: + $ref: "#/components/schemas/LodgingErrors" + example: + Errors: + - Code: INVALID_PROPERTYID + Description: The PropertyIds is invalid. Which should be comma separated list of + property IDs. + TransactionId: 97da7aa5-175e-4fdf-8bbd-32e997b6faa8 + "401": + description: Invalid authentication credentials. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Unauthorized + "403": + description: You cannot consume this service. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: You cannot consume this service + "429": + description: API rate limit exceeded. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: API rate limit exceeded. + "500": + description: Service Error + content: + application/vnd.exp-lodging.v3+json: + schema: + $ref: "#/components/schemas/LodgingErrors" + example: + Errors: + - Code: APPLICATION_ERROR + Description: Application error. + TransactionId: b2f16375-9fe3-43e3-b524-fb5e0498460b + "503": + description: Service unavailable. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Name resolution failed. + "504": + description: API time out. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: The upstream server is timing out. + security: + - Authorization: [] + /lodging/availabilityCalendars: + get: + tags: + - get-lodging-availability-calendars + summary: Get availability calendars of properties + description: Returns the availability of each day for a range of dates for given + Expedia lodging properties. + operationId: get-lodging-availability-calendars + parameters: + - name: Partner-Transaction-Id + in: header + description: > + The `Partner-Transaction-ID` is a required API request header + element that is not consumed + + by Expedia. It will be required in all XAP v3 API request headers and will be mirrored + + back to the partner in the corresponding API response header. + + + The `Partner-Transaction-ID` may be any alphanumeric string of the partner's choosing. + required: true + schema: + type: string + example: Partner123 + - name: propertyIds + in: query + description: > + Comma-separated list of Expedia Property IDs. + + + The API request supports a maximum of 50 Property IDs in a single request. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + responses: + "200": + description: Normal Response + content: + application/vnd.exp-lodging.v3+json: + schema: + $ref: "#/components/schemas/AvailabilityCalendarResponse" + "400": + description: User Fault + content: + application/vnd.exp-lodging.v3+json: + schema: + $ref: "#/components/schemas/LodgingErrors" + example: + Errors: + - Code: INVALID_PROPERTYIDS + Description: The propertyIds is invalid. Which should be comma separated list of + Expedia property IDs. + TransactionId: 97da7aa5-175e-4fdf-8bbd-32e997b6faa8 + "401": + description: Unauthorized or Invalid authentication credentials. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Unauthorized + "403": + description: cannot consume this service. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: You cannot consume this service + "429": + description: API rate limit exceeded. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: API rate limit exceeded. + "500": + description: Service Error + content: + application/vnd.exp-lodging.v3+json: + schema: + $ref: "#/components/schemas/LodgingErrors" + example: + Errors: + - Code: APPLICATION_ERROR + Description: Application error. + TransactionId: b2f16375-9fe3-43e3-b524-fb5e0498460b + "503": + description: Service unavailable. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: Name resolution failed. + "504": + description: API time out. + content: + application/json: + schema: + $ref: "#/components/schemas/APIGatewayError" + example: + message: The upstream server is timing out. + security: + - Authorization: [] + /cars/listings: + get: + tags: + - get-cars-listings + summary: Search Expedia car inventory + description: Search Expedia car inventory by date, pickup, and dropoff location + to return a listing of available cars for hire. + operationId: get-cars-listings + parameters: + - name: Partner-Transaction-Id + in: header + description: "[Not consumed by Expedia] Partner-generated identifier." + required: true + schema: + type: string + example: BestTravel-123456-798101112 + - name: pickup.airport + in: query + description: "Three letter code for the airport at which the customer would like + to pick up the car.Supported values: standard 3 letter IATA Airport + Code.Please see a full list of Car Vendor Codes and Airport Codes in + the Related Links Section below.Cannot coexist with other pickup + parameters, only one pickup parameter is allowed per request." + schema: + type: string + example: SEA + - name: pickup.city + in: query + description: The name of the city in which the customer would like to pick up + the car.Search results will include up to 40 rental locations that + are closest to the center point of the search.Cannot coexist with + other pickup parameters, only one pickup parameter is allowed per + request. + schema: + type: string + - name: pickup.address + in: query + description: The address of a car rental location where the customer would like + to pick up the car.Cannot coexist with other pickup parameters, only + one pickup parameter is allowed per request. + schema: + type: string + example: Seattle + - name: pickup.geoLocation + in: query + description: The latitude and longitude that defines where the customer would + like to pick up the car.Latitude and longitude are separated by + comma.South latitudes and West longitudes are represented by + negative values.Cannot coexist with other pickup parameters, only + one pickup parameter is allowed per request. + schema: + type: string + example: 111.00,-22.00 + - name: pickup.radius + in: query + description: Radius used in conjunction with a point to define the search area + when searching by lat/ long, city or address.See ' unit' parameter + below to select miles or kilometers.If no value is specified a + default value of 25 will be assumed. + schema: + type: integer + example: 10 + - name: dropOff.airport + in: query + description: "Three letter code for the airport at which the customer would like + to drop off the car.Supported values: standard 3 letter IATA Airport + Code.Please see a full list of Car Vendor Codes and Airport Codes in + the Related Links Section below.Cannot coexist with other drop off + parameters, only one drop off parameter is allowed per request.If no + drop off location is specified, it is assumed that the customer will + be dropping the car off at the same location at which they picked it + up." + schema: + type: string + example: SEA + - name: dropOff.city + in: query + description: City name for the location at which the customer would like to drop + off the car.Cannot coexist with other drop off parameters, only one + drop off parameter is allowed in a request.If no drop off location + is specified, it is assumed that the customer will be dropping the + car off at the same location at which they picked it up. + schema: + type: string + - name: dropOff.address + in: query + description: Address for the location at which the customer would like to drop + off the car.Cannot coexist with other drop off parameters, only one + drop off parameter is allowed in a request.If no drop off location + is specified, it is assumed that the customer will be dropping the + car off at the same location at which they picked it up. + schema: + type: string + example: Seattle + - name: dropOff.geoLocation + in: query + description: Latitude and longitude for the location at which the customer would + like to drop off the car.Latitude and longitude are separated by + comma.South latitudes and West longitudes are represented by + negative values.Cannot coexist with other drop off parameters, only + one drop off parameter is allowed per request.If no drop off + location is specified, it is assumed that the customer will be + dropping the car off at the same location at which they picked it + up. + schema: + type: string + example: 111.00,-22.00 + - name: dropOff.radius + in: query + description: "Radius used in conjunction with a point to define the search area + when searching by lat/ long, city or address.See ' unit' parameter + below to select miles or kilometers.If no value is specified a + default value of 25 will be assumed.Note: The pickup radius value + will be used (instead of the the drop-off radius) when the requested + pickup and drop-off city/address are exactly the same." + schema: + type: integer + example: 10 + - name: pickupTime + in: query + description: Requested car pickup date and time.Date should be ISO8601 Date + format.The default TIME is 10:30:00.The supported search window is + today to 330 days in the future.(Note that each rental counter has + different hours of operation. If you select a time in the middle of + the night there may be no inventory available as all locations may + be closed.) + required: true + schema: + type: string + format: date-time + example: 2021-06-05T10:00 + - name: dropOffTime + in: query + description: "Requested car drop off date and time. Date should be ISO8601 Date + format.The supported search window is today to 330 days in the + future.Note: The dropOffTime must be at least 2 hours later than the + pickupTime for the request to be valid." + required: true + schema: + type: string + format: date-time + example: 2021-06-06T10:00 + - name: sortType + in: query + description: "Method of sorting the car search results.Supported value: Price.If + no value is present a sort by 'price' will be assumed." + schema: + type: string + enum: + - Price + - name: sortOrder + in: query + description: "Order of sorting the car search results.Supported values: ASC, + DESCIf no value is present a sort order of 'ascending' will be + assumed." + schema: + type: string + enum: + - ASC + - DESC + - name: limit + in: query + description: The maximum number of search results that will be returned by the + query. + schema: + type: integer + example: 100 + - name: suppliers + in: query + description: "A list of supplier ids or supplier names to be used to filter + search results.Multiple supplier names or ids may be separated by + comma.Please see a full list of Expedia Vendor Codes & Names in the + Related Links Section below.The max count of suppliers requested is + limited to 20.Note: while you may filter using either supplier name + or supplier ID, it is recommended that you use supplier ID, as this + value will remain consistent in the event of a merger or other name + change by the supplier." + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + example: + - 11 + - 12 + - name: carClasses + in: query + description: A list of car classes to be used to filter search results.Multiple + car classes may be separated by comma.Please see Class List in the + Related Links Section below for all options. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + example: economy + - name: discount1.supplier + in: query + description: "Name or ID of the supplier who issued a coupon or discount + code.NOTE: Only ONE discount code per transaction is currently + supported by the API. If you enter more than one discount code, only + the first one will be honored.Please see a full list of Expedia + Vendor Codes & Names in the Related Links Section below." + schema: + type: string + example: Avis + - name: discount1.type + in: query + description: "The type of discount to be applied.Supported values: CorpDiscount + | Coupon." + schema: + type: string + enum: + - CorpDiscount + - Coupon + - name: discount1.code + in: query + description: The code of the discount to be applied. + schema: + type: string + example: GB1234 + - name: transmissions + in: query + description: A list of car transmission drive codes to be used to filter search + results.Multiple car classes may be separated by a comma.Please see + a full list of Transmission Drive Codes in the Related Links Section + below. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + - name: airConditioning + in: query + description: Specify whether to filter for cars that include or exclude air + conditioning. + schema: + type: boolean + - name: carTypes + in: query + description: A list of car types to be used to filter search results.Multiple + car types may be separated by comma.Please see a full list of Car + Type Codes in the Related Links Section below. + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + example: C,E + - name: unit + in: query + description: "The distance unit for the radius of a location-based search, or + the distance between the center point of a search and the vendor + location.Supported values: KM | MI.Default value: KM." + schema: + type: string + enum: + - KM + - MI + - name: driverAge + in: query + description: The age of the driver that will be renting the car.This value is + required in the UK and optional elsewhere. + schema: + type: integer + example: 18 + - name: links + in: query + description: WS = WebSearch, AD = ApiDetails, WD = WebDetails + explode: false + schema: + type: array + items: + type: string + enum: + - WS + - AD + - WD + - name: source + in: query + description: Indicates the source where the request is coming from.The available + values for the source as below:browser - The value "browser" + represents that the client is traditional website.mobile - The value + "mobile" represents that the client is mobile.all - The value "all" + indicates that the client includes both browser and mobile.Only one + source value may be used at a time. + schema: + type: string + enum: + - browser + - mobile + - all + responses: + "200": + description: car listing response + content: + application/vnd.exp-car.v3+json: + schema: + $ref: "#/components/schemas/CarListingsResponse" + application/vnd.exp-car.v3+xml: + schema: + $ref: "#/components/schemas/CarListingsResponse" + "400": + description: errors response + content: + application/vnd.exp-car.v3+json: + schema: + $ref: "#/components/schemas/CarsErrors" + examples: + Errors: + description: Errors + value: + Errors: + - Code: INVALID_LINKS + Description: Invalid links. Allowed value are:[WS, AD, WD]. + TransactionId: 583b7277-772a-4802-8ac7-bcdf978abbdb + application/vnd.exp-car.v3+xml: + schema: + $ref: "#/components/schemas/DisambiguationResponse" + examples: + DisambiguationResponse: + description: DisambiguationResponse + value: + Errors: + - Code: AMBIGUOUS_LOCATION + DetailCode: MULTIPLE_AMBIGUOUS_PICKUP_LOCATION + Description: Multiple pickup locations found. + LocationKeyword: portland + LocationOptions: + - Type: MULTICITY + RequestedLocation: Portland (and vicinity) + Locations: + - Name: Portland (and vicinity) + LocationId: seat001 + RegionId: "178299" + ShortName: Portland (and vicinity) + AirportCode: PDX + Address: Portland (and vicinity), Oregon, United States Of America + Country: + Name: United States of America + IsoCode2: US + IsoCode3: USA + GeoLocation: + Latitude: "45.516740" + Longitude: "-122.680950" + - Type: CITY + RequestedLocation: Portland (and vicinity) + Locations: + - Name: Portland (and vicinity) + LocationId: seat001 + RegionId: "6174134" + ShortName: Downtown Portland + AirportCode: PWM + Address: Downtown Portland, Portland, Maine, United States of America + Country: + Name: United States of America + IsoCode2: US + IsoCode3: USA + GeoLocation: + Latitude: "43.655764" + Longitude: "-70.255458" + TransactionId: 81e0a6d6-8ca9-4adf-a1c8-08ba0d11dcef + "401": + description: Unauthorized or Invalid authentication credentials + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + unauthorized: + value: '{message":"Unauthorized"}' + Invalid authentication credentials: + value: '{"message":"Invalid authentication credentials"}' + "403": + description: cannot consume this service + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + cannot consume this service: + value: '{"message":"You cannot consume this service"}' + "404": + description: No Route matched + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + no Route matched: + value: '{"message":"no Route matched with those values"}' + "429": + description: API rate limit exceeded + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + API rate limit exceeded: + value: '{"message":"API rate limit exceeded"}' + "503": + description: service unavailable + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + name resolution failed: + value: '{"message":"name resolution failed"}' + "504": + description: upstream server is timing out + content: + text/plain: + examples: + upstream server is timing out: + value: The upstream server is timing out + security: + - basicAuth: [] + "/cars/details/{offerToken}": + get: + tags: + - get-car-details + summary: Get Extended information with a single car offer + description: Extended information about the rates, charges, fees, and other + terms associated with a single car offer. + operationId: get-car-details + parameters: + - name: Partner-Transaction-Id + in: header + description: "[Not consumed by Expedia] Partner-generated identifier." + required: true + schema: + type: string + example: BestTravel-123456-798101112 + - name: price + in: query + description: The total price for the product. + required: true + schema: + type: string + - name: currency + in: query + description: Price currency code + required: true + schema: + type: string + example: USD + - name: source + in: query + description: source mobile - The value mobile represents that the client is + mobile. + schema: + type: string + example: mobile + - name: offerToken + in: path + description: car offer token + required: true + schema: + type: string + example: OFHSDJSJDFLJSDLKFJSDLJFLSDJFLSJDFL + responses: + "200": + description: car details successful response + content: + application/vnd.exp-car.v3+json: + schema: + $ref: "#/components/schemas/CarDetailsResponse" + application/vnd.exp-car.v3+xml: + schema: + $ref: "#/components/schemas/CarDetailsResponse" + "400": + description: car details user fault response + content: + application/vnd.exp-car.v3+json: + schema: + $ref: "#/components/schemas/CarsErrors" + application/vnd.exp-car.v3+xml: + schema: + $ref: "#/components/schemas/CarsErrors" + "401": + description: Unauthorized or Invalid authentication credentials + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + unauthorized: + value: '{message":"Unauthorized"}' + Invalid authentication credentials: + value: '{"message":"Invalid authentication credentials"}' + "403": + description: cannot consume this service + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + cannot consume this service: + value: '{"message":"You cannot consume this service"}' + "404": + description: No Route matched + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + no Route matched: + value: '{"message":"no Route matched with those values"}' + "429": + description: API rate limit exceeded + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + API rate limit exceeded: + value: '{"message":"API rate limit exceeded"}' + "500": + description: car details application error response + content: + application/vnd.exp-car.v3+json: + schema: + $ref: "#/components/schemas/CarsErrors" + application/vnd.exp-car.v3+xml: + schema: + $ref: "#/components/schemas/CarsErrors" + "503": + description: service unavailable + content: + application/json: + schema: + $ref: "#/components/schemas/APIMError" + examples: + name resolution failed: + value: '{"message":"name resolution failed"}' + "504": + description: upstream server is timing out + content: + text/plain: + examples: + upstream server is timing out: + value: The upstream server is timing out + security: + - basicAuth: [] + /feed/v1/download-url: + get: + tags: + - get-feed-download-url + operationId: get-feed-download-url + description: Get the Download URL and other details of the static files. + parameters: + - name: type + in: query + description: The type of file, used to get files by type. + deprecated: false + required: true + schema: + type: string + enum: + - DESTINATION + - VENDORLOGO + - SUMMARY + - LISTINGS + - IMAGES + - AMENITIES + - LOCATIONS + - DESCRIPTIONS + - POLICIES + - GUEST_REVIEW + - VACATION_RENTAL + - ALL_REGIONS + - BOUNDING_POLYGON + - HOTEL_TO_REGION_HIERARCHY + example: SUMMARY + - name: locale + in: query + description: 'Follow ISO-3166 Country Codes and ISO-639 Language Codes, format: + "{LanguageCode}-{CountryCode}".Support multiple values, for the feed + files that support localization, Use this parameter to help filter + out the localization files you want to download. If not using this + parameter, then this API will return all locales files for specified + type. If the specified type of file is not supported localization, + there is no file will be returned.' + deprecated: false + required: false + schema: + type: string + example: en-US + - name: pointOfSupply + in: query + description: The point of supply means a country generally. The downloadable + files provided after specifying will only contain properties' + information for that country. + deprecated: false + required: false + schema: + type: string + enum: + - US + - AT + - BR + - CA + - FR + - DE + - GR + - IT + - JA + - KR + - MX + - PT + - ES + - TR + - AE + - GB + example: AT + - name: lodgingType + in: query + description: The lodging type also means structure type, it only can be + `CL`(Conventional Lodging) and `VR`(Vacation Rental). The + downloadable files provided after specifying will only contain + property information for that lodging type. + deprecated: false + required: false + schema: + type: string + enum: + - CL + - VR + example: CL + - name: brand + in: query + description: The downloadable files provided after specifying will only contain + property information for that brand. + deprecated: false + required: false + schema: + type: string + enum: + - VRBO + responses: + "200": + content: + application/vnd.exp-lodging.v1+json: + schema: + $ref: "#/components/schemas/PresignedUrlResponse" + examples: + SDP-Summary: + value: + transactionId: c12dcd5d-4d05-42ed-8119-0e97e11f7deb + bestMatchedFile: + fileContentType: Summary + locale: de-DE + fileName: expedia-lodging-summary-en_us-all.jsonl.zip + fileSize: + unit: MB + value: 198.12 + fileLastUpdated: Tue Mar 28 08:38:14 UTC 2023 + downloadUrl: https://lpdp-data-test.s3.us-west-2.amazonaws.com/hotels/common/summary/expedia-lodging-summary-en_us-all.jsonl.zip?X-Client-Key=DD0CFD5B-4CE6-474C-934C-C2ABC250D72B&X-Amz-Security-Token=FwoGZXIvYXdzEJD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDDgCq3hfh2uzzkVrdiL0AbJ2Mr51BioDJbfW66%2F7QGFKQ5PPAcq3TprAoBGMBJVeafZ%2BvsrkKOdAUrxDGnheLNwmRBlE%2B2HS7f3pK6rE3XnnY6rEJKLe1EE2DmmNe3qIarJVVogurZumYcZ9SDPBvWwX4IGsNolFS5Qu8vtyur93xqg5%2BHnoPxLEJsP1yztRMGAiWKz9O1V79C6ZiFI5HtVOt4jYXSXdvtPKz9E6DA0ebXTpbAsm4T8PIvl30I5nNBdesXv8ap4Uie2fE6ALtUgWyJrKs%2Fy333aT6iV8Kau%2BNX3V3NW3LHh7rECgTtr5nySSxMJ2UFfQx8w7e9K8aAm098covbOPoQYyK5UIm%2BjPE%2FMbJqmroHqhzbKwbn7JFK5NnkXRmpPuGxn%2Bxmt%2Fe8Bg327adJ0%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230329T063549Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3599&X-Amz-Credential=ASIASWURL3BTL5JH6TPD%2F20230329%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=58714cc22181faea3243d689741ba0e7f1a43ae8cab172984778ca5f8b963f1f + downloadUrlExpires: Wed Mar 29 07:35:49 UTC 2023 + otherFileOptions: + - fileContentType: Summary + locale: en-US + fileName: expedia-lodging-summary_filtered_by_canada_en_us.jsonl.zip + fileSize: + unit: MB + value: 18.12 + fileLastUpdated: Tue Mar 28 06:37:36 UTC 2023 + downloadUrl: https://lpdp-data-test.s3.us-west-2.amazonaws.com/hotels/common/summary/filtered/expedia-lodging-summary_filtered_by_canada_en_us.jsonl.zip?X-Client-Key=DD0CFD5B-4CE6-474C-934C-C2ABC250D72B&X-Amz-Security-Token=FwoGZXIvYXdzEJD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDDgCq3hfh2uzzkVrdiL0AbJ2Mr51BioDJbfW66%2F7QGFKQ5PPAcq3TprAoBGMBJVeafZ%2BvsrkKOdAUrxDGnheLNwmRBlE%2B2HS7f3pK6rE3XnnY6rEJKLe1EE2DmmNe3qIarJVVogurZumYcZ9SDPBvWwX4IGsNolFS5Qu8vtyur93xqg5%2BHnoPxLEJsP1yztRMGAiWKz9O1V79C6ZiFI5HtVOt4jYXSXdvtPKz9E6DA0ebXTpbAsm4T8PIvl30I5nNBdesXv8ap4Uie2fE6ALtUgWyJrKs%2Fy333aT6iV8Kau%2BNX3V3NW3LHh7rECgTtr5nySSxMJ2UFfQx8w7e9K8aAm098covbOPoQYyK5UIm%2BjPE%2FMbJqmroHqhzbKwbn7JFK5NnkXRmpPuGxn%2Bxmt%2Fe8Bg327adJ0%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230329T063549Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=ASIASWURL3BTL5JH6TPD%2F20230329%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=ac4389b81d4b9e6563fd234b16dafceaab5fcbe2931454da2fe9956b1e3f5919 + filterConditions: + pointOfSupply: CA + bestMatchedLink: + href: https://localhost:8443/feed/v1/download-url?type=SUMMARY&pointOfSupply=CA + method: GET + - fileContentType: Summary + locale: en-US + fileName: expedia-lodging-summary_filtered_by_conventional_en_us.jsonl.zip + fileSize: + unit: MB + value: 98.12 + fileLastUpdated: Tue Mar 28 06:38:11 UTC 2023 + downloadUrl: https://lpdp-data-test.s3.us-west-2.amazonaws.com/hotels/common/summary/filtered/expedia-lodging-summary_filtered_by_conventional_en_us.jsonl.zip?X-Client-Key=DD0CFD5B-4CE6-474C-934C-C2ABC250D72B&X-Amz-Security-Token=FwoGZXIvYXdzEJD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDDgCq3hfh2uzzkVrdiL0AbJ2Mr51BioDJbfW66%2F7QGFKQ5PPAcq3TprAoBGMBJVeafZ%2BvsrkKOdAUrxDGnheLNwmRBlE%2B2HS7f3pK6rE3XnnY6rEJKLe1EE2DmmNe3qIarJVVogurZumYcZ9SDPBvWwX4IGsNolFS5Qu8vtyur93xqg5%2BHnoPxLEJsP1yztRMGAiWKz9O1V79C6ZiFI5HtVOt4jYXSXdvtPKz9E6DA0ebXTpbAsm4T8PIvl30I5nNBdesXv8ap4Uie2fE6ALtUgWyJrKs%2Fy333aT6iV8Kau%2BNX3V3NW3LHh7rECgTtr5nySSxMJ2UFfQx8w7e9K8aAm098covbOPoQYyK5UIm%2BjPE%2FMbJqmroHqhzbKwbn7JFK5NnkXRmpPuGxn%2Bxmt%2Fe8Bg327adJ0%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230329T063549Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=ASIASWURL3BTL5JH6TPD%2F20230329%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=9364ec533e909c2cb3331f16a449feee41a968492e61bcdd5761e56e7bbad73a + downloadUrlExpires: Wed Mar 29 07:35:49 UTC 2023 + filterConditions: + structureType: CONVENTIONAL + bestMatchedLink: + href: https://localhost:8443/feed/v1/download-url?type=SUMMARY&loadgingType=CL + method: GET + VendorLogo: + value: + transactionId: c12dcd5d-4d05-42ed-8119-0e97e11f7deb + bestMatchedFile: + fileName: VendorLogos.json + fileSize: + unit: MB + value: 1.32 + fileLastUpdated: Tue Mar 28 06:38:11 UTC 2023 + downloadUrl: https://ews-generated-feeds-prod-p.s3.us-west-2.amazonaws.com/vendor-logos/VendorLogos.json?response-content-disposition=inline&X-Amz-Security-Token=XXX + downloadUrlExpires: Wed Mar 29 07:35:49 UTC 2023 + description: Download URLs successfully generated for the feed files. + "400": + content: + application/vnd.exp-lodging.v1+json: + schema: + $ref: "#/components/schemas/PresignedUrlResponse" + example: + transactionId: 38dc7269-12b1-58c9-a381-4963c274cdfe + error: + code: INVALID_TYPE_ATTR + description: Invalid type provided. + description: Invalid request from the client. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/SdpAPIMError" + examples: + unauthorized: + value: + message: Unauthorized + Invalid authentication credentials: + value: + message: Invalid authentication credentials + description: Unauthorized or Invalid authentication credentials. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/SdpAPIMError" + examples: + cannot consume this service: + value: + message: You cannot consume this service + description: Cannot consume this service. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/SdpAPIMError" + examples: + no Route matched: + value: + message: no Route matched with those values + description: No Route matched. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/SdpAPIMError" + examples: + API rate limit exceeded: + value: + message: API rate limit exceeded + description: API rate limit exceeded. + "500": + content: + application/vnd.exp-lodging.v1+json: + schema: + $ref: "#/components/schemas/PresignedUrlResponse" + example: + transactionId: 38dc7269-12b1-58c9-a381-4963c274cdfe + error: + code: SERVER_ERROR + description: An error has occurred while processing the request. + description: Server side error like backend service has some issues or some + issues in EWS Feed service. The Error code is SERVER_ERROR. + "503": + content: + application/json: + schema: + $ref: "#/components/schemas/SdpAPIMError" + examples: + service unavailable: + value: + message: name resolution failed + description: Service unavailable. +components: + schemas: + Address: + type: object + properties: + Address1: + type: string + description: Street Number, Street Name, or PO Box + example: 724 Pine St + Address2: + type: string + description: Apartment, Floor, Suite, Bldg or more specific information about + Address1. + example: Second Floor + City: + type: string + description: The city + example: New York + Province: + type: string + description: The state or province + example: NY + Country: + type: string + description: 3-letter code for the country + example: USA + PostalCode: + type: string + description: Zip/postal code + example: "98004" + description: The address information of the location. + AgeClassRestriction: + type: object + properties: + AgeClass: + type: string + description: Categories for hotel guests, based on age. + example: Senior + enum: + - All Ages + - Senior + - Adult + - Child + - Infant + - Other + AgeMinimum: + type: integer + description: The minimum age defined in a particular `AgeClass`. + format: int32 + example: 2 + AgeMaximum: + type: integer + description: | + The maximum age defined in a particular `AgeClass`. + + If not specified, the `AgeClass` has no upper bound. + format: int32 + example: 17 + MaxGuestCount: + type: integer + description: The max guest count allowed in a particular `AgeClass`. + format: int32 + example: 3 + description: Container for room occupancy rules based on the age of the guests. + BedType: + type: object + properties: + Id: + type: string + description: The bed type ID + example: "40" + Description: + type: string + description: The bed type description. + example: 1 bed + description: > + Statement of bed types available for this offer. A room may have several + bed type options available. + + + **NOTE**: due to the large number of bed type options available, we no longer publish a list of available + + bed types. More information is available in + + [Lodging Bed Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/bed-types). + CancellationPenaltyRule: + type: object + properties: + PenaltyNightCount: + type: integer + description: > + Specifies the per-stay cancellation fee charged in terms of the cost + of the number of nights listed, in + + addition to any other penalties. The rate charged is based on the earliest night(s) of the stay. + format: int32 + example: 1 + PenaltyPercentOfStay: + type: string + description: > + Specifies the per-stay cancellation fee charged as a percentage of + the total rate, in addition to any other + + penalties listed. + example: "100" + PenaltyPrice: + allOf: + - $ref: "#/components/schemas/Money" + - description: Specifies the cancellation fee in terms of a set fee, in addition + to any other penalties listed. + PenaltyStartDateTime: + type: string + description: > + The beginning of the window of time when the + `CancellationPenaltyRule` is in effect. + + + The date and time are expressed in ISO 8601 International Date format, and local to the hotel. + format: date-time + example: 2022-07-23T23:00:00.000Z + PenaltyEndDateTime: + type: string + description: > + The end of the window of time when the `CancellationPenaltyRule` is + in effect. + + + The date and time are expressed in ISO 8601 International Date format, and local to the hotel. + format: date-time + example: 2022-07-25T23:00:00.000Z + WaiverPolicy: + type: object + properties: + WaiverPolicyDescription: + type: string + description: > + The localized waiver policy description, which could be put in front + of cancellation policy description. + example: > + You can cancel for a full refund up to 24 hours after booking (not + applicable to bookings made within 72 hours of check-in time). After + 24 hours: + CancellationPolicy: + type: object + properties: + WaiverPolicy: + $ref: "#/components/schemas/WaiverPolicy" + CancellableOnline: + type: boolean + description: >- + Boolean value to identify if the reservation can be cancelled + online. + + If false, the customer will only be able to cancel a refundable room by calling Expedia Customer Service. + example: true + Refundable: + type: boolean + description: Indicate whether the rate is refundable or not. + example: true + FreeCancellation: + type: boolean + description: Indicate whether the room can be cancelled free of charge. + example: true + FreeCancellationEndDateTime: + type: string + description: > + The date and time until which the room can be cancelled free of + charge. + + + This is expressed in the local time of the Hotel. + format: date-time + CancellationPenaltyRules: + type: array + description: Container for cancellation penalty details. + items: + $ref: "#/components/schemas/CancellationPenaltyRule" + CancelPolicyDescription: + type: string + description: Additional cancellation policy information available as static text. + example: Free cancellation available before 2022-07-18T16:00:00-08:00 + NonRefundableDateRanges: + type: array + description: > + A list of dates ranges that are non-refundable. + + + **Note**: The stay dates in those date ranges will always be charged whenever there is any cancellation + + penalty rule. + items: + $ref: "#/components/schemas/NonRefundableDateRange" + description: Container for room cancellation policy. + ChainAndBrandInfo: + type: object + properties: + ChainId: + type: integer + description: The chain id. + format: int32 + example: -5 + ChainName: + type: string + description: The name of the chain. + example: Hilton Worldwide + BrandId: + type: integer + description: The brand id. + format: int32 + example: 33 + BrandName: + type: string + description: The name of the brand. + example: Doubletree + description: > + The chain and brand information of hotel. + + + Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + Country: + type: object + properties: + Name: + type: string + description: country name + example: Ireland + IsoCode2: + type: string + description: 2-letter code for the country + example: IE + IsoCode3: + type: string + description: 3-letter code for the country + example: IRL + description: Container for disambiguation country information + DepositDetail: + type: object + properties: + Type: + type: string + description: >- + Should be one of the following values: + + PERCENT + + The deposit amount is calculated as a percentage of the total booking cost. + + NIGHT + + The deposit amount is calculated in terms of nights plus tax. + + AMOUNT + + The deposit amount in USD. + + REMAINDER + + The deposit amount is equal to the booking cost minus any deposits that have been made before this point. + example: NIGHT + enum: + - PERCENT + - NIGHT + - AMOUNT + - REMAINDER + Value: + type: string + description: Value to indicate how many/much of the type listed above is going + to be charged as a deposit. + example: "1" + When: + $ref: "#/components/schemas/When" + description: Container for deposit policy details + DepositPolicy: + type: object + properties: + Description: + type: array + items: + type: string + Details: + type: array + description: Container for deposit policy details + items: + $ref: "#/components/schemas/DepositDetail" + description: Container for deposit policy details + Description: + type: object + properties: + LocationTeaser: + type: string + description: A description of the property's location. + example: Built on the original site of the University of Washington + HotelTeaser: + type: string + description: A description of the features and amenities of the property itself. + example: A top-notch fitness club and spa features a pool + RoomTeaser: + type: string + description: The common description for all of the rooms in the property. + example: Renovated in May 2016, guest rooms feature upholstered chairs + description: Container for the descriptions of the property. + Distance: + type: object + properties: + Value: + type: string + description: The distance between the center of the search and the hotel. + example: "75" + Unit: + type: string + description: The unit of distance. + example: km + enum: + - km + - mi + Direction: + type: string + description: The direction to the hotel from the center point of the search. + example: N + enum: + - N + - S + - W + - E + - NW + - NE + - SW + - SE + description: > + Container for distance information. + + + Only returned for city/address search or `geoLocation` search or single `regionId` search. + GeoLocation: + type: object + properties: + Latitude: + type: string + description: Latitude of the location. + example: "38.184978" + Longitude: + type: string + description: Longitude of the location. + example: "85.7412" + Obfuscated: + type: boolean + description: Container for Geo location. + Hotel: + type: object + properties: + Id: + type: string + description: The unique, Expedia-specific hotel property identifier used to + designate a single hotel. + example: "14747" + HcomId: + type: string + description: > + The unique, Hotels.com-specific hotel property identifier used to + designate a single hotel. + + + This will only be returned if searching via hcomHotelIds in request. + example: "10532" + Name: + type: string + description: The common name of the hotel + example: Four Seasons Hotel Seattle + PropertyType: + $ref: "#/components/schemas/HotelPropertyType" + PropertyDetails: + $ref: "#/components/schemas/PropertyDetails" + LocalCurrencyCode: + type: string + description: The Local Currency Code for Hotel (which will be used for any fees + that must be paid at the hotel) + example: USD + Location: + allOf: + - $ref: "#/components/schemas/Location" + - description: Container for information about the location of the hotel. + PhoneInfos: + type: array + description: > + Container for property phone numbers. + + + Note: PhoneInfos section will not return for Vrbo Vacation Rental properties. + items: + $ref: "#/components/schemas/Phone" + Distance: + $ref: "#/components/schemas/Distance" + Description: + $ref: "#/components/schemas/Description" + Status: + type: string + description: > + Indicates whether there are available offers at the property during + the dates requested, as well as + + information as to why. + + + Note that pricing will only be present in the API response for a status of `AVAILABLE`. + + + If there are no rooms available at the property for the dates requested, then `NOT_AVAILABLE` will be + + returned. + + + If there are available rooms, but none that meet the specific parameters of the search request, + + then one of the other messages will be returned. + example: AVAILABLE + enum: + - AVAILABLE + - NOT_AVAILABLE + - ERROR + - NUMBER_OF_ADULTS_NOT_ACCEPTED + - NUMBER_OF_CHILDREN_NOT_ACCEPTED + - NUMBER_OF_INFANTS_NOT_ACCEPTED + - NUMBER_OF_PERSONS_NOT_ACCEPTED + - CHECK_IN_AGE_NOT_ACCEPTED + RenovationsAndClosures: + type: array + description: The information about renovations and closures + example: + - The following facilities are closed seasonally each year... + items: + type: string + description: The information about renovations and closures + example: The following facilities are closed seasonally each year... + ChainAndBrandInfo: + $ref: "#/components/schemas/ChainAndBrandInfo" + ThumbnailUrl: + type: string + description: > + URL of the thumbnail image of the hotel. + + + Note that other images sizes are available - You can find a link to the complete list of Supported + + Hotel Image Sizes in [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + example: https://images.trvl-media.com/hotels/3000000/2170000/2163100/2163007/2163007_15_t.jpg + StarRating: + type: string + description: Star rating value of the hotel property. + example: "5.0" + enum: + - "1.0" + - "1.5" + - "2.0" + - "2.5" + - "3.0" + - "3.5" + - "4.0" + - "4.5" + - "5.0" + GuestRating: + type: string + description: | + Average overall guest rating of the hotel. + + The value is between 1.0 and 5.0 in 0.1 increments. + + Higher is better. + example: "4.5" + GuestReviewCount: + type: integer + description: The total count of guest reviews used to create the average + `GuestRating` above. + format: int32 + example: 240 + PetFriendly: + type: boolean + description: > + Indicates whether the property allows certain pets under certain + circumstances. + + + Prior to booking, guests should review the PetPolicies information in the Lodging Details API to find out + + whether a particular pet will be permitted to stay at the property. + example: true + LgbtqiaFriendly: + type: boolean + description: This value is returned if the property owner has specifically + designated this property as LGBTQIA-friendly. + example: true + Links: + type: object + properties: + WebSearchResult: + allOf: + - $ref: "#/components/schemas/Link" + - description: Link to web search result page. + ApiRateCalendar: + allOf: + - $ref: "#/components/schemas/Link" + - description: Link for Rate Calendar API. + additionalProperties: + $ref: "#/components/schemas/Link" + description: > + Container for list of **HATEOAS** links to Expedia website to + complete booking. + + + This links section will only return a deeplink to the Website Search Results page by default. + + + If you have selected AD deeplinks they will only appear within the `RoomTypes` section of the + + response, as the Lodging Details API returns details at the room offer level, and not at the property level. + Policies: + $ref: "#/components/schemas/HotelPolicies" + CleanlinessAndSafety: + type: object + additionalProperties: + type: array + items: + type: string + description: > + Container for all cleanliness and safety measures. + + + The key is the measures category, the values are the information. The category will be: + + - CLEANLINESS + + - SOCIAL_DISTANCING + + - SAFETY + + - DISCLAIMER + example: + CLEANLINESS: + - Disinfectant is used to clean the property + - High-touch surfaces are cleaned and disinfected + - Sheets and towels are washed at 60°C/140°F or hotter + SOCIAL_DISTANCING: + - Contactless check-in and check-out + - Social distancing measures in place + OptionalExtras: + type: array + description: The optional extras info. + items: + type: string + description: The optional extras info. + ImportantNotices: + type: array + description: The important notices for hotel. + example: + - This property can only accept bookings for essential travel or + stays. You may be asked to provide evidence of this on arrival. + For more information, check local advisories before you book. + items: + type: string + description: The important notices for hotel. + example: This property can only accept bookings for essential travel or stays. + You may be asked to provide evidence of this on arrival. For more + information, check local advisories before you book. + Media: + type: array + description: Container for hotel images + items: + $ref: "#/components/schemas/Media" + HotelAmenities: + type: array + description: Container for all hotel amenities. + items: + allOf: + - $ref: "#/components/schemas/LodgingAmenity" + - description: Container for all hotel amenities. + - properties: + Id: + description: The identification number for a hotel amenity. + Name: + description: The description of a hotel amenity. + HotelDescriptiveAmenities: + type: object + additionalProperties: + type: array + items: + type: string + description: > + Container for all hotel amenities in group. + + + The key is amenity category, the values are the amenity information. The category for grouped amenities in hotel level for conventional lodging hotel will be: + + - PARKING + + - FOOD_AND_DRINK + + - INTERNET + + - THINGS_TO_DO + + - FAMILY_FRIENDLY + + - CONVENIENCES + + - GUEST_SERVICES + + - BUSINESS_SERVICE + + - OUTDOOR + + - ACCESSIBILITY + + - SPA + + - ACTIVITIES_NEARBY + + - LANGS_SPOKEN + + - MORE + + + The category for grouped amenities in hotel level for Vacation Rental hotel will be: + + - BEACH + + - SKI + + - POOL/SPA + + - INTERNET + + - PARKING + + - FAMILY_FRIENDLY + + - KITCHEN + + - DINING + + - BEDROOM + + - BATHROOMS + + - LIVING_SPACES + + - ENTERTAINMENT + + - OUTDOORS + + - LAUNDRY + + - WORKSPACES + + - CLIMATE_CONTROL + + - PETS + + - SUITABILITY/ACCESSIBILITY + + - SERVICES_AND_CONVENIENCES + + - LOCATION_HIGHLIGHTS + + - THINGS_TO_DO + + - GENERAL + + - SAFETY + example: + FAMILY_FRIENDLY: + - Refrigerator + GUEST_SERVICES: + - 24-hour front desk + - Housekeeping (on request) + - Luggage storage + - Multilingual staff + MORE: + - At least 80% lighting from LEDs + - Communal living room + - Comprehensive food waste policy + RoomAmenities: + type: array + description: Container for all room amenities. + items: + allOf: + - $ref: "#/components/schemas/LodgingAmenity" + - description: Container for all room amenities. + - properties: + Id: + description: The identification number for a room amenity. + Name: + description: The description of a room amenity. + RoomDescriptiveAmenities: + type: object + additionalProperties: + type: array + items: + type: string + description: > + Container for all common room amenities in group. + + + The key is amenity category, the values are the amenity information. The category for grouped amenities in common room level will be: + + - BEDROOM + + - BATHROOM + + - FOOD_AND_DRINK + + - ENTERTAINMENT + + - OUTDOOR_SPACE + + - MORE + example: + ENTERTAINMENT: + - Flat-screen TV + - iPad + - iPod dock + - Satellite channels + FOOD_AND_DRINK: + - Free bottled water + - Refrigerator + MORE: + - Desk + - Eco-friendly cleaning products provided + - Energy-saving switches + Accessibility: + type: array + description: | + The accessibility options available for the room. + + Possible accessibility include: + - Accessible path of travel + - Accessible bathroom + - Roll-in shower + - Handicapped parking + - In-room accessibility + - Accessibility equipment for the deaf + - Braille or raised signage + example: + - Wheelchair-accessible on-site restaurant + - Wheelchair-accessible lounge + - Well-lit path to entrance + - Stair-free path to entrance + - Wheelchair accessible (may have limitations) + - Wheelchair accessible path of travel + - Accessible bathroom (in select rooms) + - Wheelchair-accessible public washroom + - In-room accessibility (in select rooms) + - Wheelchair-accessible registration desk + - Wheelchair-accessible fitness center + - Wheelchair-accessible meeting spaces/business center + items: + type: string + description: The accessibility options available for the room. + example: Wheelchair-accessible on-site restaurant + MemberOnlyDealAvailable: + type: boolean + description: Indicates whether the property has member only deal rates available. + example: true + RoomTypes: + type: array + description: Container for all of available room types. + items: + $ref: "#/components/schemas/RoomType" + description: Container for information on each offered hotel. + HotelDetailsResponse: + type: object + properties: + Warnings: + type: array + description: > + There were some errors or events during the transaction, but the API + has still returned a response. + + + Container for all warnings. + items: + allOf: + - $ref: "#/components/schemas/Warning" + - properties: + Code: + description: > + The code of the warning. + + + Available values are: + + - PRICE_DECREASED: The price decreased after shopping. + + - PRICE_INCREASED: The price increased after shopping. + + - CURRENCY_CHANGE: You will be charged in a different currency. + OriginalPrice: + description: The original price from the Lodging Search API response. + NewPrice: + description: The new price. + ChangedAmount: + description: The difference between `OriginalPrice` and `NewPrice`. + TransactionId: + type: string + description: Unique identifier for the transaction. + example: f06edfa3-27f4-44e6-838c-b8dd3d0a3210 + StayDates: + allOf: + - $ref: "#/components/schemas/StayDates" + - description: Dates of the requested property stay. + - properties: + CheckInDate: + description: > + Check-in date for property stay in an ISO 8601 Date format + [YYYY-MM-DD]. + + + This parameter should be used in combination with the `checkOut` parameter. + + + The maximum advanced search window is 330 days in the future. + + + The maximum length of stay is 28 days. + CheckOutDate: + description: > + Checkout date for property stay in an ISO 8601 Date format + [YYYY-MM-DD]. + + + This parameter should be used in combination with the `checkIn` parameter. + + + The maximum advanced search window is 330 days in the future. + + + The maximum length of stay is 28 days. + LengthOfStay: + type: integer + description: The number of stay nights. + format: int32 + example: 3 + NumberOfRooms: + type: integer + description: Number of rooms requested. + format: int32 + example: 3 + Occupants: + type: array + description: | + Container for the list of rooms requested by the traveler. + + Occupancy for each room is specified in this node. + items: + allOf: + - $ref: "#/components/schemas/Occupant" + - description: | + Container for the list of rooms requested by the traveler. + + Occupancy for each room is specified in this node. + - properties: + Adults: + description: Specifies the number of adults staying in each room. + ChildAges: + description: Specifies the age(s) of each of the children staying in the room, + as well as the number of children in the room. + ValidFormsOfPayment: + type: array + description: Container for payment information. + items: + $ref: "#/components/schemas/ValidFormsOfPayment" + HotelDetails: + $ref: "#/components/schemas/Hotel" + HotelPolicies: + type: object + properties: + CheckInStartTime: + type: string + description: Beginning of the standard check-in window on the check in date, and + in the local time of the hotel. + example: 3 PM + CheckInEndTime: + type: string + description: End of the standard check-in window on the check in date, and in + the local time of the hotel. + example: 5 PM + SpecialCheckInInstructions: + type: array + description: Some special instructions needed care by customer when check in. + example: + - "Special Instructions: The check-in location differs from the + property location. To check in, go to 301 N Water St." + items: + type: string + description: > + Any special instructions that the guest would need to know in + order to check in. + + + Particularly important in a vacation rental property, as many of these do not have a hosted front desk as + + a hotel would. + example: "Special Instructions: The check-in location differs from the property + location. To check in, go to 301 N Water St." + CheckOutTime: + type: string + description: Customers must check out before this time on the check out date, + expressed in the local time of the hotel. + example: noon + PetPolicies: + type: array + description: The policy of the property toward having pets stay with guests. + example: + - Pets allowed, Up to 20 lb + items: + type: string + description: The policy of the property toward having pets stay with guests. + example: Pets allowed, Up to 20 lb + ChildrenAndExtraBedsPolicies: + type: array + description: The policy of the hotel for having children stay at the hotel, as + well as for including extra beds in the room. + example: + - Children are welcome, Cribs/infant beds (surcharge) + items: + type: string + description: Container for Hotel policy information. + HotelPropertyType: + type: object + properties: + Id: + type: integer + description: The id of hotel property type. + format: int32 + example: 13 + Name: + type: string + description: The name of hotel property type. + example: Ranch + description: > + Container for information on hotel property type. + + + You can find a complete list of Lodging Property Types in [Lodging Property Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/property-types). + Link: + type: object + properties: + Accept: + type: string + description: The Accept request header (for API queries only - not included for + page URLs). + Method: + type: string + description: Method of request. + Href: + type: string + description: The URL of the destination web page or API query. + Location: + type: object + properties: + Address: + $ref: "#/components/schemas/Address" + GeoLocation: + allOf: + - $ref: "#/components/schemas/GeoLocation" + - description: Container for information on the geographic location of the hotel. + - properties: + Latitude: + type: string + description: > + The geographic coordinates of the hotel property, based on a + horizontal angular measurement relative to The Equator. + + + North latitude will be represented by a positive value. + + + South latitude will be represented by a negative value. + example: "38.184978" + Longitude: + type: string + description: > + The geographic coordinates of the hotel property, based on a + vertical angular measurement relative to the universal Prime + Meridian (Royal Observatory, Greenwich). + + + East longitude will be represented by a positive value. + + + West longitude will be represented by a negative value. + example: "85.7412" + Obfuscated: + type: boolean + description: > + Indicates whether the displayed Latitude/Longitude + information is obfuscated. + + + Note: Exact Lat/Long values for Vacation Rental properties will not be shown in either XAPv3 Search + + or Details responses to respect the security of the homeowner. Instead an 'obfuscated' Lat/Long + + value will be returned that will indicate the general area within which the property is located, + + but not the exact location of the property itself. + Neighborhood: + $ref: "#/components/schemas/Neighborhood" + description: Container for list of possible locations that could be used to + disambiguate the query. + LodgingAmenity: + type: object + properties: + Id: + type: string + example: "2065" + Name: + type: string + example: Business center + MandatoryFeesDetail: + type: object + properties: + Type: + type: string + description: Type of mandatory fee. + enum: + - City_LocalTax_Amt + - City_LocalTax_Pcnt + - CleaningFee_Amt + - CleaningFee_Pcnt + - ClubCardAdult + - ClubCardChild + - DestinationFee_Amt + - DestinationFee_Pcnt + - GalaDinnerAdult + - GalaDinnerChild + - GalaDinnerChineseNYAdult + - GalaDinnerChineseNYChild + - GalaDinnerNYDayAdult + - GalaDinnerNYDayChild + - GalaDinnerNYEveAdult + - GalaDinnerNYEveChild + - GalaDinnerValentinesDayAdult + - GalaDinnerValentinesDayChild + - GalaDinnerXMASDayAdult + - GalaDinnerXMASDayChild + - GalaDinnerXMASEveAdult + - GalaDinnerXMASEveChild + - ResortFee_Amt + - ResortFee_Pcnt + - SanitationFee + - SeasonalHeatingFee + - TourismFee_Amt + - TourismFee_Pcnt + - TowelSheetsFee_Amt + - TransferFee_Amt_Adult + - TransferFee_Amt_Child + - UtilitySurcharge + example: TransferFee_Amt_Child + Amount: + allOf: + - $ref: "#/components/schemas/Money" + - description: Value of hotel mandatory fee. + description: The breakdown for the taxes and fees that must be paid at the property. + Media: + type: object + properties: + Type: + type: string + description: | + Supported type of media. + + 1=Image. + + Only 1 is supported now. + example: "1" + enum: + - 1 + Title: + type: string + description: Image title + example: Guestroom + Size: + type: string + description: > + Image size. + + You can find a link to the complete list of Supported Images Sizes in + + [Lodging Image Captions, IDs, and Sizes](https://developers.expediagroup.com/xap/products/xap/lodging/references/image-captions-ids-and-sizes). + example: t + Url: + type: string + description: Image URL + example: https://images.trvl-media.com/hotels/1000000/30000/20300/20230/20230_159_t.jpg + description: Container for hotel images + Money: + type: object + properties: + Value: + type: string + description: The value of the element being defined. + example: "21.9" + Currency: + type: string + description: The ISO 4217 Currency Code that the value is expressed in. + example: USD + LocalCurrencyPrice: + $ref: "#/components/schemas/Money" + description: Pricing information of the stat date + Neighborhood: + type: object + properties: + Id: + type: string + description: Neighborhood id. + example: "6160232" + Name: + type: string + description: Neighborhood name. + example: Le Pharo + description: Geography entities which are typically contained within a city. + This includes the categories neighborhood and point of interest. Low + level regions are not a formally defined concept in the geography model. + NightlyRates: + type: object + properties: + StayDate: + type: string + format: date + example: 2022-07-19T00:00:00.000Z + BaseRate: + $ref: "#/components/schemas/Money" + NonRefundableDateRange: + type: object + properties: + StartDate: + type: string + description: Start date of a non-refundable date range. + format: date + example: 2022-07-04T00:00:00.000Z + EndDate: + type: string + description: End date of a non-refundable date range. + format: date + example: 2022-07-05T00:00:00.000Z + Occupant: + type: object + properties: + Adults: + type: integer + description: | + The number of adults in a room. + format: int32 + example: 1 + ChildAges: + type: array + description: | + The ages of children in a room. + example: + - 2 + - 3 + - 5 + items: + type: integer + description: | + The age of children in a room. + format: int32 + description: Container for the list of room occupants. + PaymentSchedule: + type: object + properties: + Due: + type: string + description: Date/Time stamp when this installment/deposit should be paid by. + format: date + example: 2022-09-03T00:00:00.000Z + Price: + allOf: + - $ref: "#/components/schemas/Money" + - description: The monetary amount of the install/deposit required to book the + hotel and product. + description: Contains information on the payment schedule. + Phone: + type: object + properties: + CountryCode: + type: string + description: The designated country calling code. + example: "1" + AreaCode: + type: string + description: The phone's area code. + example: "614" + Number: + type: string + description: The phone's local number. + example: "9288472" + ExtensionNumber: + type: string + description: Optional extension number, if required to reach the hotel. + example: "3114" + Promotion: + type: object + properties: + Description: + type: string + description: The description of the promotion. + example: 20%Off + Amount: + allOf: + - $ref: "#/components/schemas/Money" + - description: > + The value of the promotion. + + + **CMA Compliance Note (UK)**: Both standard room rates and promotional rates are set and managed by the + + hoteliers and not Expedia. + PropertyDetails: + type: object + properties: + PropertyRegistryNumber: + type: string + description: The registry number of property. + example: P-20131 + HostLanguages: + type: array + description: The languages the host of property will speak. + example: + - English + - Chinese + items: + type: string + MaxOccupancy: + type: integer + description: The maximum number of guests allowed to stay in the property. + format: int32 + example: 12 + NumberOfBedrooms: + type: integer + description: The number of bedrooms in the property. + format: int32 + example: 4 + NumberOfBathrooms: + type: integer + description: The number of bathrooms in the property. + format: int32 + example: 1 + SquareFeet: + type: string + description: Property area in square feet. + example: "123.5" + PropertyManager: + $ref: "#/components/schemas/PropertyManager" + description: > + Container for information about the hotel property detail. It will be + shown for Vacation Rental hotel only. + PropertyManager: + type: object + properties: + Name: + type: string + description: The name of the property manager. + example: Mike + CalendarLastUpdated: + type: string + description: The latest updated date. + format: date + PhotoUrl: + type: string + description: The URL for property manager's photo. + example: https://imagesus-ssl.homeaway.com/mda01/ff30bc14-157c-43fc-ad8c-d2ce36bc7e83.4.1 + description: Container for information about the property manager. It will be + shown for Vacation Rental hotel only. + RatePlan: + type: object + properties: + RoomTypeId: + type: string + description: The room type identifier. + example: "200287452" + RatePlanId: + type: string + description: The rate plan identifier. + example: "201714191" + RateRuleId: + type: string + description: The identifier of rate rule. + example: "213544817" + InventorySourceId: + type: string + description: The identification number of the source that provides the rate plan. + example: "24" + InventorySourceCode: + type: string + description: The source name that provided the rate plan. + example: JT + StayDates: + $ref: "#/components/schemas/StayDates" + RemainingCount: + type: integer + description: > + The number of rooms remaining through Expedia for this room type. + + + **NOTE**: This value does NOT represent the total number of rooms remaining at the hotel property, + + only the number of rooms allocated to Expedia for sale by the property that currently remain in Expedia's + + inventory. + + + When a hotel is listed as 'sold out' by Expedia there may still be rooms available for sale by the hotel + + through other channels. + + + Also note that the `RemainingCount` response element has a maximum returned value of 100, even if there are + + more than 100 rooms available within bookable Expedia inventory. + + + **CMA Compliance Note (UK)**: websites in the UK that display `remainingCount` should make it clear to + + consumers that this count refers to the number of rooms remaining within Expedia inventory - NOT the number + + remaining at the property. + format: int32 + example: 3 + Price: + type: object + description: Container for all price components of the rate plan. + properties: + BaseRate: + allOf: + - $ref: "#/components/schemas/Money" + description: The price of the rate plan for all occupants, excluding taxes and + fees. + TaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total rate of taxes and fees of the rate plan for all + occupants. + TotalPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total price of the rate plan, which is equal to the sum of + `BaseRate` + `TaxesAndFees`. + + Hotel mandatory fees are not included in this value as these are paid at the hotel at checkout. + + Promotion amount have been deducted from the `TotalPrice` value. + TotalStrikeOutPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total amount to strikeout price. This value is the sum of + the pre-discount `BaseRate` + the + + pre-discount `TaxesAndFees`. + AvgNightlyRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average nightly base rate per night per room of the rate + plan, which is equal to the `BaseRate` + + divided by `StayDates` and by `room number`. + AvgNightlyStrikeOutRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average nightly strike out price per night per room of the + rate plan, which is equal to the + + strike out of `BaseRate` divided by `StayDates` and by `room number`. + HotelMandatoryFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total mandatory fees which will be charged at the hotel for the + rate plan. + RefundableDamageDeposit: + allOf: + - $ref: "#/components/schemas/Money" + description: The refundable damage deposit. + NightlyRates: + type: array + items: + allOf: + - $ref: "#/components/schemas/NightlyRates" + - properties: + StayDate: + description: A single night during the requested stay. + BaseRate: + description: Container for nightly base rate. + description: Nightly base rate of the rate plan. + TaxesAndFeesDetails: + type: array + items: + allOf: + - $ref: "#/components/schemas/TaxesAndFeesDetail" + - properties: + CategoryCode: + description: Category ID of this specific tax or fee. + Amount: + description: The value of this specific tax or fee. + description: > + Container for taxes and fees detail information. + + Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + RoomRates: + type: array + items: + allOf: + - $ref: "#/components/schemas/RoomRates" + description: Container for the rate information of all rooms. This is only + returned in Lodging Details API. + MemberOnlyDeal: + type: boolean + description: > + Indicates whether the rate is for member only. + + + Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + example: true + Promotions: + type: array + description: All promotion information of the `ratePlan`. + items: + $ref: "#/components/schemas/Promotion" + StandalonePrice: + type: object + description: > + The corresponded standalone price to the package rate plan (to show + the `strikethrough`). + + + Only returned when the returned `rateplan` is being used as part of a package. + properties: + BaseRate: + allOf: + - $ref: "#/components/schemas/Money" + description: The standalone price of the rate plan for all occupants, excluding + taxes and fees. + StrikeOutBaseRate: + allOf: + - $ref: "#/components/schemas/Money" + description: The base rate strikeout in the standalone shopping path. + TaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total standalone rate of taxes and fees of the rate plan for + all occupants. + StrikeOutTaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The taxes and fees strikeout in the standalone shopping path. + TotalPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total standalone price of the rate plan, which is equal to + the sum of `BaseRate` and `TaxesAndFees`. + + Hotel mandatory fees are not included as these are paid at the hotel at checkout. + TotalStrikeOutPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total strikeout in the standalone shopping path, which is + equal to the sum of `StrikeOutBaseRate` and + `StrikeOutTaxesAndFees`. + AvgNightlyRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average standalone nightly base rate per night per room of + the rate plan, which is equal to the + + `BaseRate` divided by `StayDates` and by `room number`. + AvgNightlyStrikeOutRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average strikeout of the base rate in the standalone + shopping path, which is per night per room and is equal to + + `StrikeOutBaseRate` divided by `StayDates` and by `room number`. + HotelMandatoryFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total standalone mandatory fees. + StrikeOutHotelMandatoryFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The strikeout of the mandatory fees in the standalone shopping + path. + TaxesAndFeesInclusive: + type: boolean + description: Indicates whether taxes and fees are included in base rate. + example: false + GuaranteeText: + type: string + description: Text description for any deposit information provide by the + property (if applicable). + example: Price Guarantee + PaymentMethod: + type: string + description: > + Room payment information. The available options are: + + - Online: Pay at the time of booking + + - Hotel: Could either be paid at the hotel during the time of stay or paid at the time indicated by `PaymentTime` and `PaymentSchedule` + example: Online + enum: + - Online + - Hotel + PaymentTime: + type: string + description: > + The time when the booking amount will be charged on the traveler’s + credit card. Valid values are as follows: + + - UponBooking + + - PayLater + + - SupplierDiscretion + example: PayLater + enum: + - UponBooking + - PayLater + - SupplierDiscretion + FullDepositUponBooking: + type: boolean + description: > + It will be true if PaymentSchedule has one installment and the value + of "Due" is booking date, otherwise, + + it will be false. + example: true + PaymentSchedule: + type: array + description: Contains information on the payment schedule. + items: + $ref: "#/components/schemas/PaymentSchedule" + ReserveWithDeposit: + type: boolean + description: Indicates whether this rate plan need deposit to reserve. + example: true + FreeInternet: + type: boolean + description: Indicates whether the price of the room includes free Internet. + (either wireless or wired) + example: true + FreeWiFi: + type: boolean + description: Indicates whether the price of the room includes free wireless + Internet access. + example: true + FreeInternetDetails: + type: array + description: > + The localized details for the free internet amenity (only shown when + FreeInternet = true). + + + You can find a link to the complete list of Free Internet Details in + + [Lodging Free Breakfast and Internet Details](https://developers.expediagroup.com/xap/products/xap/lodging/references/free-breakfast-and-internet-details). + example: + - Free Wireless Internet, Wired high-speed Internet-comp + items: + type: string + description: The localized details for the free internet amenity (only shown + when FreeInternet = true). + example: Free Wireless Internet, Wired high-speed Internet-comp + FreeParking: + type: boolean + description: Indicates whether the price of the room includes free parking. + example: true + FreeBreakfast: + type: boolean + description: Indicates whether the price of the room includes free breakfast. + example: true + FreeBreakfastDetails: + type: array + description: > + The localized details for the free breakfast amenity (only shown + when FreeBreakfast = true). + + + You can find a link to the complete list of Free Breakfast Details in + + [Lodging Free Breakfast and Internet Details](https://developers.expediagroup.com/xap/products/xap/lodging/references/free-breakfast-and-internet-details). + example: + - Full Breakfast + - Full Board + items: + type: string + description: The localized details for the free breakfast amenity (only shown + when FreeBreakfast = true). + example: Full Breakfast + HcomRewardsEarn: + type: boolean + description: Indicate whether the room qualifies for Hcom Rewards Earn. + (Hotels.com partners only) + example: true + HcomRewardsBurn: + type: boolean + description: Indicate whether the room qualifies for Hcom Rewards Burn. + (Hotels.com partners only) + example: true + CancellationPolicy: + $ref: "#/components/schemas/CancellationPolicy" + Amenities: + type: array + description: The amenities of the `rateplan`. + items: + allOf: + - $ref: "#/components/schemas/LodgingAmenity" + - description: The amenities of the `rateplan`. + - properties: + Id: + description: Amenity ID. + Name: + description: Amenity Name. + description: Container for information on each rate plan. + RoomOccupancyPolicy: + type: object + properties: + MaxGuestCount: + type: integer + description: The maximum number of guests allowed to stay in a room. + format: int32 + example: 3 + MinCheckInAge: + type: integer + description: The minimum age required for check-in. + format: int32 + example: 19 + IncludedGuestCount: + type: integer + description: The number of guests included in base rate. + format: int32 + example: 2 + MinGuestAge: + type: integer + description: The minimum age required for any guest staying in the room. + format: int32 + example: 0 + AgeClassRestrictions: + type: array + description: Container for room occupancy rules based on the age of the guests. + items: + $ref: "#/components/schemas/AgeClassRestriction" + description: Room occupancy policy. + RoomPreference: + type: object + properties: + Type: + type: string + description: |- + The type of preference. Options are: + SmokingPreference + Bed + example: SmokingPreference + enum: + - SmokingPreference + - Bed + Value: + type: string + description: >- + The value of the room preference. + + + For SmokingPreference, options are + + + SmokingOrNonSmoking + + Smoking + + NonSmoking + + For supported Bed Types, please refer to the Related Links section at the bottom of the page. + example: NonSmoking + description: Container for room preferences. + RoomRates: + type: object + properties: + RoomIndex: + type: integer + description: Index of which of the requested rooms this entry refers to. + format: int32 + example: 1 + BaseRate: + allOf: + - $ref: "#/components/schemas/Money" + - description: The price of the room, excluding taxes and fees. + TaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + - description: The total rate of taxes and fees of the room. + TotalPrice: + allOf: + - $ref: "#/components/schemas/Money" + - description: > + The total price of the room, which is equal to the sum of the + `BaseRate` and `TaxesAndFees`. + + + Hotel mandatory fees are not included as these are paid at the property at checkout. + TotalStrikeOutPrice: + allOf: + - $ref: "#/components/schemas/Money" + - description: > + The total strike out price of the room, which is equal to the + sum of the `BaseRate`'s totalStrikeOut + + and `TaxesAndFees`'s totalStrikeOut. + TaxesAndFeesDetails: + type: array + description: > + The breakdown for taxes and fees for this room for the entire stay. + + + Only visible by configuration. Please contact your Expedia Account Manager if you need this node. + items: + allOf: + - $ref: "#/components/schemas/TaxesAndFeesDetail" + - properties: + CategoryCode: + description: Tax or fee category code. + Amount: + description: Tax or fee value. + MandatoryFeesDetails: + type: array + description: The breakdown for the taxes and fees that must be paid at the + property. + items: + $ref: "#/components/schemas/MandatoryFeesDetail" + NightlyRates: + type: array + description: Container for the nightly rate of current room. + items: + allOf: + - $ref: "#/components/schemas/NightlyRates" + - description: Container for the nightly rate of current room. + - properties: + StayDate: + description: One date of the property stay + BaseRate: + description: Nightly Base Rate for the selected date of stay. + RoomType: + type: object + properties: + Description: + type: string + description: Text description of the room type. + example: Room, 1 King Bed, City View (Seattle V) + RoomKey: + type: string + description: > + An encrypted string which includes the information that could be + used to address the current room type. + + + `RoomKey` has been renamed as `OfferId`. + deprecated: true + OfferId: + type: string + description: An encrypted string which includes the information that could be + used to address the current room type. + example: wMRoCMjQqCDIwMTcwN + MerchantName: + type: string + description: Name of Merchant that did the initial Authentication. + example: EXPEDIA + RatePlanType: + type: string + description: | + Indicate the room type is sold as package or standalone. + example: package + enum: + - standalone + - package + - wholesale + RatePlans: + type: array + description: Container for rate plan information. + items: + $ref: "#/components/schemas/RatePlan" + Price: + type: object + description: Container of all price components of the room. + properties: + BaseRate: + allOf: + - $ref: "#/components/schemas/Money" + description: The price of the rate plan for all occupants, excluding taxes and + fees. + TaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total rate of taxes and fees of the rate plan for all + occupants. + TotalPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total price of the rate plan, which is equal to the sum of + `BaseRate` and `TaxesAndFees`. Hotel + + mandatory fees are not included as these are paid at the hotel at checkout. + TotalStrikeOutPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total strike out price of the rate plan, which is equal to + the sum of `BaseRate`'s + + `totalStrikeOut` and `TaxesAndFees`'s `totalStrikeOut`. + AvgNightlyRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average nightly base rate per night per room of the room + type, which is equal to the `BaseRate` + + divided by `StayDates` and by `room number`. + AvgNightlyStrikeOutRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average nightly strike out rate per night per room of the + room type, which is equal to the + + strike out of `BaseRate` divided by `StayDates` and by `room number`. + AvgNightlyRateWithFees: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average nightly rate per night per room of the room type, + including all fees except those imposed by the government. + AvgNightlyStrikeoutRateWithFees: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average nightly strike out rate per night per room of the + room type, including all fees except those imposed by the + government. + HotelMandatoryFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total mandatory fees which will be charged at the hotel for the + rate plan. + TotalPriceWithHotelFees: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total combined price that includes `TotalPrice` that will be + charged by Expedia (`BaseRate` + + + `TaxesAndFees`) combined with any `HotelMandatoryFees` that will be charged at hotel. + + **NOTE**: Since UK regulations require that `HotelMandatoryFees` be included in this price, the + + quoted price will only be accurate for the day of quote. This is due to the fact that + + currency exchange fluctuations will change the exact amount of any `HotelMandatoryFees` that are to + + be collected at the hotel during the guest's stay if the cost is converted into any other currency. + + **CMA Compliance Note (UK)**: Websites doing business in the UK should be displaying this value to + + be compliant with CMA requirements. + RefundableDamageDeposit: + allOf: + - $ref: "#/components/schemas/Money" + description: The refundable damage deposit for the rate plan. + StandalonePrice: + type: object + description: > + The corresponded standalone price to the package rate plan (to show + the `strikethrough`). + + + Only returned when this is a package rate plan. + properties: + BaseRate: + allOf: + - $ref: "#/components/schemas/Money" + description: The standalone price of the rate plan for all occupants, excluding + taxes and fees. + StrikeOutBaseRate: + allOf: + - $ref: "#/components/schemas/Money" + description: The base rate strikeout in the standalone shopping path. + TaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total standalone rate of taxes and fees of the rate plan for + all occupants. + StrikeOutTaxesAndFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The taxes and fees strikeout in the standalone shopping path. + TotalPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total standalone price of the rate plan, which is equal to + the sum of `BaseRate` and `TaxesAndFees`. + + Hotel mandatory fees are not included as these are paid at the hotel at checkout. + TotalStrikeOutPrice: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The total strikeout in the standalone shopping path, which is + equal to the sum of `StrikeOutBaseRate` and + `StrikeOutTaxesAndFees`. + AvgNightlyRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average standalone nightly base rate per night per room of + the rate plan, which is equal to the + + `BaseRate` divided by `StayDates` and by `room number`. + AvgNightlyStrikeOutRate: + allOf: + - $ref: "#/components/schemas/Money" + description: > + The average strikeout of the base rate in the standalone + shopping path, which is per night per room and is equal to + + `StrikeOutBaseRate` divided by `StayDates` and by `room number`. + HotelMandatoryFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The total standalone mandatory fees. + StrikeOutHotelMandatoryFees: + allOf: + - $ref: "#/components/schemas/Money" + description: The strikeout of the mandatory fees in the standalone shopping + path. + "Promotions [deprecated]": + type: array + description: > + All promotion information of the room. + + + **Note**: The node has been moved to `RatePlan` node, and will be deprecated soon. + deprecated: true + items: + $ref: "#/components/schemas/Promotion" + Links: + type: object + properties: + WebSearchResult: + allOf: + - $ref: "#/components/schemas/Link" + - description: Link to web search result page. + WebDetails: + allOf: + - $ref: "#/components/schemas/Link" + - description: Link to web infosite. + ApiDetails: + allOf: + - $ref: "#/components/schemas/Link" + - description: Link for details API. + additionalProperties: + $ref: "#/components/schemas/Link" + description: > + Container for list of HATEOAS links to either Expedia website or + additional Expedia APIs to complete booking + + of the selected offer. + + + Which links are returned in this section are defined by the `links` parameter in the Search API query. + + + Available links are: + + - WebSearchResult (link to web search result page) + + - WebDetails (link to web infosite) + + - ApiDetails (link for details API) + SmokingOption: + type: string + description: The smoking options available for the room type. + example: SmokingOrNonSmoking + enum: + - SmokingOrNonSmoking + - Smoking + - NonSmoking + BedTypeOptions: + type: array + description: > + Statement of bed types available for this offer. A room may have + several bed type options available. + + + **NOTE**: due to the large number of bed type options available, we no longer publish a list of available + + bed types. More information is available in + + [Lodging Bed Types](https://developers.expediagroup.com/xap/products/xap/lodging/references/bed-types). + items: + $ref: "#/components/schemas/BedType" + RoomOccupancyPolicy: + $ref: "#/components/schemas/RoomOccupancyPolicy" + Amenities: + type: array + description: Container for all room amenities. + items: + allOf: + - $ref: "#/components/schemas/LodgingAmenity" + - description: The amenity of the room. + - properties: + Id: + description: Amenity id + Name: + description: Amenity name + DescriptiveAmenities: + type: object + additionalProperties: + type: array + items: + type: string + description: > + Container for all room amenities in group. + + + The key is amenity category, the values are the amenity information. The category for grouped amenities in room level will be: + + - ACCESSIBILITY + + - BATHROOM + + - BEDROOM + + - CLUB_EXEC + + - FAMILY_FRIENDLY + + - ENTERTAINMENT + + - FOOD_AND_DRINK + + - INTERNET + + - MORE + + - OUTDOOR_SPACE + + - SAFETY + example: + FOOD_AND_DRINK: + - 2 restaurants + - Coffee/tea in common area(s) + Media: + type: array + description: Container for Media elements. + items: + allOf: + - $ref: "#/components/schemas/Media" + - description: Media elements. + StayDates: + type: object + properties: + CheckInDate: + type: string + description: The initial day of the hotel stay in an ISO 8601 Date format + [YYYY-MM-DD]. + format: date + CheckOutDate: + type: string + description: The final day of the hotel stay in an ISO 8601 Date format + [YYYY-MM-DD]. + format: date + description: Container for information for the stay dates of the rate plan. + TaxesAndFeesDetail: + type: object + properties: + CategoryCode: + type: string + example: "401" + Amount: + $ref: "#/components/schemas/Money" + ValidFormsOfPayment: + type: object + properties: + PaymentMethod: + type: string + description: The payment method. + example: DebitCard + Name: + type: string + description: The brand name of the payment sub-method to be displayed to the + customer. + example: Visa + PaymentSubMethod: + type: string + description: The payment sub-method. + example: Visa + deprecated: true + BrandName: + type: string + description: > + The brand name of the payment sub-method to be displayed to the + customer. + + + In many cases it will be the same as the payment sub-method, but "Visa/Carte Blanche" and "Visa/Delta" are some of the exceptions. + example: Visa + deprecated: true + description: Container for hotel supported payment information. + Warning: + type: object + properties: + Code: + type: string + description: The code of a warning. + example: INVALID_CORPORATE_DISCOUNT_CODE + Description: + type: string + description: A detail information of what happened. + example: The Corporate DiscountCode '811490' is unavailable, but we found other + rates for you. + OriginalPrice: + $ref: "#/components/schemas/Money" + NewPrice: + $ref: "#/components/schemas/Money" + ChangedAmount: + $ref: "#/components/schemas/Money" + ChangedPercentage: + type: string + description: |- + The changed percentage. + In the sample 2.97 means the changed percentage is 2.97%. + example: "2.97" + description: > + There were some errors or events during the transaction, but the API has + still returned a response. + + + Container for all warnings. + When: + type: object + properties: + Type: + type: string + description: >- + Indicates the time of the deposit collection. + + Options are: + + UPON_BOOKING + + The customer must pay the deposit when booking the property. + + DAYS_PRIOR + + The customer must pay the deposit a number of days before arriving at the property. + + UPON_ARRIVAL + + The customer must pay the deposit upon arriving at the property. + example: UPON_BOOKING + enum: + - UPON_BOOKING + - DAYS_PRIOR + - UPON_ARRIVAL + Value: + type: string + description: This value will only be shown when Deposit Type is DAYS_PRIOR to + indicate the number of days prior to check in when the deposit will + be collected. + example: "1" + description: Indicate when to pay. + Error: + type: object + properties: + Code: + type: string + description: Error code describing the issue + example: AMBIGUOUS_LOCATION + DetailCode: + type: string + description: Detailed error code describing the issue. + example: MULTIPLE_AMBIGUOUS_LOCATION + Description: + type: string + description: A simple description of what the error is. + example: More than one location found + LocationKeyword: + type: string + description: The requested location that caused the error. + example: Portland + LocationOptions: + type: array + description: Container for possible matches to your ambiguous `locationKeyword` + query. + items: + $ref: "#/components/schemas/LocationOption" + description: Container for error list. + Errors: + type: object + properties: + Errors: + type: array + description: Container for error list. + items: + $ref: "#/components/schemas/Error" + TransactionId: + type: string + description: A unique identifier for the transaction. + example: a9e371c4-89d9-4f9c-8df7-df105830e7fe + LocationOption: + type: object + properties: + Type: + type: string + description: Type of the location. + example: TRAINSTATION + RegionId: + type: string + description: RegionId the location resides in. + example: "6200275" + ShortName: + type: string + description: The name of the location which matches the location keyword. + example: Dublin Connolly Station + AirportCode: + type: string + description: Indicates the nearest major airport to the location. + example: DUB + Address: + type: string + description: The address of the location. + example: Dublin Connolly Station, Ireland + Country: + $ref: "#/components/schemas/Country" + GeoLocation: + $ref: "#/components/schemas/GeoLocation" + description: Container for possible matches to your ambiguous `locationKeyword` query. + APIGatewayError: + type: object + properties: + message: + type: string + HotelListingsResponse: + type: object + properties: + Warnings: + type: array + description: > + There were some errors or events during the transaction, but the API + has still returned a response. + + + Container for all warnings. + items: + $ref: "#/components/schemas/Warning" + Count: + type: integer + description: The number of hotels actually returned in the response. + format: int32 + example: 99 + TotalHotelCount: + type: integer + description: The number of hotels present in the location. + format: int32 + example: 230 + TransactionId: + type: string + description: Unique identifier for the transaction. + example: f06edfa3-27f4-44e6-838c-b8dd3d0a3210 + StayDates: + allOf: + - $ref: "#/components/schemas/StayDates" + - description: Container for requested dates of stay. + LengthOfStay: + type: integer + description: The number of stay nights. + format: int32 + example: 3 + NumberOfRooms: + type: integer + description: The number of the rooms requested on behalf of the user. + format: int32 + example: 3 + Occupants: + type: array + description: Container of occupants. It is an array including occupants of each + room. + items: + $ref: "#/components/schemas/Occupant" + Hotels: + type: array + description: Container for all hotels. + items: + $ref: "#/components/schemas/Hotel" + HotelRateCalendar: + type: object + properties: + EcomHotelId: + type: string + description: The unique, Expedia-specific hotel property identifier used to + designate a single hotel. + example: "14747" + HcomHotelId: + type: string + description: > + The unique, Hotels.com-specific hotel property identifier used to + designate a single hotel. + + + This will be returned if searching via `hcomHotelId` in request or the request is coming from Hcom partner. + example: "10532" + RateCalendar: + type: array + description: Container for all rate calendar data. + items: + $ref: "#/components/schemas/RateCalendar" + description: Container for all hotel rate calendar data. + RateCalendar: + type: object + properties: + StayDate: + type: string + description: Stay date for which the price is returned. + format: date + example: 2022-09-02T00:00:00.000Z + Price: + allOf: + - $ref: "#/components/schemas/Money" + - description: Container for pricing information. + - properties: + Value: + description: The total price of the corresponding date. + Currency: + description: > + The ISO 4217 Currency Code that the Value is expressed in. + + + See [Global Currency Codes](https://developers.expediagroup.com/xap/products/xap/lodging/references/global-currency-codes) + + for a full list of supported currencies. + PriceLevel: + type: string + description: > + Indicates how that day's price compares to the other lowest price + for that hotel over the searched date + + range. Prices will be bucketed into LOW/MEDIUM/HIGH. Here are the details for each `PriceLevel`: + + - HIGH: 65th percentile+ + + - MEDIUM: 30th Percentile+ + + - LOW: Anything lower than 30th percentile + example: MEDIUM + enum: + - HIGH + - MEDIUM + - LOW + Status: + type: string + description: Represents whether the offer is currently available. + enum: + - AVAILABLE + - NOT_AVAILABLE + example: AVAILABLE + description: The lowest rate information of requested days + RateCalendarResponse: + type: object + properties: + Warnings: + type: array + description: > + There were some errors or events during the transaction, but the API + has still returned a response. + + + Container for all warnings. + items: + $ref: "#/components/schemas/Warning" + TransactionId: + type: string + description: Unique identifier for the transaction. + example: f06edfa3-27f4-44e6-838c-b8dd3d0a3210 + RateCalendars: + type: array + description: Container for all hotel rate calendar data. + items: + $ref: "#/components/schemas/HotelRateCalendar" + LodgingCancellationPenaltyRule: + type: object + properties: + PenaltyPercentOfStay: + type: string + description: > + Specifies the per-stay cancellation fee charged as a percentage of + the total rate, in addition to any other + + penalties listed. + example: "100" + PenaltyStartDateTime: + type: string + description: > + The beginning of the window of time when the + `CancellationPenaltyRule` is in effect. + + + The date and time are expressed in ISO 8601 International Date format, and local to the property. + format: date-time + example: 2022-07-23T23:00:00.000Z + PenaltyEndDateTime: + type: string + description: > + The end of the window of time when the `CancellationPenaltyRule` is + in effect. + + + The date and time are expressed in ISO 8601 International Date format, and local to the property. + format: date-time + example: 2022-07-25T23:00:00.000Z + description: Container for cancellation penalty details. + LodgingCancellationPolicy: + type: object + properties: + Refundable: + type: boolean + description: Indicate whether the rate is refundable or not. + example: true + FreeCancellation: + type: boolean + description: Indicate whether the room can be cancelled free of charge. + example: true + FreeCancellationEndDateTime: + type: string + description: The date and time until which the room can be cancelled free of + charge. + format: date-time + CancellationPenaltyRules: + type: array + description: Container for Cancellation Penalty Rules information. + items: + $ref: "#/components/schemas/LodgingCancellationPenaltyRule" + description: Container for Cancellation Policy information. + Property: + type: object + properties: + Id: + type: string + description: The unique property identifier used to designate a single property. + example: "14747" + Status: + type: string + description: Represents whether the offer is currently available. + example: AVAILABLE + enum: + - AVAILABLE + - NOT_AVAILABLE + - ERROR + - NUMBER_OF_ADULTS_NOT_ACCEPTED + - NUMBER_OF_CHILDREN_NOT_ACCEPTED + - NUMBER_OF_INFANTS_NOT_ACCEPTED + - NUMBER_OF_PERSONS_NOT_ACCEPTED + - CHECK_IN_AGE_NOT_ACCEPTED + RoomTypes: + type: array + description: Container for all of available room types. + items: + $ref: "#/components/schemas/LodgingRoomType" + description: Container for information on each offered hotel. + LodgingLink: + type: object + properties: + Accept: + type: string + description: > + The Accept request header for API queries only. + + + Note: this value will only be returned if the link is an API query, as website URLs do not require an + + `Accept` header. + Method: + type: string + description: Method of request. + example: GET + Href: + type: string + description: The URL of the destination web page or API query. + LodgingMoney: + type: object + properties: + Value: + type: string + description: The value of the element being defined. + example: "21.9" + Currency: + type: string + description: The ISO 4217 Currency Code that the value is expressed in. + example: USD + description: Pricing information of the stat date + LodgingOccupant: + type: object + properties: + Adults: + type: integer + description: The number of adults in a room. + format: int32 + example: 1 + ChildAges: + type: array + description: The ages of children in a room. + example: + - 2 + - 3 + - 5 + items: + type: integer + format: int32 + LodgingPromotion: + type: object + properties: + Description: + type: string + description: The description of the promotion. + example: 20%Off + Amount: + $ref: "#/components/schemas/LodgingMoney" + LodgingRatePlan: + type: object + properties: + CancellationPolicy: + $ref: "#/components/schemas/LodgingCancellationPolicy" + Promotions: + type: array + description: All promotion information of the ratePlan. + items: + $ref: "#/components/schemas/LodgingPromotion" + description: Container for rate plan information. + LodgingRoomType: + type: object + properties: + RatePlans: + type: array + description: Container for rate plan information. + items: + $ref: "#/components/schemas/LodgingRatePlan" + Price: + type: object + properties: + BaseRate: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: The price of the rate plan for all occupants, excluding taxes and + fees. + TaxesAndFees: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: The total amount of taxes and fees of the rate plan for all + occupants. + TotalPrice: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: > + The total price of the rate plan, which is equal to the sum of + `BaseRate` + `TaxesAndFees`. + + Property mandatory fees are not included in this value as these are paid at the property at + + checkout. + AvgNightlyRate: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: > + The average nightly base rate per night per room of the rate + plan, which is equal to the `BaseRate` + + divided by `StayDates` and by `room number`. + AvgNightlyRateWithFees: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: > + The average nightly rate per night per room of the room type, + including all fees except those imposed by the government. + PropertyMandatoryFees: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: The total mandatory fees which will be charged at the property for + the rate plan. + TotalPriceWithPropertyFees: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: > + The total price of the rate plan include property mandatory + fees, which is equal to the sum of + + `BaseRate` + `TaxesAndFees` + `PropertyMandatoryFees`. + + **NOTE**: Since UK regulations require that `PropertyMandatoryFees` be included in this price, the + + quoted price will only be accurate for the day of quote. This is due to the fact that + + currency exchange fluctuations will change the exact amount of any `PropertyMandatoryFees` that are to + + be collected at the hotel during the guest's stay if the cost is converted into any other currency. + + **CMA Compliance Note (UK)**: Websites doing business in the UK should be displaying this value to + + be compliant with CMA requirements. + RefundableDamageDeposit: + allOf: + - $ref: "#/components/schemas/LodgingMoney" + description: The refundable damage deposit. + description: Container for Price information. + Links: + type: object + properties: + WebSearchResult: + allOf: + - $ref: "#/components/schemas/LodgingLink" + - description: Link to web search result page. + WebDetails: + allOf: + - $ref: "#/components/schemas/LodgingLink" + - description: Link to web infosite. + additionalProperties: + $ref: "#/components/schemas/LodgingLink" + description: > + Container for list of HATEOAS links to either Expedia website or + additional Expedia APIs to complete booking of the selected offer. + + + Which links are returned in this section are defined by the links parameter in the Search API query. + + Available links are: + + - WebDetails (link to web infosite) + + - WebSearchResult (link to web search result page) + LodgingStayDates: + type: object + properties: + CheckInDate: + type: string + description: The initial day of the property stay in an ISO 8601 Date format + [YYYY-MM-DD]. + format: date + CheckOutDate: + type: string + description: The final day of the property stay in an ISO 8601 Date format + [YYYY-MM-DD]. + format: date + description: | + Container for requested dates of stay. + LodgingWarning: + type: object + properties: + Code: + type: string + description: The code of a warning. + example: NO_RESULTS_FOUND + Description: + type: string + description: A description of what caused the issues. + example: > + Sorry, your query completed successfully, but did not return any + inventory. Please adjust your + + search parameters and try again. + LodgingError: + type: object + properties: + Code: + type: string + description: Error code describing the issue + example: AMBIGUOUS_LOCATION + Description: + type: string + description: A simple description of what the error is. + example: "Multiple pickup locations found. " + description: Container for error list. + LodgingErrors: + type: object + properties: + Errors: + type: array + description: Container for error list. + items: + $ref: "#/components/schemas/LodgingError" + TransactionId: + type: string + description: A unique identifier for the transaction. + example: a9e371c4-89d9-4f9c-8df7-df105830e7fe + LodgingQuotesResponse: + type: object + properties: + Warnings: + type: array + description: > + There were some errors or events during the transaction, but the API + has still returned a response. + + + Container for all warnings. + items: + $ref: "#/components/schemas/LodgingWarning" + Count: + type: integer + description: The number of properties actually returned in the response. + format: int32 + example: 99 + TotalPropertyCount: + type: integer + description: The number of properties requested. + format: int32 + example: 230 + TransactionId: + type: string + description: Unique identifier for the API transaction. + example: f06edfa3-27f4-44e6-838c-b8dd3d0a3210 + StayDates: + $ref: "#/components/schemas/LodgingStayDates" + LengthOfStay: + type: integer + description: The number of stay nights. + format: int32 + example: 3 + Occupants: + type: array + description: Container for the list of room occupants. + items: + $ref: "#/components/schemas/LodgingOccupant" + Properties: + type: array + description: Container for all properties. + items: + $ref: "#/components/schemas/Property" + DateRange: + type: object + description: The actual date range for the shown availability. + properties: + StartDate: + type: string + description: The initial day of the date range in an ISO 8601 Date format + [YYYY-MM-DD]. + example: 2022-07-05 + format: date + EndDate: + type: string + description: The final day of the date range in an ISO 8601 Date format + [YYYY-MM-DD]. + example: 2023-07-05 + format: date + AvailabilityCalendar: + type: object + properties: + PropertyId: + type: string + description: The unique property identifier that designates a single property. + example: "74041788" + DateRange: + $ref: "#/components/schemas/DateRange" + Availability: + type: string + description: > + A string of codes that shows property availability, one for every + day in the specified date range. + + + Valid values include Y (available) and N (unavailable). + + + ***Note**: The first code stands for availability on the `StartDate` in the `DateRange` and the last one stands + + for the `EndDate`.* + example: YYYYYYNNNNNN + ChangeOver: + type: string + description: > + A string of codes that shows changeover action, one for every day in + the specified date range. + + + Valid values include + + - X (no action possible) + + - C (check-in, checkout) + + - O (checkout only) + + - I (check-in only) + + ***Note**: The first code stands for possible action on the `StartDate` in the `DateRange` and the last one + + stands for the `EndDate`. All actions are possible if not returned.* + example: XXIIICCCOOCC + MinPriorNotify: + type: string + description: > + A comma-separated list of numbers that shows how many days before a + reservation the booking must occur, one + + for every day in the specified date range. Valid values include 0-999, and 0 indicates no prior notification + + required for a given day. The unit is always day. + + + ***Note**: The first number stands for the minimum advance booking days on the `StartDate` in the `DateRange` + + and the last one stands for the `EndDate`. No limitation if not returned.* + example: 1,1,1,1,1,1,1,1,1,1,1,1,1 + MinStay: + type: string + description: > + A comma-separated list of numbers that show the minimum number of + days a traveler can stay, one for every + + day in the specified date range. + + + Valid values include 0-999, and 0 indicates no minimum for a given day. The unit is always day. + + + ***Note**: The first number stands for the minimum stay on the `StartDate` in the `DateRange` and the last + + one stands for the `EndDate`. No limitation if not returned.* + example: 0,0,0,3,3,3,3,3,3,7,7,7,7,7,21,21,21 + MaxStay: + type: string + description: > + A comma-separated list of numbers that show the maximum number of + days a traveler can stay, one for every + + day in the specified date range. + + + Valid values include 0-999, and 0 indicates no maximum for a given day. The unit is always day. + + + ***Note**: The first number stands for the maximum stay on the `StartDate` in the `DateRange` and the + + last one stands for the `EndDate`. No limitation if not returned. + example: 0,0,0,31,31,31,371,370 + AvailabilityCalendarResponse: + type: object + properties: + Warnings: + type: array + description: > + There were some errors or events during the transaction, but the API + has still returned a response. + + + Container for all warnings. + items: + $ref: "#/components/schemas/LodgingWarning" + TransactionId: + type: string + description: Unique identifier for the transaction. + example: f06edfa3-27f4-44e6-838c-b8dd3d0a3210 + AvailabilityCalendars: + type: array + description: A list of the calendar entities. + items: + $ref: "#/components/schemas/AvailabilityCalendar" + example: >- + { + "TransactionId": "f06edfa3-27f4-44e6-838c-b8dd3d0a3210", + "AvailabilityCalendars": [ + { + "PropertyId": "74041788", + "DateRange": { + "StartDate": "2022-02-25", + "EndDate": "2025-02-24" + }, + "Availability":"NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY", + "ChangeOver": "OXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXICCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", + "MinStay": "3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3", + "MaxStay": "379,378,377,376,375,374,373,372,371,370,369,368,367,731,730,729,728,727,726,725,724,723,722,721,720,719,718,717,716,715,714,713,712,711,710,709,708,707,706,705,704,703,702,701,700,699,698,697,696,695,694,693,692,691,690,689,688,687,686,685,684,683,682,681,680,679,678,677,676,675,674,673,672,671,670,669,668,667,666,665,664,663,662,661,660,659,658,657,656,655,654,653,652,651,650,649,648,647,646,645,644,643,642,641,640,639,638,637,636,635,634,633,632,631,630,629,628,627,626,625,624,623,622,621,620,619,618,617,616,615,614,613,612,611,610,609,608,607,606,605,604,603,602,601,600,599,598,597,596,595,594,593,592,591,590,589,588,587,586,585,584,583,582,581,580,579,578,577,576,575,574,573,572,571,570,569,568,567,566,565,564,563,562,561,560,559,558,557,556,555,554,553,552,551,550,549,548,547,546,545,544,543,542,541,540,539,538,537,536,535,534,533,532,531,530,529,528,527,526,525,524,523,522,521,520,519,518,517,516,515,514,513,512,511,510,509,508,507,506,505,504,503,502,501,500,499,498,497,496,495,494,493,492,491,490,489,488,487,486,485,484,483,482,481,480,479,478,477,476,475,474,473,472,471,470,469,468,467,466,465,464,463,462,461,460,459,458,457,456,455,454,453,452,451,450,449,448,447,446,445,444,443,442,441,440,439,438,437,436,435,434,433,432,431,430,429,428,427,426,425,424,423,422,421,420,419,418,417,416,415,414,413,412,411,410,409,408,407,406,405,404,403,402,401,400,399,398,397,396,395,394,393,392,391,390,389,388,387,386,385,384,383,382,381,380,379,378,377,376,375,374,373,372,371,370,369,368,367,731,730,729,728,727,726,725,724,723,722,721,720,719,718,717,716,715,714,713,712,711,710,709,708,707,706,705,704,703,702,701,700,699,698,697,696,695,694,693,692,691,690,689,688,687,686,685,684,683,682,681,680,679,678,677,676,675,674,673,672,671,670,669,668,667,666,665,664,663,662,661,660,659,658,657,656,655,654,653,652,651,650,649,648,647,646,645,644,643,642,641,640,639,638,637,636,635,634,633,632,631,630,629,628,627,626,625,624,623,622,621,620,619,618,617,616,615,614,613,612,611,610,609,608,607,606,605,604,603,602,601,600,599,598,597,596,595,594,593,592,591,590,589,588,587,586,585,584,583,582,581,580,579,578,577,576,575,574,573,572,571,570,569,568,567,566,565,564,563,562,561,560,559,558,557,556,555,554,553,552,551,550,549,548,547,546,545,544,543,542,541,540,539,538,537,536,535,534,533,532,531,530,529,528,527,526,525,524,523,522,521,520,519,518,517,516,515,514,513,512,511,510,509,508,507,506,505,504,503,502,501,500,499,498,497,496,495,494,493,492,491,490,489,488,487,486,485,484,483,482,481,480,479,478,477,476,475,474,473,472,471,470,469,468,467,466,465,464,463,462,461,460,459,458,457,456,455,454,453,452,451,450,449,448,447,446,445,444,443,442,441,440,439,438,437,436,435,434,433,432,431,430,429,428,427,426,425,424,423,422,421,420,419,418,417,416,415,414,413,412,411,410,409,408,407,406,405,404,403,402,401,400,399,398,397,396,395,394,393,392,391,390,389,388,387,386,385,384,383,382,381,380,379,378,377,376,375,374,373,372,371,370,369,368,367,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", + "MinPriorNotify": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" + }, + { + "PropertyId": "1", + "DateRange": { + "StartDate": "2022-02-27", + "EndDate": "2023-11-04" + }, + "Availability": "NNNNNNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYNNNNNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" + }, + { + "PropertyId": "123", + "DateRange": { + "StartDate": "2022-02-27", + "EndDate": "2023-11-04" + }, + "Availability": "NNNNNNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYNNNNNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY", + "ChangeOver": "XXXXXXIIICCCCCCCCCCCCCCCCCCCCXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOOXXXXXIIICCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCXXXXXXCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOOO", + "MinStay": "0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,8,7,6,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,5,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,9,8,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,7,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0", + "MaxStay": "0,0,0,0,0,0,21,21,20,19,18,17,16,21,20,19,18,17,16,15,21,20,19,18,17,16,15,21,20,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,0,0,0,0,0,0,0,0,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,21,20,19,18,17,16,15,21,20,19,18,17,16,15,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,0,0,0,0,0,0,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,0,0,0", + "MinPriorNotify": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" + } + ] + } + AdditionalFee: + required: + - Amount + - FinanceCategory + - FinanceSubCategory + - IsRequired + type: object + properties: + IsRequired: + type: boolean + description: Indicates whether this additional fee is mandatory. + example: true + FinanceCategory: + type: string + description: Category of the fee / Coverages + example: Fee + FinanceSubCategory: + type: string + description: Sub category of the fee / Coverages . + example: Drop + Amount: + $ref: "#/components/schemas/CarsMoney" + Description: + type: string + description: Description of the fee. + example: DropOffCharge + Deductible: + $ref: "#/components/schemas/Deductible" + description: List of additional fees including both mandatory and optional + fees.such as young driver fee/drop off fee /CollisionDamageWaiver + CarsAddress: + required: + - Address1 + - City + - Country + type: object + properties: + Address1: + type: string + description: Street Number, Street Name, or PO Box + example: 724 Pine St + Address2: + type: string + description: "Apartment, Floor, Suite, Bldg # or more specific information about + Address1." + example: Second Floor + Suite: + type: string + description: Suite/apartment number + example: "123" + City: + type: string + description: The city + example: New York + Province: + type: string + description: The state or province + example: NY + Country: + type: string + description: 3-letter code for the country + example: USA + PostalCode: + type: string + description: Zip/postal code + example: "98004" + description: Address information + CarsCancellationPolicy: + type: object + properties: + Cancellable: + type: boolean + description: Indicates if this car can be cancelled (free cancel or penalty + cancel) + example: true + FreeCancellation: + type: boolean + description: Indicates if this car may be cancelled without a penalty. + example: true + FreeCancellationEndDateTime: + type: string + description: Indicates the latest time that the car can be cancelled for free. + format: date-time + PenaltyRules: + type: array + description: Container for penalty rules + items: + $ref: "#/components/schemas/PenaltyRule" + NonCancellableDateTimeRange: + $ref: "#/components/schemas/NonCancellableDateTimeRange" + description: Cancellation Policy Container. + Capacity: + required: + - AdultCount + type: object + properties: + AdultCount: + type: integer + description: The typical number of adults that can fit comfortably in the car. + format: int64 + example: 4 + ChildCount: + type: integer + description: The typical number of children that can fit comfortably in the car. + format: int64 + example: 0 + SmallLuggageCount: + type: integer + description: The typical number of small pieces of luggage that fit in the cargo + space. + format: int64 + example: 2 + LargeLuggageCount: + type: integer + description: The typical number of large pieces of luggage that fit in the cargo + space. + format: int64 + example: 2 + description: Capacity for car's properties. + Car: + required: + - CancellationPolicy + - DropOffDetails + - Id + - PickupDetails + - Price + - Supplier + - VehicleDetails + type: object + properties: + Id: + type: string + description: "Uniquely identifies a Car Offer.Note: since pay-online and + pay-at-the-counter Car Offers have the same associated Rate Code, + the Offer ID is the only unique identifier to differentiate between + the two offers when referencing or booking." + example: ECAR-39--1Trip-SEAC005-SEAC005 + DataTimeStamp: + type: string + description: DataTimeStamp + format: date-time + example: 2021-03-09T07:08:00Z + OnlineCheckIn: + type: boolean + description: Indicate whether the supplier supports online checkin + example: true + SkipTheCounter: + type: boolean + description: Indicate whether the supplier supports skip the counter + example: true + VehicleDetails: + $ref: "#/components/schemas/VehicleDetails" + Supplier: + $ref: "#/components/schemas/Supplier" + PickupDetails: + $ref: "#/components/schemas/VendorLocationDetails" + DropOffDetails: + $ref: "#/components/schemas/VendorLocationDetails" + Links: + type: object + additionalProperties: + $ref: "#/components/schemas/CarsLink" + description: A map of links to other Car APIs or Expedia websites. + xml: + wrapped: true + RateDetails: + $ref: "#/components/schemas/RateDetails" + Price: + $ref: "#/components/schemas/Price" + ReferencePrice: + $ref: "#/components/schemas/CarsMoney" + AdditionalFees: + type: array + description: List of additional fees including both mandatory and optional + fees.such as young driver fee/drop off fee /CollisionDamageWaiver + items: + $ref: "#/components/schemas/AdditionalFee" + CancellationPolicy: + $ref: "#/components/schemas/CarsCancellationPolicy" + NoShowPenalty: + $ref: "#/components/schemas/PenaltyType" + Images: + type: array + description: List of image resources of the car product. + items: + $ref: "#/components/schemas/Image" + Rating: + $ref: "#/components/schemas/RatingWithoutDetails" + description: List of cars matching the search criteria. + CarCategory: + required: + - Code + - Value + type: object + properties: + Code: + type: string + description: Car category code. + example: M + Value: + type: string + description: Car category value. + example: Mini + description: Car category. Please find list of Car Type Codes in + https://expediaintegration.zendesk.com/hc/en-us/articles/115008631767 + CarListingsResponse: + required: + - CarCount + - TransactionId + type: object + properties: + Warnings: + type: array + description: Container for warning codes + items: + $ref: "#/components/schemas/CarsWarning" + TransactionId: + type: string + description: A unique identifier for this transaction. + example: 1111111-2222-3333-4444-55555555555 + CarCount: + type: integer + description: The number of cars offers returned in the response. + format: int64 + example: 1 + Cars: + type: array + description: List of cars matching the search criteria. + items: + $ref: "#/components/schemas/Car" + xml: + name: CarListingsResponse + CarType: + required: + - Code + - Value + type: object + properties: + Code: + type: string + description: Car type code. + example: C + Value: + type: string + description: Car type value. + example: 2/4 Door + description: Car type. Please find list of Car Type Codes in + https://expediaintegration.zendesk.com/hc/en-us/articles/115002516708 + CarsCountry: + required: + - IsoCode2 + - IsoCode3 + - Name + type: object + properties: + Name: + type: string + description: country name + example: Ireland + Code: + type: string + description: 3-letter code for the country + example: IRL + IsoCode2: + type: string + description: 2-letter code for the country + example: IE + IsoCode3: + type: string + description: 3-letter code for the country + example: IRL + description: Container for disambiguation country information + CarsDateRange: + required: + - EndDate + - StartDate + type: object + properties: + StartDate: + type: string + description: Start date at pickup location of the period. + format: date + example: 2021-06-27 + EndDate: + type: string + description: End date at pickup location of the period. + format: date + example: 2021-06-28 + description: Date range of the period. + DateTimePeriod: + required: + - DateRange + type: object + properties: + DateRange: + $ref: "#/components/schemas/CarsDateRange" + TimeRanges: + type: array + description: A list of time range to indicate the operation hours of the date + range. + items: + $ref: "#/components/schemas/TimeRange" + description: A List of date time periods to indicate the vendor business hours + for the pickup time. + Deductible: + type: object + properties: + ExcessAmount: + $ref: "#/components/schemas/CarsMoney" + LiabilityAmount: + $ref: "#/components/schemas/CarsMoney" + DeductibleAmount: + $ref: "#/components/schemas/CarsMoney" + description: Indicate whether it is deductible + Discount: + required: + - Code + - Type + type: object + properties: + Type: + type: string + description: "Discount type. Supported values : CorpDiscount | Coupon." + example: CorpDiscount + Code: + type: string + description: Discount code. + example: G811490 + description: List of discount information. + CarsDistance: + required: + - Value + type: object + properties: + Value: + type: string + description: The number of miles/kilometers of the distance (specified by the + Unit). + example: "75" + Unit: + type: string + description: The unit (KM or MI) for the distance. + example: KM + Direction: + type: string + description: "The direction of the location from the search 'center'.Possible + values are: N,S,W,E,NW,NE,SW,SE" + example: N + description: The extra distance information. + ExtraCostPerDistance: + required: + - Cost + - Distance + type: object + properties: + Distance: + $ref: "#/components/schemas/CarsDistance" + Cost: + $ref: "#/components/schemas/CarsMoney" + description: Extra cost for each increment of distance used. + FuelAC: + required: + - Code + - Value + type: object + properties: + Code: + type: string + description: Car FuelAC code. + example: D + Value: + type: string + description: Car FuelAC value. + example: Diesel Air + description: Car fuel type and whether Air Conditioning is included. Please find + list of Car Fuel AC Codes in + https://expediaintegration.zendesk.com/hc/en-us/articles/115005378328 + CarsGeoLocation: + required: + - Latitude + - Longitude + type: object + properties: + Latitude: + type: string + description: Latitude of the location. + example: "38.184978" + Longitude: + type: string + description: Longitude of the location. + example: "85.7412" + Obfuscated: + type: boolean + description: Container for Geo location. + Image: + required: + - Href + - Size + - Type + type: object + properties: + Type: + type: string + description: Resource typeSupported values :Thumbnail - (70 pixels wide)Image - + (165 pixels wide) + Size: + type: string + description: Size of imageSupported values :s - (165 pixels wide)t - (70 pixels + wide) + Href: + type: string + description: URL for the image. + description: List of image resources of the car product. + CarsLink: + required: + - Href + type: object + properties: + Accept: + type: string + description: Accept header. + Method: + type: string + description: HTTP method to connect. + example: GET + Href: + type: string + description: HATEOAS URL to fetch details. + description: "A map of links to other Car APIs. possible link name: ApiBooking" + CarsLocation: + required: + - LocationId + type: object + properties: + Type: + type: string + description: The type of location code (MULTICITY | METROCODE). + example: MULTICITY + Id: + type: string + description: Expedia Region ID of the specified airport. + example: "6139103" + Name: + type: string + description: Location Name + example: Seattle-Tacoma International Airport + Code: + type: string + description: Location Code + example: SEA + LocationId: + type: string + description: Location id. + example: SEAT001 + Address: + $ref: "#/components/schemas/CarsAddress" + PointOfInterest: + type: string + GeoLocation: + $ref: "#/components/schemas/CarsGeoLocation" + Neighborhood: + $ref: "#/components/schemas/CarsNeighborhood" + RegionId: + type: integer + description: RegionId the location resides in. + format: int64 + example: 6200275 + Country: + $ref: "#/components/schemas/CarsCountry" + description: Container for list of possible locations that could be used to + disambiguate the query. + Mileage: + required: + - FreeDistance + - FreeDistanceRatePeriod + type: object + properties: + FreeDistance: + $ref: "#/components/schemas/CarsDistance" + FreeDistanceRatePeriod: + type: string + description: Rate period for free distance. + example: Daily + ExtraCostPerDistance: + $ref: "#/components/schemas/ExtraCostPerDistance" + description: A list of charges to be levied based on the mileage driven. + CarsMoney: + required: + - Currency + - Value + type: object + properties: + Value: + type: string + description: The value of the element being defined. + example: "21.9" + Currency: + type: string + description: The ISO 4217 Currency Code that the value is expressed in. + example: USD + LocalCurrencyPrice: + $ref: "#/components/schemas/CarsMoney" + description: Price of Special equipment. + CarsNeighborhood: + required: + - Id + - Name + type: object + properties: + Id: + type: string + description: Neighborhood id. + example: "6160232" + Name: + type: string + description: Neighborhood name. + example: Le Pharo + description: Geography entities which are typically contained within a city. + This includes the categories neighborhood and point of interest. Low + level regions are not a formally defined concept in the geography model. + NonCancellableDateTimeRange: + required: + - EndDateTime + - StartDateTime + type: object + properties: + StartDateTime: + type: string + description: The time of this non-cancellable window starts + format: date-time + EndDateTime: + type: string + description: The time of this non-cancellable window ends + format: date-time + description: Container for non-cancellable date and time range element + PenaltyRule: + required: + - EndDateTime + - Penalty + - StartDateTime + type: object + properties: + Penalty: + $ref: "#/components/schemas/PenaltyType" + StartDateTime: + type: string + description: The time when this penalty window starts + format: date-time + EndDateTime: + type: string + description: The time when this penalty window ends + format: date-time + description: Container for penalty rules + PenaltyType: + required: + - Currency + - Type + - Value + type: object + properties: + Type: + type: string + description: "What the penalty amount is based on. should be one of the + following values:AMOUNT : it means the user is charged a fixed + amount specified in the value node. Say 50$ for example.PERCENT : it + means the user is charged a percentage of the base rate/total + rate.PERDAY : it means the user is charged Per Day Price. For eg.., + if the value is 2, it means the penalty amount will the Per day + price of 2 days." + Value: + type: string + description: Value to indicate how many/much of the type listed above is going + to be charged as a penalty. + example: "20.0" + Currency: + type: string + description: The currency of the amount, only valid when Type=AMOUNT + example: USD + description: Container for no show penalty element + Price: + required: + - TotalPrice + type: object + properties: + RatePeriodUnitPrice: + $ref: "#/components/schemas/CarsMoney" + BasePrice: + $ref: "#/components/schemas/CarsMoney" + TaxesAndFees: + $ref: "#/components/schemas/CarsMoney" + TotalPriceDueAtBooking: + $ref: "#/components/schemas/CarsMoney" + TotalPrice: + $ref: "#/components/schemas/CarsMoney" + description: Pricing information for the rental. + RateDetails: + required: + - PrePay + - RateCode + - RatePeriod + type: object + properties: + RatePeriod: + type: string + description: "Rate period. Supported values: Daily,Weekly,Monthly,Trip,Weekend" + example: Daily + RateCode: + type: string + description: Rate plan identifier. + example: A3D10 + PrePay: + type: boolean + description: Indicates whether this reservation should be paid at the time of + booking (true) or at time of rental return (false). + example: false + CreditCardRequired: + type: boolean + description: Indicates whether credit card is required for booking. + example: false + Discounts: + type: array + description: List of discount information. + items: + $ref: "#/components/schemas/Discount" + Mileages: + type: array + description: A list of charges to be levied based on the mileage driven. + items: + $ref: "#/components/schemas/Mileage" + MobileRate: + type: boolean + description: Indicates whether car offer is mobile rate. + example: true + description: The rate detail information for a car offer. + Rating: + required: + - RatingPercentage + - RatingCount + type: object + properties: + RatingPercentage: + type: string + description: The percentage of rating. + example: 87% + RatingCount: + type: string + description: The total count of rating. + example: "2092" + RatingDetails: + type: array + description: List of all the details of rating. + items: + $ref: "#/components/schemas/RatingDetails" + description: The rating of the car being offered. + RatingWithoutDetails: + required: + - RatingPercentage + - RatingCount + type: object + properties: + RatingPercentage: + type: string + description: The percentage of rating. + example: 87% + RatingCount: + type: string + description: The total count of rating. + example: "2092" + description: The rating of the car being offered. + RatingDetails: + required: + - Category + - Percentage + type: object + properties: + Category: + type: string + description: The category of rating detail. + example: Pick-up location + Percentage: + type: string + description: The percentage of rating detail category. + example: "98" + description: List of all the details of rating. + Supplier: + required: + - Code + - Id + - Name + type: object + properties: + Id: + type: string + description: Supplier ID. + example: "3" + Name: + type: string + description: Supplier Name. + example: Advantage Rent-A-Car + Code: + type: string + description: Supplier Code. + example: AD + LogoImageUrl: + type: string + description: Supplier Logo Image Url. + example: https://media.int.expedia.com/int/cars/logos/NU.png + description: The supplier of the car being offered. + TimeRange: + required: + - EndTime + - StartTime + type: object + properties: + StartTime: + type: string + description: Start time at pickup location of the date range. + format: time + example: 07:00:00 + EndTime: + type: string + description: End time at pickup location of the date range. + format: time + example: 17:00:00 + description: A list of time range to indicate the operation hours of the date range. + TransmissionDrive: + required: + - Code + - Value + type: object + properties: + Code: + type: string + description: Car transmission and drive code. + example: M + Value: + type: string + description: Car transmission and drive value. + example: Manual AWD + description: Car transmission and drive. Please find list of Car Transmission + Drive Codes in + https://expediaintegration.zendesk.com/hc/en-us/articles/115005380028 + VehicleDetails: + required: + - CarCategory + - CarClass + - CarType + - FuelAC + - TransmissionDrive + type: object + properties: + Make: + type: string + description: Car manufacturer and model. + example: Kia Rio + CarClass: + type: string + description: Car category and type. + example: Economy 2/4Door Car + MinDoors: + type: integer + description: Minimal car door count. + format: int32 + example: 2 + MaxDoors: + type: integer + description: Maximal car door count. + format: int32 + example: 4 + FuelLevel: + type: string + description: Car fuel information. + example: Full to Full + CarCategory: + $ref: "#/components/schemas/CarCategory" + CarType: + $ref: "#/components/schemas/CarType" + TransmissionDrive: + $ref: "#/components/schemas/TransmissionDrive" + FuelAC: + $ref: "#/components/schemas/FuelAC" + Capacity: + $ref: "#/components/schemas/Capacity" + description: Specific information for a car. + VendorLocationDetails: + required: + - DateTime + - Location + type: object + properties: + DateTime: + type: string + description: Pickup date and time. + format: date-time + ShuttleCategory: + type: string + description: The category of shuttle from the terminal to the rental car + counter. Please find list of Shuttle Categories in the Related Links + Section below. + example: AirportShuttleToCounterAndCar + Location: + $ref: "#/components/schemas/CarsLocation" + Distance: + $ref: "#/components/schemas/CarsDistance" + OpenSchedule: + type: array + description: A List of date time periods to indicate the vendor business hours + for the pickup time. + items: + $ref: "#/components/schemas/DateTimePeriod" + description: Drop off information + CarsWarning: + required: + - Code + - Description + type: object + properties: + Code: + type: string + description: Standardized warning code. + example: INVALID_CORPORATE_DISCOUNT_CODE + Description: + type: string + description: Standardized warning description message. + example: The Corporate DiscountCode '811490' is unavailable, but we found other + rates for you. + OriginalPrice: + $ref: "#/components/schemas/CarsMoney" + NewPrice: + $ref: "#/components/schemas/CarsMoney" + ChangedAmount: + $ref: "#/components/schemas/CarsMoney" + ChangedPercentage: + type: string + description: |- + The changed percentage. + In the sample 2.97 means the changed percentage is 2.97%. + example: "2.97" + Links: + type: object + additionalProperties: + $ref: "#/components/schemas/CarsLink" + xml: + wrapped: true + description: Container for warning codes + CarsError: + required: + - Code + - Description + type: object + properties: + Code: + type: string + description: Error code describing the issue + example: AMBIGUOUS_LOCATION + DetailCode: + type: string + description: Detailed error code describing the issue. + example: MULTIPLE_AMBIGUOUS_LOCATION + Description: + type: string + description: A simple description of what the error is. + example: "Multiple pickup locations found. " + LocationKeyword: + type: string + description: The requested location that caused the error. + example: "Portland. " + LocationOptions: + type: array + description: "List for possible locations from which the customer must choose + the best one to be re-submitted in the request. " + items: + $ref: "#/components/schemas/CarsLocationOption" + description: Container for error list. + CarsErrors: + required: + - Errors + - TransactionId + type: object + properties: + Errors: + type: array + description: Container for error list. + items: + $ref: "#/components/schemas/CarsError" + TransactionId: + type: string + description: A unique identifier for the transaction. + example: a9e371c4-89d9-4f9c-8df7-df105830e7fe + xml: + name: ErrorResponse + CarsLocationOption: + required: + - Locations + - RequestedLocation + type: object + properties: + RequestedLocation: + type: string + description: Location used in partner request. + example: Paris + Locations: + type: array + description: Container for list of possible locations that could be used to + disambiguate the query. + items: + $ref: "#/components/schemas/CarsLocation" + Type: + type: string + description: Type of the location. + example: TRAINSTATION + RegionId: + type: string + description: RegionId the location resides in. + example: "6200275" + ShortName: + type: string + description: The name of the location which matches the location keyword. + example: Dublin Connolly Station + AirportCode: + type: string + description: Indicates the nearest major airport to the location. + example: DUB + Address: + type: string + description: The address of the location. + example: Dublin Connolly Station, Ireland + Country: + $ref: "#/components/schemas/CarsCountry" + GeoLocation: + $ref: "#/components/schemas/CarsGeoLocation" + description: "List for possible locations from which the customer must choose + the best one to be re-submitted in the request. " + DisambiguationResponse: + required: + - Errors + - TransactionId + type: object + properties: + Errors: + type: array + description: Container for error list. + items: + $ref: "#/components/schemas/CarsError" + TransactionId: + type: string + description: A unique identifier for the transaction. + example: ec007d1c-8d9d-4ed5-a880-da5b477d8c6c + xml: + name: DisambiguationResponse + CarDetails: + required: + - CancellationPolicy + - DropOffDetails + - PickupDetails + - Price + - Supplier + - VehicleDetails + type: object + properties: + OnlineCheckIn: + type: boolean + description: Indicate whether the supplier supports online checkin + example: true + SkipTheCounter: + type: boolean + description: Indicate whether the supplier supports skip the counter + example: true + VehicleDetails: + $ref: "#/components/schemas/VehicleDetails" + Supplier: + $ref: "#/components/schemas/Supplier" + PickupDetails: + $ref: "#/components/schemas/VendorLocationDetails" + DropOffDetails: + $ref: "#/components/schemas/VendorLocationDetails" + RateDetails: + $ref: "#/components/schemas/RateDetails" + Price: + $ref: "#/components/schemas/Price" + ReferencePrice: + $ref: "#/components/schemas/CarsMoney" + AdditionalFees: + type: array + description: List of additional fees including both mandatory and optional + fees.such as young driver fee/drop off fee /CollisionDamageWaiver + items: + $ref: "#/components/schemas/AdditionalFee" + TaxesAndFeesDetails: + type: array + description: List of TaxesAndFees Details + items: + $ref: "#/components/schemas/TaxesAndFees" + ExtraFeesDetails: + type: array + description: List of ExtraFeesDetails + items: + $ref: "#/components/schemas/ExtraFees" + SpecialEquipments: + type: array + description: Description and costs of any optional special equipment that may be + rented with the car. + items: + $ref: "#/components/schemas/Equipment" + RentalLimits: + $ref: "#/components/schemas/RentalLimits" + CancellationPolicy: + $ref: "#/components/schemas/CarsCancellationPolicy" + NoShowPenalty: + $ref: "#/components/schemas/PenaltyType" + CarPolicies: + type: array + description: A list of policies that apply to this car rental. + items: + $ref: "#/components/schemas/CarPolicy" + Images: + type: array + description: List of image resources of the car product. + items: + $ref: "#/components/schemas/Image" + Rating: + $ref: "#/components/schemas/Rating" + description: Details of requested car. + CarDetailsResponse: + required: + - TransactionId + type: object + properties: + Warnings: + type: array + description: Container for warning codes + items: + $ref: "#/components/schemas/CarsWarning" + TransactionId: + type: string + description: A unique identifier for this transaction. + example: 1111111-2222-3333-4444-55555555555 + CarDetails: + $ref: "#/components/schemas/CarDetails" + ValidFormsOfPayment: + type: array + description: List of all the forms of payment that will be accepted for the + booking of this rental transaction. + items: + $ref: "#/components/schemas/CarsValidFormsOfPayment" + Links: + type: object + additionalProperties: + $ref: "#/components/schemas/CarsLink" + description: "A map of links to other Car APIs. possible link name: ApiBooking" + xml: + wrapped: true + xml: + name: CarDetailsResponse + CarPolicy: + required: + - CategoryCode + type: object + properties: + CategoryCode: + type: string + description: "The category that this policy applies to (e.g. cancellation, + drivers license requirements, driver age requirements) " + example: Guarantee + PolicyText: + type: string + description: The raw text of the policy.This is generally localized into the + requested language, but may be English if no other translations are + available. + example: Credit card required. + description: A list of policies that apply to this car rental. + Duration: + required: + - Count + - Unit + type: object + properties: + Unit: + type: string + description: The unit for minimum amount of time for a rental. + example: Day + Count: + type: integer + description: The minimum number of units that qualify for minimum amount of time + for a rental. + format: int64 + example: 1 + description: The maximum amount of time for a rental that still qualifies for + this rate.This may or may not be the same as the current rental + duration. + Equipment: + required: + - Code + - Name + type: object + properties: + Code: + type: string + description: Special equipment code + example: BabyChildSeat + Name: + type: string + description: Special equipment name + example: Baby Child Seat + RatePeriod: + type: string + description: Unit indicating the price of special equipment. Support + value:Trip,Daily + example: Trip + Price: + $ref: "#/components/schemas/CarsMoney" + description: Description and costs of any optional special equipment that may be + rented with the car. + ExtraFees: + required: + - Amount + - Unit + - UnitCount + type: object + properties: + Unit: + type: string + description: "Rate period beyond the base rate. Supported values: ExtraHourly, + ExtraDaily" + example: ExtraHourly + UnitCount: + type: integer + description: Numbers of period + format: int64 + example: 2 + Amount: + $ref: "#/components/schemas/CarsMoney" + description: List of ExtraFeesDetails + RentalLimits: + required: + - MaxDuration + - MinDuration + type: object + properties: + MinDuration: + $ref: "#/components/schemas/Duration" + MaxDuration: + $ref: "#/components/schemas/Duration" + description: Limitations that are part of this rental agreement. + TaxesAndFees: + required: + - Amount + - Description + type: object + properties: + Description: + type: string + description: TaxesAndFees description + example: "Rental, CONSOLIDATED FACILITY CHG 4.00/DAY\t" + Amount: + $ref: "#/components/schemas/CarsMoney" + description: List of TaxesAndFees Details + CarsValidFormsOfPayment: + required: + - BrandName + - PaymentMethod + - PaymentSubMethod + type: object + properties: + PaymentMethod: + type: string + description: Method of payment + example: CreditCard + PaymentSubMethod: + type: string + description: Sub method of payment + example: American Express + BrandName: + type: string + description: The brand name of the payment sub-method to be displayed to the + customer. In many cases it will be the same as the payment + sub-method, but "Visa/Carte Bleue" and "Visa/Delta are some of the + exceptions. + example: American Express + description: List of all the forms of payment that will be accepted for the + booking of this rental transaction. + APIMError: + title: APIMError + properties: + message: + type: string + PresignedUrlResponse: + type: object + properties: + transactionId: + type: string + description: Unique identifier for each API response. + error: + $ref: "#/components/schemas/Fault" + warning: + $ref: "#/components/schemas/Fault" + bestMatchedFile: + $ref: "#/components/schemas/FileInfo" + otherFileOptions: + type: array + items: + $ref: "#/components/schemas/FileInfo" + description: Container for file Pre-signed download URL and informations. + FileInfo: + type: object + properties: + partner: + nullable: true + type: string + description: "The partner associated with the file. List of partners: `Bing`, + `Criteo`, `Facebook`, `Google`, `Retarget`, `Snapchat`." + brand: + nullable: true + type: string + description: "The brand associated with the file content. List of brand: + `Expedia`, `Hotels`, `Hotwire`, `Vrbo`, `HomeAway`, `Abritel`, + `Bookabach`, `Stayz`, `Ebbokers`, `Travalocity`, `Orbitz`, `Wotif`." + fileContentType: + nullable: true + type: string + description: "The type associated with the file content. List of types: + `Amenities`, `Descriptions`, `Images`, `Listings`, `Locations`, + `Policies`, `Regions`, `Reviews`, `Summary`, `VacationRental`" + locale: + nullable: true + type: string + description: The locale associated with the file content. + fileName: + type: string + description: File name. + size: + $ref: "#/components/schemas/FileSize" + fileLastUpdated: + type: string + description: The time about the file last updated. The format is + uuuu-MM-dd'T'HH:mm:ss.SSSX + downloadUrl: + type: string + description: Pre-signed URL is a self signed URL generated for a resource in S3 + with a set expiration time. + downloadUrlExpires: + type: string + description: The time about the download Url expires. The format is + uuuu-MM-dd'T'HH:mm:ss.SSSX + filterConditions: + $ref: "#/components/schemas/FilterConditions" + bestMatchedLink: + $ref: "#/components/schemas/SdpLink" + Fault: + type: object + description: API returned information. + properties: + code: + type: string + description: Fault code. + description: + type: string + description: Fault description. + FileSize: + type: object + description: The information about the file size. + properties: + unit: + type: string + enum: + - KB + - MB + - GB + description: The unit about the file size. + value: + type: integer + format: int64 + description: The value about the file size. + FilterConditions: + nullable: true + type: object + description: Container filter condition for the filtered file. + [Filters](https://confluence.expedia.biz/display/EWS/Filtered+Feed+File+Generation+Schedule+and+Access#FilteredFeedFileGenerationScheduleandAccess-Filters) + properties: + pointOfSupply: + type: string + description: "List of filter condition for PointOfSupplies: `US`, + `AT`,`BR`,`CA`,`FR`,`DE`,`GR`,`IT`, `JP`,`KR`,`MX`,`PT`,`ES`,`TR`, + `AE`,`GB`." + brand: + type: string + description: "List of filter condition for Brands: `VRBO`." + structureType: + type: string + description: "List of filter condition for StructureTypes: `VR`, `CONVENTIONAL`." + SdpLink: + nullable: true + type: object + description: Contains link information, including link address, request method. + Only provided if FileInfo is in OtherFileOptions. + properties: + href: + type: string + description: a link address. + method: + type: string + description: Request method, it will support `GET`, `POST`, `DELETE` and `PUT` + etc... + SdpAPIMError: + type: object + description: Error from the APIM. + properties: + message: + type: string + description: Error from the APIM. + securitySchemes: + Authorization: + type: http + scheme: basic diff --git a/customizations/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt b/customizations/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt index 09778913f..b930fe0d9 100644 --- a/customizations/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt +++ b/customizations/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt @@ -40,9 +40,6 @@ class OpenApiSdkGenerator { "README.md", "ApiException.kt", "LinkableOperation.kt", - "PropertyConstraintViolation.kt", - "PropertyConstraintsValidator.kt", - "PropertyConstraintViolationException.kt", "ApiAbstractions.kt" ) @@ -147,27 +144,6 @@ class OpenApiSdkGenerator { "ApiException.kt" ) ) - add( - SupportingFile( - "validation/propertyConstraintViolationException.mustache", - "$packagePath/models/exception/", - "PropertyConstraintViolationException.kt" - ) - ) - add( - SupportingFile( - "validation/propertyConstraintViolation.mustache", - "$packagePath/models/exception/", - "PropertyConstraintViolation.kt" - ) - ) - add( - SupportingFile( - "validation/propertyConstraintsValidator.mustache", - "$packagePath/validation/", - "PropertyConstraintsValidator.kt" - ) - ) add( TemplateDefinition( diff --git a/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-listings-operation-params/rooms.kt b/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-listings-operation-params/rooms.kt index 86f9a3144..804d09cac 100644 --- a/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-listings-operation-params/rooms.kt +++ b/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-listings-operation-params/rooms.kt @@ -1,5 +1,11 @@ fun rooms(rooms: List) = apply { + if (rooms.size > 8) { + throw PropertyConstraintViolationException( + constraintViolations = listOf("rooms: size must be between 0 and 8") + ) + } + rooms.elementAtOrNull(0)?.let { this.room1Adults = it.adults this.room1ChildAges = it.childAges?.map { item -> item.toString() } diff --git a/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-quotes-operation-params/rooms.kt b/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-quotes-operation-params/rooms.kt index 86f9a3144..804d09cac 100644 --- a/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-quotes-operation-params/rooms.kt +++ b/customizations/generator/openapi/src/main/resources/post-processor/assets/templates/get-lodging-quotes-operation-params/rooms.kt @@ -1,5 +1,11 @@ fun rooms(rooms: List) = apply { + if (rooms.size > 8) { + throw PropertyConstraintViolationException( + constraintViolations = listOf("rooms: size must be between 0 and 8") + ) + } + rooms.elementAtOrNull(0)?.let { this.room1Adults = it.adults this.room1ChildAges = it.childAges?.map { item -> item.toString() } diff --git a/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/client.mustache b/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/client.mustache index edf97bf48..11c895595 100644 --- a/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/client.mustache +++ b/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/client.mustache @@ -52,7 +52,6 @@ class {{clientClassname}}Client private constructor(clientConfiguration: XapClie } appendHeaders(extraHeaders) - validateConstraints(operation.requestBody) contentType(ContentType.Application.Json) setBody(operation.requestBody) } diff --git a/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/operation_params.mustache b/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/operation_params.mustache index de3958995..aeaea1529 100644 --- a/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/operation_params.mustache +++ b/customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/operation_params.mustache @@ -3,13 +3,25 @@ {{#hasNonBodyParams}} package com.expediagroup.sdk.{{namespace}}.operations + import com.expediagroup.sdk.core.model.exception.client.PropertyConstraintViolationException import com.expediagroup.sdk.core.model.OperationParams + import {{packageName}}.infrastructure.* import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.ktor.http.Headers import io.ktor.http.Parameters + import javax.validation.constraints.Max + import javax.validation.constraints.Min + import javax.validation.constraints.NotNull + import javax.validation.constraints.Pattern + import javax.validation.constraints.Size + import javax.validation.Valid + import javax.validation.Validation + + import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator + /** {{#nonBodyParams}} {{#params}} @@ -21,6 +33,7 @@ data class {{classname}}Params( {{#nonBodyParams}} {{#params}} + {{>models/constraints}} {{>modelMutable}} {{>client/apiParam}}{{^-last}}, {{/-last}} {{/params}} {{/nonBodyParams}} @@ -67,32 +80,36 @@ {{/nonBodyParams}} fun build(): {{classname}}Params { - {{#hasRequiredParams}} - validateNullity() - {{/hasRequiredParams}} - - return {{classname}}Params( + val params = {{classname}}Params( {{#nonBodyParams}} {{#params}} {{{paramName}}} = {{{paramName}}}{{#required}}!!{{/required}}{{^-last}},{{/-last}} {{/params}} {{/nonBodyParams}} ) + + validate(params) + + return params } - {{#hasRequiredParams}} - private fun validateNullity() { - {{#nonBodyParams}} - {{#params}} - {{#required}} - if ({{{paramName}}} == null) { - throw NullPointerException("Required parameter {{{paramName}}} is missing") - } - {{/required}} - {{/params}} - {{/nonBodyParams}} + private fun validate(params: {{classname}}Params) { + 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}" } + ) } - {{/hasRequiredParams}} + } } fun toBuilder() = Builder( diff --git a/examples/src/main/java/com/expediagroup/sdk/xap/examples/scenarios/lodging/AvailabilityCalendarsQuickStartScenario.java b/examples/src/main/java/com/expediagroup/sdk/xap/examples/scenarios/lodging/AvailabilityCalendarsQuickStartScenario.java index f42782225..279fe7e70 100644 --- a/examples/src/main/java/com/expediagroup/sdk/xap/examples/scenarios/lodging/AvailabilityCalendarsQuickStartScenario.java +++ b/examples/src/main/java/com/expediagroup/sdk/xap/examples/scenarios/lodging/AvailabilityCalendarsQuickStartScenario.java @@ -20,10 +20,10 @@ import com.expediagroup.sdk.xap.models.AvailabilityCalendarResponse; import com.expediagroup.sdk.xap.operations.GetLodgingAvailabilityCalendarsOperation; import com.expediagroup.sdk.xap.operations.GetLodgingAvailabilityCalendarsOperationParams; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.HashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This example demonstrates how to use Availability Calendar api with simple search.