Skip to main content

๐Ÿ“ Details

The Details feature provides access to rich, structured information about places.

It allows you to retrieve:

  • ๐Ÿ“„ General place metadata
  • ๐Ÿ–ผ๏ธ Photos
  • โญ Reviews
  • ๐Ÿงช Raw JSON responses (advanced scenarios)

This feature is exposed through:

๐Ÿ‘‰ See: IDetailsService


๐Ÿงฉ Serviceโ€‹

public interface IDetailsService {
Task<PlaceDetails> GetDetailsAsync(string placeId);
Task<JsonDocument> GetDetailsRawAsync(string placeId, params string[] fields);
Task<IReadOnlyList<PlacePhoto>> GetPhotosAsync(string placeId, PhotoRequest? photoRequest = null);
Task<PlaceReviews> GetReviewsAsync(string placeId);
}

โš™๏ธ Methodsโ€‹

  • GetDetailsAsync โ†’ structured place data
  • GetDetailsRawAsync โ†’ raw JSON response
  • GetPhotosAsync โ†’ place photos
  • GetReviewsAsync โ†’ reviews and summaries

๐Ÿง  Notesโ€‹

  • GetDetailsAsync โ†’ returns strongly-typed structured data
  • GetDetailsRawAsync โ†’ useful for unmapped fields and debugging (remember to dispose)
  • GetPhotosAsync โ†’ supports optional configuration via PhotoRequest
  • GetReviewsAsync โ†’ includes both user reviews and optional AI summaries
  • Prefer strongly-typed methods for most scenarios
  • Use raw JSON only for advanced/custom needs
  • All methods are async and designed for high-performance API usage

โšก Examplesโ€‹

๐Ÿ“ Place Detailsโ€‹

var details = await detailsService.GetDetailsAsync(placeId);

Console.WriteLine(details.DisplayName);
Console.WriteLine(details.FormattedAddress);

๐Ÿงพ Get Raw Details (Advanced)โ€‹

using var json = await detailsService.GetDetailsRawAsync(
placeId,
"displayName",
"rating"
);

var root = json.RootElement;

โญ Get Reviewsโ€‹

var reviews = await detailsService.GetReviewsAsync(placeId);

foreach (var review in reviews.Reviews) {
Console.WriteLine($"{review.AuthorName}: {review.Text}");
}

๐Ÿ“ธ Get Photosโ€‹

var request = new PhotoRequestBuilder()
.WithMaximumPhotos(5)
.WithResolution(800, 800)
.Build();

var photos = await detailsService.GetPhotosAsync(placeId, request);

๐Ÿ“ฆ Modelsโ€‹

PlaceDetailsโ€‹

Represents detailed information about a place.

public sealed class PlaceDetails {
public string PlaceId { get; internal set; } = null!;
public string? DisplayName { get; internal set; }
public IReadOnlyList<string> Types { get; internal set; } = [];
public string? FormattedAddress { get; internal set; }
public string? GlobalCode { get; internal set; }
public LatLng? Location { get; internal set; }
public PostalAddress? PostalAddress { get; internal set; }
public string? TimeZone { get; internal set; }
public string? NationalPhoneNumber { get; internal set; }
public string? InternationalPhoneNumber { get; internal set; }
public string? PriceLevel { get; internal set; }
public float? Rating { get; internal set; }
public int? UserRatingCount { get; internal set; }
public IReadOnlyList<string> RegularOpeningHoursDaysDescriptions { get; internal set; } = [];
public GoogleMapsLinks? GoogleMapsLinks { get; internal set; }
public PaymentOptions? PaymentOptions { get; internal set; }
public ParkingOptions? ParkingOptions { get; internal set; }
}

๐Ÿง  Includesโ€‹

  • Basic info โ†’ id, name, types, address (formatted and detailed -> see PostalAddress)
  • Location โ†’ timezone, coordinates exposed by LatLng Core object
  • Contact โ†’ phone numbers
  • Ratings โ†’ score, user count and price level
  • Extras

PlacePhotoโ€‹

Represents a photo associated with a place.

public sealed class PlacePhoto {
public Uri Uri { get; internal set; } = null!;
public string Name { get; internal set; } = null!;
public string? AuthorName { get; internal set; }
public int? HeightPx { get; internal set; }
public int? WidthPx { get; internal set; }
}

PlaceReviewsโ€‹

Represents reviews and summary information for a place.

public sealed class PlaceReviews {
public string PlaceId { get; internal set; } = null!;
public string DisplayName { get; internal set; } = null!;
public IReadOnlyList<Review> Reviews { get; internal set; } = [];
public ReviewSummary? ReviewSummary { get; internal set; }
public string? ReviewsUri { get; internal set; }
}

