Newbtech .net 3.5/C# Twitter API Wrapper
A .net 3.5 wrapper for the Twitter API
Author: Deepak Prasad (dee@newbtech.com)
Version: 1.0.0.4 (Alpha) – PREVIEW RELEASE
Latest News (19 October 2009)
Ability to retrieve a specified user’s followers (just their Id’s) in version 1.0.0.4
Ability to retrieve a specified user’s details (given their screen id) in version 1.0.0.4
Introduction
This library provides a simple .net interface for the Twitter API. The main Twitter API documentation is here: (http://apiwiki.twitter.com/Twitter-API-Documentation). What the NewbtechTwitter library tries to do is wrap as many of these calls as possible and returns back friendly objects that you can access to get the most out of the Twitter API’s.
Note: It makes use of the XML Web Services of the Twitter API.
Release Notes
As development is continuing, the latest release notes can always be found here: http://www.newbtech.com/twitterapiwrapper/release-notes
Methods Available
You can review the complete list of methods here:
http://www.newbtech.com/twitterapiwrapper/methods-available (updated 1.0.0.4 – 19 October 2009).
More methods will be made available in subsequent releases. If there is any one in particular that you are looking for, please let me know.
Prerequisites
Visual Studio 2008 with .Net 3.5 SP1
Download
To download, use the following link :
Latest build: Version 1004 (October 19, 2009)
- http://www.newbtech.com/TwitterAPI/Newbtech.TwitterAPI.1004.zip (release notes)
Older builds:
- Release 1003 (August 13 2009) – http://www.newbtech.com/TwitterAPI/Newbtech.TwitterAPI.1003.zip
- Release 1002 (June 22 2009) – http://www.newbtech.com/TwitterAPI/Newbtech.TwitterAPI.1002.zip
- Release 1001 (June 19 2009) – http://www.newbtech.com/TwitterAPI/Newbtech.TwitterAPI.1001.zip
- Release 1000 (June 18 2009) – http://www.newbtech.com/TwitterAPI/Newbtech.TwitterAPI.1000.zip
Usage
This assumes that you have referenced the three DLL’s in the archive above within your project and have put the following using statements in your class:
using Newbtech.TwitterAPI; using Newbtech.TwitterAPI.Objects;
Most of the methods returns back generic lists of objects that you can easily reference. As an example, if you wish to get a list of your friends (people you follow):
TwitterAPI.Interface api = new Interface(USERNAME, PASSWORD);
Friends friends = api.GetFriends();
Then to list out all your friends, you would simply go through the friends list and access each user:
foreach (UserDetails user in friends.FriendsList) { Console.WriteLine(user.ScreenName); }
I will be adding more detailed documentation later. Most of the functionality should be pretty much self-explanatory. I also include the source XML for each object as a public property just in case you wish to traverse through them to get any additional information.
As an example, the UserDetails class (which stores the information about a user) contains the following:
public XmlElement SourceXml { get; set; } public string Id { get; set; } public string Name { get; set; } public string ScreenName { get; set; } public string Location { get; set; } public string Description { get; set; } public string ProfileImageUrl { get; set; } public string Url { get; set; } public TriState Protected { get; set; } public long FollowerCount { get; set; } public long FriendsCount { get; set; } public long FavoritesCount { get; set; } public long StatusCount { get; set; } public TriState IsFollowing { get; set; }
Features to come..
- EXCEPTION HANDLING (yes, there isn’t much there yet!)
- Commenting on the code ;-)
- URL Shortening Service – done 1.0.01
- Relative Time
- Json support
- OAuth Authentication and workflow
- etc etc.
License
You are welcome to use the DLL’s as they are. However, you are not allowed to disassemble the libraries without prior consent. You may not use these DLL’s for any commercial application without prior consent. All code within these DLL’s remain the property of Newbtech.
A fuller license agreement will be coming towards final release.