public ResultsPage <AbbreviatedPerson> GetSearchPage(short pageSize, PagingTokens pagingTokens,
                                                             SearchPeopleParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
        {
            var url = UrlProvider.GetV1PersonSearchUrl(pageSize, pagingTokens, parameters);

            return(GetJson <ResultsPage <AbbreviatedPerson> >(url, cancellationToken).Payload);
        }
        /// <summary>
        ///     Searches for people with specific attributes as pages of results
        /// </summary>
        /// <param name="parameters">The attributes used to search for people</param>
        /// <param name="pageSize">The size of the pages of results to return from the server. If null it will use the default value.</param>
        /// <returns>A cursor that can be used to iterate through the pages of people either syncronously or asyncronously</returns>
        public IAsyncCursor <ResultsPage <AbbreviatedPerson> > SearchAsPages(SearchPeopleParameters parameters,
                                                                             short?pageSize = null)
        {
            Ensure.IsNotNull(parameters, nameof(parameters));
            Ensure.IsValidExplicitPageSize(pageSize);

            var actualPageSize = GetPageSize(pageSize);

            return(new AsyncPageCursor <AbbreviatedPerson>(
                       (size, tokens, token) => GetSearchPage(actualPageSize, tokens, parameters, token),
                       async(size, tokens, token) => await GetSearchPageAsync(actualPageSize, tokens, parameters, token),
                       actualPageSize));
        }
Esempio n. 3
0
        /// <inheritDoc/>
        public string GetV1PersonSearchUrl(short pageSize, PagingTokens pagingTokens, SearchPeopleParameters parameters)
        {
            var queryValues = CreateQueryStringValues(pageSize, pagingTokens, parameters);

            PopulateQueryStringWithCustomValues(queryValues, parameters.CustomValues);
            return("api/v1/people/search" + queryValues.ToString(true));
        }
 /// <summary>
 ///     Searches for people with specific attributes
 /// </summary>
 /// <param name="parameters">The attributes used to search for people</param>
 /// <param name="pageSize">The size of the pages of results to return from the server. If null it will use the default value.</param>
 /// <returns>A cursor that can be used to iterate through the people either syncronously or asyncronously</returns>
 public IAsyncCursor <AbbreviatedPerson> Search(SearchPeopleParameters parameters, short?pageSize = null)
 {
     return(new AsyncPagedEntityCursor <AbbreviatedPerson>(SearchAsPages(parameters, pageSize)));
 }