Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created March 15, 2022 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malcommac/74ed5eae051a2bf321fde8c19cc9b49e to your computer and use it in GitHub Desktop.
Save malcommac/74ed5eae051a2bf321fde8c19cc9b49e to your computer and use it in GitHub Desktop.
public extension HTTPClient {
func fetch<T: APIResourceConvertible>(_ convertible: T) async throws -> T.Result {
let result = try await fetch(convertible.request())
return try result.decode(T.Result.self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment