Requests done
This commit is contained in:
@@ -162,6 +162,11 @@ public struct Request {
|
||||
return try decoder.decode(Out.self, from: outData)
|
||||
}
|
||||
|
||||
public func requestJson<ApiError: Decodable & Sendable>(config: Config, data: Data, apiError: ApiError.Type = EmptyError.self) async throws {
|
||||
let urlRequest = makeURLRequest(config: config, body: data)
|
||||
try await requestData(urlRequest: urlRequest, apiError: apiError).data
|
||||
}
|
||||
|
||||
public func requestJson<Out: Decodable, ApiError: Decodable & Sendable>(config: Config, data: Data, apiError: ApiError.Type = EmptyError.self) async throws -> Out {
|
||||
let urlRequest = makeURLRequest(config: config, body: data)
|
||||
let outData = try await requestData(urlRequest: urlRequest, apiError: apiError).data
|
||||
|
||||
Reference in New Issue
Block a user