public async Task <ImmutableList <IFileReference> > SearchFileReferencesAsync(string searchTerm, CancellationToken token) { if (string.IsNullOrWhiteSpace(searchTerm)) { return(ImmutableList <IFileReference> .Empty); } var searchResult = await _searchResultCollection.AddOrUpdate ( searchTerm, () => _graphQLService.GetFileReferencesAsync(searchTerm, token) ); return(FileReferencesFactory.Create(searchResult.JsonResult)); }
public IObservable <IEnumerable <IFileReference> > SearchFileReferences(string searchTerm, CancellationToken token) { return(Observable.Defer <IEnumerable <IFileReference> >(async() => { var searchResult = await _searchResultCollection.AddOrUpdate ( searchTerm, () => _graphQLService.GetFileReferencesAsync(searchTerm, token) ); var fileReferences = FileReferencesFactory.Create(searchResult.JsonResult); return Observable.Return <IEnumerable <IFileReference> >(fileReferences); })); }