From ab6274b4cf3babbdf77d30e1c4ab7a08a194b35c Mon Sep 17 00:00:00 2001 From: caterryan Date: Sun, 21 May 2023 12:38:09 -0500 Subject: [PATCH] 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 --- GoogleMapsApi/Entities/Common/PlusCode.cs | 26 ++ .../PlacesDetails/Response/BusinessStatus.cs | 15 ++ .../Response/PlaceEditorialSummary.cs | 22 ++ .../PlacesDetails/Response/PriceLevel.cs | 10 + .../Entities/PlacesDetails/Response/Result.cs | 224 ++++++++++++++++-- 5 files changed, 271 insertions(+), 26 deletions(-) create mode 100644 GoogleMapsApi/Entities/Common/PlusCode.cs create mode 100644 GoogleMapsApi/Entities/PlacesDetails/Response/BusinessStatus.cs create mode 100644 GoogleMapsApi/Entities/PlacesDetails/Response/PlaceEditorialSummary.cs create mode 100644 GoogleMapsApi/Entities/PlacesDetails/Response/PriceLevel.cs diff --git a/GoogleMapsApi/Entities/Common/PlusCode.cs b/GoogleMapsApi/Entities/Common/PlusCode.cs new file mode 100644 index 0000000..12aab4b --- /dev/null +++ b/GoogleMapsApi/Entities/Common/PlusCode.cs @@ -0,0 +1,26 @@ +using System.Runtime.Serialization; + +namespace GoogleMapsApi.Entities.Common; + +/// +/// An encoded location reference, derived from latitude and longitude coordinates, that represents an area, +/// 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller. +/// Plus codes can be used as a replacement for street addresses in places where they do not exist +/// (where buildings are not numbered or streets are not named). +/// +[DataContract] +public class PlusCode +{ + /// + /// A 4 character area code and 6 character or longer local code (849VCWC8+R9). + /// + [DataMember(Name = "global_code")] + public string GlobalCode { get; set; } + + /// + /// A 6 character or longer local code with an explicit location (CWC8+R9, Mountain View, CA, USA). + /// May return an empty string if the compound_code is not available. + /// + [DataMember(Name = "compound_code")] + public string CompoundCode { get; set; } +} \ No newline at end of file diff --git a/GoogleMapsApi/Entities/PlacesDetails/Response/BusinessStatus.cs b/GoogleMapsApi/Entities/PlacesDetails/Response/BusinessStatus.cs new file mode 100644 index 0000000..d13c074 --- /dev/null +++ b/GoogleMapsApi/Entities/PlacesDetails/Response/BusinessStatus.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace GoogleMapsApi.Entities.PlacesDetails.Response +{ + [DataContract] + public enum BusinessStatus + { + [EnumMember(Value = "OPERATIONAL")] + Operational, + [EnumMember(Value = "CLOSED_TEMPORARILY")] + ClosedTemporarily, + [EnumMember(Value = "CLOSED_PERMANENTLY")] + ClosedPermanently, + } +} diff --git a/GoogleMapsApi/Entities/PlacesDetails/Response/PlaceEditorialSummary.cs b/GoogleMapsApi/Entities/PlacesDetails/Response/PlaceEditorialSummary.cs new file mode 100644 index 0000000..2249ee0 --- /dev/null +++ b/GoogleMapsApi/Entities/PlacesDetails/Response/PlaceEditorialSummary.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace GoogleMapsApi.Entities.PlacesDetails.Response; + +/// +/// Contains a summary of the place. +/// +[DataContract] +public class PlaceEditorialSummary +{ + /// + /// The language of the previous fields. May not always be present. + /// + [DataMember(Name = "language")] + public string Language { get; set; } + + /// + /// A medium-length textual summary of the place. + /// + [DataMember(Name = "overview")] + public string Overview { get; set; } +} \ No newline at end of file diff --git a/GoogleMapsApi/Entities/PlacesDetails/Response/PriceLevel.cs b/GoogleMapsApi/Entities/PlacesDetails/Response/PriceLevel.cs new file mode 100644 index 0000000..aa93fe3 --- /dev/null +++ b/GoogleMapsApi/Entities/PlacesDetails/Response/PriceLevel.cs @@ -0,0 +1,10 @@ +namespace GoogleMapsApi.Entities.PlacesDetails.Response; + +public enum PriceLevel +{ + Free = 0, + Inexpensive = 1, + Moderate = 2, + Expensive = 3, + VeryExpensive = 4, +} \ No newline at end of file diff --git a/GoogleMapsApi/Entities/PlacesDetails/Response/Result.cs b/GoogleMapsApi/Entities/PlacesDetails/Response/Result.cs index 790df8f..aa5d4f8 100644 --- a/GoogleMapsApi/Entities/PlacesDetails/Response/Result.cs +++ b/GoogleMapsApi/Entities/PlacesDetails/Response/Result.cs @@ -10,51 +10,141 @@ namespace GoogleMapsApi.Entities.PlacesDetails.Response public class Result { /// - /// name contains the human-readable name for the returned result. For establishment results, this is usually the canonicalized business name. + /// An array containing the separate components applicable to this address. /// - [DataMember(Name="address_components")] public IEnumerable AddressComponent { get; set; } + /// + /// A representation of the place's address in the adr microformat. + /// + [DataMember(Name="adr_address")] + public string AdrAddress { get; set; } + + /// + /// Indicates the operational status of the place, if it is a business. + /// + [DataMember(Name="business_status")] + public BusinessStatus BusinessStatus { get; set; } + + /// + /// Specifies if the business supports curbside pickup. + /// + [DataMember(Name = "curbside_pickup")] + public bool CurbsidePickup { get; set; } + + /// + /// Contains the hours of operation for the next seven days (including today). + /// + [DataMember(Name = "current_opening_hours")] + public OpeningHours CurrentOpeningHours { get; set; } + + /// + /// Specifies if the business supports delivery. + /// + [DataMember(Name = "delivery")] + public bool Delivery { get; set; } - [DataMember(Name = "events")] - public IEnumerable Event { get; set; } - + /// + /// Specifies if the business supports indoor or outdoor seating options. + /// + [DataMember(Name = "dine_in")] + public bool DineIn { get; set; } + + /// + /// Contains a summary of the place. + /// + [DataMember(Name = "editorial_summary")] + public PlaceEditorialSummary PlaceEditorialSummary { get; set; } + + /// + /// A string containing the human-readable address of this place. + /// [DataMember(Name = "formatted_address")] public string FormattedAddress { get; set; } + /// + /// Contains the place's phone number in its local format. + /// [DataMember(Name = "formatted_phone_number")] public string FormattedPhoneNumber { get; set; } + /// + /// Contains the location and viewport for the location. + /// [DataMember(Name = "geometry")] public Geometry Geometry { get; set; } + /// + /// Contains the URL of a suggested icon which may be displayed to the user when indicating this result on a map. + /// [DataMember(Name = "icon")] public string Icon { get; set; } - [DataMember(Name = "id")] - public string ID { get; set; } + /// + /// Contains the default HEX color code for the place's category. + /// + [DataMember(Name = "icon_background_color")] + public string IconBackgroundColor { get; set; } + + /// + /// Contains the URL of a recommended icon, minus the .svg or .png file type extension. + /// + [DataMember(Name = "icon_mask_base_uri")] + public string IconMaskBaseUri { get; set; } + /// + /// Contains the place's phone number in international format. + /// [DataMember(Name = "international_phone_number")] public string InternationalPhoneNumber { get; set; } + /// + /// Contains the human-readable name for the returned result. + /// For establishment results, this is usually the canonicalized business name. + /// [DataMember(Name = "name")] public string Name { get; set; } /// - /// Opening hours information + /// Contains the regular hours of operation. /// [DataMember(Name = "opening_hours")] public OpeningHours OpeningHours { get; set; } - + + /// [DataMember(Name = "permanently_closed")] + [Obsolete("Use business_status to get the operational status of businesses.")] public bool PermanentlyClosed { get; set; } + /// + /// An array of photo objects, each containing a reference to an image. + /// A request may return up to ten photos. + /// [DataMember(Name = "photos")] public IEnumerable Photos { get; set; } - public PriceLevel? PriceLevel; + /// + /// A textual identifier that uniquely identifies a place. + /// + [DataMember(Name = "place_id")] + public string PlaceId { get; set; } + /// + /// An encoded location reference, derived from latitude and longitude coordinates, that represents an area: + /// 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller. + /// Plus codes can be used as a replacement for street addresses in places where they do not exist + /// (where buildings are not numbered or streets are not named). + /// + [DataMember(Name = "plus_code")] + public PlusCode PlusCode { get; set; } + + /// + /// The price level of the place, on a scale of 0 to 4. + /// The exact amount indicated by a specific value will vary from region to region. + /// + public PriceLevel? PriceLevel; + [DataMember(Name = "price_level")] internal string string_PriceLevel { @@ -74,41 +164,123 @@ internal string string_PriceLevel } } + /// + /// Contains the place's rating, from 1.0 to 5.0, based on aggregated user reviews. + /// [DataMember(Name = "rating")] public double Rating { get; set; } - + + /// [DataMember(Name = "reference")] [Obsolete("Use place_id instead. See https://developers.google.com/places/documentation/search#deprecation for more information.")] public string Reference { get; set; } + /// + /// A JSON array of up to five reviews. By default, the reviews are sorted in order of relevance. + /// [DataMember(Name = "reviews")] - public IEnumerable Review { get; set; } + public IEnumerable Reviews { get; set; } + /// + /// Contains an array of entries for the next seven days including information about secondary hours of a business. + /// Secondary hours are different from a business's main hours. + /// For example, a restaurant can specify drive through hours or delivery hours as its secondary hours. + /// + [DataMember(Name = "secondary_opening_hours")] + public IEnumerable SecondaryOpeningHours { get; set; } + + /// + /// Specifies if the place serves beer. + /// + [DataMember(Name = "serves_beer")] + public bool ServesBeer { get; set; } + + /// + /// Specifies if the place serves breakfast. + /// + [DataMember(Name = "serves_breakfast")] + public bool ServesBreakfast { get; set; } + + /// + /// Specifies if the place serves brunch. + /// + [DataMember(Name = "serves_brunch")] + public bool ServesBrunch { get; set; } + + /// + /// Specifies if the place serves dinner. + /// + [DataMember(Name = "serves_dinner")] + public bool ServesDinner { get; set; } + + /// + /// Specifies if the place serves lunch. + /// + [DataMember(Name = "serves_lunch")] + public bool ServesLunch { get; set; } + + /// + /// Specifies if the place serves vegetarian food. + /// + [DataMember(Name = "serves_vegetarian_food")] + public bool ServesVegetarianFood { get; set; } + + /// + /// Specifies if the place serves wine. + /// + [DataMember(Name = "serves_wine")] + public bool ServesWine { get; set; } + + /// + /// Specifies if the business supports takeout. + /// + [DataMember(Name = "takeout")] + public bool Takeout { get; set; } + + /// + /// Contains an array of feature types describing the given result. + /// [DataMember(Name = "types")] - public string[] Types { get; set; } + public IEnumerable Types { get; set; } + /// + /// Contains the URL of the official Google page for this place. + /// This will be the Google-owned page that contains the best available information about the place. + /// [DataMember(Name = "url")] - public string URL { get; set; } + public string Url { get; set; } + /// + /// The total number of reviews, with or without text, for this place. + /// + [DataMember(Name = "user_ratings_total")] + public int UserRatingsTotal { get; set; } + + /// + /// Contains the number of minutes this place’s current timezone is offset from UTC. + /// For example, for places in Sydney, Australia during daylight saving time this would be 660 (+11 hours from UTC), + /// and for places in California outside of daylight saving time this would be -480 (-8 hours from UTC). + /// [DataMember(Name = "utc_offset")] - public string UTCOffset { get; set; } + public int UtcOffset { get; set; } + /// + /// 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. + /// 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. + /// [DataMember(Name = "vicinity")] public string Vicinity { get; set; } + /// + /// The authoritative website for this place, such as a business' homepage. + /// [DataMember(Name = "website")] public string Website { get; set; } - [DataMember(Name = "place_id")] - public string PlaceId { get; set; } - } - - public enum PriceLevel - { - Free = 0, - Inexpensive = 1, - Moderate = 2, - Expensive = 3, - VeryExpensive = 4, + /// + /// Specifies if the place has an entrance that is wheelchair-accessible. + /// + [DataMember(Name = "wheelchair_accessible_entrance")] + public bool WheelchairAccessibleEntrance { get; set; } } }