Example #1
0
 public GoogleBooksApiClient(ILogger <GoogleBooksApiClient> logger, GoogleApiKey apiKey)
 {
     _client             = new HttpClient();
     _client.BaseAddress = new Uri($"https://www.googleapis.com");
     _logger             = logger;
     _apiKey             = apiKey;
 }
 public AutocompleteRequest(string input, GoogleApiKey googleApiKey, SessionToken sessionToken = null, IpAddress ipAddress = null)
 {
     Input        = input;
     GoogleApiKey = googleApiKey;
     SessionToken = sessionToken;
     IpAddress    = ipAddress;
 }
Example #3
0
        public async Task GetPlaceDetails()
        {
            var apiKey = KeyHelper.GetApiKey();

            var httpClient = new HttpClient();

            httpClient.BaseAddress = UrlHelper.GetStagingUri();

            var addressService = new AddressService(apiKey, httpClient);

            var googleApiKey = new GoogleApiKey(KeyHelper.GetGoogleApiKey());

            var googlePlaceId = KeyHelper.GetGooglePlaceId();

            var result = await addressService.PlaceDetails(new PlaceDetailsRequest(googlePlaceId, googleApiKey));

            Assert.IsTrue(result.IsSuccess);
        }
Example #4
0
 public PlaceDetailsRequest(GooglePlaceId placeId, GoogleApiKey googleApiKey)
 {
     PlaceId      = placeId;
     GoogleApiKey = googleApiKey;
 }
Example #5
0
 public LocationService(HttpClient client, IOptions <GoogleApiKey> options)
 {
     _client             = client;
     _apiKey             = options.Value;
     _client.BaseAddress = new Uri(_apiKey.Url);
 }