public async Task <IEnumerable <Comment> > GetGalleryCommentsAsync(string id, CommentDisplayParams.Sort sort = CommentDisplayParams.Sort.Best) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var response = await client.GetAsync($"/3/gallery/{id}/comments/{sort.ToString().ToLower()}"); (bool success, int status, string dataJson) = GetDataToken(await response.Content.ReadAsStringAsync()); if (success) { return(JsonConvert.DeserializeObject <List <Comment> >(dataJson)); } else { throw new ApiRequestException(dataJson) { Status = status }; } }
public async Task <IEnumerable <Comment> > GetAccountCommentsAsync(string username, CommentDisplayParams.Sort sort = CommentDisplayParams.Sort.New, int page = 0) { if (username == null) { throw new ArgumentNullException(nameof(username)); } var response = await client.GetAsync($"/3/account/{username}/comments/{$"{sort}".ToLower()}/{page}"); (bool success, int status, string dataJson) = GetDataToken(await response.Content.ReadAsStringAsync()); if (success) { return(JsonConvert.DeserializeObject <List <Comment> >(dataJson)); } else { throw new ApiRequestException(dataJson) { Status = status }; } }