Skip to content

Commit

Permalink
Fix access level for InvocationResponse properties
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-mladenovic committed Mar 24, 2018
1 parent 19b0cc8 commit 77f8813
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/AwsLambda/AwsLambda.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions Sources/AwsLambda/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public enum FunctionError: String, Codable {
}

public struct InvocationResponse<T: Decodable> {
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
Expand Down
8 changes: 4 additions & 4 deletions Tests/AwsLambdaTests/AwsLambdaTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AwsLambdaTests: XCTestCase {

func testInvokeSuccess() {
let publishExpectation = expectation(description: "InvokeExpectation")
lambdaClient?.function(with: "AwsLambdaTestSuccess").invoke(completion: { (response: InvocationResponse<String>) in
lambdaClient?.function(named: "AwsLambdaTestSuccess").invoke(completion: { (response: InvocationResponse<String>) in
XCTAssertNil(response.errorDescription)
XCTAssertNil(response.logResult)
XCTAssertNil(response.functionError)
Expand All @@ -39,7 +39,7 @@ class AwsLambdaTests: XCTestCase {

func testInvokeLogging() {
let publishExpectation = expectation(description: "InvokeExpectation")
lambdaClient?.function(with: "AwsLambdaTestSuccess").invoke(logType: .tail, completion: { (response: InvocationResponse<String>) in
lambdaClient?.function(named: "AwsLambdaTestSuccess").invoke(logType: .tail, completion: { (response: InvocationResponse<String>) in
XCTAssertNil(response.errorDescription)
XCTAssertNotNil(response.logResult)
XCTAssertNil(response.functionError)
Expand All @@ -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<TestPayload>) in
lambdaClient?.function(named: "AwsLambdaTestPayload").invoke(payload: payload, completion: { (response: InvocationResponse<TestPayload>) in
XCTAssertNil(response.errorDescription)
XCTAssertNil(response.logResult)
XCTAssertNil(response.functionError)
Expand All @@ -68,7 +68,7 @@ class AwsLambdaTests: XCTestCase {

func testInvokeFailed() {
let publishExpectation = expectation(description: "InvokeExpectation")
lambdaClient?.function(with: "AwsLambdaTestFailed").invoke(completion: { (response: InvocationResponse<String>) in
lambdaClient?.function(named: "AwsLambdaTestFailed").invoke(completion: { (response: InvocationResponse<String>) in
XCTAssertNotNil(response.errorDescription)
XCTAssertNil(response.logResult)
XCTAssert(response.functionError == .handled)
Expand Down

0 comments on commit 77f8813

Please sign in to comment.