Skip to content

Commit

Permalink
update dependencies + fix related API breakages
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiBM committed May 23, 2024
1 parent de0c596 commit b4ab513
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Lambdas/AutoPings/AutoPingsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct AutoPingsHandler: LambdaHandler {
}
} else if event.rawPath.hasSuffix("users") {
switch event.context.http.method {
case .PUT:
case .put:
do {
let request = try event.decode(as: AutoPingsRequest.self)
newItems = try await pingsRepo.insert(
Expand All @@ -51,7 +51,7 @@ struct AutoPingsHandler: LambdaHandler {
)
)
}
case .DELETE:
case .delete:
do {
let request = try event.decode(as: AutoPingsRequest.self)
newItems = try await pingsRepo.remove(
Expand Down
7 changes: 4 additions & 3 deletions Lambdas/LambdasShared/+APIGatewayV2.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AWSLambdaEvents
import HTTPTypes
import Crypto
import Foundation

Expand Down Expand Up @@ -30,17 +31,17 @@ extension APIGatewayV2Request {
}

extension APIGatewayV2Response {
package init(status: HTTPResponseStatus, content: some Encodable) {
package init(status: HTTPResponse.Status, content: some Encodable) {
do {
let data = try jsonEncoder.encode(content)
let string = String(data: data, encoding: .utf8)
self.init(statusCode: status, body: string)
} catch {
if let data = try? jsonEncoder.encode(content) {
let string = String(data: data, encoding: .utf8)
self.init(statusCode: .failedDependency, body: string)
self.init(statusCode: .preconditionFailed, body: string)
} else {
self.init(statusCode: .failedDependency, body: "Plain Error: \(error)")
self.init(statusCode: .preconditionFailed, body: "Plain Error: \(error)")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"location" : "https://github.com/DiscordBM/DiscordBM.git",
"state" : {
"branch" : "main",
"revision" : "757c899626d0946fbae230036ac01631bbf11afe"
"revision" : "edafb343826dbf42e8cc8e06262e2b84e8923c79"
}
},
{
Expand Down Expand Up @@ -123,8 +123,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/swift-aws-lambda-events.git",
"state" : {
"revision" : "997094fe7c55762c07179419a1686230dfa13bef",
"version" : "0.2.0"
"revision" : "f015dbfffaf52f456732460ff0a70d6349faa828",
"version" : "0.3.0"
}
},
{
Expand Down

0 comments on commit b4ab513

Please sign in to comment.