원활한 Google API 통합.
Google 지도, 장소, 도로, 검색 및 번역.
자유롭게 참여하고, 질문을 던지고, 문제를 보고해 보세요. 저는 보통 빠르게 응답합니다(24~48시간).
추가 .Net 프레임워크에 대한 지원이 필요합니까? 알려주세요.
새로운 기능: Routes Api(방향 및 매트릭스), Ariel View Api 및 Address Validation Api가 포함된 버전 5.0.0.
개별 Facede 구현을 사용하거나 개별 API를 종속성 주입하여 라이브러리를 사용할 수 있습니다.
각 API 구현은 요청과 응답으로 구성됩니다. 요청에는 지원되는 매개변수를 반영하는 속성이 있으며, 응답은 반환된 json에 대한 개체 모델을 나타냅니다.
그 외 주목할 만한 멤버 몇 명.
var uri = request . GetUri ( ) ; // Gets the full request uri, including query parameters.
var params = request . GetQUeryStringParameters ( ) ; // Gets a list of all the added parameters.
response . RawJson // The raw json returned by Google.
response . RawQueryString // The querystring sent to Google when invoking the request.
각 API에는 요청을 실행하고 응답을 반환하는 일반적인 Facade 작업이 있습니다.
아래 예에서는 단순히 요청을 채우고 Facade 작업을 호출한 후 응답을 받습니다.
TRequest request = new TRequest ( ) ;
TResponse response = await { Api } . [ { SubGroup } ] . { Action } . QueryAsync < TRequest , TResponse > ( request ) ;
지원되는 API 및 작업의 전체 목록은 아래를 참조하세요.
종속성으로 API를 주입하는 것이 선호되는 경우 아래와 같이 시작 중에 서비스를 등록합니다.
services
. AddGoogleApiClients ( ) ;
그런 다음 필요에 따라 생성자에 개별 Api를 삽입합니다.
public class MyClass
{
private Api api ;
public MyClass ( Api api )
{
this . api = api
}
}
지원되는 API 및 작업의 전체 목록은 아래를 참조하세요.
WebProxy
필요한 경우 GoogleApi 종속성을 등록하거나 Facade를 사용하기 전에 정적 속성 HttpClientFactory.Proxy
설정하세요.
다음 API가 지원됩니다.
GoogleMaps.Directions
)GoogleMaps.DistanceMatrix
)GoogleMaps.Elevation
)GoogleMaps.Geocode.PlaceGeocode
)GoogleMaps.Geocode.AddressGeocode
)GoogleMaps.Geocode.LocationGeocode
)GoogleMaps.Geocode.PlusCodeGeocode
)GoogleMaps.Geolocation
)GoogleMaps.Roads.NearestRoads
)GoogleMaps.Roads.SnapToRoad
)GoogleMaps.Roads.SpeedLimits
)GoogleMaps.Routes.Directions
)GoogleMaps.Routes.Matrix
)GoogleMaps.AddressValidation
)GoogleMaps.AerialView.GetVideo
)GoogleMaps.AerialView.RenderVideo
) GooglePlaces.Search.FindSearch
)GooglePlaces.Search.NearBySearch
)GooglePlaces.Search.TextSearch
)GooglePlaces.Details
)GooglePlaces.Photos
)GooglePlaces.AutoComplete
)GooglePlaces.QueryAutoComplete
) GoogleSearch.WebSearch
)GoogleSearch.ImageSearch
)GoogleSearch.VideoSearch.Channels
)GoogleSearch.VideoSearch.Playlists
)GoogleSearch.VideoSearch.Vidoes
) GoogleTranslate.Detect
)GoogleTranslate.Languages
)GoogleTranslate.Translate
) 테스트 스위트를 실행하는 것은 간단합니다.
테스트 프로젝트는 Google 구독(무료 또는 유료)과 관련된 설정을 application.default.json
에 저장합니다.
가장 중요한 것은 Google 구독을 식별하는 데 사용되는 ApiKey
입니다.
{
"ApiKey" : " " ,
"SearchEngineId" : " " ,
}
키 생성에 대한 자세한 내용은 여기(https://console.developers.google.com/)에서 확인할 수 있습니다.