Skip to content

Commit 45e355c

Browse files
author
Andrea Scuderi
committed
Add package instructions
1 parent ec2b6bf commit 45e355c

File tree

1 file changed

+34
-3
lines changed
  • Sources/BreezeLambdaWebHook/Docs.docc

1 file changed

+34
-3
lines changed

Sources/BreezeLambdaWebHook/Docs.docc/Docs.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,42 @@ The framework handles the underlying AWS Lambda event processing, allowing you t
3333
4. The handler returns a response, which is serialized back to the API Gateway format
3434

3535
## 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+
```
3667

3768
To create a webhook handler, implement the BreezeLambdaWebHookHandler protocol:
3869

3970
```swift
40-
class MyWebhook: BreezeLambdaWebHookHandler {
71+
class Webhook: BreezeLambdaWebHookHandler {
4172
let handlerContext: HandlerContext
4273

4374
required init(handlerContext: HandlerContext) {
@@ -51,7 +82,7 @@ class MyWebhook: BreezeLambdaWebHookHandler {
5182
}
5283
```
5384

54-
Then, implement the `main.swift` file to run the Lambda function:
85+
Then, implement the `@main` to run the Lambda function:
5586
```swift
5687
import BreezeLambdaWebHook
5788
import AWSLambdaEvents
@@ -63,7 +94,7 @@ import NIOCore
6394
@main
6495
struct BreezeDemoHTTPApplication {
6596
static func main() async throws {
66-
let app = BreezeLambdaWebHook<DemoLambdaHandler>(name: "BreezeDemoHTTPApplication")
97+
let app = BreezeLambdaWebHook<WebHook>(name: "WebHook")
6798
try await app.run()
6899
}
69100
}

0 commit comments

Comments
 (0)