From 6341848e80b95936b104c91fc240d2661ad67af1 Mon Sep 17 00:00:00 2001 From: CircuitRCAY Date: Sat, 16 Mar 2019 16:59:54 +1100 Subject: [PATCH 1/7] feat: added /top-headlines endpoint. docs: documented /everything endpoint. --- NewsAPI.Net/Entities/NewsEntity.cs | 2 ++ NewsAPI.Net/NewsApi.cs | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/NewsAPI.Net/Entities/NewsEntity.cs b/NewsAPI.Net/Entities/NewsEntity.cs index efdd3e5..f3497bc 100644 --- a/NewsAPI.Net/Entities/NewsEntity.cs +++ b/NewsAPI.Net/Entities/NewsEntity.cs @@ -5,6 +5,8 @@ namespace NewsAPI.Net.Entities public class NewsEntity { public string Status { get; set; } + + public int TotalResults { get; set; } public List Articles { get; set; } } } \ No newline at end of file diff --git a/NewsAPI.Net/NewsApi.cs b/NewsAPI.Net/NewsApi.cs index 21484b8..5a1bbfb 100644 --- a/NewsAPI.Net/NewsApi.cs +++ b/NewsAPI.Net/NewsApi.cs @@ -40,7 +40,14 @@ public async Task GetSourcesAsync() .GetJsonAsync(); return result; } - + + /// + /// Returns a containing a list of articles relating to . + /// + /// Keywords or phrases to search for. + /// A comma-separated string of identifiers (maximum 20) for the news sources or blogs you want headlines from. + /// A comma-separated string of domains (eg bbc.co.uk, techcrunch.com, engadget.com) to restrict the search to. + /// public async Task GetEverythingAsync(string q, string sources, string domains) { var result = await "https://newsapi.org/v2/everything" @@ -53,6 +60,24 @@ public async Task GetEverythingAsync(string q, string sources, strin return result; } + /// + /// Returns a containing a list of top articles relating to . + /// + /// Keywords or phrases to search for. + /// A comma-separated string of identifiers (maximum 20) for the news sources or blogs you want headlines from. + /// A comma-separated string of domains (eg bbc.co.uk, techcrunch.com, engadget.com) to restrict the search to. + /// + public async Task GetTopHeadlinesAsync(string q, string sources, string domains) + { + var result = await "https://newsapi.org/v2/top-headlines" + .SetQueryParams("apiKey", apiKey) + .SetQueryParams("q", q) + .SetQueryParams("sources", sources) + .SetQueryParams("domains", domains) + .ConfigureRequest(settings => { settings.JsonSerializer = GetSerializer(); }) + .GetJsonAsync(); + return result; + } private ISerializer GetSerializer() { From 6c7871b874dc1d0dd944b57fa8b34b7d9e1f557c Mon Sep 17 00:00:00 2001 From: CircuitRCAY Date: Sat, 16 Mar 2019 17:25:47 +1100 Subject: [PATCH 2/7] ver: 1.0.0 --- NewsAPI.Net.sln | 6 ------ NewsAPI.Net/NewsAPI.Net.csproj | 10 ++++++++++ README.md | 7 +++++++ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 README.md diff --git a/NewsAPI.Net.sln b/NewsAPI.Net.sln index ab549ed..eb6608b 100644 --- a/NewsAPI.Net.sln +++ b/NewsAPI.Net.sln @@ -2,8 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewsAPI.Net", "NewsAPI.Net\NewsAPI.Net.csproj", "{EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewsAPI.Net.Tests", "NewsAPI.Net.Tests\NewsAPI.Net.Tests.csproj", "{D973CA85-6E44-498A-955F-E5F64B4B24DC}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -14,9 +12,5 @@ Global {EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}.Release|Any CPU.Build.0 = Release|Any CPU - {D973CA85-6E44-498A-955F-E5F64B4B24DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D973CA85-6E44-498A-955F-E5F64B4B24DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D973CA85-6E44-498A-955F-E5F64B4B24DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D973CA85-6E44-498A-955F-E5F64B4B24DC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/NewsAPI.Net/NewsAPI.Net.csproj b/NewsAPI.Net/NewsAPI.Net.csproj index 2dee194..a808f34 100644 --- a/NewsAPI.Net/NewsAPI.Net.csproj +++ b/NewsAPI.Net/NewsAPI.Net.csproj @@ -2,6 +2,16 @@ netcoreapp2.1 + + 1.0.0 + https://github.com/CircuitCodes/NewsAPI.Net/blob/master/LICENSE + CircuitRCAY + Copyright 2019-present CircuitRCAY + https://github.com/CircuitCodes/NewsAPI.Net/ + https://circuitrcay.com + news + A C# library wrapping https://newsapi.org + Released 1.0.0, covered all 3 endpoints. diff --git a/README.md b/README.md new file mode 100644 index 0000000..dfa0ff4 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# NewsAPI.Net + +NewsAPI.Net is a C# library that wraps around https://newsapi.org. + +## How to Use + +Coming soon... \ No newline at end of file From 022e865ca6e44ea7c224ee46cfd4c40d5db91ff6 Mon Sep 17 00:00:00 2001 From: CircuitRCAY Date: Sat, 16 Mar 2019 17:28:42 +1100 Subject: [PATCH 3/7] chore: license --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b61ee0d --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019-present CircuitRCAY + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file From f391ca0a658e2ca013e48682494bd043fb34a5e1 Mon Sep 17 00:00:00 2001 From: CircuitRCAY Date: Sat, 16 Mar 2019 17:33:09 +1100 Subject: [PATCH 4/7] docs: added basic docs. --- NewsAPI.Net.Tests/EndpointTest.cs | 41 ---------------------- NewsAPI.Net.Tests/NewsAPI.Net.Tests.csproj | 20 ----------- README.md | 12 ++++++- 3 files changed, 11 insertions(+), 62 deletions(-) delete mode 100644 NewsAPI.Net.Tests/EndpointTest.cs delete mode 100644 NewsAPI.Net.Tests/NewsAPI.Net.Tests.csproj diff --git a/NewsAPI.Net.Tests/EndpointTest.cs b/NewsAPI.Net.Tests/EndpointTest.cs deleted file mode 100644 index d43c0dd..0000000 --- a/NewsAPI.Net.Tests/EndpointTest.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Flurl.Http.Testing; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NewsAPI.Net; - -namespace NewsAPI.Net.Tests -{ - [TestClass] - public class EndpointTest - { - private static NewsApi api = new NewsApi(""); - - - [TestMethod] - public async void TestSourcesEndpoint() - { - using (var httpTest = new HttpTest()) - { - var result = await api.GetSourcesAsync(); - - var sources = result.Sources; - - Assert.AreEqual("abc-news", sources[0].ID); - - - } - } - - [TestMethod] - public async void TestEverythingEndpoint() - { - using (var httpTest = new HttpTest()) - { - var result = await api.GetEverythingAsync("bitcoin", null, null); - - var articles = result.Articles; - - Assert.AreEqual("ok", result.Status); - } - } - } -} \ No newline at end of file diff --git a/NewsAPI.Net.Tests/NewsAPI.Net.Tests.csproj b/NewsAPI.Net.Tests/NewsAPI.Net.Tests.csproj deleted file mode 100644 index b39df75..0000000 --- a/NewsAPI.Net.Tests/NewsAPI.Net.Tests.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netcoreapp2.1 - - false - - - - - - - - - - - - - - diff --git a/README.md b/README.md index dfa0ff4..0a1b823 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,14 @@ NewsAPI.Net is a C# library that wraps around https://newsapi.org. ## How to Use -Coming soon... \ No newline at end of file +First get an API key from [here](https://newsapi.org/account) + +```cs +var api = new NewsAPI("api-key"); + +var sources = await api.GetSourcesAsync(); + +var everything = await api.GetEverythingAsync("query?", "sources", "domains?"); + +var topHeadlines = await api.GetTopHeadlinesAsync("query?", "sources", "domains?"); +``` \ No newline at end of file From 31a5e6b7834f233a05823c3a19fca2219726f228 Mon Sep 17 00:00:00 2001 From: CircuitRCAY Date: Sat, 16 Mar 2019 21:35:02 +1100 Subject: [PATCH 5/7] fix: query params in /sources??? --- NewsAPI.Net/NewsAPI.Net.csproj | 6 +++--- NewsAPI.Net/NewsApi.cs | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NewsAPI.Net/NewsAPI.Net.csproj b/NewsAPI.Net/NewsAPI.Net.csproj index a808f34..1eb2a06 100644 --- a/NewsAPI.Net/NewsAPI.Net.csproj +++ b/NewsAPI.Net/NewsAPI.Net.csproj @@ -1,9 +1,9 @@  - netcoreapp2.1 + netcoreapp2.1;netstandard2.0;net472 - 1.0.0 + 1.1.0 https://github.com/CircuitCodes/NewsAPI.Net/blob/master/LICENSE CircuitRCAY Copyright 2019-present CircuitRCAY @@ -11,7 +11,7 @@ https://circuitrcay.com news A C# library wrapping https://newsapi.org - Released 1.0.0, covered all 3 endpoints. + Released 1.1.0, supports multiple frameworks diff --git a/NewsAPI.Net/NewsApi.cs b/NewsAPI.Net/NewsApi.cs index 5a1bbfb..28488eb 100644 --- a/NewsAPI.Net/NewsApi.cs +++ b/NewsAPI.Net/NewsApi.cs @@ -35,7 +35,10 @@ public NewsApi(string apiKey) public async Task GetSourcesAsync() { var result = await "https://newsapi.org/v2/sources" - .SetQueryParams("apiKey", apiKey) + .SetQueryParams(new + { + apiKey = apiKey + }) .ConfigureRequest(settings => { settings.JsonSerializer = GetSerializer(); }) .GetJsonAsync(); return result; From 632afd5644afd9e9bf58105f3579c07277450f82 Mon Sep 17 00:00:00 2001 From: Kot Date: Sat, 16 Mar 2019 12:02:36 -0700 Subject: [PATCH 6/7] Update license, add clarification to README --- LICENSE | 202 +----------------------------------------------- NewsAPI.Net.sln | 24 +++++- README.md | 15 ++-- 3 files changed, 36 insertions(+), 205 deletions(-) diff --git a/LICENSE b/LICENSE index b61ee0d..a9af9fc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,7 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ +Copyright 2019 The-Grape-Vine - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - 1. Definitions. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2019-present CircuitRCAY - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/NewsAPI.Net.sln b/NewsAPI.Net.sln index eb6608b..ee4a842 100644 --- a/NewsAPI.Net.sln +++ b/NewsAPI.Net.sln @@ -1,6 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewsAPI.Net", "NewsAPI.Net\NewsAPI.Net.csproj", "{EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}" +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.421 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewsAPI.Net", "NewsAPI.Net\NewsAPI.Net.csproj", "{EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewsAPI.Net.Tests", "NewsAPI.Net.Tests\NewsAPI.Net.Tests.csproj", "{645DF89E-3AEB-4685-AEC3-3BCF3497E047}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39DCF869-D144-40D6-AE7C-695B75C05E5C}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + LICENSE = LICENSE + README.md = README.md + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -12,5 +24,15 @@ Global {EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {EAD6AD89-5094-46E2-AA15-5E5644AA0A3B}.Release|Any CPU.Build.0 = Release|Any CPU + {645DF89E-3AEB-4685-AEC3-3BCF3497E047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {645DF89E-3AEB-4685-AEC3-3BCF3497E047}.Debug|Any CPU.Build.0 = Debug|Any CPU + {645DF89E-3AEB-4685-AEC3-3BCF3497E047}.Release|Any CPU.ActiveCfg = Release|Any CPU + {645DF89E-3AEB-4685-AEC3-3BCF3497E047}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {04F6E8D6-A9C1-4211-8AB7-619D8C001E5D} EndGlobalSection EndGlobal diff --git a/README.md b/README.md index 0a1b823..0c0d4ee 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ # NewsAPI.Net -NewsAPI.Net is a C# library that wraps around https://newsapi.org. +NewsAPI.Net is an alternative .NET api wrapper for https://newsapi.org. ## How to Use -First get an API key from [here](https://newsapi.org/account) +First get an API key from https://newsapi.org/ ```cs -var api = new NewsAPI("api-key"); +var api = new NewsAPIClient("api-key"); var sources = await api.GetSourcesAsync(); -var everything = await api.GetEverythingAsync("query?", "sources", "domains?"); +var everything = await api.GetEverythingAsync("bitcoin", "sources", "domains"); -var topHeadlines = await api.GetTopHeadlinesAsync("query?", "sources", "domains?"); -``` \ No newline at end of file +var topHeadlines = await api.GetTopHeadlinesAsync("dotnet", "sources", "domains"); +``` + +# Documentation + - under construction \ No newline at end of file From c3fd2ed4ec10cd657d921f4a62fcab95b84ccce8 Mon Sep 17 00:00:00 2001 From: CircuitRCAY Date: Sun, 17 Mar 2019 10:13:33 +1100 Subject: [PATCH 7/7] chore: update csproj info. --- NewsAPI.Net/NewsAPI.Net.csproj | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/NewsAPI.Net/NewsAPI.Net.csproj b/NewsAPI.Net/NewsAPI.Net.csproj index 1eb2a06..ae668e3 100644 --- a/NewsAPI.Net/NewsAPI.Net.csproj +++ b/NewsAPI.Net/NewsAPI.Net.csproj @@ -3,20 +3,25 @@ netcoreapp2.1;netstandard2.0;net472 - 1.1.0 - https://github.com/CircuitCodes/NewsAPI.Net/blob/master/LICENSE + 2.0.0 + https://github.com/The-Grape-Vine/NewsAPI.Net/blob/master/LICENSE CircuitRCAY - Copyright 2019-present CircuitRCAY - https://github.com/CircuitCodes/NewsAPI.Net/ + Copyright 2019-present The Grape Vine + https://github.com/The-Grape-Vine/NewsAPI.Net/ https://circuitrcay.com news A C# library wrapping https://newsapi.org - Released 1.1.0, supports multiple frameworks + Released 2.0.0, a major refactor in the core implementation. - + + + ..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.1.0\ref\netcoreapp2.1\System.Web.HttpUtility.dll + + +