Skip to content

Commit 6075a82

Browse files
authored
chore: Publish v1.2.0 (#123)
1 parent 46cf951 commit 6075a82

File tree

177 files changed

+34316
-6404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+34316
-6404
lines changed

code/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<dependency>
66
<groupId>com.expediagroup</groupId>
77
<artifactId>xap-sdk</artifactId>
8-
<version>1.1.0</version>
8+
<version>1.2.0</version>
99
</dependency>
1010
```
1111

code/pom.xml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.expediagroup</groupId>
66
<artifactId>xap-sdk</artifactId>
7-
<version>1.1.0</version>
7+
<version>1.2.0</version>
88
<name>EG xap-sdk for Java</name>
9-
<description>EG xap-sdk v1.1.0</description>
9+
<description>EG xap-sdk v1.2.0</description>
1010
<url>https://github.com/ExpediaGroup/test-sdk</url>
1111
<inceptionYear>2022</inceptionYear>
1212
<packaging>jar</packaging>
@@ -63,27 +63,27 @@
6363
<sdk-title>${project.artifactId}</sdk-title>
6464

6565
<!-- Plugin Versions -->
66-
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
66+
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
6767
<maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
6868
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
6969
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
7070
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
7171
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
7272
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
73-
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
73+
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
7474
<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
75-
<ktlint-plugin.version>3.4.0</ktlint-plugin.version>
76-
<jacoco-plugin.version>0.8.12</jacoco-plugin.version>
77-
<dokka-plugin.version>1.9.20</dokka-plugin.version>
75+
<ktlint-plugin.version>3.5.0</ktlint-plugin.version>
76+
<jacoco-plugin.version>0.8.13</jacoco-plugin.version>
77+
<dokka-plugin.version>2.0.0</dokka-plugin.version>
7878
<dokka-old-versions.location/> <!-- passed as a property when running dokka:dokka-->
7979
<properties.maven.plugin.version>1.2.1</properties.maven.plugin.version>
8080
<maven.licence.plugin.version>4.6</maven.licence.plugin.version>
81-
<flatten.maven.plugin.version>1.6.0</flatten.maven.plugin.version>
82-
<kotlin.version>2.0.21</kotlin.version>
83-
<kotlinx.coroutines.version>1.9.0</kotlinx.coroutines.version>
84-
<ktor.version>2.3.13</ktor.version>
85-
<kotlin-atomic.version>0.26.1</kotlin-atomic.version>
86-
<slf4j.version>2.0.16</slf4j.version>
81+
<flatten.maven.plugin.version>1.7.0</flatten.maven.plugin.version>
82+
<kotlin.version>2.1.20</kotlin.version>
83+
<kotlinx.coroutines.version>1.10.1</kotlinx.coroutines.version>
84+
<ktor.version>3.1.2</ktor.version>
85+
<kotlin-atomic.version>0.27.0</kotlin-atomic.version>
86+
<slf4j.version>2.0.17</slf4j.version>
8787
<maven.nexus-staging.plugin.version>1.7.0</maven.nexus-staging.plugin.version>
8888
<maven.gpg.plugin.version>3.2.7</maven.gpg.plugin.version>
8989
</properties>
@@ -131,19 +131,19 @@
131131
<dependency>
132132
<groupId>com.fasterxml.jackson</groupId>
133133
<artifactId>jackson-bom</artifactId>
134-
<version>2.18.2</version>
134+
<version>2.18.3</version>
135135
<type>pom</type>
136136
<scope>import</scope>
137137
</dependency>
138138
<dependency>
139139
<groupId>com.squareup.okio</groupId>
140140
<artifactId>okio-jvm</artifactId>
141-
<version>3.9.1</version>
141+
<version>3.10.2</version>
142142
</dependency>
143143
<dependency>
144144
<groupId>org.jetbrains</groupId>
145145
<artifactId>annotations</artifactId>
146-
<version>26.0.1</version>
146+
<version>26.0.2</version>
147147
</dependency>
148148
<dependency>
149149
<groupId>org.hibernate.validator</groupId>
@@ -153,7 +153,7 @@
153153
<dependency>
154154
<groupId>com.fasterxml.jackson.core</groupId>
155155
<artifactId>jackson-annotations</artifactId>
156-
<version>2.18.2</version>
156+
<version>2.18.3</version>
157157
</dependency>
158158
</dependencies>
159159
</dependencyManagement>
@@ -449,6 +449,7 @@
449449
<plugin>
450450
<groupId>org.jetbrains.dokka</groupId>
451451
<artifactId>dokka-maven-plugin</artifactId>
452+
<version>${dokka-plugin.version}</version>
452453
<configuration>
453454
<sourceDirectories>
454455
<dir>${project.basedir}/src/main/kotlin/com/expediagroup/sdk/xap</dir>
@@ -732,13 +733,13 @@
732733
<dependency>
733734
<groupId>org.apache.commons</groupId>
734735
<artifactId>commons-lang3</artifactId>
735-
<version>3.14.0</version>
736+
<version>3.17.0</version>
736737
</dependency>
737738

738739
<dependency>
739740
<groupId>org.apache.commons</groupId>
740741
<artifactId>commons-text</artifactId>
741-
<version>1.12.0</version>
742+
<version>1.13.1</version>
742743
</dependency>
743744

744745
<dependency>

code/src/main/kotlin/com/expediagroup/sdk/core/client/Client.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import okhttp3.Dispatcher
5454
import okhttp3.OkHttpClient
5555

5656
// Create a Dispatcher with limits
57-
val dispatcher =
57+
val configuredDispatcher =
5858
Dispatcher().apply {
5959
maxRequests = 10000 // Maximum number of concurrent requests
6060
maxRequestsPerHost = 1000
@@ -64,7 +64,7 @@ val DEFAULT_HTTP_CLIENT_ENGINE: HttpClientEngine =
6464
OkHttp.create {
6565
config {
6666
eventListenerFactory(OkHttpEventListener.FACTORY)
67-
dispatcher(dispatcher)
67+
dispatcher(configuredDispatcher)
6868
}
6969
}
7070

code/src/main/kotlin/com/expediagroup/sdk/core/client/ExpediaGroupClient.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,20 @@ abstract class ExpediaGroupClient(
6767
return self()
6868
}
6969
}
70+
71+
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
72+
abstract class BuilderWithHttpClient<SELF : Client.BuilderWithHttpClient<SELF>> : Client.BuilderWithHttpClient<SELF>() {
73+
/** Sets the API auth endpoint to use for requests. */
74+
protected var authEndpoint: String? = null
75+
76+
/** Sets the API auth endpoint to use for requests.
77+
*
78+
* @param authEndpoint The API auth endpoint to use for requests.
79+
* @return The [Builder] instance.
80+
*/
81+
fun authEndpoint(authEndpoint: String): SELF {
82+
this.authEndpoint = authEndpoint
83+
return self()
84+
}
85+
}
7086
}

code/src/main/kotlin/com/expediagroup/sdk/core/configuration/provider/XapConfigurationProvider.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
*/
1616
package com.expediagroup.sdk.core.configuration.provider
1717

18-
import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.connectionTimeout
19-
import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.endpoint
20-
import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.name
21-
import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.requestTimeout
22-
import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider.socketTimeout
2318
import com.expediagroup.sdk.core.constant.Constant
2419

2520
/**

code/src/main/kotlin/com/expediagroup/sdk/core/constant/Constant.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
*/
1616
package com.expediagroup.sdk.core.constant
1717

18-
import io.ktor.client.plugins.HttpTimeout
18+
import io.ktor.client.plugins.HttpTimeoutConfig
1919

2020
internal object Constant {
2121
const val EMPTY_STRING = ""
2222
const val TEN_SECONDS_IN_MILLIS = 10_000L
2323
const val FIFTEEN_SECONDS_IN_MILLIS = 15_000L
24-
const val INFINITE_TIMEOUT = HttpTimeout.INFINITE_TIMEOUT_MS
24+
const val INFINITE_TIMEOUT = HttpTimeoutConfig.INFINITE_TIMEOUT_MS
2525

2626
private const val SUCCESSFUL_STATUS_CODES_RANGE_START = 200
2727
private const val SUCCESSFUL_STATUS_CODES_RANGE_END = 299

code/src/main/kotlin/com/expediagroup/sdk/core/constant/LogMaskingRegex.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
*/
1616
package com.expediagroup.sdk.core.constant
1717

18+
import com.expediagroup.sdk.core.constant.LoggingMessage.OMITTED
19+
1820
internal object LogMaskingRegex {
1921
val FIELD_REGEX = "^[a-zA-Z0-9-_]+$".toRegex()
2022

21-
val NUMBER_FIELD_REGEX = "(?<=[\"']?number[\"']?:\\s?[\"'])(\\s*\\d{15,16}\\s*)(?=[\"'])".toRegex()
23+
const val REPLACEMENT_TEMPLATE = "\"$1$2${OMITTED}\""
2224
}

code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,38 @@
1616
package com.expediagroup.sdk.core.constant.provider
1717

1818
internal object LogMaskingRegexProvider {
19-
fun getMaskedFieldsRegex(maskedBodyFields: Set<String>) = "(?<=[\"']?(${maskedBodyFields.joinToString("|")})[\"']?:\\s?[\"'])(\\s*[^\"']+\\s*)(?=[\"'])".toRegex()
19+
/**
20+
* Generates a regex pattern to match specified fields in a JSON string.
21+
*
22+
* @param maskedBodyFields the set of fields to be masked
23+
* @param valueToMatch regex pattern to match the value of the fields. Default: match any sequence of characters except double quotes.
24+
* @return the regex pattern to match the specified fields and their values
25+
*/
26+
fun getMaskedFieldsRegex(
27+
maskedBodyFields: Set<String>,
28+
valueToMatch: String = "[^\\\"]+"
29+
): Regex {
30+
val fields = maskedBodyFields.joinToString("|")
31+
// The pattern matches:
32+
// - The field name (one of the specified fields) captured in group 1.
33+
// - Optional backslash, closing double quotes, colon(:), optional whitespace, and opening double quotes.
34+
// - The value of the field, matching the specified valueToMatch pattern.
35+
// - Optional backslash, followed by a closing double quote
36+
return "\"($fields)(\\\\?\"\\s*:\\s*\\\\*\")$valueToMatch(?:\\\\?\")".toRegex()
37+
}
38+
39+
/**
40+
* Generates a regex pattern to match a specified field in a JSON string.
41+
*
42+
* @param maskedBodyField the field to be masked
43+
* @param valueToMatch regex pattern to match the value of the field. Default: match any sequence of characters except double quotes.
44+
* @return the regex pattern to match the specified field and its value
45+
*/
46+
fun getMaskedFieldsRegex(
47+
maskedBodyField: String,
48+
valueToMatch: String = "[^\\\"]+"
49+
): Regex {
50+
val fields = setOf(maskedBodyField)
51+
return getMaskedFieldsRegex(fields, valueToMatch)
52+
}
2053
}

code/src/main/kotlin/com/expediagroup/sdk/core/model/paging/ResponseState.kt

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,10 @@
1616
package com.expediagroup.sdk.core.model.paging
1717

1818
import com.expediagroup.sdk.core.client.Client
19-
import com.expediagroup.sdk.core.constant.HeaderValue
2019
import com.expediagroup.sdk.core.model.Response
21-
import com.expediagroup.sdk.core.plugin.logging.GZipEncoder.decode
22-
import com.expediagroup.sdk.core.plugin.logging.contentEncoding
2320
import io.ktor.client.statement.HttpResponse
24-
import io.ktor.util.InternalAPI
25-
import io.ktor.util.moveToByteArray
26-
import io.ktor.utils.io.ByteReadChannel
27-
import io.ktor.utils.io.bits.Memory
21+
import io.ktor.client.statement.bodyAsBytes
2822
import kotlinx.coroutines.runBlocking
29-
import java.nio.ByteBuffer
3023

3124
internal interface ResponseState<T> {
3225
fun getNextResponse(): Response<T>
@@ -63,22 +56,10 @@ internal class FetchLinkState<T>(
6356

6457
override fun hasNext(): Boolean = true
6558

66-
private suspend fun parseBody(response: HttpResponse): T = if (decodeBody(response).isEmpty()) fallbackBody else getBody(response)
67-
68-
private suspend fun decodeBody(response: HttpResponse): String {
69-
val byteReadChannel = prepareByteReadChannel(response)
70-
val decodedByteReadChannel = if (response.contentEncoding().equals(HeaderValue.GZIP)) client.httpClient.decode(byteReadChannel) else byteReadChannel
71-
val bodyString: String = decodedByteReadChannel.readRemaining().readText()
72-
return bodyString
73-
}
74-
75-
@OptIn(InternalAPI::class)
76-
private suspend fun prepareByteReadChannel(response: HttpResponse): ByteReadChannel {
77-
val bufferSize = response.content.availableForRead
78-
val buffer = ByteBuffer.allocate(bufferSize)
79-
val numberOfBytesRead = response.content.peekTo(Memory(buffer), 0, 0, 0, bufferSize.toLong()).toInt()
80-
val byteReadChannel = ByteReadChannel(buffer.moveToByteArray(), 0, numberOfBytesRead)
81-
return byteReadChannel
59+
private suspend fun parseBody(response: HttpResponse): T {
60+
// response.bodyAsBytes() applies all plugins
61+
// if content-length header is set, response.contentLength could be used instead
62+
return if (response.bodyAsBytes().isEmpty()) fallbackBody else getBody(response)
8263
}
8364
}
8465

code/src/main/kotlin/com/expediagroup/sdk/core/plugin/authentication/strategy/AuthenticationStrategy.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import com.expediagroup.sdk.core.plugin.authentication.AuthenticationConfigurati
2020
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.BASIC
2121
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.BEARER
2222
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy.AuthenticationType.SIGNATURE
23-
import io.ktor.client.plugins.auth.Auth
23+
import io.ktor.client.plugins.auth.AuthConfig
2424
import io.ktor.client.request.HttpRequestBuilder
2525

2626
internal interface AuthenticationStrategy {
27-
fun loadAuth(auth: Auth) {}
27+
fun loadAuth(auth: AuthConfig) {}
2828

2929
fun isTokenAboutToExpire(): Boolean
3030

0 commit comments

Comments
 (0)