Skip to content

Commit 4c9d974

Browse files
committed
Update ReplicateAPI.swift
1 parent 29358d4 commit 4c9d974

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Sources/replicate-kit-swift/ReplicateAPI.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public struct ReplicateAPI{
7777
let path = "collections/\(collection_slug)"
7878
let rule = [Http.Validate.status(.range(200..<299))]
7979
do{
80-
let result : Http.Response<CollectionOfModels> = try await client.get(path: path, validate: rule)
81-
return result.value
80+
return try await client.get(path: path, validate: rule).value
8281
}catch{
8382
throw ResponseError.check(error)
8483
}
@@ -93,8 +92,7 @@ public struct ReplicateAPI{
9392
let path = "models/\(owner)/\(name)"
9493
let rule = [Http.Validate.status(.range(200..<299))]
9594
do{
96-
let result : Http.Response<Model> = try await client.get(path: path, validate: rule)
97-
return result.value
95+
return try await client.get(path: path, validate: rule).value
9896
}catch{
9997
throw ResponseError.check(error)
10098
}
@@ -151,12 +149,10 @@ public struct ReplicateAPI{
151149
let rule = [Http.Validate.status(.range(200..<299))]
152150

153151
do{
154-
let result : Http.Response<Prediction<Output>> = try await client.get(
152+
return try await client.get(
155153
path: "predictions/\(id)",
156154
validate: rule
157-
)
158-
159-
return result.value
155+
).value
160156
}catch{
161157
throw ResponseError.check(error)
162158
}
@@ -211,13 +207,11 @@ public struct ReplicateAPI{
211207
let rule = [Http.Validate.status(.range(200..<299))]
212208

213209
do{
214-
let result : Http.Response<Prediction<Output>> = try await client.post(
210+
return try await client.post(
215211
path: "predictions",
216212
body : body,
217213
validate: rule
218-
)
219-
220-
return result.value
214+
).value
221215
}catch{
222216
throw ResponseError.check(error)
223217
}

0 commit comments

Comments
 (0)