|
1 |
| -# RedditSharp |
2 |
| - |
3 |
| -A partial implementation of the [Reddit](http://reddit.com) API. Includes support for many API endpoints, as well as |
4 |
| -LINQ-style paging of results. |
5 |
| - |
6 |
| -```csharp |
7 |
| -var reddit = new Reddit(); |
8 |
| -var user = reddit.LogIn("username", "password"); |
9 |
| -var subreddit = reddit.GetSubreddit("/r/example"); |
10 |
| -subreddit.Subscribe(); |
11 |
| -foreach (var post in subreddit.New.Take(25)) |
12 |
| -{ |
13 |
| - if (post.Title == "What is my karma?") |
14 |
| - { |
15 |
| - // Note: This is an example. Bots are not permitted to cast votes automatically. |
16 |
| - post.Upvote(); |
17 |
| - var comment = post.Comment(string.Format("You have {0} link karma!", post.Author.LinkKarma)); |
18 |
| - comment.Distinguish(DistinguishType.Moderator); |
19 |
| - } |
20 |
| -} |
21 |
| -``` |
22 |
| - |
23 |
| -**Important note**: Make sure you use `.Take(int)` when working with pagable content. For example, don't do this: |
24 |
| - |
25 |
| -```csharp |
26 |
| -var all = reddit.RSlashAll; |
27 |
| -foreach (var post in all) // BAD |
28 |
| -{ |
29 |
| - // ... |
30 |
| -} |
31 |
| -``` |
32 |
| - |
33 |
| -This will cause you to page through everything that has ever been posted on Reddit. Better: |
34 |
| - |
35 |
| -```csharp |
36 |
| -var all = reddit.RSlashAll; |
37 |
| -foreach (var post in all.Take(25)) |
38 |
| -{ |
39 |
| - // ... |
40 |
| -} |
41 |
| -``` |
42 |
| - |
43 |
| -## Development |
44 |
| - |
45 |
| -RedditSharp is developed with the following workflow: |
46 |
| - |
47 |
| -1. Nothing happens for weeks/months/years |
48 |
| -2. Someone needs it to do something it doesn't already do |
49 |
| -3. That person implements that something and submits a pull request |
50 |
| -4. Repeat |
51 |
| - |
52 |
| -If it doesn't have a feature that you want it to have, add it! The code isn't that scary. |
| 1 | +# RedditSharp |
| 2 | + |
| 3 | +**Hey, listen**! The Reddit admins are making some really crappy changes to the |
| 4 | +API, and I need you to speak out against them. The changes |
| 5 | +[are here](https://www.reddit.com/r/redditdev/comments/3xdf11/introducing_new_api_terms/) |
| 6 | +and you should |
| 7 | +[message the admins](https://www.reddit.com/message/compose?to=/r/reddit.com&subject=The+planned+API+changes+are+awful&message=Hey,+the+planned+API+changes+are+pretty+awful.+You%27re+asking+users+to+reveal+far+too+much+about+themselves+and+making+the+barrier+to+entry+much+higher+for+new+developers+who+want+to+do+cool+things+with+the+Reddit+API.+You+already+ask+users+to+put+contact+information+in+their+user+agent+string,+and+that+should+be+sufficient.) |
| 8 | +if you disagree with them (you're welcome to change this message to something |
| 9 | +more personal). |
| 10 | + |
| 11 | +A partial implementation of the [Reddit](http://reddit.com) API. Includes support for many API endpoints, as well as |
| 12 | +LINQ-style paging of results. |
| 13 | + |
| 14 | +```csharp |
| 15 | +var reddit = new Reddit(); |
| 16 | +var user = reddit.LogIn("username", "password"); |
| 17 | +var subreddit = reddit.GetSubreddit("/r/example"); |
| 18 | +subreddit.Subscribe(); |
| 19 | +foreach (var post in subreddit.New.Take(25)) |
| 20 | +{ |
| 21 | + if (post.Title == "What is my karma?") |
| 22 | + { |
| 23 | + // Note: This is an example. Bots are not permitted to cast votes automatically. |
| 24 | + post.Upvote(); |
| 25 | + var comment = post.Comment(string.Format("You have {0} link karma!", post.Author.LinkKarma)); |
| 26 | + comment.Distinguish(DistinguishType.Moderator); |
| 27 | + } |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +**Important note**: Make sure you use `.Take(int)` when working with pagable content. For example, don't do this: |
| 32 | + |
| 33 | +```csharp |
| 34 | +var all = reddit.RSlashAll; |
| 35 | +foreach (var post in all) // BAD |
| 36 | +{ |
| 37 | + // ... |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +This will cause you to page through everything that has ever been posted on Reddit. Better: |
| 42 | + |
| 43 | +```csharp |
| 44 | +var all = reddit.RSlashAll; |
| 45 | +foreach (var post in all.Take(25)) |
| 46 | +{ |
| 47 | + // ... |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +## Development |
| 52 | + |
| 53 | +RedditSharp is developed with the following workflow: |
| 54 | + |
| 55 | +1. Nothing happens for weeks/months/years |
| 56 | +2. Someone needs it to do something it doesn't already do |
| 57 | +3. That person implements that something and submits a pull request |
| 58 | +4. Repeat |
| 59 | + |
| 60 | +If it doesn't have a feature that you want it to have, add it! The code isn't that scary. |
0 commit comments