Skip to content

Commit 028b8b7

Browse files
committed
Patch support
1 parent ade53f5 commit 028b8b7

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Sources/BaseKit/API/API.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
public enum ResourceVerb: Hashable, Sendable {
4-
case index, show, create, update, delete
4+
case index, show, create, update, delete, patch
55
}
66

77
public protocol ResourceRequest: Sendable {
@@ -108,6 +108,8 @@ public struct API: APIType {
108108
return .put
109109
case .show:
110110
return .get
111+
case .patch:
112+
return .patch
111113
}
112114
}
113115

@@ -147,7 +149,7 @@ public struct API: APIType {
147149
case .index:
148150
body = .empty
149151
queryItems = try makeQueryItems(request)
150-
case .update:
152+
case .update, .patch:
151153
body = .json(request.parameters)
152154
queryItems = nil
153155
case .show:

Sources/BaseKit/HTTP/HTTPRequest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public struct HTTPRequest<T: Encodable & Equatable & Sendable>: Equatable, Senda
66
case put = "PUT"
77
case post = "POST"
88
case delete = "DELETE"
9+
case patch = "PATCH"
910
}
1011

1112
let method: Method

0 commit comments

Comments
 (0)