Skip to content

Commit b7a7388

Browse files
committed
chore: Move CRT dependency from SmithyHTTPAPI to ClientRuntime
1 parent a019370 commit b7a7388

File tree

4 files changed

+45
-34
lines changed

4 files changed

+45
-34
lines changed

Package.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ let package = Package(
177177
),
178178
.target(
179179
name: "SmithyHTTPAPI",
180-
dependencies: [
181-
"Smithy",
182-
.product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift")
183-
]
180+
dependencies: ["Smithy"]
184181
),
185182
.target(
186183
name: "SmithyHTTPClient",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// Copyright Amazon.com Inc. or its affiliates.
3+
// All Rights Reserved.
4+
//
5+
// SPDX-License-Identifier: Apache-2.0
6+
//
7+
8+
import enum AwsCommonRuntimeKit.EndpointProperty
9+
import struct Foundation.URLComponents
10+
import enum Smithy.ClientError
11+
import struct SmithyHTTPAPI.Endpoint
12+
import struct SmithyHTTPAPI.Headers
13+
import enum SmithyHTTPAPI.EndpointPropertyValue
14+
15+
extension Endpoint {
16+
17+
public init(urlString: String,
18+
headers: Headers = Headers(),
19+
endpointProperties: [String: EndpointProperty]) throws {
20+
guard let url = URLComponents(string: urlString)?.url else {
21+
throw ClientError.unknownError("invalid url \(urlString)")
22+
}
23+
24+
let properties = endpointProperties.mapValues(EndpointPropertyValue.init)
25+
try self.init(url: url, headers: headers, properties: properties)
26+
}
27+
}
28+
29+
extension EndpointPropertyValue {
30+
31+
init(_ endpointProperty: EndpointProperty) {
32+
switch endpointProperty {
33+
case .bool(let value):
34+
self = .bool(value)
35+
case .string(let value):
36+
self = .string(value)
37+
case .array(let values):
38+
self = .array(values.map(EndpointPropertyValue.init))
39+
case .dictionary(let dict):
40+
self = .dictionary(dict.mapValues(EndpointPropertyValue.init))
41+
}
42+
}
43+
}

Sources/SmithyHTTPAPI/Endpoint.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import enum AwsCommonRuntimeKit.EndpointProperty
98
import Foundation
109
import Smithy
1110

@@ -80,19 +79,6 @@ public struct Endpoint: Sendable, Equatable {
8079
}
8180
}
8281

83-
extension Endpoint {
84-
public init(urlString: String,
85-
headers: Headers = Headers(),
86-
endpointProperties: [String: EndpointProperty]) throws {
87-
guard let url = URLComponents(string: urlString)?.url else {
88-
throw ClientError.unknownError("invalid url \(urlString)")
89-
}
90-
91-
let properties = endpointProperties.mapValues(EndpointPropertyValue.init)
92-
try self.init(url: url, headers: headers, properties: properties)
93-
}
94-
}
95-
9682
extension Endpoint {
9783

9884
/// Returns list of auth schemes

Sources/SmithyHTTPAPI/EndpointPropertyValue.swift

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import enum AwsCommonRuntimeKit.EndpointProperty
8+
//import enum AwsCommonRuntimeKit.EndpointProperty
99
import Foundation
1010
import Smithy
1111

@@ -22,21 +22,6 @@ public extension EndpointPropertyValue {
2222
init(_ bool: Bool) { self = .bool(bool) }
2323
}
2424

25-
extension EndpointPropertyValue {
26-
init(_ endpointProperty: EndpointProperty) {
27-
switch endpointProperty {
28-
case .bool(let value):
29-
self = .bool(value)
30-
case .string(let value):
31-
self = .string(value)
32-
case .array(let values):
33-
self = .array(values.map(EndpointPropertyValue.init))
34-
case .dictionary(let dict):
35-
self = .dictionary(dict.mapValues(EndpointPropertyValue.init))
36-
}
37-
}
38-
}
39-
4025
extension EndpointPropertyValue: ExpressibleByStringLiteral {
4126
public init(stringLiteral value: String) {
4227
self = .string(value)

0 commit comments

Comments
 (0)