Skip to content

Commit 830d20c

Browse files
committed
Fix docs
1 parent ae303c6 commit 830d20c

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

Sources/AWSLambdaRuntimeCore/Lambda+Codable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public struct LambdaCodableAdapter<
9393
@usableFromInline var byteBuffer: ByteBuffer = .init()
9494

9595
/// Initializes an instance given an encoder, decoder, and a handler with a non-`Void` output.
96-
/// - Parameters:
96+
/// - Parameters:
9797
/// - encoder: The encoder object that will be used to encode the generic `Output` obtained from the `handler`'s `outputWriter` into a `ByteBuffer`.
9898
/// - decoder: The decoder object that will be used to decode the received `ByteBuffer` event into the generic `Event` type served to the `handler`.
9999
/// - handler: The handler object.
@@ -106,8 +106,8 @@ public struct LambdaCodableAdapter<
106106

107107
/// Initializes an instance given a decoder, and a handler with a `Void` output.
108108
/// - Parameters:
109-
/// - decoder: The decoder object that will be used to decode the received `ByteBuffer` event into the generic `Event` type served to the `handler`.
110-
/// - handler: The handler object.
109+
/// - decoder: The decoder object that will be used to decode the received `ByteBuffer` event into the generic `Event` type served to the `handler`.
110+
/// - handler: The handler object.
111111
@inlinable
112112
public init(decoder: Decoder, handler: Handler) where Output == Void, Encoder == VoidEncoder {
113113
self.encoder = VoidEncoder()

Sources/AWSLambdaRuntimeCore/LambdaHandlers.swift

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import NIOCore
1616

17-
/// The base handler protocol that receives a ``ByteBuffer`` representing the incoming event and returns the response as a ``ByteBuffer`` too.
17+
/// The base handler protocol that receives a `ByteBuffer` representing the incoming event and returns the response as a `ByteBuffer` too.
1818
/// This handler protocol supports response streaming. Bytes can be streamed outwards through the ``LambdaResponseStreamWriter``
1919
/// passed as an argument in the ``handle(_:responseWriter:context:)`` function.
2020
/// Background work can also be executed after returning the response. After closing the response stream by calling
@@ -69,12 +69,12 @@ public protocol LambdaHandler {
6969
/// The body of the request sent to Lambda will be decoded into this type for the handler to consume.
7070
associatedtype Event: Decodable
7171
/// Generic output type.
72-
/// This is the return type of the ``handle(_:context:)`` function.
72+
/// This is the return type of the ``LambdaHandler/handle(_:context:)`` function.
7373
associatedtype Output
7474

7575
/// Implement the business logic of the Lambda function here.
7676
/// - Parameters:
77-
/// - event: The generic ``Event`` object representing the invocation's input data.
77+
/// - event: The generic ``LambdaHandler/Event`` object representing the invocation's input data.
7878
/// - context: The ``LambdaContext`` containing the invocation's metadata.
7979
/// - Returns: A generic ``Output`` object representing the computed result.
8080
func handle(_ event: Event, context: LambdaContext) async throws -> Output
@@ -83,8 +83,9 @@ public protocol LambdaHandler {
8383
/// This protocol is exactly like ``LambdaHandler``, with the only difference being the added support for executing background
8484
/// work after the result has been sent to the AWS Lambda control plane.
8585
/// This is achieved by not having a return type in the `handle` function. The output is instead written into a
86-
/// ``LambdaResponseWriter``that is passed in as an argument, meaning that the ``handle(_:)`` function is then free to implement
87-
/// any background work after the result has been sent to the AWS Lambda control plane.
86+
/// ``LambdaResponseWriter``that is passed in as an argument, meaning that the
87+
/// ``LambdaWithBackgroundProcessingHandler/handle(_:outputWriter:context:)`` function is then
88+
/// free to implement any background work after the result has been sent to the AWS Lambda control plane.
8889
public protocol LambdaWithBackgroundProcessingHandler {
8990
/// Generic input type.
9091
/// The body of the request sent to Lambda will be decoded into this type for the handler to consume.
@@ -95,7 +96,7 @@ public protocol LambdaWithBackgroundProcessingHandler {
9596

9697
/// Implement the business logic of the Lambda function here.
9798
/// - Parameters:
98-
/// - event: The generic ``Event`` object representing the invocation's input data.
99+
/// - event: The generic ``LambdaWithBackgroundProcessingHandler/Event`` object representing the invocation's input data.
99100
/// - outputWriter: The writer to send the computed response to. A call to `outputWriter.write(_:)` will return the response to the AWS Lambda response endpoint.
100101
/// Any background work can then be executed before returning.
101102
/// - context: The ``LambdaContext`` containing the invocation's metadata.
@@ -111,7 +112,7 @@ public protocol LambdaWithBackgroundProcessingHandler {
111112
/// have a return type and exit at that point. This allows for background work to be executed _after_ a response has been sent to the AWS Lambda response endpoint.
112113
public protocol LambdaResponseWriter<Output> {
113114
associatedtype Output
114-
/// Sends the generic ``Output`` object (representing the computed result of the handler)
115+
/// Sends the generic ``LambdaResponseWriter/Output`` object (representing the computed result of the handler)
115116
/// to the AWS Lambda response endpoint.
116117
/// This function simply serves as a mechanism to return the computed result from a handler function
117118
/// without an explicit `return`.
@@ -131,18 +132,18 @@ public struct StreamingClosureHandler: StreamingLambdaHandler {
131132
self.body = body
132133
}
133134

134-
/// Calls the provided `self.body` closure with the ``ByteBuffer`` invocation event, the ``LambdaResponseStreamWriter``, and the ``LambdaContext``
135+
/// Calls the provided `self.body` closure with the `ByteBuffer` invocation event, the ``LambdaResponseStreamWriter``, and the ``LambdaContext``
135136
/// - Parameters:
136137
/// - event: The invocation's input data.
137138
/// - responseWriter: A ``LambdaResponseStreamWriter`` to write the invocation's response to.
138-
/// If no response or error is written to `responseWriter` an error will be reported to the invoker.
139+
/// If no response or error is written to `responseWriter` an error will be reported to the invoker.
139140
/// - context: The ``LambdaContext`` containing the invocation's metadata.
140141
public func handle(
141-
_ request: ByteBuffer,
142+
_ event: ByteBuffer,
142143
responseWriter: some LambdaResponseStreamWriter,
143144
context: LambdaContext
144145
) async throws {
145-
try await self.body(request, responseWriter, context)
146+
try await self.body(event, responseWriter, context)
146147
}
147148
}
148149

@@ -163,9 +164,9 @@ public struct ClosureHandler<Event: Decodable, Output>: LambdaHandler {
163164
self.body = body
164165
}
165166

166-
/// Calls the provided `self.body` closure with the generic ``Event`` object representing the incoming event, and the ``LambdaContext``
167+
/// Calls the provided `self.body` closure with the generic `Event` object representing the incoming event, and the ``LambdaContext``
167168
/// - Parameters:
168-
/// - event: The generic ``Event`` object representing the invocation's input data.
169+
/// - event: The generic `Event` object representing the invocation's input data.
169170
/// - context: The ``LambdaContext`` containing the invocation's metadata.
170171
public func handle(_ event: Event, context: LambdaContext) async throws -> Output {
171172
try await self.body(event, context)
@@ -183,8 +184,8 @@ extension LambdaRuntime {
183184

184185
/// Initialize an instance with a ``LambdaHandler`` defined in the form of a closure **with a non-`Void` return type**, an encoder, and a decoder.
185186
/// - Parameter body: The handler in the form of a closure.
186-
/// - Parameter encoder: The encoder object that will be used to encode the generic ``Output`` into a ``ByteBuffer``.
187-
/// - Parameter decoder: The decoder object that will be used to decode the incoming ``ByteBuffer`` event into the generic ``Event`` type.
187+
/// - Parameter encoder: The encoder object that will be used to encode the generic `Output` into a `ByteBuffer`.
188+
/// - Parameter decoder: The decoder object that will be used to decode the incoming `ByteBuffer` event into the generic `Event` type.
188189
public convenience init<
189190
Event: Decodable,
190191
Output: Encodable,
@@ -214,9 +215,9 @@ extension LambdaRuntime {
214215
}
215216

216217
/// Initialize an instance with a ``LambdaHandler`` defined in the form of a closure **with a `Void` return type**, an encoder, and a decoder.
217-
/// - Parameter body: The handler in the form of a closure.
218-
/// - Parameter encoder: The encoder object that will be used to encode the generic ``Output`` into a ``ByteBuffer``.
219-
/// - Parameter decoder: The decoder object that will be used to decode the incoming ``ByteBuffer`` event into the generic ``Event`` type.
218+
/// - Parameters:
219+
/// - decoder: The decoder object that will be used to decode the incoming `ByteBuffer` event into the generic `Event` type.
220+
/// - body: The handler in the form of a closure.
220221
public convenience init<Event: Decodable, Decoder: LambdaEventDecoder>(
221222
decoder: Decoder,
222223
body: @escaping (Event, LambdaContext) async throws -> Void

0 commit comments

Comments
 (0)