Skip to content

stuarthillary/Disqus.NET

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disqus.NET

Build status

Example usage

  • Get forum details
var disqus = new DisqusApi(DisqusAuthMethod.SecretKey, <your_application_secret_key>);

var request = DisqusForumDetailsRequest
    .New("disqus")
    .Related(DisqusForumRelated.Author)
    .Attach(DisqusForumAttach.ForumForumCategory | DisqusForumAttach.Counters);

var response = await disqus.Forums.DetailsAsync(request).ConfigureAwait(false);
  • Get forum threads page by page using cursor
var disqus = new DisqusApi(DisqusAuthMethod.SecretKey, <your_application_secret_key>);

List<string> threads = new List<string>();
string cursor = null;

do
{
    var request = DisqusForumListThreadsRequest
        .New("disqus")
        .Limit(100)
        .Cursor(cursor)
        .Include(DisqusThreadInclude.Open)
        .Since(new DateTime(2016, 09, 01))
        .Order(DisqusOrder.Asc);

    var response = await disqus.Forums
        .ListThreadsAsync(request)
        .ConfigureAwait(false);

    /* do something with threads */
    foreach (var thread in response.Response)
    {
        threads.Add(thread.Id);
    }

    // if cursor has more then set cursor to next result
    if (response.Cursor.More)
    {
        cursor = response.Cursor.Next;
    }
    else
    {
        cursor = null;
    }

} while (cursor != null);
	    
  • More examples

See integration tests for examples of usage

Installation

Disqus.NET is available as Nuget-package

Resources

About

Disqus API for .NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.2%
  • PowerShell 1.8%