@@ -125,15 +125,26 @@ public final class RESTClient: Sendable {
125
125
self . errorBodyToMessage = errorBodyToMessage
126
126
}
127
127
128
- public func requestObject< ResponseBodyType: Decodable > (
128
+ public func send(
129
+ method: HTTPMethod ,
130
+ path: String ,
131
+ body: Body ? = nil ,
132
+ extraHeaders: [ String : String ] = [ : ] ,
133
+ extraQueryItems: [ URLQueryItem ] = [ ] ,
134
+ errorContext: String ? = nil
135
+ ) async throws ( RequestError) {
136
+ _ = try await self . fetchData ( method: method, path: path, body: body, extraHeaders: extraHeaders, extraQueryItems: extraQueryItems)
137
+ }
138
+
139
+ public func fetchObject< ResponseBodyType: Decodable > (
129
140
method: HTTPMethod ,
130
141
path: String ,
131
142
body: Body ? = nil ,
132
143
extraHeaders: [ String : String ] = [ : ] ,
133
144
extraQueryItems: [ URLQueryItem ] = [ ] ,
134
145
errorContext: String ? = nil
135
146
) async throws ( RequestError) -> ResponseBodyType {
136
- let responseData = try await self . requestData ( method: method, path: path, body: body, extraHeaders: extraHeaders, extraQueryItems: extraQueryItems)
147
+ let responseData = try await self . fetchData ( method: method, path: path, body: body, extraHeaders: extraHeaders, extraQueryItems: extraQueryItems)
137
148
138
149
do {
139
150
return try self . jsonDecoder. decode ( ResponseBodyType . self, from: responseData)
@@ -142,8 +153,7 @@ public final class RESTClient: Sendable {
142
153
}
143
154
}
144
155
145
- @discardableResult
146
- public func requestData(
156
+ public func fetchData(
147
157
method: HTTPMethod ,
148
158
path: String ,
149
159
body: Body ? = nil ,
0 commit comments