StackExchange.NET 1.1.0

dotnet add package StackExchange.NET --version 1.1.0
NuGet\Install-Package StackExchange.NET -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StackExchange.NET" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StackExchange.NET --version 1.1.0
#r "nuget: StackExchange.NET, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StackExchange.NET as a Cake Addin
#addin nuget:?package=StackExchange.NET&version=1.1.0

// Install StackExchange.NET as a Cake Tool
#tool nuget:?package=StackExchange.NET&version=1.1.0

StackExchange.NET

All Contributors

 _____ _             _    ______          _                              _   _ ______ _______ 
 / ____| |           | |  |  ____|        | |                            | \ | |  ____|__   __|
| (___ | |_ __ _  ___| | _| |__  __  _____| |__   __ _ _ __   __ _  ___  |  \| | |__     | |   
 \___ \| __/ _` |/ __| |/ /  __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \ | . ` |  __|    | |   
 ____) | || (_| | (__|   <| |____ >  < (__| | | | (_| | | | | (_| |  __/_| |\  | |____   | |   
|_____/ \__\__,_|\___|_|\_\______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___(_)_| \_|______|  |_|   
                                                              __/ |                            
                                                             |___/                             
 

Created by Hari Haran

Overview

StackExchange.NET is a .NET Standard managed library that provides easy access to the StackExchange APi's with virtually no boilerplate code required.

Currently the library supports 18 Endpoints ( As on 11:09:2019) listed in the API Docs. I will be covering all the other endpoints as well, except those that require Auth.

StackExchange.NET is FOSS (MIT License) and written entirely in c#.

Contributors

<table> <tr> <td align="center"><a href="http://efficientuser.com"><img src="https://avatars1.githubusercontent.com/u/6157834?v=4" width="100px;" alt="Pandiyan Murugan"/><br /><sub><b>Pandiyan Murugan</b></sub></a><br /><a href="https://github.com/gethari/StackExchange.NET/commits?author=PandiyanCool" title="Documentation">📖</a></td> </tr> </table>

Usage

To create a new API instance provide the apikey. If you need a new key check docs

  var client = new StackExchangeClient("yourApiKey");

You can easily find the relevant method under your preferred section. For example, lets say i want to GetAllPosts It can be simply achived by

var posts = client.Posts.GetAllPosts(postFilter);

Noticed the postFiler parameter. Similar to that, each method has its own parameter to filter the results from the api. The Post Filter object can also be accessed like this

var postFilter = new PostFilter()
{
    Sort = PostSort.Creation
};

Parameter Filters

There are different types of parameter filter objects available. Each Parent Method will have its own filter. Example : All the clients.Comments will accept a CommentFilter()

  • AnswerFilters
  • BadgeFilters
  • CommentFilter
  • PostFilter

ChangeLogs

Verison 1.1

  • Improved overall code quality using Fluent API Url Builders

  • Removed all Hardcoded API URL's

  • More Clean code

    # Before V.0 (Initial commit)
    
    var apiParams = filters.GetQueryParams();
    var url = $"{_baseApiUrl}/answers?key={_apiKey}&{apiParams}";
    var response = _httpClient.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
    var apiResult = response.DeserializeJson<Data<Answer>>().ValidateApiResponse();
    return apiResult;
    
    # After V1.1
    
    var url = ApiUrlBuilder
                .Initialize(_apiKey)
                .ForClient(ClientType.Answers)
                .WithFilter(filters)
                .GetApiUrl();
    var response = _httpClient.GetAsync(url).Result
                .ReadAsJsonAsync<Data<Answer>>()
                .ValidateApiResponse();
    return response;
    
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.0 7,374 9/18/2019
1.0.0 483 9/17/2019