๐Ÿง  Includesโ€‹

  • Individual user reviews -> see Review
  • Optional AI-generated summary -> see ReviewSummary
  • Link to Google Maps reviews

Raw JSON Accessโ€‹

  • Useful for unmapped fields
  • Useful for debugging

โš ๏ธ JsonDocument is disposable

using var json = await details.GetDetailsRawAsync(placeId);

๐Ÿงฐ Componentsโ€‹

These models provide additional structured information used within PlaceDetails and PlaceReviews.

  • These models are optional and context-dependent
  • Values may be null depending on API response
  • Designed to keep both PlaceDetails and PlaceReviews clean and modular

PostalAddressโ€‹

Represents a structured postal address. Used in PlaceDetails

public sealed class PostalAddress {
public string? RegionCode { get; internal set; }
public string? PostalCode { get; internal set; }
public string? AdministrativeArea { get; internal set; }
public string? Locality { get; internal set; }
public IReadOnlyList<string> AddressLines { get; internal set; } = [];
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
RegionCodeCountry/region code
PostalCodeZIP/postal code
AdministrativeAreaState/province
LocalitySity
AddressLinesFormatted address lines

Represents useful Google Maps-related links. Used in PlaceDetails

public sealed class GoogleMapsLinks {
public string? WebsiteUri { get; internal set; }
public string? GoogleMapsUri { get; internal set; }
public string? PlaceUri { get; internal set; }
public string? WriteAReviewUri { get; internal set; }
public string? ReviewsUri { get; internal set; }
public string? PhotosUri { get; internal set; }
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
WebsiteUriOfficial website
GoogleMapsUriMaps view
PlaceUriDirect place page
WriteAReviewUriReview submission link
ReviewsUriReviews page
PhotosUriPhotos page

PaymentOptionsโ€‹

Represents supported payment methods. Used in PlaceDetails

public sealed class PaymentOptions {
public bool? AcceptsCreditCards { get; internal set; }
public bool? AcceptsDebitCards { get; internal set; }
public bool? AcceptsCashOnly { get; internal set; }
public bool? AcceptsNfc { get; internal set; }
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
AcceptsCreditCardsCredit card support
AcceptsDebitCardsDebit card support
AcceptsCashOnlyCash-only business
AcceptsNfcContactless payments

ParkingOptionsโ€‹

Represents parking availability. Used in PlaceDetails

public sealed class ParkingOptions {
public bool? FreeParkingLot { get; internal set; }
public bool? FreeStreetParking { get; internal set; }
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
FreeParkingLotDedicated parking lot
FreeStreetParkingStreet parking available

Reviewโ€‹

Represents a single user review. Used in PlaceReviews

public sealed class Review {
public string Text { get; internal set; } = null!;
public float? Rating { get; internal set; }
public string? AuthorName { get; internal set; }
public DateTimeOffset? PublishTime { get; internal set; }
public string LanguageCode { get; internal set; } = null!;
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
TextReview content
RatingUser rating
AuthorNameReviewer name
PublishTimeWhen the review was published
LanguageCodeReview language

ReviewSummaryโ€‹

Represents an AI-generated summary of reviews (optional and may not always be present). Used in PlaceReviews

public sealed class ReviewSummary {
public string Text { get; internal set; } = null!;
public string LanguageCode { get; internal set; } = null!;
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
Textsummarized sentiment
LanguageCodeSummary language

๐Ÿงพ Requestโ€‹

PhotoRequestโ€‹

Represents the configuration used when requesting photos for a place.

public sealed class PhotoRequest {
public int MaxPhotos { get; internal set; } = 10;
public int MaxHeightPx { get; internal set; } = 480;
public int MaxWidthPx { get; internal set; } = 480;
}

โš™๏ธ Propertiesโ€‹

PropertyDescription
MaxPhotosMaximum number of photos to retrieve (default: 10)
MaxHeightPxMaximum height in pixels (default: 480)
MaxWidthPxMaximum width in pixels (default: 480)

๐Ÿง  Notesโ€‹

  • Must be constructed using PhotoRequestBuilder

PhotoRequestBuilderโ€‹

Provides a fluent API for constructing PhotoRequest instances.

public sealed class PhotoRequestBuilder {
public PhotoRequestBuilder WithMaximumPhotos(int maxPhotos);
public PhotoRequestBuilder WithResolution(int maxHeight, int maxWidth);

public PhotoRequest Build();
}

โš™๏ธ Configurationโ€‹

  • WithMaximumPhotos(int) โ†’ limits number of photos (1โ€“10)
  • WithResolution(int, int) โ†’ sets max height & width (1โ€“4096 px)

๐Ÿง  Notesโ€‹

  • Defaults are applied if no configuration is provided:
    • 10 photos
    • 480x480 resolution
  • Validation is enforced through MapsInvalidRequestException
  • Designed to keep photo requests safe and within API limits