Skip to content

Commit

Permalink
fix(clients): update browse iterator (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4058

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
  • Loading branch information
algolia-bot and Fluf22 committed Oct 31, 2024
1 parent 044b879 commit 1135c6b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/Search/Extra/SearchClientExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,13 @@ public extension SearchClient {
aggregator: @escaping (BrowseResponse<T>) -> Void,
requestOptions: RequestOptions? = nil
) async throws -> BrowseResponse<T> {
try await createIterable(
var updatedBrowseParams = browseParams
if updatedBrowseParams.hitsPerPage == nil {
updatedBrowseParams.hitsPerPage = 1000
}

return try await createIterable(
execute: { previousResponse in
var updatedBrowseParams = browseParams
if let previousResponse {
updatedBrowseParams.cursor = previousResponse.cursor
}
Expand Down Expand Up @@ -298,7 +302,7 @@ public extension SearchClient {
)
},
validate: validate ?? { response in
response.nbHits < hitsPerPage
response.hits.count < hitsPerPage
},
aggregator: aggregator
)
Expand Down Expand Up @@ -341,7 +345,7 @@ public extension SearchClient {
)
},
validate: validate ?? { response in
response.nbHits < hitsPerPage
response.hits.count < hitsPerPage
},
aggregator: aggregator
)
Expand Down

0 comments on commit 1135c6b

Please sign in to comment.