--- /dev/null
+// OpenTween - Client of Twitter
+// Copyright (c) 2019 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
+// All rights reserved.
+//
+// This file is part of OpenTween.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+using Xunit;
+
+namespace OpenTween.Api.DataModel
+{
+ public class TwitterUser_20190520ChangesTest
+ {
+ [Fact]
+ public void ParseJsonTest()
+ {
+ // 2019-05-20 に予定されている User object の仕様変更テスト
+ // (廃止されるフィールドに null がセットされる)
+ // https://twittercommunity.com/t/124732
+
+ var json = @"{
+ ""id"": 6253282,
+ ""id_str"": ""6253282"",
+ ""name"": ""Twitter API"",
+ ""screen_name"": ""TwitterAPI"",
+ ""location"": ""San Francisco, CA"",
+ ""profile_location"": null,
+ ""description"": ""The Real Twitter API. Tweets about API changes, service issues and our Developer Platform. Don't get an answer? It's on my website."",
+ ""url"": ""https:\/\/t.co\/8IkCzCDr19"",
+ ""protected"": false,
+ ""followers_count"": 6133601,
+ ""friends_count"": 12,
+ ""listed_count"": 12935,
+ ""created_at"": ""Wed May 23 06:01:13 +0000 2007"",
+ ""favourites_count"": 31,
+ ""utc_offset"": null,
+ ""time_zone"": null,
+ ""geo_enabled"": null,
+ ""verified"": true,
+ ""statuses_count"": 3657,
+ ""lang"": null,
+ ""contributors_enabled"": null,
+ ""is_translator"": null,
+ ""is_translation_enabled"": null,
+ ""profile_background_color"": null,
+ ""profile_background_image_url"": null,
+ ""profile_background_image_url_https"": null,
+ ""profile_background_tile"": null,
+ ""profile_image_url"": null,
+ ""profile_image_url_https"": ""https:\/\/pbs.twimg.com\/profile_images\/942858479592554497\/BbazLO9L_normal.jpg"",
+ ""profile_banner_url"": ""https:\/\/pbs.twimg.com\/profile_banners\/6253282\/1497491515"",
+ ""profile_image_extensions_alt_text"": null,
+ ""profile_banner_extensions_alt_text"": null,
+ ""profile_link_color"": null,
+ ""profile_sidebar_border_color"": null,
+ ""profile_sidebar_fill_color"": null,
+ ""profile_text_color"": null,
+ ""profile_use_background_image"": null,
+ ""has_extended_profile"": null,
+ ""default_profile"": false,
+ ""default_profile_image"": false,
+ ""following"": null,
+ ""follow_request_sent"": null,
+ ""notifications"": null,
+ ""translator_type"": null
+}";
+ TwitterUser.ParseJson(json);
+ }
+ }
+}
[DataContract]
public class TwitterUser
{
- [DataMember(Name = "contributors_enabled")]
- public bool ContributorsEnabled { get; set; }
-
[DataMember(Name = "created_at")]
public string CreatedAt { get; set; }
[DataMember(Name = "favourites_count")]
public int FavouritesCount { get; set; }
- [DataMember(Name = "follow_request_sent")]
- public bool? FollowRequestSent { get; set; }
-
[DataMember(Name = "followers_count")]
public int FollowersCount { get; set; }
[DataMember(Name = "friends_count")]
public int FriendsCount { get; set; }
- [DataMember(Name = "geo_enabled")]
- public bool GeoEnabled { get; set; }
-
[DataMember(Name = "id")]
public long Id { get; set; }
[DataMember(Name = "id_str")]
public string IdStr { get; set; }
- [DataMember(Name = "lang")]
- public string Lang { get; set; }
-
[DataMember(Name = "listed_count")]
public int? ListedCount { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
- [DataMember(Name = "profile_background_color")]
- public string ProfileBackgroundColor { get; set; }
-
- [DataMember(Name = "profile_background_image_url_https")]
- public string ProfileBackgroundImageUrlHttps { get; set; }
-
- [DataMember(Name = "profile_background_tile")]
- public bool ProfileBackgroundTile { get; set; }
-
[DataMember(Name = "profile_banner_url")]
public string ProfileBannerUrl { get; set; }
[DataMember(Name = "profile_image_url_https")]
public string ProfileImageUrlHttps { get; set; }
- [DataMember(Name = "profile_link_color")]
- public string ProfileLinkColor { get; set; }
-
- [DataMember(Name = "profile_sidebar_border_color")]
- public string ProfileSidebarBorderColor { get; set; }
-
- [DataMember(Name = "profile_sidebar_fill_color")]
- public string ProfileSidebarFillColor { get; set; }
-
- [DataMember(Name = "profile_text_color")]
- public string ProfileTextColor { get; set; }
-
- [DataMember(Name = "profile_use_background_image")]
- public bool ProfileUseBackgroundImage { get; set; }
-
[DataMember(Name = "protected")]
public bool Protected { get; set; }
[DataMember(Name = "url")]
public string Url { get; set; } // Nullable
- [DataMember(Name = "utc_offset")]
- public int? UtcOffset { get; set; }
-
[DataMember(Name = "verified")]
public bool Verified { get; set; }