Skip to content

Commit 7d017a5

Browse files
fix: cleanups
1 parent 8f025db commit 7d017a5

File tree

14 files changed

+191
-26
lines changed

14 files changed

+191
-26
lines changed

examples/build.gradle.kts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
plugins {
2-
id("java")
3-
}
4-
51
group = project.property("GROUP_ID") as String
62

7-
repositories {
8-
mavenCentral()
9-
}
10-
113
dependencies {
12-
implementation(project(":xap-sdk"))
4+
api(project(":xap-sdk"))
5+
6+
implementation("com.expediagroup:expediagroup-sdk-transport-okhttp:0.0.4-alpha")
137

148
implementation("org.apache.logging.log4j:log4j-api:2.24.3")
159
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.24.3")

examples/src/main/java/com/expediagroup/sdk/xap/examples/scenarios/XapScenario.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.expediagroup.sdk.xap.examples.scenarios;
22

3+
import com.expediagroup.sdk.core.auth.basic.BasicCredentials;
34
import com.expediagroup.sdk.xap.client.XapClient;
45

56
/**
@@ -19,10 +20,15 @@ public interface XapScenario {
1920
default XapClient createClient() {
2021
String key = System.getProperty("com.expediagroup.xapjavasdk.apikey");
2122
String secret = System.getProperty("com.expediagroup.xapjavasdk.apisecret");
23+
24+
BasicCredentials credentials = new BasicCredentials(key, secret);
25+
26+
// Or enable OAuth by passing OAuthCredentials instead:
27+
// OAuthCredentials credentials = new OAuthCredentials("api-key", "api-secret");
28+
2229
return XapClient
23-
.builder()
24-
.key(key)
25-
.secret(secret)
26-
.build();
30+
.builder()
31+
.credentials(credentials)
32+
.build();
2733
}
2834
}

examples/src/main/java/com/expediagroup/sdk/xap/examples/scenarios/lodging/VrboScenario.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.expediagroup.sdk.xap.examples.scenarios.lodging;
22

3+
import com.expediagroup.sdk.core.auth.basic.BasicCredentials;
4+
import com.expediagroup.sdk.core.auth.oauth.OAuthCredentials;
35
import com.expediagroup.sdk.xap.client.XapClient;
46
import com.expediagroup.sdk.xap.examples.scenarios.XapScenario;
57

@@ -18,11 +20,16 @@ public interface VrboScenario extends XapScenario {
1820
default XapClient createClient() {
1921
String key = System.getProperty("com.expediagroup.xapjavasdk.vrbokey");
2022
String secret = System.getProperty("com.expediagroup.xapjavasdk.vrbosecret");
23+
24+
BasicCredentials credentials = new BasicCredentials(key, secret);
25+
26+
// Or enable OAuth by passing OAuthCredentials instead:
27+
// OAuthCredentials credentials = new OAuthCredentials("api-key", "api-secret");
28+
2129
return XapClient
22-
.builder()
23-
.key(key)
24-
.secret(secret)
25-
.build();
30+
.builder()
31+
.credentials(credentials)
32+
.build();
2633
}
2734

2835
}

xap-sdk/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ plugins {
55

66
dependencies {
77
api("com.expediagroup:expediagroup-sdk-rest:0.0.4-alpha-SNAPSHOT")
8-
implementation("com.expediagroup:expediagroup-sdk-transport-okhttp:0.0.4-alpha")
98
implementation("com.fasterxml.jackson.core:jackson-databind:2.18.2")
109
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")
1110
runtimeOnly("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")

xap-sdk/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ARTIFACT_NAME=xap-sdk
22
DESCRIPTION=The Expedia API Platform (XAP) SDK
33

4-
VERSION=2.0.1-alpha-SNAPSHOT
4+
VERSION=2.0.0-beta

xap-sdk/src/main/kotlin/com/expediagroup/sdk/xap/client/AsyncXapClient.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2025 Expedia, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.expediagroup.sdk.xap.client
218

319
import com.expediagroup.sdk.rest.AsyncRestClient

xap-sdk/src/main/kotlin/com/expediagroup/sdk/xap/client/XapClient.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2025 Expedia, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.expediagroup.sdk.xap.client
218

319
import com.expediagroup.sdk.rest.RestClient

xap-sdk/src/main/kotlin/com/expediagroup/sdk/xap/configuration/Constant.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2025 Expedia, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.expediagroup.sdk.xap.configuration
218

319
internal object Constant {

xap-sdk/src/main/kotlin/com/expediagroup/sdk/xap/configuration/XapClientConfiguration.kt

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2025 Expedia, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.expediagroup.sdk.xap.configuration
218

319
import com.expediagroup.sdk.core.auth.common.Credentials
@@ -35,6 +51,12 @@ abstract class ClientBuilder<T : RestClient> {
3551
private var credentials: Credentials? = null
3652
private var transport: Transport? = null
3753

54+
/**
55+
* Sets the credentials used to authenticate with the API.
56+
*
57+
* @param credentials
58+
* @return The builder instance.
59+
*/
3860
fun credentials(credentials: Credentials) = apply { this.credentials = credentials }
3961

4062
/**
@@ -56,7 +78,7 @@ abstract class ClientBuilder<T : RestClient> {
5678
* Builds the configuration for the XAP client.
5779
*
5880
* @return The built [XapClientConfiguration] instance.
59-
* @throws IllegalArgumentException If the key or secret is not provided.
81+
* @throws IllegalArgumentException If the credentials type is unsupported
6082
*/
6183
protected fun buildConfig(): XapClientConfiguration {
6284
require(credentials != null) {
@@ -79,6 +101,12 @@ abstract class AsyncClientBuilder<T : AsyncRestClient> {
79101
private var credentials: Credentials? = null
80102
private var asyncTransport: AsyncTransport? = null
81103

104+
/**
105+
* Sets the credentials used to authenticate with the API.
106+
*
107+
* @param credentials
108+
* @return The builder instance.
109+
*/
82110
fun credentials(credentials: Credentials) = apply { this.credentials = credentials }
83111

84112
/**
@@ -100,7 +128,7 @@ abstract class AsyncClientBuilder<T : AsyncRestClient> {
100128
* Builds the configuration for the asynchronous XAP client.
101129
*
102130
* @return The built [AsyncXapClientConfiguration] instance.
103-
* @throws IllegalArgumentException If the key or secret is not provided.
131+
* @throws IllegalArgumentException If the credentials type is unsupported
104132
*/
105133
protected fun buildConfig(): AsyncXapClientConfiguration {
106134
require(credentials != null) {

xap-sdk/src/main/kotlin/com/expediagroup/sdk/xap/configuration/XapJacksonObjectMapper.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2025 Expedia, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.expediagroup.sdk.xap.configuration
218

319
import com.fasterxml.jackson.databind.DeserializationFeature

0 commit comments

Comments
 (0)