Reputation: 2788
I am using a linq-to-twitter query to attempt to get a tweet (status) and reply to that status, but the query always returns ID and TweetIds as null. I attempted to use the statusId, but it went through as a tweet and not a response
var tweets =
await
(from tweet in twitterCtx.Status
where tweet.Type == StatusType.User &&
tweet.UserID == {UserId}
select tweet)
.ToListAsync();
Any help would be greatly appreciateed
Upvotes: 1
Views: 225
Reputation: 2788
I guess I had to add the @{ScreenNameResponse} before the response. I got it working. Thanks for the quick response.
Upvotes: 1
Reputation: 7513
From the LINQ to Twitter FAQ:
ScreenName
and/or UserID
properties null in the User
entity response from Twitter?The ScreenName
and UserID
properties are input only, allowing you to see the parameters you provided in your query.
Identifier
property, which has the ScreenName
and UserID
returned from Twitter.ScreenNameResponse
and UserIDResponse
properties.A bit of background: Anything used as an input parameter is also looked at in the query response, so if a user omits the parameter in a query but the twitter response contains a value, it was being filtered out of the results. To fix this, I adopted a convention where any return parameters also match input parameters would have a 'Response' suffix. e.g. ScreenName
(input) and ScreenNameResponse
(output). To find which values are input, the docs for each API call contain the input/filter parameters.
Here's an example, from LINQ to Twitter Samples code:
static void PrintTweetsResults(List<Status> tweets)
{
if (tweets != null)
tweets.ForEach(tweet =>
{
if (tweet != null && tweet.User != null)
Console.WriteLine(
"ID: [{0}] Name: {1}\n\tTweet: {2}",
tweet.StatusID, tweet.User.ScreenNameResponse, tweet.Text);
});
}
Upvotes: 2