Giter Club home page Giter Club logo

stackexchange.net's Introduction

StackExchange.NET

All Contributors

CodeFactor

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

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.

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

Installation

Use a NuGet package reference inside your project with the name StackExchange.NET Alternatively, binaries can be pulled from the build server linked above under artifacts or compiled manually from the build folder.

Supported Operations

  • Answers
  • Badges
  • Comments
  • Posts
  • Questions
  • Suggested Edits
  • Tags

Contributors

Pandiyan Murugan
Pandiyan Murugan

๐Ÿ“–

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

Contributing

If you're looking to contribute, thanks for your interest. Feel free to submit reports for any issues you can find, or request potential features you'd like to see here.

ChangeLogs

Version 1.3

  • Added support for most of the methods in Tags interface.

Version 1.2

  • Added support for Suggested Edits API's

Version 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;
    

stackexchange.net's People

Contributors

allcontributors[bot] avatar gethari avatar pandiyancool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pandiyancool

stackexchange.net's Issues

Optimizing the filters on each API's

In the current implementation, one thing i see changing is the Filters. Each API has its own filter. StackExchange does not have common filters across all API's.

Example The Answers API supports filters like

  • Activity
  • Votes
  • Creation

If you switch over to the Questions API , it has some more additional filters. Posts API has totally different filters.

I am not sure how should we proceed on this. ๐Ÿ’ก
Any suggestions for improvements are welcome, Feel free to send a PR ๐Ÿ‘Œ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.