Merge pull request #2103 from Microsoft/nmetulev/twitter
[Twitter service] support for 280 characters on non streaming api calls
This commit is contained in:
Коммит
a506336e4a
|
@ -21,6 +21,8 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
/// </summary>
|
||||
public class Tweet : Toolkit.Parsers.SchemaBase, ITwitterResult
|
||||
{
|
||||
private string _text;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets time item was created.
|
||||
/// </summary>
|
||||
|
@ -40,10 +42,14 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets text of the tweet (140 characters).
|
||||
/// Gets or sets text of the tweet (handles both 140 and 280 characters)
|
||||
/// </summary>
|
||||
[JsonProperty("text")]
|
||||
public string Text { get; set; }
|
||||
public string Text
|
||||
{
|
||||
get { return _text ?? FullText; }
|
||||
set { _text = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the extended mode.
|
||||
|
@ -63,6 +69,12 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
[JsonProperty("entities")]
|
||||
public TwitterEntities Entities { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Retweeted Tweet
|
||||
/// </summary>
|
||||
[JsonProperty("retweeted_status")]
|
||||
public Tweet RetweetedStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation date
|
||||
/// </summary>
|
||||
|
@ -79,5 +91,11 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
return dt;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets text of the tweet (280 characters).
|
||||
/// </summary>
|
||||
[JsonProperty("full_text")]
|
||||
private string FullText { get; set; }
|
||||
}
|
||||
}
|
|
@ -153,7 +153,7 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
string rawResult = null;
|
||||
try
|
||||
{
|
||||
var uri = new Uri($"{BaseUrl}/statuses/user_timeline.json?screen_name={screenName}&count={maxRecords}&include_rts=1");
|
||||
var uri = new Uri($"{BaseUrl}/statuses/user_timeline.json?screen_name={screenName}&count={maxRecords}&include_rts=1&tweet_mode=extended");
|
||||
|
||||
TwitterOAuthRequest request = new TwitterOAuthRequest();
|
||||
rawResult = await request.ExecuteGetAsync(uri, _tokens);
|
||||
|
@ -212,7 +212,7 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
{
|
||||
try
|
||||
{
|
||||
var uri = new Uri($"{BaseUrl}/search/tweets.json?q={Uri.EscapeDataString(hashTag)}&count={maxRecords}");
|
||||
var uri = new Uri($"{BaseUrl}/search/tweets.json?q={Uri.EscapeDataString(hashTag)}&count={maxRecords}&tweet_mode=extended");
|
||||
TwitterOAuthRequest request = new TwitterOAuthRequest();
|
||||
var rawResult = await request.ExecuteGetAsync(uri, _tokens);
|
||||
|
||||
|
@ -622,7 +622,7 @@ namespace Microsoft.Toolkit.Uwp.Services.Twitter
|
|||
{
|
||||
try
|
||||
{
|
||||
var uri = new Uri($"{BaseUrl}/statuses/home_timeline.json?count={maxRecords}");
|
||||
var uri = new Uri($"{BaseUrl}/statuses/home_timeline.json?count={maxRecords}&tweet_mode=extended");
|
||||
|
||||
TwitterOAuthRequest request = new TwitterOAuthRequest();
|
||||
var rawResult = await request.ExecuteGetAsync(uri, _tokens);
|
||||
|
|
|
@ -34,10 +34,11 @@ In the code section below the GetUserTimeLineAsync method returns some Tweet obj
|
|||
| Property | Type | Description |
|
||||
| -- | -- | -- |
|
||||
| **CreatedAt** | string | The date and time of the Tweet formatted by Twitter |
|
||||
| **Text** | string | The text of the Tweet |
|
||||
| **Text** | string | The text of the Tweet (if retweet, the text might not be complete - use the RetweetedStatus object for the original tweet)|
|
||||
| **Id** | string | The Twitter status identifier |
|
||||
| **GeoData** | TwitterGeoData | A class containing the latitude and longitude of the Tweet |
|
||||
| **User** | TwitterUser | A class containing the user ID, Name, ScreenName, and ProfileImageUrl |
|
||||
| **RetweetedStatus** | Tweet | if this tweet is a retweet, this object will contain the original tweet |
|
||||
|
||||
## Syntax
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче