Skip to content

Commit 3ff2c71

Browse files
chore: Publish v1.0.0 (#38)
1 parent b3a876b commit 3ff2c71

File tree

322 files changed

+42293
-0
lines changed

Some content is hidden

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

322 files changed

+42293
-0
lines changed

code/LICENSE-HEADER.txt

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

code/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Welcome to the xap-sdk SDK!
2+
3+
## Usage
4+
```xml
5+
<dependency>
6+
<groupId>com.expediagroup</groupId>
7+
<artifactId>xap-sdk</artifactId>
8+
<version>1.0.0</version>
9+
</dependency>
10+
```
11+
12+
## License
13+
14+
This project is licensed under the Apache License v2.0 - see the [LICENSE](LICENSE) for details.

code/pom.xml

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (C) 2022 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+
package com.expediagroup.sdk.core.client
17+
18+
import com.expediagroup.sdk.core.configuration.RapidClientConfiguration
19+
import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector
20+
import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider
21+
import com.expediagroup.sdk.core.configuration.provider.RapidConfigurationProvider
22+
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy
23+
import io.ktor.client.HttpClient
24+
import io.ktor.client.engine.HttpClientEngine
25+
import io.ktor.client.engine.okhttp.OkHttp
26+
27+
/**
28+
* The integration point between the SDK Core and the product SDKs.
29+
*
30+
* @param httpClientEngine The HTTP client engine to use.
31+
* @param clientConfiguration The configuration for the client.
32+
*/
33+
abstract class BaseRapidClient(
34+
namespace: String,
35+
clientConfiguration: RapidClientConfiguration,
36+
httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE
37+
) : Client(namespace) {
38+
private val _configurationProvider: ConfigurationProvider =
39+
ConfigurationCollector.create(
40+
clientConfiguration.toProvider(),
41+
RapidConfigurationProvider
42+
)
43+
44+
private val engine: HttpClientEngine =
45+
_configurationProvider.okHttpClient?.let {
46+
OkHttp.create {
47+
preconfigured = it
48+
}
49+
} ?: httpClientEngine
50+
51+
private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.SIGNATURE, engine)
52+
53+
init {
54+
finalize()
55+
}
56+
57+
override val configurationProvider: ConfigurationProvider
58+
get() = _configurationProvider
59+
60+
override val httpClient: HttpClient
61+
get() = _httpClient
62+
63+
/** A [BaseRapidClient] builder. */
64+
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
65+
abstract class Builder<SELF : Builder<SELF>> : HttpConfigurableBuilder<SELF>()
66+
67+
/** A [BaseRapidClient] builder with ability to pass a custom okhttp client. */
68+
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
69+
abstract class BuilderWithHttpClient<SELF : Client.BuilderWithHttpClient<SELF>> : Client.BuilderWithHttpClient<SELF>()
70+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (C) 2022 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+
package com.expediagroup.sdk.core.client
17+
18+
import com.expediagroup.sdk.core.configuration.XapClientConfiguration
19+
import com.expediagroup.sdk.core.configuration.collector.ConfigurationCollector
20+
import com.expediagroup.sdk.core.configuration.provider.ConfigurationProvider
21+
import com.expediagroup.sdk.core.configuration.provider.XapConfigurationProvider
22+
import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationStrategy
23+
import io.ktor.client.HttpClient
24+
import io.ktor.client.engine.HttpClientEngine
25+
import io.ktor.client.engine.okhttp.OkHttp
26+
27+
/**
28+
* The integration point between the SDK Core and the product SDKs.
29+
*
30+
* @param httpClientEngine The HTTP client engine to use.
31+
* @param clientConfiguration The configuration for the client.
32+
*/
33+
abstract class BaseXapClient(
34+
namespace: String,
35+
clientConfiguration: XapClientConfiguration,
36+
httpClientEngine: HttpClientEngine = DEFAULT_HTTP_CLIENT_ENGINE
37+
) : Client(namespace) {
38+
private val _configurationProvider: ConfigurationProvider =
39+
ConfigurationCollector.create(
40+
clientConfiguration.toProvider(),
41+
XapConfigurationProvider
42+
)
43+
44+
private val engine: HttpClientEngine =
45+
_configurationProvider.okHttpClient?.let {
46+
OkHttp.create {
47+
preconfigured = it
48+
}
49+
} ?: httpClientEngine
50+
51+
private val _httpClient: HttpClient = buildHttpClient(_configurationProvider, AuthenticationStrategy.AuthenticationType.BASIC, engine)
52+
53+
init {
54+
finalize()
55+
}
56+
57+
override val configurationProvider: ConfigurationProvider
58+
get() = _configurationProvider
59+
60+
override val httpClient: HttpClient
61+
get() = _httpClient
62+
63+
/** A [BaseXapClient] builder. */
64+
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
65+
abstract class Builder<SELF : Builder<SELF>> : HttpConfigurableBuilder<SELF>()
66+
67+
/** A [BaseXapClient] builder with ability to pass a custom okhttp client. */
68+
@Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients.
69+
abstract class BuilderWithHttpClient<SELF : Client.BuilderWithHttpClient<SELF>> : Client.BuilderWithHttpClient<SELF>()
70+
}

0 commit comments

Comments
 (0)