当前位置: 首页>>代码示例>>C#>>正文


C# TwitterParametersCollection类代码示例

本文整理汇总了C#中TwitterParametersCollection的典型用法代码示例。如果您正苦于以下问题:C# TwitterParametersCollection类的具体用法?C# TwitterParametersCollection怎么用?C# TwitterParametersCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TwitterParametersCollection类属于命名空间,在下文中一共展示了TwitterParametersCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteTweet

 /// <summary>
 /// Deletes tweet of a given id
 /// </summary>
 /// <param name="tweetId">ID of the tweet to delete</param>
 /// <returns></returns>
 /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/%3Aid </remarks>
 public async static Task<TwitterSuccess> DeleteTweet(this IUserSession session, string tweetId)
 {
     var parameters = new TwitterParametersCollection();
     var url = TwitterApi.Resolve("/1.1/statuses/destroy/{0}.json", tweetId); 
     return await session.PostAsync(url, parameters)
                   .ContinueWith(c => c.MapToTwitterSuccess());
 }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:13,代码来源:TweetExtensions.cs

示例2: GetTrendsAvailableLocations

        /// <summary>
        /// Returns the locations that Twitter has trending topic information for.
        /// </summary>
        /// <returns></returns>
        /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/trends/available </remarks>
        public static async Task<TwitterResponseCollection<TrendsAvailableLocationsResponse>> GetTrendsAvailableLocations(this ITwitterSession session)
        {
            var parameters = new TwitterParametersCollection();

            return await session.GetAsync(TwitterApi.Resolve("/1.1/trends/available.json"), parameters)
                .ContinueWith(c => c.MapToMany<TrendsAvailableLocationsResponse>());
        }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:12,代码来源:TrendsExtenstions.cs

示例3: GetSuggestedUsers

 /// <summary>
 /// Access the users in a given category of the Twitter suggested user list.
 /// </summary>
 /// <param name="slug">The short name of list or a category returned by GetSuggestedList</param>
 /// <returns></returns>
 /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug </remarks>
 public static async Task<SuggestedUsers> GetSuggestedUsers(this ITwitterSession session, string slug)
 {
     var parameters = new TwitterParametersCollection();
     var url = TwitterApi.Resolve("/1.1/users/suggestions/{0}.json", slug);
     return await session.GetAsync(url, parameters)
                   .ContinueWith(c => c.MapToSingle<SuggestedUsers>());
 }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:13,代码来源:SuggestedUsersExtension.cs

