[Share]Twitter VB[Dll Wrapper]
Twitter VB
Definition: A "wrapper" is essentially a chunk of code (class, dll, etc.) that you will be able to download, drop into your project, and be pretty much ready to go quickly and efficiently . These "wrappers" will handle all the details of the connections, parameters, and interface for you so that you can focus on just using the object(s).
this is for anyone looking to increase their skills and if your bored, If you feel like developing a Desktop Widget, A App, Or a notification service. This is a Twitter API .net Dll Wrapper. Essentially it allows you to use Twitter API without having to lay down any of the annoying (sometimes time consuming) ground work {which for twitter can be annoying especially now that authorization using OAuth is all that is excepted when creating desktop or web applications}, Simply add the .dll as a reference, and create your application using the API
What You Need.
1. A Twitter API Key
Click Here
2. Visual Basic (or studio if using with C#, Web Developer, etc)
3. The .dll attachment located in this thread
Once you have registered your application and receive your Secret Keys you can begin creating your project.
Among a-lot of other things Twitter VB has
A implementation of OAuth for desktop and web applications. (Which is now the only acceptable way to access twitter from a 3rd party app)
Supports Twitter's new "retweet" and "list" functions.
Can upload photos to TwicPic and TweetPhoto.
Provides access to Url shorteners.
100% .NET code, implemented to be compatible with version 2.0 or higher of the .NET Framework. \
it can be used with any .NET-compliant language (C#, C, Delphi, etc).
Here is a quick tutorial(ish), Quickly made a small project to display how to use it.
After adding the dll as a reference
Code:
Imports TwitterVB2 Imports TwitterAPIException
Code:
Try 'Code Catch Ex as TwitterAPIException 'display error end try
At this point you will have intellisense to guide you. However that API Requires your "Secrets" to gain access to the Twitter API.
First we need to ask the user permission for this app to use their account
Code:
Public TwLog as New TwitterAPI 'On button click event or form load event 'This will generate a unigue url for the user to use your registered application Dim AuthUrl As String = tw.GetAuthorizationLink(ConsumerKey, ConsumerKeySecret)
Once you have a generated URL (which you never need to know, Unless you have some development issues, then maybe you can create a admin part to the application for debugging where all twitter API generated info is stored , like a database for debugging)
Use the URL either in a 3rd party browser or in a browser in your application (or if your not lazy like me, user some parsing to grab the information and cleanly add it to the application)
Code:
Webbrowser1.navigate(AuthUrl)
Here are some screenshots of the process
Login from in app webbrowser

Authorization screen

Now we need to verify the pin is correct
"Ask Twitter to confirm"
'Allow the user to enter the pin number.
Code:
Dim Validate As Boolean = TwLog.ValidatePIN(Textbox1.text)
Code:
If Validate Then
Dim OAuthToken as String = tw.OAuth_Token()
Dim OAuthTokenSecret as String = tw.OAuth_TokenSecret()
End If
That's pretty much it.
To update status use
Code:
TwLog.AuthenticateWith(ConsumerKey,ConsumerKeySecret,OAuthToken,OAuthTokenSecret) TwLog.Update(Textbox2.text)
'Again you can really just parse the information and make this all automatic, just really to lazy.
Get Tweets from homepage
Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","tokensecret")
For Each tweet As TwitterStatus In twlog.HomeTimeline()
' then pass the information to a listbox or similar
Next
Plus the user is required to login from your app because username and password will be required.
Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","oauthtokensecret")
twlog.TweetPhotoUpload("C:\filelocation\Image.jpg", textbox1.text, Username.text, Password.Text", "tweet photo API key")
If you would like to user to be able to read direct messages.
Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","oauthtokensecret")
For Each message As TwitterDirectMessage In twlog.DirectMessages
'then pass the data to a listbox or something (message.SenderScreenName & " : " & message.Text)
Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","tokensecret")
twlog.SendDirectMessage("Twitter UserName to message", "Your Message")
Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","oauthtokensecret")
For Each tweet As TwitterStatus In twlog.UserTimeline("Twitter UserName")
'Pass the information to a listbox or whatever (tweet.User.ScreenName & " : " & tweet.Text)
'This wrapper is part of the twittervb project over at codeplex.
____________________________
Virus Scan Of Attached File
VirusTotal - Free Online Virus, Malware and URL Scanner
http://virusscan.jotti.org/en/scanre...2c35fad8934fed
TwitterVB-2.5.zip




Might have a try at this. /
i, would never find this out xD