Пример #1
0
        /// <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
0
        /// <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);
        }
        /// <summary>
        /// Deletes this direct message.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="id">The direct message id.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="TwitterDirectMessage"/> instance.
        /// </returns>
        public static TwitterResponse <TwitterDirectMessage> Delete(OAuthTokens tokens, decimal id, OptionalProperties options)
        {
            Commands.DeleteDirectMessageCommand command = new Commands.DeleteDirectMessageCommand(tokens, id, options);

            TwitterResponse <TwitterDirectMessage> result = Core.CommandPerformer.PerformAction(command);

            return(result);
        }
        /// <summary>
        /// Sends a new direct message to the specified user from the authenticating user.
        /// </summary>
        /// <param name="tokens">The OAuth tokens.</param>
        /// <param name="screenName">The user's screen name.</param>
        /// <param name="text">The message text.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterDirectMessage"/> object of the created direct message.</returns>
        public static TwitterResponse <TwitterDirectMessage> Send(OAuthTokens tokens, string screenName, string text, OptionalProperties options)
        {
            Commands.SendDirectMessageCommand command = new Commands.SendDirectMessageCommand(tokens, text, screenName, options);

            TwitterResponse <TwitterDirectMessage> result = Core.CommandPerformer.PerformAction(command);

            return(result);
        }
Пример #5
0
        /// <summary>
        /// Searches Twitter with the the specified query.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="query">The query.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="TwitterSearchResultCollection"/> instance.
        /// </returns>
        public static TwitterResponse <TwitterSearchResultCollection> Search(OAuthTokens tokens, string query, SearchOptions options)
        {
            if (options == null)
            {
                options = new SearchOptions();
            }

            Commands.SearchCommand command = new Twitterizer.Commands.SearchCommand(tokens, query, options);

            TwitterResponse <TwitterSearchResultCollection> results =
                Core.CommandPerformer.PerformAction(command);

            return(results);
        }
        /// <summary>
        /// Converts a <see cref="TwitterResponse{T}"/> to an async response.
        /// </summary>
        /// <typeparam name="T">The datatype contained in the response.</typeparam>
        /// <param name="response">The response.</param>
        /// <returns></returns>
        public static TwitterAsyncResponse <T> ToAsyncResponse <T>(this TwitterResponse <T> response)
            where T : Core.ITwitterObject
        {
            TwitterAsyncResponse <T> newResponse = new TwitterAsyncResponse <T>();

            newResponse.Content        = response.Content;
            newResponse.ErrorMessage   = response.ErrorMessage;
            newResponse.RateLimiting   = response.RateLimiting;
            newResponse.AccessLevel    = response.AccessLevel;
            newResponse.RequestUrl     = response.RequestUrl;
            newResponse.ResponseObject = response.ResponseObject;
            newResponse.Result         = response.Result;

            return(newResponse);
        }