Skip to content
StacMan is a .NET client for Stack Exchange API v2 https://api.stackexchange.com
C#
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
StacMan.Tests
StacMan
packages
.gitignore
LICENSE
Local.testsettings
README.md Added syntax highlighting to the examples
StacMan.sln
StacMan.vsmdi
TraceAndTestImpact.testsettings StacMan v0.1

README.md

Features

Get StacMan

StacMan is available on NuGet:

PM> Install-Package StacMan

Example Usage

using StackExchange.StacMan;
...
var client = new StacManClient(key: "my-app-key", version: "2.1");

Synchronous

var response = client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz").Result;

foreach (var question in response.Data.Items)
{
    Console.WriteLine(question.Title);
}

Asynchronous

var task = client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz");

task.ContinueWith(t =>
    {
        foreach (var user in t.Result.Data.Items)
        {
            Console.WriteLine(question.Title);
        }
    });

Asynchronous (C# 5)

var response = await client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz");

foreach (var user in response.Data.Items)
{
    Console.WriteLine(question.Title);
}

Filters

StacMan supports the Stack Exhchange API's concept of filters, which allow applications to specify which fields are included/excluded in the API response.

When a field is excluded, the property returned by StacMan corresponding to the excluded field assumes the default value of the type. For example, when the "default" filter is used, the AnswerCount property of the User object returned by StacMan will be 0, since user.answer_count is not included by the "default" filter.

Something went wrong with that request. Please try again.