Skip to content

Commit cfc8b9d

Browse files
author
Ihtasham
committed
Some changes
1 parent 603a5b3 commit cfc8b9d

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,43 @@
1+
Unofficial C# Wrapper for the [devRant](https://www.devrant.io/) public API.
2+
3+
![](https://www.devrant.io/static/devrant/img/landing/landing-avatars2.png)
4+
5+
# Prerequisites
6+
7+
- .NET Framework 4+
8+
9+
# Getting started
10+
11+
```
12+
using devRantDotNet;
13+
14+
namespace MyProject
15+
{
16+
class MyProgram
17+
{
18+
public static void Main(string[] args)
19+
{
20+
using(var dr = new devRant())
21+
{
22+
Console.WriteLine(dr.GetUserIdAsync("px06").Result);
23+
Console.WriteLine(dr.GetRantsAsync().Result);
24+
...
25+
}
26+
}
27+
}
28+
29+
```
30+
31+
Most methods are available in this library with some ongoing work on improving it. All methods are Async.
32+
133
# devRantDotNet
234

335
This is a library written in C#.NET for access to the devRant API. It aims to provide serialization on the components received so you can easily make use of the library to build applications and other code.
436

37+
# Usage and Documentation
38+
39+
Please see the wiki: https://github.com/redrails/devRantDotNet/wiki/Documentation
40+
541
# Contributing
642

743
If you would like to contribute then please submit pull-requests.

devRantDotNet/Source/devRant.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace devRantDotNet
1515
/// <summary>
1616
/// A C# Wrapper for the devRant API
1717
/// </summary>
18-
public class devRant
18+
public class devRant : IDisposable
1919
{
2020

2121
/// <summary>
@@ -38,7 +38,7 @@ public enum SortType
3838
/// </summary>
3939
recent
4040
}
41-
41+
4242
/// <summary>
4343
/// Uses <see cref="HttpWebRequest"/> and <see cref="HttpWebResponse"/> to create requests to the API.
4444
/// Returns the JSON result.
@@ -320,5 +320,10 @@ public async Task<Rant> GetRandomRantAsync()
320320
return null;
321321
}
322322
}
323+
324+
public void Dispose()
325+
{
326+
//throw new NotImplementedException();
327+
}
323328
}
324329
}

devRantTests/Program.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ public static async void getRandomRant()
5353

5454
static void Main(string[] args)
5555
{
56-
getAllRants();
57-
getSearchResults("px06");
58-
getSingleRant(448369);
59-
getUserProfile(getUserId("px06").Result);
60-
56+
//getAllRants();
57+
//getSearchResults("px06");
58+
//getSingleRant(448369);
59+
//getUserProfile(getUserId("px06").Result);
60+
using(var api = new devRant())
61+
{
62+
Console.WriteLine(api.GetUserIdAsync("px06").Result);
63+
}
6164
Console.ReadLine();
6265
}
6366
}

0 commit comments

Comments
 (0)