本文整理汇总了C#中Twitterizer.OptionalProperties类的典型用法代码示例。如果您正苦于以下问题:C# OptionalProperties类的具体用法?C# OptionalProperties怎么用?C# OptionalProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OptionalProperties类属于Twitterizer命名空间,在下文中一共展示了OptionalProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetStatus
/// <summary>
/// Gets the rate limiting status status for the authenticated user.
/// </summary>
/// <param name="tokens">The OAuth tokens.</param>
/// <param name="options">The options.</param>
/// <returns>
/// A <see cref="TwitterRateLimitStatus"/> instance.
/// </returns>
public static TwitterResponse<TwitterRateLimitStatus> GetStatus(OAuthTokens tokens, OptionalProperties options)
{
Commands.RateLimitStatusCommand command = new Twitterizer.Commands.RateLimitStatusCommand(tokens, options);
TwitterResponse<TwitterRateLimitStatus> result = Core.CommandPerformer.PerformAction(command);
return result;
}
示例2: Send
/// <summary>
/// Sends a new direct message to the specified user from the authenticating user.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="userId">The user id.</param>
/// <param name="text">The text.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The function.</param>
/// <returns></returns>
public static IAsyncResult Send(OAuthTokens tokens, decimal userId, string text, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterDirectMessage>> function)
{
Func<OAuthTokens, decimal, string, OptionalProperties, TwitterResponse<TwitterDirectMessage>> methodToCall = TwitterDirectMessage.Send;
return methodToCall.BeginInvoke(
tokens,
userId,
text,
options,
result => AsyncUtility.ThreeParamsCallback(result, timeout, methodToCall, function),
null);
}
示例3: CheckMembership
/// <summary>
/// Check if a user is a member of the specified list.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="ownerUsername">The owner username.</param>
/// <param name="listId">The list id.</param>
/// <param name="userId">The user id.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The function.</param>
/// <returns></returns>
public static IAsyncResult CheckMembership(OAuthTokens tokens, string ownerUsername, string listId, decimal userId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
{
Func<OAuthTokens, string, string, decimal, OptionalProperties, TwitterResponse<TwitterUser>> methodToCall = TwitterList.CheckMembership;
return methodToCall.BeginInvoke(
tokens,
ownerUsername,
listId,
userId,
options,
result => AsyncUtility.FourParamsCallback(result, timeout, methodToCall, function),
null);
}
示例4: RequestGetDirectMessageNew
public void RequestGetDirectMessageNew(string screen_name, string text, Action<TwitterDirectMessage> action)
{
OptionalProperties option = new OptionalProperties();
option.APIBaseAddress = Whisper.Properties.Settings.Default.APIBaseAddress;
TwitterResponse<TwitterUser> showUserResponse = TwitterUser.Show(_tokens, screen_name, option);
if (showUserResponse.Result == RequestResult.Success)
{
TwitterResponse<TwitterDirectMessage> response = TwitterDirectMessage.Send(_tokens, showUserResponse.ResponseObject.Id, text, option);
if (response.Result == RequestResult.Success)
{
action(response.ResponseObject);
}
}
}
示例5: GetStatus
/// <summary>
/// Gets the rate limiting status status for the authenticated user asynchronously.
/// </summary>
/// <param name="tokens">The OAuth tokens.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The callback or anonymous funtion.</param>
/// <returns>
/// A <see cref="TwitterRateLimitStatus"/> instance.
/// </returns>
public static IAsyncResult GetStatus(OAuthTokens tokens, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterRateLimitStatus>> function)
{
Func<OAuthTokens, OptionalProperties, TwitterResponse<TwitterRateLimitStatus>> methodToCall = TwitterRateLimitStatus.GetStatus;
return methodToCall.BeginInvoke(
tokens,
options,
result =>
{
result.AsyncWaitHandle.WaitOne(timeout);
try
{
function(methodToCall.EndInvoke(result).ToAsyncResponse());
}
catch (Exception ex)
{
function(new TwitterAsyncResponse<TwitterRateLimitStatus>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
}
},
null);
}
示例6: ReportUser
/// <summary>
/// Blocks the user and reports them for spam/abuse.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="screenName">The users screenName.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The function.</param>
/// <returns></returns>
public static IAsyncResult ReportUser(OAuthTokens tokens, string screenName, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
{
Func<OAuthTokens, string, OptionalProperties, TwitterResponse<TwitterUser>> methodToCall = TwitterSpam.ReportUser;
return methodToCall.BeginInvoke(
tokens,
screenName,
options,
result =>
{
result.AsyncWaitHandle.WaitOne(timeout);
try
{
function(methodToCall.EndInvoke(result).ToAsyncResponse());
}
catch (Exception ex)
{
function(new TwitterAsyncResponse<TwitterUser>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
}
},
null);
}
示例7: Delete
/// <summary>
/// Deletes the saved search specified in the ID parameter as the authenticating user.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="statusId">The saved search id.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The function.</param>
/// <returns></returns>
public static IAsyncResult Delete(OAuthTokens tokens, decimal savedsearchId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterSavedSearch>> function)
{
Func<OAuthTokens, decimal, OptionalProperties, TwitterResponse<TwitterSavedSearch>> methodToCall = TwitterSavedSearch.Delete;
return methodToCall.BeginInvoke(
tokens,
savedsearchId,
options,
result =>
{
result.AsyncWaitHandle.WaitOne(timeout);
try
{
function(methodToCall.EndInvoke(result).ToAsyncResponse());
}
catch (Exception ex)
{
function(new TwitterAsyncResponse<TwitterSavedSearch>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
}
},
null);
}
示例8: CheckMembership
/// <summary>
/// Check if a user is a member of the specified list.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="ownerUsername">The owner username.</param>
/// <param name="listId">The list id.</param>
/// <param name="userId">The user id.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The function.</param>
/// <returns></returns>
public static IAsyncResult CheckMembership(OAuthTokens tokens, string ownerUsername, string listId, decimal userId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
{
Func<OAuthTokens, string, string, decimal, OptionalProperties, TwitterResponse<TwitterUser>> methodToCall = TwitterList.CheckMembership;
return methodToCall.BeginInvoke(
tokens,
ownerUsername,
listId,
userId,
options,
result =>
{
result.AsyncWaitHandle.WaitOne(timeout);
try
{
function(methodToCall.EndInvoke(result).ToAsyncResponse());
}
catch (Exception ex)
{
function(new TwitterAsyncResponse<TwitterUser>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
}
},
null);
}
示例9: PublicTimeline
/// <summary>
/// Returns the 20 most recent statuses, including retweets if they exist, from non-protected users. The public timeline is cached for 60 seconds.
/// </summary>
/// <param name="tokens">The oauth tokens.</param>
/// <param name="options">The options.</param>
/// <returns>A <see cref="TwitterStatusCollection"/>.</returns>
/// <remarks></remarks>
public static TwitterResponse<TwitterStatusCollection> PublicTimeline(OAuthTokens tokens, OptionalProperties options)
{
Commands.PublicTimelineCommand command = new Commands.PublicTimelineCommand(tokens, options);
TwitterResponse<TwitterStatusCollection> result = CommandPerformer.PerformAction(command);
return result;
}
示例10: NoRetweetIDs
/// <summary>
/// Returns a collection of IDs that the user does not want to see retweets from.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="options">The options.</param>
/// <returns></returns>
public static TwitterResponse<UserIdCollection> NoRetweetIDs(OAuthTokens tokens, OptionalProperties options)
{
Commands.NoRetweetIDsCommand command = new Commands.NoRetweetIDsCommand(tokens, options);
return Core.CommandPerformer.PerformAction(command);
}
示例11: Show
/// <summary>
/// Returns detailed information about the relationship between two users.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="sourceUserName">The source user name.</param>
/// <param name="targetUserName">The target user name.</param>
/// <param name="options">The options.</param>
/// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
public static TwitterResponse<TwitterRelationship> Show(OAuthTokens tokens, string sourceUserName, string targetUserName, OptionalProperties options)
{
Commands.ShowFriendshipCommand command = new Twitterizer.Commands.ShowFriendshipCommand(tokens, 0, sourceUserName, 0, targetUserName, options);
return Core.CommandPerformer.PerformAction(command);
}
示例12: ShowAsync
/// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
/// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByIDWithTokensAndOptions"]/*'/>
public static async Task<TwitterResponse<User>> ShowAsync(decimal id, OAuthTokens tokens = null, OptionalProperties options = null)
{
return await Core.CommandPerformer.PerformAction(new Commands.ShowUserCommand(tokens, id, string.Empty, options));
}
示例13: Show
/// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
/// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByUsernameWithTokensAndOptions"]/*'/>
public static TwitterResponse<TwitterUser> Show(OAuthTokens tokens, string username, OptionalProperties options)
{
Commands.ShowUserCommand command = new Commands.ShowUserCommand(tokens, 0, username, options);
return Core.CommandPerformer.PerformAction(command);
}
示例14: GetStatus
/// <summary>
/// Gets the rate limiting status status for the authenticated user.
/// </summary>
/// <param name="tokens">The OAuth tokens.</param>
/// <param name="options">The options.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The function.</param>
/// <returns></returns>
public static IAsyncResult GetStatus(OAuthTokens tokens, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterRateLimitStatus>> function)
{
return AsyncUtility.ExecuteAsyncMethod(tokens, options, timeout, TwitterRateLimitStatus.GetStatus, function);
}
示例15: UpdateProfileImage
/// <summary>
/// Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.
/// </summary>
/// <param name="tokens">The tokens.</param>
/// <param name="imageData">The image data.</param>
/// <param name="timeout">The timeout.</param>
/// <param name="function">The callback or anonymous funtion.</param>
/// <param name="options">The options.</param>
/// <returns></returns>
/// <remarks></remarks>
public static IAsyncResult UpdateProfileImage(OAuthTokens tokens, byte[] imageData, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function, OptionalProperties options = null)
{
return AsyncUtility.ExecuteAsyncMethod(tokens, imageData, options, timeout, TwitterAccount.UpdateProfileImage, function);
}