Skip to content

Commit 0e9f198

Browse files
committed
swift-format
1 parent a7a7570 commit 0e9f198

30 files changed

+1620
-1381
lines changed

Examples/Simple/Package.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import PackageDescription
55
let package = Package(
66
name: "swift-aws-lambda-events-samples",
77
platforms: [
8-
.macOS(.v12),
8+
.macOS(.v12)
99
],
1010
products: [
1111
// demonstrate how to integrate with AWS API Gateway
12-
.executable(name: "APIGateway", targets: ["APIGateway"]),
12+
.executable(name: "APIGateway", targets: ["APIGateway"])
1313
],
1414
dependencies: [
1515
// this is the dependency on the swift-aws-lambda-runtime library
@@ -21,9 +21,12 @@ let package = Package(
2121
.package(name: "swift-aws-lambda-events", path: "../.."),
2222
],
2323
targets: [
24-
.executableTarget(name: "APIGateway", dependencies: [
25-
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
26-
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"),
27-
]),
24+
.executableTarget(
25+
name: "APIGateway",
26+
dependencies: [
27+
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
28+
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"),
29+
]
30+
)
2831
]
2932
)

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let swiftSettings: [SwiftSetting] = [.enableExperimentalFeature("StrictConcurren
77
let package = Package(
88
name: "swift-aws-lambda-events",
99
products: [
10-
.library(name: "AWSLambdaEvents", targets: ["AWSLambdaEvents"]),
10+
.library(name: "AWSLambdaEvents", targets: ["AWSLambdaEvents"])
1111
],
1212
dependencies: [
1313
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
@@ -17,14 +17,14 @@ let package = Package(
1717
.target(
1818
name: "AWSLambdaEvents",
1919
dependencies: [
20-
.product(name: "HTTPTypes", package: "swift-http-types"),
20+
.product(name: "HTTPTypes", package: "swift-http-types")
2121
],
2222
swiftSettings: swiftSettings
2323
),
2424
.testTarget(
2525
name: "AWSLambdaEventsTests",
2626
dependencies: [
27-
"AWSLambdaEvents",
27+
"AWSLambdaEvents"
2828
],
2929
swiftSettings: swiftSettings
3030
),

Sources/AWSLambdaEvents/APIGatewayLambdaAuthorizers.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ public struct APIGatewayLambdaAuthorizerSimpleResponse: Codable, Sendable {
6060
public let isAuthorized: Bool
6161
public let context: LambdaAuthorizerContext?
6262

63-
public init(isAuthorized: Bool,
64-
context: LambdaAuthorizerContext?) {
63+
public init(
64+
isAuthorized: Bool,
65+
context: LambdaAuthorizerContext?
66+
) {
6567
self.isAuthorized = isAuthorized
6668
self.context = context
6769
}

Sources/AWSLambdaEvents/AppSync.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ public struct AppSyncEvent: Decodable, Sendable {
2929
} else if let dictionaryValue = try? container.decode([String: String].self) {
3030
self = .dictionary(dictionaryValue)
3131
} else {
32-
throw DecodingError.dataCorruptedError(in: container, debugDescription: """
33-
Unexpected AppSync argument.
34-
Expected a String or a Dictionary.
35-
""")
32+
throw DecodingError.dataCorruptedError(
33+
in: container,
34+
debugDescription: """
35+
Unexpected AppSync argument.
36+
Expected a String or a Dictionary.
37+
"""
38+
)
3639
}
3740
}
3841

@@ -127,10 +130,13 @@ public struct AppSyncEvent: Decodable, Sendable {
127130
} else if let cognitoIdentity = try? container.decode(CognitoUserPoolIdentity.self) {
128131
self = .cognitoUserPools(cognitoIdentity)
129132
} else {
130-
throw DecodingError.dataCorruptedError(in: container, debugDescription: """
131-
Unexpected Identity argument.
132-
Expected a IAM Identity or a Cognito User Pool Identity.
133-
""")
133+
throw DecodingError.dataCorruptedError(
134+
in: container,
135+
debugDescription: """
136+
Unexpected Identity argument.
137+
Expected a IAM Identity or a Cognito User Pool Identity.
138+
"""
139+
)
134140
}
135141
}
136142

Sources/AWSLambdaEvents/Cognito.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,14 @@ extension CognitoEvent: Codable {
189189
let userName = try container.decode(String.self, forKey: .userName)
190190
let callerContext = try container.decode(CallerContext.self, forKey: .callerContext)
191191

192-
let params = CognitoEvent.Parameters(version: version, triggerSource: triggerSource, region: region, userPoolId: userPoolId, userName: userName, callerContext: callerContext)
192+
let params = CognitoEvent.Parameters(
193+
version: version,
194+
triggerSource: triggerSource,
195+
region: region,
196+
userPoolId: userPoolId,
197+
userName: userName,
198+
callerContext: callerContext
199+
)
193200

194201
switch triggerSource {
195202
case .preSignUp_SignUp, .preSignUp_ExternalProvider, .preSignUp_AdminCreateUser:
@@ -204,7 +211,9 @@ extension CognitoEvent: Codable {
204211
let value = try container.decode(CognitoEvent.PostAuthentication.self, forKey: .request)
205212
self = .postAuthentication(params, value)
206213

207-
case .customMessage_SignUp, .customMessage_AdminCreateUser, .customMessage_ResendCode, .customMessage_ForgotPassword, .customMessage_UpdateUserAttribute, .customMessage_VerifyUserAttribute, .customMessage_Authentication:
214+
case .customMessage_SignUp, .customMessage_AdminCreateUser, .customMessage_ResendCode,
215+
.customMessage_ForgotPassword, .customMessage_UpdateUserAttribute, .customMessage_VerifyUserAttribute,
216+
.customMessage_Authentication:
208217
let value = try container.decode(CognitoEvent.CustomMessage.self, forKey: .request)
209218
self = .customMessage(params, value)
210219

@@ -317,7 +326,14 @@ extension CognitoEventResponse: Codable {
317326
let userName = try container.decode(String.self, forKey: .userName)
318327
let callerContext = try container.decode(CognitoEvent.CallerContext.self, forKey: .callerContext)
319328

320-
let params = CognitoEvent.Parameters(version: version, triggerSource: triggerSource, region: region, userPoolId: userPoolId, userName: userName, callerContext: callerContext)
329+
let params = CognitoEvent.Parameters(
330+
version: version,
331+
triggerSource: triggerSource,
332+
region: region,
333+
userPoolId: userPoolId,
334+
userName: userName,
335+
callerContext: callerContext
336+
)
321337

322338
switch triggerSource {
323339
case .preSignUp_SignUp, .preSignUp_AdminCreateUser, .preSignUp_ExternalProvider:
@@ -338,7 +354,9 @@ extension CognitoEventResponse: Codable {
338354

339355
self = .postAuthentication(params, request, response)
340356

341-
case .customMessage_SignUp, .customMessage_AdminCreateUser, .customMessage_ResendCode, .customMessage_ForgotPassword, .customMessage_UpdateUserAttribute, .customMessage_VerifyUserAttribute, .customMessage_Authentication:
357+
case .customMessage_SignUp, .customMessage_AdminCreateUser, .customMessage_ResendCode,
358+
.customMessage_ForgotPassword, .customMessage_UpdateUserAttribute, .customMessage_VerifyUserAttribute,
359+
.customMessage_Authentication:
342360
let request = try container.decode(CognitoEvent.CustomMessage.self, forKey: .request)
343361
let response = try container.decode(CognitoEventResponse.CustomMessage.self, forKey: .response)
344362

0 commit comments

Comments
 (0)