bas.Blogmarks.MarkClient? C# Client
A C# Client to the blogmarks.net Atom API
Regard this library as a sample to use the blogmarks.net Atom Api. While this Api may change at any time, this code needs to be updated.
Public Methods
- public MarkEntry addMark(MarkEntry entry)
- public MarkEntry updateMark(MarkEntry entry)
- public bool deleteMark(int id)
- public MarkEntry getMark(int id)
- public MarkEntry getLastMark()
A MarkEntry is an object with the following properties :
- title string (required)
- link string (required)
- summary string
- isPrivate boolean (default false)
- categories string array
- via string
Sample (see Class1.cs)
string username = "killi";
string password = "xxxxx";
MarkClient bmc = new MarkClient(username, password);
// Adding a new mark
MarkEntry newm = new MarkEntry();
newm.title = "Killifishes";
newm.link = "http://www.peixebom.com.br/Killies/killies.htm";
newm.isPrivate = true;
newm.via = "http://www.google.com/?q=Killies";
MarkEntry result = bmc.addMark(newm);
if (result == null) {
Console.WriteLine("Error : " + bmc.lastError);
return;
}
Console.WriteLine("Your entry \"" + result.title + "\" was posted to Blogmarks.net!");
// Getting the new mark
MarkEntry lastm = bmc.getLastMark();
if (lastm == null) {
Console.WriteLine("Error : " + bmc.lastError);
return;
}
Console.WriteLine("Your last entry is \"" + lastm.title + "\".");
// Updating the last mark with tags and new description
lastm.summary = "very interesting site !";
lastm.categories = new string[] {"test", "nyfiken", "i love fishes"};
result = bmc.updateMark(lastm);
if (result == null) {
Console.WriteLine("Error : " + bmc.lastError);
return;
}
Console.WriteLine("Blogmarks.net has updated this \"" + result.summary + "\"");
// Deleting the mark
Console.Write("Hit <enter> to delete last mark...");
Console.ReadLine();
bool gone = bmc.deleteMark(lastm.entryId);
if (gone == false) {
Console.WriteLine("Error : " + bmc.lastError);
return;
}
Console.WriteLine("Your last mark has gone");
Visual Studio 2003 solution
- Library : bas.Blogmarks project
- Sample : Sample project
Manual builds
- Library : csc -t:library -out:bas.Blogmarks.dll Mark*.cs
- Sample : csc -r:bas.Blogmarks.dll -target:exe -out:Class1.exe Class1.cs
Issues
- Don't work with Mono (1.1.8) but I can't discover why.
- Should use Atom.NET (http://atomnet.sourceforge.net/) to implement a getTagsList() method
Credits
- Atomizer was a good starting point to understand how to use Atom API and REST (http://www.gotdotnet.com/workspaces/workspace.aspx?id=4cd32ea2-c4be-400e-9391-caf05c0d273a)
Attachments
- MarkClient.cs (11.9 kB) -
Main library source
, added by ms_michel on 08/02/05 19:38:15. - MarkEntry.cs (3.8 kB) -
Library source for entry
, added by ms_michel on 08/02/05 19:39:14. - Class1.cs (2.1 kB) -
Sample
, added by ms_michel on 08/02/05 19:40:49. - Blogmarks.tar.gz (23.6 kB) -
Full VS2003 solution
, added by ms_michel on 08/02/05 19:41:24.
