本文整理汇总了C#中GlobusTwitterLib.Authentication.oAuthTwitter类的典型用法代码示例。如果您正苦于以下问题:C# oAuthTwitter类的具体用法?C# oAuthTwitter怎么用?C# oAuthTwitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
oAuthTwitter类属于GlobusTwitterLib.Authentication命名空间,在下文中一共展示了oAuthTwitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getTwitterData
public void getTwitterData(object UserId)
{
try
{
Guid userId = (Guid)UserId;
oAuthTwitter OAuth = new oAuthTwitter(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);
TwitterAccountRepository objTwtRepo = new TwitterAccountRepository();
ArrayList arrTwtAcc = objTwtRepo.getAllTwitterAccountsOfUser(userId);
foreach (TwitterAccount itemTwt in arrTwtAcc)
{
OAuth.AccessToken = itemTwt.OAuthToken;
OAuth.AccessTokenSecret = itemTwt.OAuthSecret;
getUserProile(OAuth, itemTwt.TwitterUserId, userId);
getUserTweets(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
getUserFeed(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
示例2: FollowersStatus
/// <summary>
/// This Method Get All Followers Details of User
/// </summary>
/// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="ScreenName">User Screen Name</param>
/// <returns></returns>
public XmlDocument FollowersStatus(oAuthTwitter oAuth, string ScreenName, string cursor)
{
string RequestUrl = Globals.FollowerStatusUrl + ScreenName + ".xml?cursor=" + cursor;
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例3: FriendsId
/// <summary>
/// This Method Will Get All Friends Id of User
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="ScreenName">ScreenName Of Whom You Want To Get FriendsId</param>
/// <returns>All Friends Id</returns>
public XmlDocument FriendsId(oAuthTwitter OAuth, string ScreenName, SortedDictionary<string, string> strdic)
{
string RequestUrl = Globals.FriendsIdUrl + ScreenName;
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,strdic);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例4: PostScheduleMessage
public override void PostScheduleMessage(dynamic data)
{
try
{
oAuthTwitter OAuthTwt = new oAuthTwitter();
TwitterAccountRepository fbaccrepo = new TwitterAccountRepository();
TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId);
OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"];
OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"];
OAuthTwt.ConsumerKeySecret = System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"];
OAuthTwt.AccessToken = twtaccount.OAuthToken;
OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret;
OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
OAuthTwt.TwitterUserId = twtaccount.TwitterUserId;
#region For Testing
// For Testing
//OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
//OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
//OAuthTwt.AccessToken = "1904022338-Ao9chvPouIU8ejE1HMG4yJsP3hOgEoXJoNRYUF7";
//OAuthTwt.AccessTokenSecret = "Wj93a8csVFfaFS1MnHjbmbPD3V6DJbhEIf4lgSAefORZ5";
//OAuthTwt.TwitterScreenName = "";
//OAuthTwt.TwitterUserId = "";
#endregion
TwitterUser twtuser = new TwitterUser();
if (string.IsNullOrEmpty(data.ShareMessage))
{
data.ShareMessage = "There is no data in Share Message !";
}
JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage);
Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage);
ScheduledMessageRepository schrepo = new ScheduledMessageRepository();
schrepo.updateMessage(data.Id);
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
Log log = new Log();
log.CreatedDate = DateTime.Now;
log.Exception = ex.Message;
log.Id = Guid.NewGuid();
log.ModuleName = "TwitterScheduler";
log.ProfileId = data.ProfileId;
log.Status = false;
LogRepository logRepo = new LogRepository();
logRepo.AddLog(log);
}
}
示例5: Rate_Limit_Status
//#region OAuth
///// <summary>
///// This Method Will Check That User is Authenticated Or Not Using OAUTH
///// </summary>
///// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
///// <returns>Return Xml Text With User Details</returns>
//public XmlDocument Verify_Credentials(oAuthTwitter OAuth)
//{
// string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, String.Empty);
// xmlResult.Load(new StringReader(response));
// return xmlResult;
//}
/// <summary>
/// This method Will Check Rate Limit Of Account Using OAUTH
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Return Xml Text With User Details</returns>
public XmlDocument Rate_Limit_Status(oAuthTwitter OAuth, SortedDictionary<string, string> strdic)
{
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.RateLimitStatusUrl, strdic);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例6: SearchMethodForTwtUser
public JObject SearchMethodForTwtUser(oAuthTwitter OAuth, string SearchKey, string pageindex)
{
TwitterWebRequest twtWebReq = new TwitterWebRequest();
string RequestUrl = Globals.SearchTwtUserUrl + SearchKey + "&page=" + pageindex;
JObject response = objTwitterWebRequest.PerformWebRequest(RequestUrl, "GET");
return response;
}
示例7: FollowersId
/// <summary>
/// This Method Will Get All Followers Id of User
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <param name="ScreenName">ScreenName Of Whom You Want To Get Followers Id</param>
/// <returns>All Followers Id</returns>
public XmlDocument FollowersId(oAuthTwitter OAuth, string ScreenName)
{
string RequestUrl = Globals.FollowersIdUrl + ScreenName;
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例8: FollowAccount
public static bool FollowAccount(string AccessToken,string AccessTokenSecret ,string Screen_name, string user_id)
{
bool IsFollowed = false;
oAuthTwitter oauth = new oAuthTwitter();
oauth.AccessToken = AccessToken;
oauth.AccessTokenSecret = AccessTokenSecret;
oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
string RequestUrl = "https://api.twitter.com/1.1/friendships/create.json";
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
if (!string.IsNullOrEmpty(Screen_name))
{
strdic.Add("screen_name", Screen_name);
}
else if (!string.IsNullOrEmpty(user_id))
{
strdic.Add("user_id", user_id);
}
else
{
return false;
}
strdic.Add("follow", "true");
string response = oauth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
if (!string.IsNullOrEmpty(response))
{
IsFollowed = true;
}
return IsFollowed;
}
示例9: PostScheduleMessage
public override void PostScheduleMessage(dynamic data)
{
try
{
oAuthTwitter OAuthTwt = new oAuthTwitter();
TwitterAccountRepository fbaccrepo = new TwitterAccountRepository();
TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId);
OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"];
OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"];
OAuthTwt.ConsumerKeySecret= System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"];
OAuthTwt.AccessToken = twtaccount.OAuthToken;
OAuthTwt.AccessTokenSecret= twtaccount.OAuthSecret;
OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
TwitterUser twtuser = new TwitterUser();
JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage);
Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage);
ScheduledMessageRepository schrepo = new ScheduledMessageRepository();
schrepo.updateMessage(data.Id);
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
示例10: SearchMethod
/// <summary>
/// This Method Will Get All Trends Of Twitter Using OAUTH
/// </summary>
/// <param name="User">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Json Text Of Trends</returns>
public XmlDocument SearchMethod(oAuthTwitter OAuth, string SearchKey, string pageindex)
{
TwitterWebRequest twtWebReq = new TwitterWebRequest();
string RequestUrl = Globals.SearchUrl + SearchKey + "&page=" + pageindex;
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl,string.Empty);
xmlResult.Load(new StringReader(response));
return xmlResult;
}
示例11: Verify_Credentials
/// <summary>
/// This Method Will Check That User is Authenticated Or Not Using OAUTH
/// </summary>
/// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Return Xml Text With User Details</returns>
public JArray Verify_Credentials(oAuthTwitter OAuth)
{
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, strdic);
//xmlResult.Load(new StringReader(response));
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}
示例12: Post_Statuses_DestroyById
/// <summary>
/// Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. Returns the destroyed status if successful.
/// </summary>
/// <param name="oAuth"></param>
/// <param name="UserId"></param>
/// <returns></returns>
public JArray Post_Statuses_DestroyById(oAuthTwitter oAuth, string UserId)
{
SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
string RequestUrl = Globals.StatusDestroyByIdUrl + UserId + ".json";
string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
if (!response.StartsWith("["))
response = "[" + response + "]";
return JArray.Parse(response);
}
示例13: AuthenticateTwitter
public void AuthenticateTwitter(object sender, EventArgs e)
{
oAuthTwitter OAuth = new oAuthTwitter();
if (Request["oauth_token"] == null)
{
OAuth.AccessToken = string.Empty;
OAuth.AccessTokenSecret = string.Empty;
OAuth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
Response.Redirect(OAuth.AuthorizationLinkGet());
}
}
示例14: Verify_Credentials
/// <summary>
/// This Method Will Check That User Is Authenticatde Or Not
/// </summary>
/// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
/// <returns>Return True If User Is Authenticated</returns>
public bool Verify_Credentials(oAuthTwitter oAuth)
{
Twitter.Core.AccountMethods.Account account = new Twitter.Core.AccountMethods.Account();
JArray obj = account.Verify_Credentials(oAuth);
// XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");
foreach (var item in obj)
{
//XmlElement idElement = (XmlElement)xmlNode;
//twitterUser.UserID = idElement.GetElementsByTagName("id")[0].InnerText;
return true;
}
return false;
}
示例15: CheckTwitterToken
public bool CheckTwitterToken(oAuthTwitter objoAuthTwitter, string txtvalue)
{
bool CheckTwitterToken = false;
//oAuthTwitter oAuthTwt = new oAuthTwitter();
Users twtUser = new Users();
try
{
JArray twtuserjson = twtUser.Get_Users_Search(objoAuthTwitter, txtvalue, "5");
CheckTwitterToken = true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return CheckTwitterToken;
}