@@ -75,7 +75,7 @@ public struct ReplicateAPI{
7575 public func getCollections( collection_slug : String ) async throws -> CollectionOfModels {
7676
7777 let path = " collections/ \( collection_slug) "
78- let rule = [ Http . Validate . status ( . range ( 200 ..< 299 ) ) ]
78+
7979 do {
8080 return try await client. get ( path: path, validate: rule) . value
8181 } catch {
@@ -90,7 +90,7 @@ public struct ReplicateAPI{
9090 public func getModel( owner: String , name: String ) async throws -> Model {
9191
9292 let path = " models/ \( owner) / \( name) "
93- let rule = [ Http . Validate . status ( . range ( 200 ..< 299 ) ) ]
93+
9494 do {
9595 return try await client. get ( path: path, validate: rule) . value
9696 } catch {
@@ -145,9 +145,7 @@ public struct ReplicateAPI{
145145 public func getPrediction< Output: Decodable > (
146146 by id : String
147147 ) async throws -> Prediction < Output > {
148-
149- let rule = [ Http . Validate. status ( . range( 200 ..< 299 ) ) ]
150-
148+
151149 do {
152150 return try await client. get (
153151 path: " predictions/ \( id) " ,
@@ -204,8 +202,6 @@ public struct ReplicateAPI{
204202 with body : HttpBody < Input >
205203 ) async throws -> Prediction < Output > {
206204
207- let rule = [ Http . Validate. status ( . range( 200 ..< 299 ) ) ]
208-
209205 do {
210206 return try await client. post (
211207 path: " predictions " ,
@@ -252,3 +248,6 @@ fileprivate func sessionCfg (_ token : String) -> URLSessionConfiguration{
252248
253249 return config
254250}
251+
252+ /// Between the range responses from the server is valid
253+ fileprivate let rule = [ Http . Validate. status ( . range( 200 ..< 299 ) ) ]
0 commit comments