public async Task<ICollection<string>> GetSubRedditsAsync(SubRedditKind kind) { var uri = $"{BaseUri}/subreddits/mine/{kind.ToString().ToLowerInvariant()}"; var results = new List<string>(); var after = (string) null; while (true) { var data = after == null ? null : new[] { new KeyValuePair<string, string>("after", after), }; var listing = await _requester.GetAsync(uri, data); var content = listing["data"]; after = (string) content["after"]; results.AddRange(from item in content["children"] where (string) item["kind"] == "t5" select (string) item["data"]["display_name"]); if (after == null) break; } return results; }
public async Task <ICollection <string> > GetSubRedditsAsync(SubRedditKind kind) { var uri = $"{BaseUri}/subreddits/mine/{kind.ToString().ToLowerInvariant()}"; var results = new List <string>(); var after = (string)null; while (true) { var data = after == null ? null : new[] { new KeyValuePair <string, string>("after", after), }; var listing = await _requester.GetAsync(uri, data); var content = listing["data"]; after = (string)content["after"]; results.AddRange(from item in content["children"] where (string)item["kind"] == "t5" select(string) item["data"]["display_name"]); if (after == null) { break; } } return(results); }