Skip to content

Commit 6adf36c

Browse files
authored
Add missing Google Places API properties to fix issue #157 (#175)
This commit adds 23 missing properties to the PlacesDetails Result entity and creates 3 new supporting entity classes to match the official Google Places API documentation. New entity classes: - BusinessStatus enum for operational status - PlusCode class for location references - PlaceEditorialSummary class for place summaries New properties added to Result class: - Business features: CurbsidePickup, Delivery, DineIn, Takeout - Accessibility: WheelchairAccessibleEntrance - Services: ServesBeer, ServesBreakfast, ServesBrunch, ServesDinner, ServesLunch, ServesVegetarianFood, ServesWine - Enhanced metadata: BusinessStatus, EditorialSummary, PlusCode, IconBackgroundColor, IconMaskBaseUri - Opening hours: CurrentOpeningHours, SecondaryOpeningHours - Events: Event property - Ratings: UserRatingsTotal All new properties use nullable types to maintain backward compatibility and prevent deserialization issues. Existing property names preserved to avoid breaking changes. Resolves #157
1 parent aa57ad0 commit 6adf36c

File tree

4 files changed

+206
-0
lines changed

4 files changed

+206
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace GoogleMapsApi.Entities.Common
4+
{
5+
/// <summary>
6+
/// An encoded location reference, derived from latitude and longitude coordinates, that represents an area,
7+
/// 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller.
8+
/// Plus codes can be used as a replacement for street addresses in places where they do not exist
9+
/// (where buildings are not numbered or streets are not named).
10+
/// </summary>
11+
[DataContract]
12+
public class PlusCode
13+
{
14+
/// <summary>
15+
/// A 4 character area code and 6 character or longer local code (849VCWC8+R9).
16+
/// </summary>
17+
[DataMember(Name = "global_code")]
18+
public string GlobalCode { get; set; }
19+
20+
/// <summary>
21+
/// A 6 character or longer local code with an explicit location (CWC8+R9, Mountain View, CA, USA).
22+
/// May return an empty string if the compound_code is not available.
23+
/// </summary>
24+
[DataMember(Name = "compound_code")]
25+
public string CompoundCode { get; set; }
26+
}
27+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace GoogleMapsApi.Entities.PlacesDetails.Response
4+
{
5+
/// <summary>
6+
/// Indicates the operational status of the place, if it is a business.
7+
/// </summary>
8+
[DataContract]
9+
public enum BusinessStatus
10+
{
11+
/// <summary>
12+
/// The place is operational.
13+
/// </summary>
14+
[EnumMember(Value = "OPERATIONAL")]
15+
Operational,
16+
17+
/// <summary>
18+
/// The place is closed temporarily.
19+
/// </summary>
20+
[EnumMember(Value = "CLOSED_TEMPORARILY")]
21+
ClosedTemporarily,
22+
23+
/// <summary>
24+
/// The place is closed permanently.
25+
/// </summary>
26+
[EnumMember(Value = "CLOSED_PERMANENTLY")]
27+
ClosedPermanently
28+
}
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace GoogleMapsApi.Entities.PlacesDetails.Response
4+
{
5+
/// <summary>
6+
/// Contains a summary of the place.
7+
/// </summary>
8+
[DataContract]
9+
public class PlaceEditorialSummary
10+
{
11+
/// <summary>
12+
/// The language of the previous fields. May not always be present.
13+
/// </summary>
14+
[DataMember(Name = "language")]
15+
public string Language { get; set; }
16+
17+
/// <summary>
18+
/// A medium-length textual summary of the place.
19+
/// </summary>
20+
[DataMember(Name = "overview")]
21+
public string Overview { get; set; }
22+
}
23+
}

GoogleMapsApi/Entities/PlacesDetails/Response/Result.cs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,48 @@ public class Result
1616
[DataMember(Name="address_components")]
1717
public IEnumerable<GoogleMapsApi.Entities.Geocoding.Response.AddressComponent> AddressComponent { get; set; }
1818

19+
/// <summary>
20+
/// A representation of the place's address in the adr microformat.
21+
/// </summary>
22+
[DataMember(Name="adr_address")]
23+
public string AdrAddress { get; set; }
24+
25+
/// <summary>
26+
/// Indicates the operational status of the place, if it is a business.
27+
/// </summary>
28+
[DataMember(Name="business_status")]
29+
public BusinessStatus? BusinessStatus { get; set; }
30+
31+
/// <summary>
32+
/// Specifies if the business supports curbside pickup.
33+
/// </summary>
34+
[DataMember(Name = "curbside_pickup")]
35+
public bool? CurbsidePickup { get; set; }
36+
37+
/// <summary>
38+
/// Contains the hours of operation for the next seven days (including today).
39+
/// </summary>
40+
[DataMember(Name = "current_opening_hours")]
41+
public OpeningHours CurrentOpeningHours { get; set; }
42+
43+
/// <summary>
44+
/// Specifies if the business supports delivery.
45+
/// </summary>
46+
[DataMember(Name = "delivery")]
47+
public bool? Delivery { get; set; }
48+
49+
/// <summary>
50+
/// Specifies if the business supports indoor or outdoor seating options.
51+
/// </summary>
52+
[DataMember(Name = "dine_in")]
53+
public bool? DineIn { get; set; }
54+
55+
/// <summary>
56+
/// Contains a summary of the place.
57+
/// </summary>
58+
[DataMember(Name = "editorial_summary")]
59+
public PlaceEditorialSummary EditorialSummary { get; set; }
60+
1961

2062
[DataMember(Name = "events")]
2163
public IEnumerable<Event> Event { get; set; }
@@ -32,6 +74,18 @@ public class Result
3274
[DataMember(Name = "icon")]
3375
public string Icon { get; set; }
3476

77+
/// <summary>
78+
/// Contains the default HEX color code for the place's category.
79+
/// </summary>
80+
[DataMember(Name = "icon_background_color")]
81+
public string IconBackgroundColor { get; set; }
82+
83+
/// <summary>
84+
/// Contains the URL of a recommended icon, minus the .svg or .png file type extension.
85+
/// </summary>
86+
[DataMember(Name = "icon_mask_base_uri")]
87+
public string IconMaskBaseUri { get; set; }
88+
3589
[DataMember(Name = "id")]
3690
public string ID { get; set; }
3791

@@ -48,8 +102,15 @@ public class Result
48102
public OpeningHours OpeningHours { get; set; }
49103

50104
[DataMember(Name = "permanently_closed")]
105+
[Obsolete("Use BusinessStatus property instead. See https://developers.google.com/maps/documentation/places/web-service/details#fields for more information.")]
51106
public bool PermanentlyClosed { get; set; }
52107

108+
/// <summary>
109+
/// An encoded location reference, derived from latitude and longitude coordinates.
110+
/// </summary>
111+
[DataMember(Name = "plus_code")]
112+
public PlusCode PlusCode { get; set; }
113+
53114
[DataMember(Name = "photos")]
54115
public IEnumerable<Photo> Photos { get; set; }
55116

@@ -84,12 +145,72 @@ internal string string_PriceLevel
84145
[DataMember(Name = "reviews")]
85146
public IEnumerable<Review> Review { get; set; }
86147

148+
/// <summary>
149+
/// Contains an array of entries for the next seven days including information about secondary hours of a business.
150+
/// </summary>
151+
[DataMember(Name = "secondary_opening_hours")]
152+
public IEnumerable<OpeningHours> SecondaryOpeningHours { get; set; }
153+
154+
/// <summary>
155+
/// Specifies if the place serves beer.
156+
/// </summary>
157+
[DataMember(Name = "serves_beer")]
158+
public bool? ServesBeer { get; set; }
159+
160+
/// <summary>
161+
/// Specifies if the place serves breakfast.
162+
/// </summary>
163+
[DataMember(Name = "serves_breakfast")]
164+
public bool? ServesBreakfast { get; set; }
165+
166+
/// <summary>
167+
/// Specifies if the place serves brunch.
168+
/// </summary>
169+
[DataMember(Name = "serves_brunch")]
170+
public bool? ServesBrunch { get; set; }
171+
172+
/// <summary>
173+
/// Specifies if the place serves dinner.
174+
/// </summary>
175+
[DataMember(Name = "serves_dinner")]
176+
public bool? ServesDinner { get; set; }
177+
178+
/// <summary>
179+
/// Specifies if the place serves lunch.
180+
/// </summary>
181+
[DataMember(Name = "serves_lunch")]
182+
public bool? ServesLunch { get; set; }
183+
184+
/// <summary>
185+
/// Specifies if the place serves vegetarian food.
186+
/// </summary>
187+
[DataMember(Name = "serves_vegetarian_food")]
188+
public bool? ServesVegetarianFood { get; set; }
189+
190+
/// <summary>
191+
/// Specifies if the place serves wine.
192+
/// </summary>
193+
[DataMember(Name = "serves_wine")]
194+
public bool? ServesWine { get; set; }
195+
196+
/// <summary>
197+
/// Specifies if the business supports takeout.
198+
/// </summary>
199+
[DataMember(Name = "takeout")]
200+
public bool? Takeout { get; set; }
201+
87202
[DataMember(Name = "types")]
88203
public string[] Types { get; set; }
89204

90205
[DataMember(Name = "url")]
91206
public string URL { get; set; }
92207

208+
/// <summary>
209+
/// The total number of reviews, with or without text, for this place.
210+
/// </summary>
211+
[DataMember(Name = "user_ratings_total")]
212+
public int? UserRatingsTotal { get; set; }
213+
93214
[DataMember(Name = "utc_offset")]
94215
public string UTCOffset { get; set; }
95216

@@ -99,6 +220,12 @@ internal string string_PriceLevel
99220
[DataMember(Name = "website")]
100221
public string Website { get; set; }
101222

223+
/// <summary>
224+
/// Specifies if the place has an entrance that is wheelchair-accessible.
225+
/// </summary>
226+
[DataMember(Name = "wheelchair_accessible_entrance")]
227+
public bool? WheelchairAccessibleEntrance { get; set; }
228+
102229
[DataMember(Name = "place_id")]
103230
public string PlaceId { get; set; }
104231
}

0 commit comments

Comments
 (0)