Skip to content

Commit

Permalink
Add newPatch
Browse files Browse the repository at this point in the history
  • Loading branch information
3lvis committed Aug 4, 2024
1 parent dba6e3a commit 5aaa89f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/Networking/Networking+HTTPRequests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ public extension Networking {
}
}

func newPatch<T: Decodable>(_ path: String, parameters: [String: Any]) async -> Result<T, NetworkingError> {
return await handle(.patch, path: path, parameters: parameters)
}

func newPatch(_ path: String, parameters: [String: Any]) async -> Result<Void, NetworkingError> {
let result: Result<Data, NetworkingError> = await handle(.patch, path: path, parameters: parameters)
switch result {
case .success:
return .success(())
case .failure(let error):
return .failure(error)
}
}

func newDelete(_ path: String) async -> Result<Void, NetworkingError> {
let result: Result<Data, NetworkingError> = await handle(.delete, path: path, parameters: nil)
switch result {
Expand Down

0 comments on commit 5aaa89f

Please sign in to comment.