GetUsersFromNames Value cannot be null issue

Aug 27, 2014 at 11:10 PM
Edited Aug 27, 2014 at 11:12 PM
Hi Linvi

Im having an issue with GetUsersFromNames always returning null. I have a function that gets a list of user names

IEnumerable<string> users = connection.GetRecentUsers();

The funtion is returning the a list of usernames

and when I execute

IEnumerable<IUser> userCollection = User.UserFactory.GetUsersFromNames(users);

I get the following error
Value cannot be null.
Parameter name: collection


The getrecentusers function is just hardcoded at the moment

public IEnumerable <string> GetRecentUsers()
{

    List<string> list = new List<string>();
    list.Add("blindasfcuk");
    IEnumerable<string> users = list.AsEnumerable();

    return users;
}

When I run the same code with a list of user IDs returned I can use the GetUsersFromIDs function without any issue and id prefer to use this method but the tweetinvi API doenst expose the user ID from the tweetDTO so I only have access to usernames at the moment.

Cheers
Brian
Aug 28, 2014 at 12:19 AM
Hi,

I am not sure what you are doing wrong but this is working perfectly well here.
I have also added a method to the static User class so that you no longer need to use the UserFactory in 0.9.4.0 which is coming soon.
It will also be renamed to GetUsersFromScreenNames.

Here is the code I am using :
var userScreenNames = new[] {"blindasfcuk"};
var user = User.UserFactory.GetUsersFromNames(userScreenNames);
Linvi
Aug 28, 2014 at 12:52 AM
Ya that doesnt work either. Just fired up fiddler there to check out the traffic to twitter and its actually retuning a 404 page not found message. That screen name definitely exists as its the test one ive set up and when I use the user id it returns the data correctly.
Aug 28, 2014 at 11:09 PM
What would I need to make some changes to the API to add some features for myself? If I want to make changes to the DTO code for tweets Im assuming I can just launch the Tweetinvi.Logic project make the changes and rebuild the dll. Or am I way off? Just looking at the code I can see it was created in visual studio 2013 so Ill probably need to upgrade my visual studio so I want to make sure Im on the right track first
Aug 29, 2014 at 12:33 AM
I am not sure what is going wrong with your code. It seems perfectly alright.

Concerning the modification of Tweetinvi you can just update the Tweetinvi.Logic project as you said and rebuild it.
I am using Visual Studio 2013 but the project should work in Visual 2012.

Just by curiosity, what are you trying to change in the DTOs?

Linvi
Aug 29, 2014 at 2:28 PM
Edited Aug 29, 2014 at 2:57 PM
I was planning on exposing the user id field from the user info provided in the tweet but I just noticed that the IUser interface creates an IUserDTO object whos class inherits from IUserIdentifier which has the as user ID field within so I should already be able to get the user ID string is that correct?

Any example on how I can get at that field from a tweet object? Would it be something like this
stream.TweetReceived += (sender, args) =>
 {
     var tweet = args.Tweet;
Console.WriteLine("{0} from user {1} was detected ", tweet.Id, tweet.creator.id);
 };