public PaginationBaseService(string baseUrl, Func <string, CancellationToken, Task <HttpResponseMessage> > getHttpAsync, DefaultPaginationOptions options = null) { _baseUrl = baseUrl ?? string.Empty; _getHttpAsync = getHttpAsync ?? throw new ArgumentNullException(nameof(getHttpAsync)); PaginationResult = _paginationResultSource.AsObservable(); RequestRunning = _requestRunningSource.AsObservable(); if (options != null) { Page = options.Page; PageSize = options.PageSize; SetSortProperty(options.SortProperty); SortDescending = options.SortDescending; SetThenSortProperty(options.ThenSortProperty); ThenSortDescending = options.ThenSortDescending; } SetupQuerySubscription(); BuildUrl(); }
public PaginationBaseService(string baseUrl, Func <string, Task <HttpResponseMessage> > getHttpAsync, DefaultPaginationOptions options = null) : this(baseUrl, (url, _) => getHttpAsync == null ? throw new ArgumentNullException(nameof(getHttpAsync)) : getHttpAsync(url), options) { }