Hacker-News-Net
1.0.0
dotnet add package Hacker-News-Net --version 1.0.0
NuGet\Install-Package Hacker-News-Net -Version 1.0.0
<PackageReference Include="Hacker-News-Net" Version="1.0.0" />
paket add Hacker-News-Net --version 1.0.0
#r "nuget: Hacker-News-Net, 1.0.0"
// Install Hacker-News-Net as a Cake Addin #addin nuget:?package=Hacker-News-Net&version=1.0.0 // Install Hacker-News-Net as a Cake Tool #tool nuget:?package=Hacker-News-Net&version=1.0.0
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:
dotnet add package Hacker-News-Net
or just add package in the Visual Studio
Basic usage
using HackerNewsApiClient;
//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);
//search for an item with id
HackerNews hn = new HackerNews();
string story = await HackerNews.SearchItem(<item id>);
//get top 10 stories as a collection of obects
List<Story> storiesAsObject = await hn.TopStoriesObjects(10)
foreach(story in storiesAsObject)
{
//use objects
}
//get all comments on an item
HackerNews hn = new HackerNews()
string comments = await hn.GetComments(<item id>)
//get comments on an item with range
HackerNews hn hackerNewsClient = new HackerNews()
string comments = await hn.GetComments(<item id>, offset, limit)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 176 | 9/13/2023 |