Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25f46e6

Browse files
author
Hariharan Subramanian
committed
Added Readme
1 parent 8177871 commit 25f46e6

File tree

2 files changed

+126
-65
lines changed

2 files changed

+126
-65
lines changed

‎README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,62 @@
1-
# FluentExchange
1+
# StackExchange.NET
2+
3+
```
4+
_____ _ _ ______ _ _ _ ______ _______
5+
/ ____| | | | | ____| | | | \ | | ____|__ __|
6+
| (___ | |_ __ _ ___| | _| |__ __ _____| |__ __ _ _ __ __ _ ___ | \| | |__ | |
7+
\___ \| __/ _` |/ __| |/ / __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \ | . ` | __| | |
8+
____) | || (_| | (__| <| |____ > < (__| | | | (_| | | | | (_| | __/_| |\ | |____ | |
9+
|_____/ \__\__,_|\___|_|\_\______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___(_)_| \_|______| |_|
10+
__/ |
11+
|___/
12+
13+
```
14+
Created by Hari Haran
15+
- [StackExchange.NET](#stackexchangenet)
16+
- [Overview](#overview)
17+
- [Contributers](#contributers)
18+
- [Usage](#usage)
19+
- [Parameter Filters](#parameter-filters)
20+
21+
## Overview
22+
StackExchange.NET is a .NET Standard managed library that provides easy access to the StackExchange APi's with virtually no boilerplate code required.
23+
24+
Currently the library supports 18 Endpoints ( As on 11:09:2019) listed in the [API Docs](https://api.stackexchange.com/docs). I will be covering all the other endpoints as well, except those that require Auth.
25+
26+
StackEchange.NET is FOSS (MIT License) and written entirely in c#.
27+
28+
## Contributers
29+
30+
## Usage
31+
32+
To create a new API instance provide the apikey. If you need a new key check [docs](https://stackapps.com/apps/oauth/register)
33+
34+
```
35+
var client = new StackExchangeClient("yourApiKey");
36+
```
37+
38+
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
39+
40+
```
41+
var posts = client.Posts.GetAllPosts(postFilter);
42+
```
43+
44+
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
45+
46+
```
47+
var postFilter = new PostFilter()
48+
{
49+
Sort = PostSort.Creation
50+
;
51+
```
52+
53+
## Parameter Filters
54+
55+
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()`
56+
57+
- AnswerFilters
58+
- BadgeFilters
59+
- CommentFilter
60+
- PostFilter
61+
62+
More to be added soon...

‎Sample/StackExchange.NET_Example/Program.cs

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,82 +6,82 @@
66

77
namespace StackExchange.NET_Example
88
{
9-
class Program
10-
{
11-
static void Main(string[] args)
12-
{
13-
var client = new StackExchangeClient("U4DMV*8nvpm3EOpvf69Rxw((");
14-
var queryString = new AnswerFilters()
15-
{
16-
PageSize = 1,
17-
Page = 1,
18-
Sort = Sort.Votes
19-
};
20-
//var answers = client.Answers.GetAllAnswers(queryString);
21-
var ids = new List<string>()
22-
{
23-
"44164379","6841479"
24-
};
25-
//var answers = client.Answers.GetAnswerByIds(ids, queryString);
26-
//var answers = client.Answers.GetCommentsByIds(ids, queryString);
27-
//var answers = client.Answers.GetQuestionByAnswerIds(ids, queryString);
9+
class Program
10+
{
11+
static void Main(string[] args)
12+
{
13+
var client = new StackExchangeClient("U4DMV*8nvpm3EOpvf69Rxw((");
14+
var queryString = new AnswerFilters()
15+
{
16+
PageSize = 1,
17+
Page = 1,
18+
Sort = Sort.Votes
19+
};
20+
//var answers = client.Answers.GetAllAnswers(queryString);
21+
var ids = new List<string>()
22+
{
23+
"44164379","6841479"
24+
};
25+
//var answers = client.Answers.GetAnswerByIds(ids, queryString);
26+
//var answers = client.Answers.GetCommentsByIds(ids, queryString);
27+
//var answers = client.Answers.GetQuestionByAnswerIds(ids, queryString);
2828

29-
var badgeFilter = new BadgeFilters()
30-
{
31-
Sort = BadgeSort.Name
32-
};
33-
//var badges = client.Badges.GetAllBadges(badgeFilter);
29+
var badgeFilter = new BadgeFilters()
30+
{
31+
Sort = BadgeSort.Name
32+
};
33+
//var badges = client.Badges.GetAllBadges(badgeFilter);
3434

35-
var batchIds = new List<string>()
36-
{
37-
"4600","2600","26"
38-
};
35+
var batchIds = new List<string>()
36+
{
37+
"4600","2600","26"
38+
};
3939

40-
//var getBadgesByIds = client.Badges.GetBadgesByIds(batchIds, badgeFilter);
41-
//var getBadgesByIds = client.Badges.GetRecentlyAwardedBadges(badgeFilter);
40+
//var getBadgesByIds = client.Badges.GetBadgesByIds(batchIds, badgeFilter);
41+
//var getBadgesByIds = client.Badges.GetRecentlyAwardedBadges(badgeFilter);
4242

43-
//var getBadgesByIds = client.Badges.GetRecentlyAwardedBadgesByIds(batchIds, badgeFilter);
43+
//var getBadgesByIds = client.Badges.GetRecentlyAwardedBadgesByIds(batchIds, badgeFilter);
4444

45-
//var getBadgesByIds = client.Badges.GetAllTaggedBadges(badgeFilter);
46-
//Console.WriteLine(JsonConvert.SerializeObject(getBadgesByIds));
45+
//var getBadgesByIds = client.Badges.GetAllTaggedBadges(badgeFilter);
46+
//Console.WriteLine(JsonConvert.SerializeObject(getBadgesByIds));
4747

48-
var commentFilter = new CommentFilter()
49-
{
50-
Sort = CommentSort.Creation
51-
};
52-
//var comments = client.Comments.GetAllComments(commentFilter);
48+
var commentFilter = new CommentFilter()
49+
{
50+
Sort = CommentSort.Creation
51+
};
52+
//var comments = client.Comments.GetAllComments(commentFilter);
5353

54-
var commentIds = new List<string>()
55-
{
56-
"102165885", "102166303"
57-
};
58-
//var comments = client.Comments.GetCommentsByIds(commentIds,commentFilter);
59-
//Console.WriteLine(JsonConvert.SerializeObject(comments));
54+
var commentIds = new List<string>()
55+
{
56+
"102165885", "102166303"
57+
};
58+
//var comments = client.Comments.GetCommentsByIds(commentIds,commentFilter);
59+
//Console.WriteLine(JsonConvert.SerializeObject(comments));
6060

61-
var postFilter = new PostFilter()
62-
{
63-
Sort = PostSort.Creation
64-
};
65-
//var posts = client.Posts.GetAllPosts(postFilter);
61+
var postFilter = new PostFilter()
62+
{
63+
Sort = PostSort.Creation
64+
};
65+
//var posts = client.Posts.GetAllPosts(postFilter);
6666

67-
var postIds = new List<string>()
68-
{
69-
"57871119", "57698255"
70-
};
67+
var postIds = new List<string>()
68+
{
69+
"57871119", "57698255"
70+
};
7171

72-
//var postsByIds = client.Posts.GetAllPostsByIds(postIds, postFilter);
72+
var postsByIds = client.Posts.GetAllPostsByIds(postIds, postFilter);
7373

74-
//var postsByIds = client.Posts.GetCommentsOnPosts(postIds, postFilter);
74+
//var postsByIds = client.Posts.GetCommentsOnPosts(postIds, postFilter);
7575

76-
//var revisionByIds = client.Posts.GetRevisionsByIds(postIds, postFilter);
76+
//var revisionByIds = client.Posts.GetRevisionsByIds(postIds, postFilter);
7777

78-
var suggestedEdits = client.Posts.GetSuggestedEdits(postIds, new SuggestedEditFilter()
79-
{
80-
Sort = Sort.Activity
81-
});
78+
// var suggestedEdits = client.Posts.GetSuggestedEdits(postIds, new SuggestedEditFilter()
79+
// {
80+
// Sort = Sort.Activity
81+
// });
8282

83-
Console.WriteLine(JsonConvert.SerializeObject(suggestedEdits));
84-
Console.ReadKey();
85-
}
86-
}
83+
//Console.WriteLine(JsonConvert.SerializeObject(suggestedEdits));
84+
Console.ReadKey();
85+
}
86+
}
8787
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /