Skip to content

Commit 18cdfd0

Browse files
committed
Version 2.0.0
1 parent 6a8ce4c commit 18cdfd0

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

Hassie.API.NewsAPI/Hassie.NET.API.NewsAPI.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
<PackageLicenseUrl>https://github.com/hassie-dash/NewsAPI.NET/blob/master/LICENSE</PackageLicenseUrl>
1313
<RepositoryUrl>https://github.com/hassie-dash/NewsAPI.NET</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>
15-
<PackageReleaseNotes>HTTP request exceptions now more meaningful - News API responses are now parsed and thrown.</PackageReleaseNotes>
15+
<PackageReleaseNotes>Rewrote API wrapper to use builder pattern.
16+
Implemented Sources endpoint.
17+
Please refer to documentation to see the updated example usages.</PackageReleaseNotes>
1618
<PackageTags>news;api;hassie;hassie-dash</PackageTags>
1719
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
18-
<AssemblyVersion>1.0.2.0</AssemblyVersion>
20+
<AssemblyVersion>2.0.0.0</AssemblyVersion>
1921
<NeutralLanguage>en-GB</NeutralLanguage>
2022
<Title>NewsAPI.NET</Title>
2123
<Description>A simple to use async library to retrieve news from News API; written in .NET Standard 1.1.</Description>
22-
<Version>1.0.2</Version>
24+
<Version>2.0.0</Version>
25+
<FileVersion>2.0.0.0</FileVersion>
2326
</PropertyGroup>
2427

2528
<ItemGroup>

NewsAPI.NET.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{15667796-E30F-4563-9A82-939EA7926682}"
1111
ProjectSection(SolutionItems) = preProject
1212
.travis.yml = .travis.yml
13+
README.md = README.md
1314
EndProjectSection
1415
EndProject
1516
Global

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,38 @@ NewsAPI.NET
22
===========
33
[![Build Status](https://travis-ci.org/hassie-dash/NewsAPI.NET.svg?branch=master)](https://travis-ci.org/hassie-dash/NewsAPI.NET)
44

5-
NewsAPI.NET is a asynchronous API wrapper around News API. It is based on their new v2 API and is a work in progress. At the moment, only the top headlines endpoint has been implemented.
5+
NewsAPI.NET is a asynchronous API wrapper around News API. It is based on their new v2 API and is a work in progress. At the moment, the top headlines and news sources endpoint has been implemented.
66
It is written in NET Standard 1.1.
77

88
NuGet
99
-----
10-
This library is available on NuGet, under the package name Hassie.NET.API.NewsAPI. The current version is 1.0.1.
10+
This library is available on NuGet, under the package name Hassie.NET.API.NewsAPI. The current version is 2.0.0.
1111

1212
Example usage
1313
-------------
1414
```cs
1515
INewsClient newsClient = new ClientBuilder()
1616
{
1717
ApiKey = "Your API Key";
18-
};
19-
INewsArticles articles = await newsClient.GetTopHeadlines(Category.TECHNOLOGY, Country.GB);
20-
INewsArticle article = articles.Articles.ElementAt(4);
21-
Console.WriteLine(article.Author);
22-
Console.WriteLine(article.Description);
23-
Console.WriteLine(article.ImageURL);
24-
Console.WriteLine(article.PublishTime);
25-
Console.WriteLine(article.SourceName);
26-
Console.WriteLine(article.Title);
27-
Console.WriteLine(article.URL);
18+
}
19+
.Build();
20+
21+
INewsArticles newsArticles = await newsClient.GetTopHeadlines(new TopHeadlinesBuilder()
22+
.WithCountryQuery(Country.GB)
23+
.WithLanguageQuery(Language.EN)
24+
.WithSourcesQuery(Source.BBC_NEWS, Source.BBC_SPORT)
25+
.Build());
26+
27+
foreach (INewsArticle article in newsArticles.Articles)
28+
{
29+
Console.WriteLine(article.Author);
30+
Console.WriteLine(article.Description);
31+
Console.WriteLine(article.ImageURL);
32+
Console.WriteLine(article.PublishTime);
33+
Console.WriteLine(article.SourceName);
34+
Console.WriteLine(article.Title);
35+
Console.WriteLine(article.URL);
36+
}
2837
```
2938

3039
License

0 commit comments

Comments
 (0)