DEV Community

Aleksey Podoba
Aleksey Podoba

Posted on

Showdev: DevToAPI - Forem/DEV API Client Library for .NET

Hello comunity πŸ‘‹

I built DevToAPI - a simple .NET library that implements the Forem/Dev.to API. At the moment, all endpoints are implemented.
I hope it will be useful ;)

Usage examples:

Create new article

var client = new DevToClient("api-key");
await client.Articles.CreateAsync(new CreateArticle()
{
    Title = "My post",
    BodyMarkdown = "...",
    Tags = new List<string>()
    {
        "csharp",
        "opensource"
    },
    Published = true
});
Enter fullscreen mode Exit fullscreen mode

Pagination

var client = new DevToClient("api-key");
var pagination = await client.Articles.GetAllMyAsync();

while (pagination.CanMoveNext)
{
    var myArticles = pagination.Items;

    //do stuff

    await pagination.NextPageAsync();
}
Enter fullscreen mode Exit fullscreen mode

Specific page

var client = new DevToClient("api-key");
var pagination = await client.Articles.GetAllMyAsync(option =>
{
    option.Page = 5;
    option.PageSize = 10;
});
Enter fullscreen mode Exit fullscreen mode

Supported Platforms

.NET 4.5.2 or greater
.NET Standard 2.0 or greater

Top comments (0)