Skip to content

Commit cf5e756

Browse files
github-actions[bot]dtayehmohnoor94
authored
chore: Publish v5.3.2 (#277)
Co-authored-by: dtayeh <[email protected]> Co-authored-by: Dana AlTayeh <[email protected]> Co-authored-by: Mohammad Noor Abu Khleif <[email protected]>
1 parent da7da46 commit cf5e756

20 files changed

+87
-277
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>rapid-sdk</artifactId>
8-
<version>5.3.1</version>
8+
<version>5.3.2</version>
99
</dependency>
1010
```
1111

code/pom.xml

Lines changed: 13 additions & 12 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>rapid-sdk</artifactId>
7-
<version>5.3.1</version>
7+
<version>5.3.2</version>
88
<name>EG rapid-sdk for Java</name>
9-
<description>EG rapid-sdk v5.3.1</description>
9+
<description>EG rapid-sdk v5.3.2</description>
1010
<url>https://github.com/ExpediaGroup/test-sdk</url>
1111
<inceptionYear>2022</inceptionYear>
1212
<packaging>jar</packaging>
@@ -72,17 +72,17 @@
7272
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
7373
<maven-surefire-plugin.version>3.5.2</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>
75+
<ktlint-plugin.version>3.5.0</ktlint-plugin.version>
7676
<jacoco-plugin.version>0.8.12</jacoco-plugin.version>
77-
<dokka-plugin.version>1.9.20</dokka-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>
8181
<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>
82+
<kotlin.version>2.1.0</kotlin.version>
83+
<kotlinx.coroutines.version>1.10.1</kotlinx.coroutines.version>
84+
<ktor.version>3.0.3</ktor.version>
85+
<kotlin-atomic.version>0.27.0</kotlin-atomic.version>
8686
<slf4j.version>2.0.16</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>
@@ -138,12 +138,12 @@
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>
@@ -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/rapid</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.0</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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,19 @@
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+
fun getMaskedFieldsRegex(
20+
maskedBodyFields: Set<String>,
21+
value: String = "[^\\\"]+"
22+
): Regex {
23+
val fields = maskedBodyFields.joinToString("|")
24+
return "\"($fields)(\\\\*\"\\s*:\\s*\\\\*\")$value(?:\\\\?\"|)".toRegex()
25+
}
26+
27+
fun getMaskedFieldsRegex(
28+
maskedBodyField: String,
29+
value: String = "[^\\\"]+"
30+
): Regex {
31+
val fields = setOf(maskedBodyField)
32+
return getMaskedFieldsRegex(fields, value)
33+
}
2034
}

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)