From 77f8813b689adf72f63a0c59a84f6a4f29f32cda Mon Sep 17 00:00:00 2001 From: Nikola Mladenovic Date: Sat, 24 Mar 2018 20:06:21 +0100 Subject: [PATCH] Fix access level for InvocationResponse properties --- README.md | 2 +- Sources/AwsLambda/AwsLambda.swift | 4 ++-- Sources/AwsLambda/Models.swift | 8 ++++---- Tests/AwsLambdaTests/AwsLambdaTests.swift | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cbf998f..51354c0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ import AwsLambda To use library first initialize the `AwsLambda` instance with your credentials and host. After that initialize `AwsLambdaFunction` instance: ``` swift let awsLambda = AwsLambda(host: "https://dynamodb.us-west-2.amazonaws.com", accessKeyId: "OPKASPJPOAS23IOJS", secretAccessKey: "232(I(%$jnasoijaoiwj2919109233") -let testFunction = awsLambda.table(name: "test-function") +let testFunction = awsLambda.function(named: "test-function") ``` To invoke the function use the `invoke` method of the `AwsLambdaFunction` instance: ``` swift diff --git a/Sources/AwsLambda/AwsLambda.swift b/Sources/AwsLambda/AwsLambda.swift index 482b176..5def10c 100644 --- a/Sources/AwsLambda/AwsLambda.swift +++ b/Sources/AwsLambda/AwsLambda.swift @@ -32,9 +32,9 @@ public class AwsLambda { /// Initializes `AwsLambdaFunction` instance for given function name. /// - /// - Parameter name: The name of the function. + /// - Parameter named: The name of the function. /// - Returns: `AwsLambdaFunction` instance. - public func function(with name: String) -> AwsLambdaFunction { + public func function(named name: String) -> AwsLambdaFunction { return AwsLambdaFunction(name: name, awsLambda: self) } diff --git a/Sources/AwsLambda/Models.swift b/Sources/AwsLambda/Models.swift index 07c58e8..1c95bf3 100644 --- a/Sources/AwsLambda/Models.swift +++ b/Sources/AwsLambda/Models.swift @@ -17,10 +17,10 @@ public enum FunctionError: String, Codable { } public struct InvocationResponse { - let payload: T? // Available only if invocation type is 'requestResponse'. - let logResult: String? - let functionError: FunctionError? - let errorDescription: String? + public let payload: T? // Available only if invocation type is 'requestResponse'. + public let logResult: String? + public let functionError: FunctionError? + public let errorDescription: String? init(payload: T? = nil, logResult: String? = nil, functionError: FunctionError? = nil, errorDescription: String? = nil) { self.payload = payload diff --git a/Tests/AwsLambdaTests/AwsLambdaTests.swift b/Tests/AwsLambdaTests/AwsLambdaTests.swift index e03c212..7c5b83f 100644 --- a/Tests/AwsLambdaTests/AwsLambdaTests.swift +++ b/Tests/AwsLambdaTests/AwsLambdaTests.swift @@ -25,7 +25,7 @@ class AwsLambdaTests: XCTestCase { func testInvokeSuccess() { let publishExpectation = expectation(description: "InvokeExpectation") - lambdaClient?.function(with: "AwsLambdaTestSuccess").invoke(completion: { (response: InvocationResponse) in + lambdaClient?.function(named: "AwsLambdaTestSuccess").invoke(completion: { (response: InvocationResponse) in XCTAssertNil(response.errorDescription) XCTAssertNil(response.logResult) XCTAssertNil(response.functionError) @@ -39,7 +39,7 @@ class AwsLambdaTests: XCTestCase { func testInvokeLogging() { let publishExpectation = expectation(description: "InvokeExpectation") - lambdaClient?.function(with: "AwsLambdaTestSuccess").invoke(logType: .tail, completion: { (response: InvocationResponse) in + lambdaClient?.function(named: "AwsLambdaTestSuccess").invoke(logType: .tail, completion: { (response: InvocationResponse) in XCTAssertNil(response.errorDescription) XCTAssertNotNil(response.logResult) XCTAssertNil(response.functionError) @@ -54,7 +54,7 @@ class AwsLambdaTests: XCTestCase { func testInvokePayload() { let publishExpectation = expectation(description: "InvokeExpectation") let payload = TestPayload(name: "Mrvica", number: 666) - lambdaClient?.function(with: "AwsLambdaTestPayload").invoke(payload: payload, completion: { (response: InvocationResponse) in + lambdaClient?.function(named: "AwsLambdaTestPayload").invoke(payload: payload, completion: { (response: InvocationResponse) in XCTAssertNil(response.errorDescription) XCTAssertNil(response.logResult) XCTAssertNil(response.functionError) @@ -68,7 +68,7 @@ class AwsLambdaTests: XCTestCase { func testInvokeFailed() { let publishExpectation = expectation(description: "InvokeExpectation") - lambdaClient?.function(with: "AwsLambdaTestFailed").invoke(completion: { (response: InvocationResponse) in + lambdaClient?.function(named: "AwsLambdaTestFailed").invoke(completion: { (response: InvocationResponse) in XCTAssertNotNil(response.errorDescription) XCTAssertNil(response.logResult) XCTAssert(response.functionError == .handled)