BaconographyPortable.Model.Reddit.RedditService.GetPostsBySubreddit C# (CSharp) Method

GetPostsBySubreddit() public method

public GetPostsBySubreddit ( string subreddit, int limit ) : Task
subreddit string
limit int
return Task
        public async Task<Listing> GetPostsBySubreddit(string subreddit, int? limit)
        {
            var maxLimit = (await UserIsGold()) ? 1500 : 100;
            var guardedLimit = Math.Min(maxLimit, limit ?? maxLimit);

            if (subreddit == null)
            {
                //this isnt the front page, that would be "/"
                //return empty since there isnt anything here
                _notificationService.CreateNotification("There doesnt seem to be anything here");
                return new Listing { Kind = "Listing", Data = new ListingData { Children = new List<Thing>() } };
            }

            var targetUri = string.Format("http://www.reddit.com{0}.json?limit={1}", subreddit, guardedLimit);
            try
            {
                var links = await _simpleHttpService.SendGet(await GetCurrentLoginCookie(), targetUri);
				var newListing = JsonConvert.DeserializeObject<Listing>(links);
                return MaybeInjectAdvertisements(MaybeFilterForNSFW(newListing));
            }
            catch (Exception ex)
            {
                _notificationService.CreateErrorNotification(ex);
                return new Listing { Kind = "Listing", Data = new ListingData { Children = new List<Thing>() } };
            }
        }