Hacker-News-Net

所属分类:collect
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2023-09-13 09:17:52
上 传 者sh-1993
说明:  .Net nuget客户端程序包到黑客新闻API
(.Net nuget client package to the Hacker news API)

文件列表:
FPage.sln (993, 2023-09-15)
FrontPage.csproj (349, 2023-09-15)
HNN/ (0, 2023-09-15)
HNN/HackerNews.cs (11108, 2023-09-15)
HNN/Story.cs (444, 2023-09-15)
HackerNewsNetTest/ (0, 2023-09-15)
HackerNewsNetTest/HackerNewsNetTest.csproj (717, 2023-09-15)
HackerNewsNetTest/JsonCommentsTest.cs (1860, 2023-09-15)
HackerNewsNetTest/JsonStoriesTest.cs (4500, 2023-09-15)
HackerNewsNetTest/ObjectReponseTest.cs (1096, 2023-09-15)
HackerNewsNetTest/Usings.cs (62, 2023-09-15)
LICENSE (1065, 2023-09-15)
logo.png (114088, 2023-09-15)

# Hacker-News-Net This is a .Net client package to the Hacker News API. You can interact with the Api through six(6) public instance methods and a static method to retrieve informations like best stories , job stories, comments on a post etc ## Methods - TopStoriesJson - TopStoriesObjects - JobStoriesJson - NewStoriesJson - BestStoriesJson - GetComments - _All Comments on a particular Story_ ... in Json Format mostly The Hacker News API is faily minimal and easy to use, this client mostly does the work of exposing easy to call methods and the convenience of returning to you a collection of json instead of a list of story ids as most endpoints do. There is also a method `(TopStoriesObjects)` which returns a collection of stories as a collection of iterative native objects(`story`) for easy access and information retrieval. ## Installation You can install the Hacker-News-Net Client using NuGet Package Manager: ```bash dotnet add package Hacker-News-Net ``` or just add package in the `Visual Studio` ## Basic usage ```csharp using Hacker-News-Net; //get top 10 stories HackerNews hn = new HackerNews(); string topStories = await hn.TopStoriesJsom(10); //get top 10 new stories string topStories = await hn.NewStoriesJson(10); //get top 10 Best stories string topStories = await hn.BestStoriesJson(10); ``` ```csharp //search for an item with id HackerNews hn = new HackerNews(); string story = await HackerNews.SearchItem(); //get top 10 stories as a collection of obects List storiesAsObject = await hn.TopStoriesObjects(10) foreach(story in storiesAsObject) { //use objects } ``` ```csharp //get all comments on an item HackerNews hn = new HackerNews() string comments = await hn.GetComments() //get comments on an item with range HackerNews hn hackerNewsClient = new HackerNews() string comments = await hn.GetComments(, offset, limit) ```

近期下载者

相关文件


收藏者