示例4: GetRetweetsOfMe

        /// <summary>
        /// Returns the most recent tweets authored by the authenticating user that have been retweeted by others. 
        /// </summary>
        /// <param name="sinceId">Returns results with an ID greater than (that is, more recent than) the specified ID.</param>
        /// <param name="count">Specifies the number of records to retrieve. Must be less than or equal to 100. If omitted, 20 will be assumed.</param>
        /// <param name="maxId">Returns results with an ID less than (that is, older than) or equal to the specified ID.</param>
        /// <returns></returns>
        /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/statuses/retweets_of_me </remarks>
        public async static Task<TwitterResponseCollection<Tweet>> GetRetweetsOfMe(this IUserSession session, long sinceId = 0, long maxId = 0, int count = 20)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(include_entities: true, include_rts: true, count: count, since_id: sinceId, max_id: maxId);

            return await session.GetAsync(TwitterApi.Resolve("/1.1/statuses/retweets_of_me.json"), parameters)
                          .ContinueWith(c => c.MapToMany<Tweet>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:16,代码来源:TimelineExtensions.cs

示例5: GetVerifyCredentials

        /// <summary>
        /// Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not. Use this method to test if supplied user credentials are valid.
        /// </summary>
        /// <returns></returns>
        public static async Task<User> GetVerifyCredentials(this IUserSession session) 
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(include_entities: true);

            return await session.GetAsync(TwitterApi.Resolve("/1.1/account/verify_credentials.json"), parameters)
                          .ContinueWith(c => c.MapToSingle<User>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:12,代码来源:UsersExtensions.cs

示例6: GetDirectMessageSingle

        /// <summary>
        /// Returns a direct message sent to the authenticating user.
        /// </summary>
        /// <param name="Id">ID of direct message to return</param>
        /// <returns>(awaitable) Get A DirectMessage sent/received the session's authenticated user</returns>
        /// <remarks>ref: https://dev.twitter.com/docs/api/1.1/get/direct_messages/show </remarks>
        public async static Task<DirectMessage> GetDirectMessageSingle(this IUserSession session, long Id)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(id: Id, full_text:true);

            return await session.GetAsync(TwitterApi.Resolve("/1.1/direct_messages/show.json"), parameters)
                          .ContinueWith(c => c.MapToSingle<DirectMessage>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:14,代码来源:DirectMessageExtensions.cs

示例7: GetUserTimeline

        /// <summary>
        /// Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
        /// </summary>
        /// <param name="userId">The ID of the user for whom to return results for.</param>
        /// <param name="screenName">The screen name of the user for whom to return results for.</param>
        /// <param name="sinceId">Returns results with an ID greater than (that is, more recent than) the specified ID.</param>
        /// <param name="count">Specifies the number of tweets to try and retrieve, up to a maximum of 200 per distinct request</param>
        /// <param name="maxId">Returns results with an ID less than (that is, older than) or equal to the specified ID.</param>
        /// <param name="excludeReplies">This parameter will prevent replies from appearing in the returned timeline. </param>
        /// <param name="includeRetweets">When set to false, the timeline will strip any native retweets</param>
        /// <returns></returns>
        /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline </remarks>
        public async static Task<TwitterResponseCollection<Tweet>> GetUserTimeline(this ITwitterSession session, string screenName = "", long userId = 0, long sinceId = 0, long maxId = 0, int count = 200, bool excludeReplies = true, bool includeRetweets = true)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(include_entities: true, include_rts: true, count: count, since_id: sinceId, max_id: maxId, screen_name:screenName);

            return await session.GetAsync(TwitterApi.Resolve("/1.1/statuses/user_timeline.json"), parameters)
                          .ContinueWith(c => c.MapToMany<Tweet>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:20,代码来源:TimelineExtensions.cs

示例8: GetFavourites

        /// <summary>
        /// https://dev.twitter.com/docs/api/1.1/get/favorites/list
        /// Returns the count most recent Tweets favorited by the authenticating or specified user.
        /// If user_id and screen_name is left blank, current auth'd user favourites are returned
        /// Entities are always returned
        /// </summary>
        /// <param name="userId">The ID of the user for whom to return results for</param>
        /// <param name="screenName">The screen name of the user for whom to return results for</param>
        /// <param name="sinceId">Returns results with an ID greater than</param>
        /// <param name="count">Specifies the number of records to retrieve. Must be less than or equal to 200. Defaults to 20.</param>
        /// <param name="maxId">Returns results with an ID less than (that is, older than) or equal to the specified </param>
        /// <returns></returns>
        public async static Task<TwitterResponseCollection<Tweet>> GetFavourites(this ITwitterSession session, string screenName = "", int userId = 0, long sinceId = 0, long maxId = 0, int count = 20 )
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(count:count,include_entities:true,since_id:sinceId,max_id:maxId, user_id:userId, screen_name:screenName);

            var url = TwitterApi.Resolve("/1.1/favorites/list.json");
            return await session.GetAsync(url, parameters)
                          .ContinueWith(c => c.MapToMany<Tweet>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:21,代码来源:FavouritesExtensions.cs

示例9: DeleteFavourite

        /// <summary>
        /// https://dev.twitter.com/docs/api/1.1/post/favorites/destroy
        /// Un-favourites a given tweet
        /// </summary>
        /// <param name="tweet">Tweet for to favourite</param>
        /// <returns></returns>
        public async static Task<Tweet> DeleteFavourite(this IUserSession session, Tweet tweet)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(id: tweet.Id);

            var url = TwitterApi.Resolve("/1.1/favorites/destroy.json");
            return await session.PostAsync(url, parameters)
                          .ContinueWith(c => c.MapToSingle<Tweet>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:15,代码来源:FavouritesExtensions.cs

示例10: GetDirectMessagesSent

        /// <summary>
        /// Returns the most recent direct messages sent by the authenticating user.
        /// </summary>
        /// <param name="sinceId">Returns results with an ID greater than (that is, more recent than) the specified ID</param>
        /// <param name="maxId">Returns results with an ID less than (that is, older than) or equal to the specified ID</param>
        /// <param name="count">Specifies the number of direct messages to try and retrieve, up to a maximum of 200</param>
        /// <returns>(awaitable) IEnumerable of DirectMessages Sent by the session's authenticated user</returns>
        /// <remarks>ref: https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent </remarks>
        public async static Task<TwitterResponseCollection<DirectMessage>> GetDirectMessagesSent(this IUserSession session, long sinceId = 0, long maxId = 0, int count = 20)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(include_entities: true, count: count, since_id: sinceId,
                max_id: maxId, full_text:true);

            return await session.GetAsync(TwitterApi.Resolve("/1.1/direct_messages/sent.json"), parameters)
                          .ContinueWith(c => c.MapToMany<DirectMessage>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:17,代码来源:DirectMessageExtensions.cs

示例11: DeleteUserFromList

        /// <summary>
        /// Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list.
        /// </summary>
        /// <param name="listId">The numerical id of the list.</param>
        /// <param name="slug">You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.</param>
        /// <param name="userId">The ID of the user to remove from the list. Helpful for disambiguating when a valid user ID is also a valid screen name.</param>
        /// <param name="screenName">The screen name of the user for whom to remove from the list. Helpful for disambiguating when a valid screen name is also a user ID.</param>
        /// <param name="ownerScreenName">The screen name of the user who owns the list being requested by a slug.</param>
        /// <param name="ownerId">The user ID of the user who owns the list being requested by a slug.</param>
        /// <returns></returns>
        /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/lists/members/destroy </remarks>
        public static async Task<TwitterSuccess> DeleteUserFromList(this IUserSession session, long listId = 0, string slug = "",
            long userId = 0, string screenName = "", string ownerScreenName = "", long ownerId = 0)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(list_id: listId, slug: slug, owner_id: ownerId, owner_screen_name: ownerScreenName, user_id: userId, screen_name: screenName);

            return await session.PostAsync(TwitterApi.Resolve("/1.1/lists/members/destroy"), parameters)
                          .ContinueWith(c => c.MapToTwitterSuccess());
        }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:20,代码来源:ListExtensions.cs

示例12: GetTrendsForPlace

        /// <summary>
        /// Returns the top 10 trending topics for a specific WOEID, if trending information is available for it.
        /// </summary>
        /// <param name="placeId">The Yahoo! Where On Earth ID of the location to return trending information for. Global information is available by using 1 as the WOEID.</param>
        /// <param name="exclude">If true will remove all hashtags from the trends list.</param>
        /// <returns></returns>
        /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/trends/place </remarks>
        public static async Task<TwitterResponseCollection<TrendsForPlaceResponse>> GetTrendsForPlace(this ITwitterSession session, int placeId = 1, bool exclude = false)
        {
            var parameters = new TwitterParametersCollection
                        {{"id",placeId.ToString()}};
            if (exclude)
                parameters.Add("exclude","hashtags");

            return await session.GetAsync(TwitterApi.Resolve("/1.1/trends/place.json"), parameters)
                .ContinueWith(c => c.MapToMany<TrendsForPlaceResponse>());
        }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:17,代码来源:TrendsExtenstions.cs

示例13: GetListTimeline

        /// <summary>
        /// Returns a timeline of tweets authored by members of the specified list. Retweets are included by default.
        /// </summary>
        /// <param name="listId">The numerical id of the list.</param>
        /// <param name="slug">You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.</param>
        /// <param name="ownerId">The user ID of the user who owns the list being requested by a slug.</param>
        /// <param name="ownerScreenName">The screen name of the user who owns the list being requested by a slug.</param>
        /// <param name="sinceId">Returns results with an ID greater than (that is, more recent than) the specified ID.</param>
        /// <param name="count">Specifies the number of results to retrieve per "page."</param>
        /// <param name="maxId">Returns results with an ID less than (that is, older than) or equal to the specified ID.</param>
        /// <param name="includeRetweets">the list timeline will contain native retweets (if they exist) in addition to the standard stream of tweets.</param>
        /// <returns></returns>
        /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/lists/statuses </remarks>
        public static async Task<TwitterResponseCollection<Tweet>> GetListTimeline(this ITwitterSession session, long listId, string slug, long ownerId = 0, string ownerScreenName = "", long sinceId = 0, int count = 20, long maxId = 0, bool includeRetweets = true)
        {
            var parameters = new TwitterParametersCollection
                                 {
                                     {"include_rts", includeRetweets.ToString()},
                                 };
            parameters.Create(list_id:listId, slug:slug, owner_id:ownerId, owner_screen_name:ownerScreenName, since_id:sinceId, max_id:maxId);

            return await session.GetAsync(TwitterApi.Resolve("/1.1/lists/statuses.json"), parameters)
                          .ContinueWith(c => c.MapToMany<Tweet>());
        }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:24,代码来源:ListExtensions.cs

示例14: GetTrendsByLocation

        /// <summary>
        /// Returns the locations that Twitter has trending topic information for, closest to a specified location.
        /// </summary>
        /// <param name="latitude">If provided with a long parameter the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair.</param>
        /// <param name="longitude">If provided with a lat parameter the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair.</param>
        /// <returns></returns>
        /// <remarks> ref:  https://dev.twitter.com/docs/api/1.1/get/trends/closest </remarks>
        public static async Task<TwitterResponseCollection<TrendsAvailableLocationsResponse>> GetTrendsByLocation(
            this ITwitterSession session, double latitude = 0.0,
            double longitude = 0.0)
        {
            var parameters = new TwitterParametersCollection
                             {
                                 {"lat", latitude.ToString()},
                                 {"long", longitude.ToString()},
                             };

            return await session.GetAsync(TwitterApi.Resolve("/1.1/trends/closest.json"), parameters)
                .ContinueWith(c => c.MapToMany<TrendsAvailableLocationsResponse>());
        }
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:20,代码来源:TrendsExtenstions.cs

示例15: SendDirectMessage

        /// <summary>
        /// Sends a direct message sent to a user.
        /// </summary>
        /// <param name="text">Text to send to user</param>
        /// <param name="screenName">Screen name of the recipient</param>
        /// <returns></returns>
        /// <remarks>ref: https://dev.twitter.com/docs/api/1.1/post/direct_messages/new </remarks>
        public async static Task<DirectMessage> SendDirectMessage(this IUserSession session, string screenName, string text)
        {
            var parameters = new TwitterParametersCollection();
            parameters.Create(include_entities:true, screen_name:screenName, text:text.TrimAndTruncate(140));
            if (parameters.EnsureAllArePresent(new [] {"screen_name", "text"}).IsFalse())
            {
                return session.MapParameterError<DirectMessage>(
                        "Either screen_name and text required");
            }

            return await session.PostAsync(TwitterApi.Resolve("/1.1/direct_messages/new.json"), parameters)
                          .ContinueWith(c => c.MapToSingle<DirectMessage>());
        }
开发者ID:nickhodge,项目名称:BoxKite.Twitter,代码行数:20,代码来源:DirectMessageExtensions.cs


注:本文中的TwitterParametersCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。