@@ -75,7 +75,7 @@ public struct ReplicateAPI{
75
75
public func getCollections( collection_slug : String ) async throws -> CollectionOfModels {
76
76
77
77
let path = " collections/ \( collection_slug) "
78
- let rule = [ Http . Validate . status ( . range ( 200 ..< 299 ) ) ]
78
+
79
79
do {
80
80
return try await client. get ( path: path, validate: rule) . value
81
81
} catch {
@@ -90,7 +90,7 @@ public struct ReplicateAPI{
90
90
public func getModel( owner: String , name: String ) async throws -> Model {
91
91
92
92
let path = " models/ \( owner) / \( name) "
93
- let rule = [ Http . Validate . status ( . range ( 200 ..< 299 ) ) ]
93
+
94
94
do {
95
95
return try await client. get ( path: path, validate: rule) . value
96
96
} catch {
@@ -145,9 +145,7 @@ public struct ReplicateAPI{
145
145
public func getPrediction< Output: Decodable > (
146
146
by id : String
147
147
) async throws -> Prediction < Output > {
148
-
149
- let rule = [ Http . Validate. status ( . range( 200 ..< 299 ) ) ]
150
-
148
+
151
149
do {
152
150
return try await client. get (
153
151
path: " predictions/ \( id) " ,
@@ -204,8 +202,6 @@ public struct ReplicateAPI{
204
202
with body : HttpBody < Input >
205
203
) async throws -> Prediction < Output > {
206
204
207
- let rule = [ Http . Validate. status ( . range( 200 ..< 299 ) ) ]
208
-
209
205
do {
210
206
return try await client. post (
211
207
path: " predictions " ,
@@ -252,3 +248,6 @@ fileprivate func sessionCfg (_ token : String) -> URLSessionConfiguration{
252
248
253
249
return config
254
250
}
251
+
252
+ /// Between the range responses from the server is valid
253
+ fileprivate let rule = [ Http . Validate. status ( . range( 200 ..< 299 ) ) ]
0 commit comments