Add method for processing cursor response

This commit is contained in:
Ivan Babkin 2019-08-30 14:06:23 +03:00
parent 6e1e4de0b1
commit 31bb4d9798
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# Changelog
### 0.9.26
- **Add**: method `processResultFromConfigurationSingle` for `TotalCountCursor` that allows to get server response.
- **Add**: possibility to override `loadNextBatch` method from `TotalCountCursor`.
- **Add**: possibility to inherit from `TotalCountCursor`.

View File

@ -54,8 +54,12 @@ open class TotalCountCursor<CursorConfiguration: TotalCountCursorConfiguration>:
configuration = other.configuration.reset()
}
open func loadNextBatch() -> Single<[Element]> {
open func processResultFromConfigurationSingle() -> Single<CursorConfiguration.ResultType> {
return configuration.resultSingle()
}
public func loadNextBatch() -> Single<[Element]> {
return processResultFromConfigurationSingle()
.do(onSuccess: { [weak self] listingResult in
self?.totalCount = listingResult.totalCount
self?.elements = (self?.elements ?? []) + listingResult.results