Skip to content

Commit ab6274b

Browse files
committed
Update Entities.PlacesDetails.Response with latest properties and docstrings from official google documentation: https://developers.google.com/maps/documentation/places/web-service/details
Add supporting types for update
1 parent eeb821f commit ab6274b

File tree

5 files changed

+271
-26
lines changed

5 files changed

+271
-26
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace GoogleMapsApi.Entities.PlacesDetails.Response
4+
{
5+
[DataContract]
6+
public enum BusinessStatus
7+
{
8+
[EnumMember(Value = "OPERATIONAL")]
9+
Operational,
10+
[EnumMember(Value = "CLOSED_TEMPORARILY")]
11+
ClosedTemporarily,
12+
[EnumMember(Value = "CLOSED_PERMANENTLY")]
13+
ClosedPermanently,
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace GoogleMapsApi.Entities.PlacesDetails.Response;
2+
3+
public enum PriceLevel
4+
{
5+
Free = 0,
6+
Inexpensive = 1,
7+
Moderate = 2,
8+
Expensive = 3,
9+
VeryExpensive = 4,
10+
}

GoogleMapsApi/Entities/PlacesDetails/Response/Result.cs

+198-26
Original file line numberDiff line numberDiff line change
@@ -10,51 +10,141 @@ namespace GoogleMapsApi.Entities.PlacesDetails.Response
1010
public class Result
1111
{
1212
/// <summary>
13-
/// name contains the human-readable name for the returned result. For establishment results, this is usually the canonicalized business name.
13+
/// An array containing the separate components applicable to this address.
1414
/// </summary>
15-
1615
[DataMember(Name="address_components")]
1716
public IEnumerable<GoogleMapsApi.Entities.Geocoding.Response.AddressComponent> AddressComponent { get; set; }
1817

18+
/// <summary>
19+
/// A representation of the place's address in the adr microformat.
20+
/// </summary>
21+
[DataMember(Name="adr_address")]
22+
public string AdrAddress { get; set; }
23+
24+
/// <summary>
25+
/// Indicates the operational status of the place, if it is a business.
26+
/// </summary>
27+
[DataMember(Name="business_status")]
28+
public BusinessStatus BusinessStatus { get; set; }
29+
30+
/// <summary>
31+
/// Specifies if the business supports curbside pickup.
32+
/// </summary>
33+
[DataMember(Name = "curbside_pickup")]
34+
public bool CurbsidePickup { get; set; }
35+
36+
/// <summary>
37+
/// Contains the hours of operation for the next seven days (including today).
38+
/// </summary>
39+
[DataMember(Name = "current_opening_hours")]
40+
public OpeningHours CurrentOpeningHours { get; set; }
41+
42+
/// <summary>
43+
/// Specifies if the business supports delivery.
44+
/// </summary>
45+
[DataMember(Name = "delivery")]
46+
public bool Delivery { get; set; }
1947

20-
[DataMember(Name = "events")]
21-
public IEnumerable<Event> Event { get; set; }
22-
48+
/// <summary>
49+
/// Specifies if the business supports indoor or outdoor seating options.
50+
/// </summary>
51+
[DataMember(Name = "dine_in")]
52+
public bool DineIn { get; set; }
53+
54+
/// <summary>
55+
/// Contains a summary of the place.
56+
/// </summary>
57+
[DataMember(Name = "editorial_summary")]
58+
public PlaceEditorialSummary PlaceEditorialSummary { get; set; }
59+
60+
/// <summary>
61+
/// A string containing the human-readable address of this place.
62+
/// </summary>
2363
[DataMember(Name = "formatted_address")]
2464
public string FormattedAddress { get; set; }
2565

66+
/// <summary>
67+
/// Contains the place's phone number in its local format.
68+
/// </summary>
2669
[DataMember(Name = "formatted_phone_number")]
2770
public string FormattedPhoneNumber { get; set; }
2871

72+
/// <summary>
73+
/// Contains the location and viewport for the location.
74+
/// </summary>
2975
[DataMember(Name = "geometry")]
3076
public Geometry Geometry { get; set; }
3177

78+
/// <summary>
79+
/// Contains the URL of a suggested icon which may be displayed to the user when indicating this result on a map.
80+
/// </summary>
3281
[DataMember(Name = "icon")]
3382
public string Icon { get; set; }
3483

35-
[DataMember(Name = "id")]
36-
public string ID { get; set; }
84+
/// <summary>
85+
/// Contains the default HEX color code for the place's category.
86+
/// </summary>
87+
[DataMember(Name = "icon_background_color")]
88+
public string IconBackgroundColor { get; set; }
89+
90+
/// <summary>
91+
/// Contains the URL of a recommended icon, minus the .svg or .png file type extension.
92+
/// </summary>
93+
[DataMember(Name = "icon_mask_base_uri")]
94+
public string IconMaskBaseUri { get; set; }
3795

96+
/// <summary>
97+
/// Contains the place's phone number in international format.
98+
/// </summary>
3899
[DataMember(Name = "international_phone_number")]
39100
public string InternationalPhoneNumber { get; set; }
40101

102+
/// <summary>
103+
/// Contains the human-readable name for the returned result.
104+
/// For establishment results, this is usually the canonicalized business name.
105+
/// </summary>
41106
[DataMember(Name = "name")]
42107
public string Name { get; set; }
43108

44109
/// <summary>
45-
/// Opening hours information
110+
/// Contains the regular hours of operation.
46111
/// </summary>
47112
[DataMember(Name = "opening_hours")]
48113
public OpeningHours OpeningHours { get; set; }
49-
114+
115+
/// <depreciated />
50116
[DataMember(Name = "permanently_closed")]
117+
[Obsolete("Use business_status to get the operational status of businesses.")]
51118
public bool PermanentlyClosed { get; set; }
52119

120+
/// <summary>
121+
/// An array of photo objects, each containing a reference to an image.
122+
/// A request may return up to ten photos.
123+
/// </summary>
53124
[DataMember(Name = "photos")]
54125
public IEnumerable<Photo> Photos { get; set; }
55126

56-
public PriceLevel? PriceLevel;
127+
/// <summary>
128+
/// A textual identifier that uniquely identifies a place.
129+
/// </summary>
130+
[DataMember(Name = "place_id")]
131+
public string PlaceId { get; set; }
57132

133+
/// <summary>
134+
/// An encoded location reference, derived from latitude and longitude coordinates, that represents an area:
135+
/// 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller.
136+
/// Plus codes can be used as a replacement for street addresses in places where they do not exist
137+
/// (where buildings are not numbered or streets are not named).
138+
/// </summary>
139+
[DataMember(Name = "plus_code")]
140+
public PlusCode PlusCode { get; set; }
141+
142+
/// <summary>
143+
/// The price level of the place, on a scale of 0 to 4.
144+
/// The exact amount indicated by a specific value will vary from region to region.
145+
/// </summary>
146+
public PriceLevel? PriceLevel;
147+
58148
[DataMember(Name = "price_level")]
59149
internal string string_PriceLevel
60150
{
@@ -74,41 +164,123 @@ internal string string_PriceLevel
74164
}
75165
}
76166

167+
/// <summary>
168+
/// Contains the place's rating, from 1.0 to 5.0, based on aggregated user reviews.
169+
/// </summary>
77170
[DataMember(Name = "rating")]
78171
public double Rating { get; set; }
79-
172+
173+
/// <depreciated />
80174
[DataMember(Name = "reference")]
81175
[Obsolete("Use place_id instead. See https://developers.google.com/places/documentation/search#deprecation for more information.")]
82176
public string Reference { get; set; }
83177

178+
/// <summary>
179+
/// A JSON array of up to five reviews. By default, the reviews are sorted in order of relevance.
180+
/// </summary>
84181
[DataMember(Name = "reviews")]
85-
public IEnumerable<Review> Review { get; set; }
182+
public IEnumerable<Review> Reviews { get; set; }
86183

184+
/// <summary>
185+
/// Contains an array of entries for the next seven days including information about secondary hours of a business.
186+
/// Secondary hours are different from a business's main hours.
187+
/// For example, a restaurant can specify drive through hours or delivery hours as its secondary hours.
188+
/// </summary>
189+
[DataMember(Name = "secondary_opening_hours")]
190+
public IEnumerable<OpeningHours> SecondaryOpeningHours { get; set; }
191+
192+
/// <summary>
193+
/// Specifies if the place serves beer.
194+
/// </summary>
195+
[DataMember(Name = "serves_beer")]
196+
public bool ServesBeer { get; set; }
197+
198+
/// <summary>
199+
/// Specifies if the place serves breakfast.
200+
/// </summary>
201+
[DataMember(Name = "serves_breakfast")]
202+
public bool ServesBreakfast { get; set; }
203+
204+
/// <summary>
205+
/// Specifies if the place serves brunch.
206+
/// </summary>
207+
[DataMember(Name = "serves_brunch")]
208+
public bool ServesBrunch { get; set; }
209+
210+
/// <summary>
211+
/// Specifies if the place serves dinner.
212+
/// </summary>
213+
[DataMember(Name = "serves_dinner")]
214+
public bool ServesDinner { get; set; }
215+
216+
/// <summary>
217+
/// Specifies if the place serves lunch.
218+
/// </summary>
219+
[DataMember(Name = "serves_lunch")]
220+
public bool ServesLunch { get; set; }
221+
222+
/// <summary>
223+
/// Specifies if the place serves vegetarian food.
224+
/// </summary>
225+
[DataMember(Name = "serves_vegetarian_food")]
226+
public bool ServesVegetarianFood { get; set; }
227+
228+
/// <summary>
229+
/// Specifies if the place serves wine.
230+
/// </summary>
231+
[DataMember(Name = "serves_wine")]
232+
public bool ServesWine { get; set; }
233+
234+
/// <summary>
235+
/// Specifies if the business supports takeout.
236+
/// </summary>
237+
[DataMember(Name = "takeout")]
238+
public bool Takeout { get; set; }
239+
240+
/// <summary>
241+
/// Contains an array of feature types describing the given result.
242+
/// </summary>
87243
[DataMember(Name = "types")]
88-
public string[] Types { get; set; }
244+
public IEnumerable<string> Types { get; set; }
89245

246+
/// <summary>
247+
/// Contains the URL of the official Google page for this place.
248+
/// This will be the Google-owned page that contains the best available information about the place.
249+
/// </summary>
90250
[DataMember(Name = "url")]
91-
public string URL { get; set; }
251+
public string Url { get; set; }
92252

253+
/// <summary>
254+
/// The total number of reviews, with or without text, for this place.
255+
/// </summary>
256+
[DataMember(Name = "user_ratings_total")]
257+
public int UserRatingsTotal { get; set; }
258+
259+
/// <summary>
260+
/// Contains the number of minutes this place’s current timezone is offset from UTC.
261+
/// For example, for places in Sydney, Australia during daylight saving time this would be 660 (+11 hours from UTC),
262+
/// and for places in California outside of daylight saving time this would be -480 (-8 hours from UTC).
263+
/// </summary>
93264
[DataMember(Name = "utc_offset")]
94-
public string UTCOffset { get; set; }
265+
public int UtcOffset { get; set; }
95266

267+
/// <summary>
268+
/// For establishment (types:["establishment", ...]) results only, the vicinity field contains a simplified address for the place, including the street name, street number, and locality, but not the province/state, postal code, or country.
269+
/// For all other results, the vicinity field contains the name of the narrowest political (types:["political", ...]) feature that is present in the address of the result.
270+
/// </summary>
96271
[DataMember(Name = "vicinity")]
97272
public string Vicinity { get; set; }
98273

274+
/// <summary>
275+
/// The authoritative website for this place, such as a business' homepage.
276+
/// </summary>
99277
[DataMember(Name = "website")]
100278
public string Website { get; set; }
101279

102-
[DataMember(Name = "place_id")]
103-
public string PlaceId { get; set; }
104-
}
105-
106-
public enum PriceLevel
107-
{
108-
Free = 0,
109-
Inexpensive = 1,
110-
Moderate = 2,
111-
Expensive = 3,
112-
VeryExpensive = 4,
280+
/// <summary>
281+
/// Specifies if the place has an entrance that is wheelchair-accessible.
282+
/// </summary>
283+
[DataMember(Name = "wheelchair_accessible_entrance")]
284+
public bool WheelchairAccessibleEntrance { get; set; }
113285
}
114286
}

0 commit comments

Comments
 (0)