O2 API/TweetSharp/Script Examples
From
Examples on using the O2 API/TweetSharp API
Contents |
Create API
var twitterAPI = new O2TwitterAPI(); return twitterAPI; //O2File:O2TwitterAPI.cs
Login using Username and Password
unless there has been abuse on this account, this should return true :)
var twitterAPI = new O2TwitterAPI(); var testUser = "O2Test1"; var testUserPassword = "PleaseDontAbuseThisAccount"; twitterAPI.login(testUser, testUserPassword); return twitterAPI;
Login using Credentials file
This is a better way to write these scripts since the account details are not hardcoded in to the script
var fileWithCredentials = @"C:\O2\_USERDATA\TwitterAccounts.xml"; var credential = fileWithCredentials.deserialize<SecretData>().get_User("DinisCruz"); var twitterAPI = new O2TwitterAPI(); twitterAPI.login(credential);
Write a tweet
twitterAPI.login(testUser, testUserPassword); return twitterAPI.update("This is my first tweet");
get user's timeline (his tweets)
var twitterAPI = new O2TwitterAPI(); twitterAPI.login(credential); return twitterAPI.user_Timeline(); //O2File:O2TwitterAPI.cs //O2File:ISecretData.cs //O2Ref:Dimebrain.TweetSharp.dll
Showing User Timeline in a Table
var twitterAPI = new O2TwitterAPI(); twitterAPI.login(credential); panel.add_TableList_With_Tweets("User Tweets", ()=> { return twitterAPI.user_Timeline();});





