@@ -33,11 +33,42 @@ The framework handles the underlying AWS Lambda event processing, allowing you t
33
33
4 . The handler returns a response, which is serialized back to the API Gateway format
34
34
35
35
## Getting Started
36
+
37
+ Install the package by adding it to your ` Package.swift ` file:
38
+
39
+ ``` swift
40
+ // swift-tools-version:6.1
41
+ // The swift-tools-version declares the minimum version of Swift required to build this package.
42
+
43
+ import PackageDescription
44
+
45
+ let package = Package (
46
+ name : " BreezeWebHook" ,
47
+ platforms : [
48
+ .macOS (.v15 )
49
+ ],
50
+ products : [
51
+ .executable (name : " WebHook" , targets : [" WebHook" ]),
52
+ ],
53
+ dependencies : [
54
+ .package (url : " https://github.com/swift-serverless/BreezeLambdaWebHook.git" , branch : " main" ),
55
+ .package (url : " https://github.com/andrea-scuderi/swift-aws-lambda-runtime.git" , branch : " main" ),
56
+ ],
57
+ targets : [
58
+ .executableTarget (
59
+ name : " WebHook" ,
60
+ dependencies : [
61
+ .product (name : " BreezeLambdaWebHook" , package : " BreezeLambdaWebHook" ),
62
+ ]
63
+ )
64
+ ]
65
+ )
66
+ ```
36
67
37
68
To create a webhook handler, implement the BreezeLambdaWebHookHandler protocol:
38
69
39
70
``` swift
40
- class MyWebhook : BreezeLambdaWebHookHandler {
71
+ class Webhook : BreezeLambdaWebHookHandler {
41
72
let handlerContext: HandlerContext
42
73
43
74
required init (handlerContext : HandlerContext) {
@@ -51,7 +82,7 @@ class MyWebhook: BreezeLambdaWebHookHandler {
51
82
}
52
83
```
53
84
54
- Then, implement the ` main.swift ` file to run the Lambda function:
85
+ Then, implement the ` @ main` to run the Lambda function:
55
86
``` swift
56
87
import BreezeLambdaWebHook
57
88
import AWSLambdaEvents
@@ -63,7 +94,7 @@ import NIOCore
63
94
@main
64
95
struct BreezeDemoHTTPApplication {
65
96
static func main () async throws {
66
- let app = BreezeLambdaWebHook< DemoLambdaHandler > (name : " BreezeDemoHTTPApplication " )
97
+ let app = BreezeLambdaWebHook< WebHook > (name : " WebHook " )
67
98
try await app.run ()
68
99
}
69
100
}
0 commit comments