OSDN Git Service

TwitterDataModel.Place を TwitterPlace に移行
authorKimura Youichi <kim.upsilon@bucyou.net>
Mon, 5 May 2014 14:38:06 +0000 (23:38 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Mon, 5 May 2014 17:20:40 +0000 (02:20 +0900)
OpenTween/Api/GeoJson.cs
OpenTween/Api/TwitterDataModel.cs
OpenTween/Api/TwitterPlace.cs [new file with mode: 0644]
OpenTween/Api/TwitterStatus.cs
OpenTween/OpenTween.csproj

index 6b9e35c..e3f67a9 100644 (file)
@@ -46,4 +46,16 @@ namespace OpenTween.Api
             this.Type = "Point";
         }
     }
+
+    [DataContract]
+    public class GeoJsonPolygon : GeoJson
+    {
+        [DataMember(Name = "coordinates")]
+        public double[][][] Coordinates { get; set; }
+
+        public GeoJsonPolygon()
+        {
+            this.Type = "Polygon";
+        }
+    }
 }
index 4825a37..862ceaf 100644 (file)
@@ -42,34 +42,6 @@ namespace OpenTween.Api
         }
 
         [DataContract]
-        public class BoundingBox
-        {
-            [DataMember(Name = "type", IsRequired = false)] public string Type;
-            [DataMember(Name = "coordinates", IsRequired = false)] public double[][][] Coordinates;
-        }
-
-        [DataContract]
-        public class Attributes
-        {
-            [DataMember(Name = "street_address", IsRequired = false)] public string StreetAddress;
-        }
-
-        [DataContract]
-        public class Place
-        {
-            [DataMember(Name = "url")] public string Url;
-            [DataMember(Name = "bounding_box", IsRequired = false)] public BoundingBox BoundingBox;
-            [DataMember(Name = "street_address", IsRequired = false)] public string StreetAddress;
-            [DataMember(Name = "full_name")] public string FullName;
-            [DataMember(Name = "name")] public string Name;
-            //[DataMember(Name = "attributes", IsRequired = false)] public attributes attributes;
-            [DataMember(Name = "country_code", IsRequired = false)] public string CountryCode;
-            [DataMember(Name = "id")] public string Id;
-            [DataMember(Name = "country")] public string Country;
-            [DataMember(Name = "place_type")] public string PlaceType;
-        }
-
-        [DataContract]
         public class TargetObject : TwitterStatus
         {
             [DataMember(Name = "mode")] public string Mode;
diff --git a/OpenTween/Api/TwitterPlace.cs b/OpenTween/Api/TwitterPlace.cs
new file mode 100644 (file)
index 0000000..04ef609
--- /dev/null
@@ -0,0 +1,60 @@
+// OpenTween - Client of Twitter
+// Copyright (c) 2014 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OpenTween.Api
+{
+    // 参照: https://dev.twitter.com/docs/platform-objects/places
+
+    [DataContract]
+    public class TwitterPlace
+    {
+        [DataMember(Name = "bounding_box")]
+        public GeoJsonPolygon BoundingBox { get; set; }
+
+        [DataMember(Name = "country")]
+        public string Country { get; set; }
+
+        [DataMember(Name = "country_code")]
+        public string CountryCode { get; set; }
+
+        [DataMember(Name = "full_name")]
+        public string FullName { get; set; }
+
+        [DataMember(Name = "id")]
+        public string Id { get; set; }
+
+        [DataMember(Name = "name")]
+        public string Name { get; set; }
+
+        [DataMember(Name = "place_type")]
+        public string PlaceType { get; set; }
+
+        [DataMember(Name = "url")]
+        public string Url { get; set; }
+    }
+}
index 017da2c..c6b02a9 100644 (file)
@@ -92,7 +92,7 @@ namespace OpenTween.Api
         public string Lang { get; set; } // Nullable
 
         [DataMember(Name = "place", IsRequired = false)]
-        public TwitterDataModel.Place Place { get; set; }
+        public TwitterPlace Place { get; set; }
 
         [DataMember(Name = "possibly_sensitive")]
         public bool? PossiblySensitive { get; set; }
index 6125414..76ae042 100644 (file)
@@ -66,6 +66,7 @@
     <Compile Include="Api\TwitterConfiguration.cs" />
     <Compile Include="Api\TwitterEntity.cs" />
     <Compile Include="Api\TwitterList.cs" />
+    <Compile Include="Api\TwitterPlace.cs" />
     <Compile Include="Api\TwitterStatus.cs" />
     <Compile Include="Api\TwitterUser.cs" />
     <Compile Include="Api\TwitterApiAccessLevel.cs" />