public bool PublishTweet(ITweet tweet, IPublishTweetOptionalParameters optionalParameters = null) { if (tweet == null) { throw new ArgumentException("Tweet cannot be null!"); } var parameters = new PublishTweetParameters(tweet.Text, optionalParameters); var tweetDTO = InternalPublishTweet(parameters); UpdateTweetIfTweetSuccessfullyBeenPublished(tweet, tweetDTO); return tweet.IsTweetPublished; }
public ITweet PublishTweet(string text, IPublishTweetOptionalParameters optionalParameters = null) { var parameters = new PublishTweetParameters(text, optionalParameters); var tweetDTO = InternalPublishTweet(parameters); return(_tweetFactory.GenerateTweetFromDTO(tweetDTO)); }
public ITweet PublishTweet(string text, IPublishTweetOptionalParameters optionalParameters = null) { var parameters = new PublishTweetParameters(text, optionalParameters); var tweetDTO = InternalPublishTweet(parameters); return _tweetFactory.GenerateTweetFromDTO(tweetDTO); }
public static int EstimateTweetLength(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { var textLength = text == null ? 0 : StringExtension.EstimateTweetLength(text); if (text == null || publishTweetOptionalParameters == null) { return(textLength); } if (publishTweetOptionalParameters.QuotedTweet != null) { var newText = text.TrimEnd(); textLength = StringExtension.EstimateTweetLength(newText); textLength += 1; // for the space that needs to be added before the link to quoted tweet. textLength += TweetinviConsts.MEDIA_CONTENT_SIZE; } if (!publishTweetOptionalParameters.Medias.IsNullOrEmpty() || !publishTweetOptionalParameters.MediaIds.IsNullOrEmpty() || !publishTweetOptionalParameters.MediaBinaries.IsNullOrEmpty()) { textLength += TweetinviConsts.MEDIA_CONTENT_SIZE; } return(textLength); }
public PublishTweetParameters(string text, IPublishTweetOptionalParameters optionalParameters = null) { Text = text; if (optionalParameters == null) { Parameters = new PublishTweetOptionalParameters(); } else { Parameters = optionalParameters; } }
public bool PublishTweet(ITweet tweet, IPublishTweetOptionalParameters optionalParameters = null) { if (tweet == null) { throw new ArgumentException("Tweet cannot be null!"); } var parameters = new PublishTweetParameters(tweet.Text, optionalParameters); var tweetDTO = InternalPublishTweet(parameters); UpdateTweetIfTweetSuccessfullyBeenPublished(tweet, tweetDTO); return(tweet.IsTweetPublished); }
public string PublishTweet(string text, IPublishTweetOptionalParameters optionalParameters = null) { // The exceptions have to be raised before the QueryGenerator as // We do not want to wait for the media to be uploaded to throw the // Exception. And The logic of uploading the media should live in // the TweetController var publishParameter = new PublishTweetParameters(text, optionalParameters); _tweetQueryValidator.ThrowIfTweetCannotBePublished(publishParameter); _tweetController.UploadMedias(publishParameter); var query = _tweetQueryGenerator.GetPublishTweetQuery(publishParameter); return _twitterAccessor.ExecuteJsonPOSTQuery(query); }
public string PublishTweet(string text, IPublishTweetOptionalParameters optionalParameters = null) { // The exceptions have to be raised before the QueryGenerator as // We do not want to wait for the media to be uploaded to throw the // Exception. And The logic of uploading the media should live in // the TweetController var publishParameter = new PublishTweetParameters(text, optionalParameters); _tweetQueryValidator.ThrowIfTweetCannotBePublished(publishParameter); _tweetController.UploadMedias(publishParameter); var query = _tweetQueryGenerator.GetPublishTweetQuery(publishParameter); return(_twitterAccessor.ExecuteJsonPOSTQuery(query)); }
public int Length(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { var textLength = text == null ? 0 : text.TweetLength(); if (publishTweetOptionalParameters == null) { return(textLength); } if (publishTweetOptionalParameters.QuotedTweet != null) { textLength += TweetinviConsts.MEDIA_CONTENT_SIZE; } if (!publishTweetOptionalParameters.Medias.IsNullOrEmpty() || !publishTweetOptionalParameters.MediaIds.IsNullOrEmpty() || !publishTweetOptionalParameters.MediaBinaries.IsNullOrEmpty()) { textLength += TweetinviConsts.MEDIA_CONTENT_SIZE; } return(textLength); }
// Tweet public ITweet PublishTweet(string text, IPublishTweetOptionalParameters parameters) { return(ExecuteAuthenticatedUserOperation(() => _tweetController.PublishTweet(text, parameters))); }
public static bool CanBePublished(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return TweetController.CanBePublished(text, publishTweetOptionalParameters); }
public static int Length(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return TweetController.Length(text, publishTweetOptionalParameters); }
public static ITweet PublishTweet(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return TweetController.PublishTweet(text, publishTweetOptionalParameters); }
/// <summary> /// Publish a tweet /// </summary> public static ITweet PublishTweet(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return(TweetController.PublishTweet(text, publishTweetOptionalParameters)); }
// Tweet Controller public static async Task<ITweet> PublishTweet(string text, IPublishTweetOptionalParameters parameters = null) { return await Sync.ExecuteTaskAsync(() => Tweet.PublishTweet(text, parameters)); }
public bool CanBePublished(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return(true); //return TweetinviConsts.MAX_TWEET_SIZE >= EstimateTweetLength(text, publishTweetOptionalParameters); }
public PublishTweetParameters(string text, IPublishTweetOptionalParameters optionalParameters = null) { Text = text; Parameters = optionalParameters ?? new PublishTweetOptionalParameters(); }
public static IPublishTweetParameters CreatePublishTweetParameters(string text, IPublishTweetOptionalParameters optionalParameters = null) { return new PublishTweetParameters(text, optionalParameters); }
/// <summary> /// Get the length of a tweet as calculated by Twitter /// </summary> public static int Length(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return(TweetController.Length(text, publishTweetOptionalParameters)); }
public bool CanBePublished(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return TweetinviConsts.MAX_TWEET_SIZE <= Length(text, publishTweetOptionalParameters); }
/// <summary> /// Verify that a tweet can be published /// </summary> public static bool CanBePublished(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return(TweetController.CanBePublished(text, publishTweetOptionalParameters)); }
public bool CanBePublished(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { return(TweetinviConsts.MAX_TWEET_SIZE >= Length(text, publishTweetOptionalParameters)); }
public static IPublishTweetParameters CreatePublishTweetParameters(string text, IPublishTweetOptionalParameters optionalParameters = null) { return(new PublishTweetParameters(text, optionalParameters)); }
// Publish Tweet public static string PublishTweet(string text, IPublishTweetOptionalParameters parameters = null) { return TweetJsonController.PublishTweet(text, parameters); }
// Tweet Controller public static async Task <ITweet> PublishTweet(string text, IPublishTweetOptionalParameters parameters = null) { return(await Sync.ExecuteTaskAsync(() => Tweet.PublishTweet(text, parameters))); }
public int Length(string text, IPublishTweetOptionalParameters publishTweetOptionalParameters = null) { var textLength = text == null ? 0 : text.TweetLength(); if (publishTweetOptionalParameters == null) { return textLength; } if (publishTweetOptionalParameters.QuotedTweet != null) { textLength += TweetinviConsts.MEDIA_CONTENT_SIZE; } if (!publishTweetOptionalParameters.Medias.IsNullOrEmpty() || !publishTweetOptionalParameters.MediaIds.IsNullOrEmpty() || !publishTweetOptionalParameters.MediaBinaries.IsNullOrEmpty()) { textLength += TweetinviConsts.MEDIA_CONTENT_SIZE; } return textLength; }