Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<dependency>
<groupId>com.expediagroup</groupId>
<artifactId>rapid-sdk</artifactId>
<version>5.3.2</version>
<version>5.3.2+ads-SNAPSHOT</version>
</dependency>
```

Expand Down
14 changes: 7 additions & 7 deletions code/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.expediagroup</groupId>
<artifactId>rapid-sdk</artifactId>
<version>5.3.2</version>
<version>5.3.2+ads-SNAPSHOT</version>
<name>EG rapid-sdk for Java</name>
<description>EG rapid-sdk v5.3.2</description>
<description>EG rapid-sdk v5.3.2+ads-SNAPSHOT</description>
<url>https://github.com/ExpediaGroup/test-sdk</url>
<inceptionYear>2022</inceptionYear>
<packaging>jar</packaging>
Expand Down Expand Up @@ -63,7 +63,7 @@
<sdk-title>${project.artifactId}</sdk-title>

<!-- Plugin Versions -->
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
Expand All @@ -79,9 +79,9 @@
<properties.maven.plugin.version>1.2.1</properties.maven.plugin.version>
<maven.licence.plugin.version>4.6</maven.licence.plugin.version>
<flatten.maven.plugin.version>1.6.0</flatten.maven.plugin.version>
<kotlin.version>2.1.0</kotlin.version>
<kotlin.version>2.1.10</kotlin.version>
<kotlinx.coroutines.version>1.10.1</kotlinx.coroutines.version>
<ktor.version>3.0.3</ktor.version>
<ktor.version>3.1.1</ktor.version>
<kotlin-atomic.version>0.27.0</kotlin-atomic.version>
<slf4j.version>2.0.16</slf4j.version>
<maven.nexus-staging.plugin.version>1.7.0</maven.nexus-staging.plugin.version>
Expand Down Expand Up @@ -131,7 +131,7 @@
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.18.2</version>
<version>2.18.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -153,7 +153,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.18.2</version>
<version>2.18.3</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,38 @@
package com.expediagroup.sdk.core.constant.provider

internal object LogMaskingRegexProvider {
/**
* Generates a regex pattern to match specified fields in a JSON string.
*
* @param maskedBodyFields the set of fields to be masked
* @param valueToMatch regex pattern to match the value of the fields. Default: match any sequence of characters except double quotes.
* @return the regex pattern to match the specified fields and their values
*/
fun getMaskedFieldsRegex(
maskedBodyFields: Set<String>,
value: String = "[^\\\"]+"
valueToMatch: String = "[^\\\"]+"
): Regex {
val fields = maskedBodyFields.joinToString("|")
return "\"($fields)(\\\\*\"\\s*:\\s*\\\\*\")$value(?:\\\\?\"|)".toRegex()
// The pattern matches:
// - The field name (one of the specified fields) captured in group 1.
// - Optional backslash, closing double quotes, colon(:), optional whitespace, and opening double quotes.
// - The value of the field, matching the specified valueToMatch pattern.
// - Optional backslash, followed by a closing double quote
return "\"($fields)(\\\\?\"\\s*:\\s*\\\\*\")$valueToMatch(?:\\\\?\")".toRegex()
}

/**
* Generates a regex pattern to match a specified field in a JSON string.
*
* @param maskedBodyField the field to be masked
* @param valueToMatch regex pattern to match the value of the field. Default: match any sequence of characters except double quotes.
* @return the regex pattern to match the specified field and its value
*/
fun getMaskedFieldsRegex(
maskedBodyField: String,
value: String = "[^\\\"]+"
valueToMatch: String = "[^\\\"]+"
): Regex {
val fields = setOf(maskedBodyField)
return getMaskedFieldsRegex(fields, value)
return getMaskedFieldsRegex(fields, valueToMatch)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import com.expediagroup.sdk.rapid.operations.DeleteRoomOperation
import com.expediagroup.sdk.rapid.operations.DeleteRoomOperationParams
import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperation
import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperationParams
import com.expediagroup.sdk.rapid.operations.GetAdsOperation
import com.expediagroup.sdk.rapid.operations.GetAdsOperationParams
import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperation
import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperationParams
import com.expediagroup.sdk.rapid.operations.GetBookingReceiptOperation
Expand Down Expand Up @@ -896,6 +898,107 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
}
}

/**
*
* Returns relevant ads.
* @param operation [GetAdsOperation]
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type AdsResponse
*/
fun execute(operation: GetAdsOperation): Response<AdsResponse> = execute<AdsRequest, AdsResponse>(operation)

/**
*
* Returns relevant ads.
* @param operation [GetAdsOperation]
* @throws ExpediaGroupApiErrorException
* @return a [CompletableFuture<Response>] object with a body of type AdsResponse
*/
fun executeAsync(operation: GetAdsOperation): CompletableFuture<Response<AdsResponse>> = executeAsync<AdsRequest, AdsResponse>(operation)

private suspend inline fun kgetAdsWithResponse(
customerId: kotlin.String,
customerIp: kotlin.String? =
null,
customerSessionId: kotlin.String? =
null,
adsRequest: AdsRequest? =
null
): Response<AdsResponse> {
val params =
GetAdsOperationParams(
customerIp = customerIp,
customerSessionId = customerSessionId,
customerId = customerId
)

val operation =
GetAdsOperation(
params,
adsRequest
)

return execute(operation)
}

/**
*
* Returns relevant ads.
* @param customerId An obfuscated unique identifier for each customer. This should not contain any personal information such as email, first or last name.
* @param customerIp IP address of the customer, as captured by your integration. Ensure your integration passes the customer's IP, not your own. Used for fraud recovery and other important analytics. (optional)
* @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session. (optional)
* @param adsRequest (optional)
* @throws ExpediaGroupApiErrorException
* @return AdsResponse
*/
@Throws(
ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdsOperation)"))
fun getAds(
customerId: kotlin.String,
customerIp: kotlin.String? =
null,
customerSessionId: kotlin.String? =
null,
adsRequest: AdsRequest? =
null
): AdsResponse = getAdsWithResponse(customerId, customerIp, customerSessionId, adsRequest).data

/**
*
* Returns relevant ads.
* @param customerId An obfuscated unique identifier for each customer. This should not contain any personal information such as email, first or last name.
* @param customerIp IP address of the customer, as captured by your integration. Ensure your integration passes the customer's IP, not your own. Used for fraud recovery and other important analytics. (optional)
* @param customerSessionId Insert your own unique value for each user session, beginning with the first API call. Continue to pass the same value for each subsequent API call during the user's session, using a new value for every new customer session. (optional)
* @param adsRequest (optional)
* @throws ExpediaGroupApiErrorException
* @return a [Response] object with a body of type AdsResponse
*/
@Throws(
ExpediaGroupApiErrorException::class
)
@JvmOverloads
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdsOperation)"))
fun getAdsWithResponse(
customerId: kotlin.String,
customerIp: kotlin.String? =
null,
customerSessionId: kotlin.String? =
null,
adsRequest: AdsRequest? =
null
): Response<AdsResponse> {
try {
return GlobalScope.future(Dispatchers.IO) {
kgetAdsWithResponse(customerId, customerIp, customerSessionId, adsRequest)
}.get()
} catch (exception: Exception) {
exception.handle()
}
}

/**
* Get property room rates and availability
* Returns rates on available room types for specified properties (maximum of 250 properties per request). The response includes rate details such as promos, whether the rate is refundable, cancellation penalties and a full price breakdown to meet the price display requirements for your market. _Note_: If there are no available rooms, the response will be an empty array. * Multiple rooms of the same type may be requested by including multiple instances of the `occupancy` parameter. * The `nightly` array includes each individual night's charges. When the total price includes fees, charges, or adjustments that are not divided by night, these amounts will be included in the `stay` rate array, which details charges applied to the entire stay (each check-in).
Expand Down
Loading