Blocking users

Jan 19, 2014 at 8:56 PM
How do you block a user with tweetinvi? (twitterer)
Coordinator
Jan 20, 2014 at 12:39 AM
Edited Mar 13, 2014 at 12:01 PM
Hi Ricky,

This feature was not implemented before.

Consequently I have implemented it for you in Tweetinvi 0.9.0.0.
You can download Tweetinvi 0.9 in Source Code and select the Development solution. It is mature enough to allow you to use it.

Here is the example provided within Examplinvi:
var user = User.GetUserFromScreenName(userName);
user.Block();
Hope this help you.
Regards,
Linvi
Marked as answer by linvi on 1/21/2014 at 7:33 AM
Mar 13, 2014 at 4:52 AM
Is it possible to report a user for spam?
... and maybe have a list of already blocked users too?

Thanks in advance
Coordinator
Mar 13, 2014 at 2:20 PM
Edited Mar 13, 2014 at 2:43 PM
Hi,

This method is not yet implemented but you can use the TwitterAccessor like this :
// var queryWithUserId = "https://api.twitter.com/1.1/users/report_spam.json?user_id=YOUR_USER_ID";

var queryWithScreenName = "https://api.twitter.com/1.1/users/report_spam.json?screen_name=YOUR_USER_SCREEN_NAME";
var spamReportedSuccessfully = TwitterAccessor.TryExecutePOSTQuery(queryWithScreenName);
Concerning user list this is a bit more complicated, here is the code you need:
public class BlockedUsersContainer
{
    public IEnumerable<IUserDTO> Users { get; set; }

    public IEnumerable<IUser> BlockedUsers
    {
        get { return User.GenerateUsersFromDTO(Users); }
    }
}

// Invoke the reques in your code
var blockedUsersQuery = "https://api.twitter.com/1.1/blocks/list.json?skip_status=true";
var blockedUsers = TwitterAccessor.ExecuteGETQuery<BlockedUsersContainer>(blockedUsersQuery).BlockedUsers;
I can see how the 2 posts are related but please try to open news posts if the features are different.

Regards,
Linvi
Marked as answer by linvi on 3/13/2014 at 6:43 AM