예제 #1
0
        public static bool addPersonToList(Person person, TweetList list, AccountTwitter account)
        {
            AddListMemberOptions options = new TweetSharp.AddListMemberOptions();

            options.OwnerScreenName = account.username;
            options.Slug            = list.Slug;
            options.UserId          = Convert.ToInt64(person.Id);
            TwitterUser user = account.twitterService.AddListMember(options);

            if (user != null)
            {
                list.Members.Add(person);
                return(true);
            }
            else
            {
                return(false);
            }
        }
		public virtual void AddListMember(AddListMemberOptions options, Action<TwitterUser, TwitterResponse> action)
		{
			var list_id = options.ListId;
			var slug = options.Slug;
			var user_id = options.UserId;
			var screen_name = options.ScreenName;
			var owner_screen_name = options.OwnerScreenName;
			var owner_id = options.OwnerId;
			
			WithHammock(WebMethod.Post, action, "lists/members/create", FormatAsString, "?list_id=", list_id, "&slug=", slug, "&user_id=", user_id, "&screen_name=", screen_name, "&owner_screen_name=", owner_screen_name, "&owner_id=", owner_id);
		}
		public virtual IAsyncResult BeginAddListMember(AddListMemberOptions options)
		{
			var list_id = options.ListId;
			var slug = options.Slug;
			var user_id = options.UserId;
			var screen_name = options.ScreenName;
			var owner_screen_name = options.OwnerScreenName;
			var owner_id = options.OwnerId;
				

			return BeginWithHammock<TwitterUser>(WebMethod.Post, "lists/members/create", FormatAsString, "?list_id=", list_id, "&slug=", slug, "&user_id=", user_id, "&screen_name=", screen_name, "&owner_screen_name=", owner_screen_name, "&owner_id=", owner_id);
		}
		public virtual Task<TwitterResponse<TwitterUser>> AddListMemberAsync(AddListMemberOptions options)
		{
			var list_id = options.ListId;
			var slug = options.Slug;
			var user_id = options.UserId;
			var screen_name = options.ScreenName;
			var owner_screen_name = options.OwnerScreenName;
			var owner_id = options.OwnerId;
				
			
			return ExecuteRequest<TwitterUser>(HttpMethod.Post, "lists/members/create", FormatAsString, "?list_id=", list_id, "&slug=", slug, "&user_id=", user_id, "&screen_name=", screen_name, "&owner_screen_name=", owner_screen_name, "&owner_id=", owner_id);
		}