/// <summary> /// Gets a user's timeline from the Twitter service /// </summary> /// <param name="UserName">The screen name of the user</param> /// <returns>The XML doc returned from the Twitter service /// contatining the timeline</returns> public virtual string GetTimeline(string UserName) { this.Method = HTTPMethod.POST; this.Url = new Uri("http://twitter.com/statuses/user_timeline.xml"); this.AddParameter("screen_name", UserName); REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); return(RestHelper.GET()); }
/// <summary> /// Updates the status of the user /// </summary> /// <param name="Status">Status of the user (needs to be within 140 characters)</param> /// <returns>The XML doc returned from the Twitter service</returns> public virtual string UpdateStatus(string Status) { this.Method = HTTPMethod.POST; this.Url = new Uri("http://twitter.com/statuses/update.xml"); this.AddParameter("status", Status); REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); return(RestHelper.POST()); }
/// <summary> /// Gets the access token/token secret which are used in actual calls /// (requires the PIN from the authorization site and the request token /// and request token secret) /// </summary> /// <param name="PIN">PIN received from the authorization site</param> /// <param name="AccessToken">The access token</param> /// <param name="AccessTokenSecret">The access token secret</param> public virtual void GetAccessToken(string PIN, out string AccessToken, out string AccessTokenSecret) { this.Url = new Uri("https://twitter.com/oauth/access_token"); this.AddParameter("oauth_verifier", PIN); this.Method = HTTPMethod.POST; REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); string Value = RestHelper.POST(); Regex TokenRegex = new Regex("oauth_token=(?<Value>[^&]*)"); Match TempToken = TokenRegex.Match(Value); AccessToken = TempToken.Groups["Value"].Value; Regex TokenSecretRegex = new Regex("oauth_token_secret=(?<Value>[^&]*)"); Match TempTokenSecret = TokenSecretRegex.Match(Value); AccessTokenSecret = TempTokenSecret.Groups["Value"].Value; }
/// <summary> /// Gets a request token/token secret /// </summary> /// <param name="Token">The request token</param> /// <param name="TokenSecret">The request token secret</param> public void GetRequestToken(out string Token, out string TokenSecret) { this.Token = ""; this.TokenSecret = ""; this.Method = HTTPMethod.GET; this.Url = new Uri("http://twitter.com/oauth/request_token"); REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); string Value = RestHelper.GET(); Regex TokenRegex = new Regex("oauth_token=(?<Value>[^&]*)"); Match TempToken = TokenRegex.Match(Value); Token = TempToken.Groups["Value"].Value; Regex TokenSecretRegex = new Regex("oauth_token_secret=(?<Value>[^&]*)"); Match TempTokenSecret = TokenSecretRegex.Match(Value); TokenSecret = TempTokenSecret.Groups["Value"].Value; }
/// <summary> /// Gets a request token/token secret /// </summary> /// <param name="Token">The request token</param> /// <param name="TokenSecret">The request token secret</param> public virtual void GetRequestToken(out string Token, out string TokenSecret) { this.Token = ""; this.TokenSecret = ""; this.Method = HTTPMethod.GET; this.Url = new Uri("http://twitter.com/oauth/request_token"); REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); string Value = RestHelper.GET(); Regex TokenRegex = new Regex("oauth_token=(?<Value>[^&]*)"); Match TempToken = TokenRegex.Match(Value); Token = TempToken.Groups["Value"].Value; Regex TokenSecretRegex = new Regex("oauth_token_secret=(?<Value>[^&]*)"); Match TempTokenSecret = TokenSecretRegex.Match(Value); TokenSecret = TempTokenSecret.Groups["Value"].Value; }
/// <summary> /// Updates the status of the user /// </summary> /// <param name="Status">Status of the user (needs to be within 140 characters)</param> /// <returns>The XML doc returned from the Twitter service</returns> public virtual string UpdateStatus(string Status) { this.Method = HTTPMethod.POST; this.Url = new Uri("http://twitter.com/statuses/update.xml"); this.AddParameter("status", Status); REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); return RestHelper.POST(); }
/// <summary> /// Gets a user's timeline from the Twitter service /// </summary> /// <param name="UserName">The screen name of the user</param> /// <returns>The XML doc returned from the Twitter service /// contatining the timeline</returns> public virtual string GetTimeline(string UserName) { this.Method = HTTPMethod.POST; this.Url = new Uri("http://twitter.com/statuses/user_timeline.xml"); this.AddParameter("screen_name", UserName); REST.REST RestHelper = new Utilities.Web.REST.REST(); RestHelper.Url = new Uri(GenerateRequest()); return RestHelper.GET(); }
/// <summary> /// Constructor /// </summary> public OpenSearch() { RestHelper = new Utilities.Web.REST.REST(); }