/// <summary> /// Gets the first page of posts for the specified section. /// </summary> /// <param name="section">The section for which the posts are to be retrieved.</param> /// <param name="cancellationToken">The cancellation token, which can be used to cancel the retrieval of the page.</param> /// <exception cref="NineGagException">If anything goes wrong during the retrieval of the page, an <see cref="NineGagException"/> exception is thrown.</exception> /// <returns>Returns the first page of the specified section.</returns> public Task<Page> GetPostsAsync(Section section, CancellationToken cancellationToken) => this.GetPostsAsync(section, SubSection.Hot, cancellationToken);
/// <summary> /// Gets the first page of posts for the specified section. /// </summary> /// <param name="section">The section for which the posts are to be retrieved.</param> /// <exception cref="NineGagException">If anything goes wrong during the retrieval of the page, an <see cref="NineGagException"/> exception is thrown.</exception> /// <returns>Returns the first page of the specified section.</returns> public Task<Page> GetPostsAsync(Section section) => this.GetPostsAsync(section, new CancellationTokenSource().Token);
/// <summary> /// Gets the first page of posts for the specified section and sub-section. /// </summary> /// <param name="section">The section for which the posts are to be retrieved.</param> /// <param name="subSection">The sub-section for which the posts are to be retrieved.</param> /// <param name="cancellationToken">The cancellation token, which can be used to cancel the retrieval of the page.</param> /// <exception cref="NineGagException">If anything goes wrong during the retrieval of the page, an <see cref="NineGagException"/> exception is thrown.</exception> /// <returns>Returns the first page of the specified section.</returns> public Task<Page> GetPostsAsync(Section section, SubSection subSection, CancellationToken cancellationToken) { // Generates the URI for the section and sub-section Uri sectionUri; if (subSection == SubSection.Hot) sectionUri = new Uri(string.Concat(section.RelativeUri.OriginalString, NineGagClient.hotPath), UriKind.Relative); else sectionUri = new Uri(string.Concat(section.RelativeUri.OriginalString, NineGagClient.freshPath), UriKind.Relative); // Retrieves the posts of the section and the sub-section return this.GetPostsAsync(sectionUri, cancellationToken); }