A fully featured C# wrapper for the pinboard.in API.
PM> Install-Package pinboard.net
Since this is written atop .Net Standard 1.4, it will run on the following platforms:
- .NET Core 1.0
- .NET Framework 4.6.1
- Mono 4.6
- Xamarin.iOS 10.0
- Xamarin.Android 7.0
- Universal Windows Platform 10
To start, retrieve the Pinboard API Token from the password page on the website.
The class that starts it all is PinboardAPI
. It implements IDisposable
and
is best used within an using
block like so:
using (var pb = new PinboardAPI(apiToken))
{
// ...
}
This internally creates and reuses one instance of HttpClient
per
instance of PinboardAPI
.
The pb
object can now be used to make calls to the Pinboard API
Returns the most recent time a bookmark was added, updated or deleted. Use this before calling All to see if the data has changed since the last fetch.
pb.Posts.GetLastUpdate()
var bookmark = new Bookmark
{
Url = "http://linkur.co.in",
Description = "Bookmarking for groups!",
Extended = "",
Tags = new List<string> { "bookmarking", "web", "tools" },
dt = DateTime.Now,
Shared = true,
ToRead = false
};
pb.Posts.Add(bookmark);
// Get the bookmark first
var bookmark = pb.Posts.All().FirstOrDefault();
bookmark.Extended = "Nothing does group bookmarking better";
bookmark.Tags.Add("free");
pb.Posts.Update(bookmark)
pb.Posts.Delete("http://linkur.co.in");
Returns one or more posts on a single day matching the arguments. If no date or url is given, date of most recent bookmark will be used.
It can be filtered by:
- Tags
- Date
- URL
pb.Posts.Get();
Returns a list of the user's most recent posts, filtered by tag.
pb.Posts.Recent(tags: new List<string> { "programming", "dotnet" });
Returns all bookmarks in the user's account.
It can be filtered by:
- Tags
- Offset
- Number of results
- From date
- To date
pb.Posts.All()
This also returns the number of times each tag has been used
pb.Tags.Get()
pb.Posts.Suggest("https://linkur.co.in")
pb.Tags.Delete("prugramming");
pb.Tags.Rename("pithon", "python");
Returns the user's secret RSS key (for viewing private feeds)
pb.Users.Secret()
Returns the user's API token (for making API calls without a password)
pb.Users.ApiToken()
pb.Notes.List()
pb.Notes.Note("foobar")