From ec895b72f4a9b6f0b88ff9509b8acf1d8d84f9d8 Mon Sep 17 00:00:00 2001 From: Bryan Amundson Date: Tue, 2 Jul 2024 15:36:02 -0600 Subject: [PATCH] Added new international autocomplete fields for admin area short and long. --- international-autocomplete-api/candidate.go | 12 ++++---- international-autocomplete-api/client_test.go | 28 ++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/international-autocomplete-api/candidate.go b/international-autocomplete-api/candidate.go index 6bd36a5..1710580 100644 --- a/international-autocomplete-api/candidate.go +++ b/international-autocomplete-api/candidate.go @@ -1,11 +1,13 @@ package international_autocomplete_api type Candidate struct { - Street string `json:"street"` - Locality string `json:"locality"` - AdministrativeArea string `json:"administrative_area"` - PostalCode string `json:"postal_code"` - CountryIso3 string `json:"country_iso3"` + Street string `json:"street"` + Locality string `json:"locality"` + AdministrativeArea string `json:"administrative_area"` + AdministrativeAreaShort string `json:"administrative_area_short"` + AdministrativeAreaLong string `json:"administrative_area_long"` + PostalCode string `json:"postal_code"` + CountryIso3 string `json:"country_iso3"` Entries int `json:"entries"` AddressText string `json:"address_text"` diff --git a/international-autocomplete-api/client_test.go b/international-autocomplete-api/client_test.go index 488a5e5..bfc3a0b 100644 --- a/international-autocomplete-api/client_test.go +++ b/international-autocomplete-api/client_test.go @@ -36,6 +36,8 @@ func (f *ClientFixture) TestAddressLookupSerializedAndSentWithContext__ResponseS "street": "1", "locality": "2", "administrative_area": "3", + "administrative_area_short": "3.0", + "administrative_area_long": "3.1", "postal_code": "4", "country_iso3": "5" }, @@ -43,6 +45,8 @@ func (f *ClientFixture) TestAddressLookupSerializedAndSentWithContext__ResponseS "street": "6", "locality": "7", "administrative_area": "8", + "administrative_area_short": "8.0", + "administrative_area_long": "8.1", "postal_code": "9", "country_iso3": "10" } @@ -64,18 +68,22 @@ func (f *ClientFixture) TestAddressLookupSerializedAndSentWithContext__ResponseS f.So(f.input.Result, should.Resemble, &Result{Candidates: []*Candidate{ { - Street: "1", - Locality: "2", - AdministrativeArea: "3", - PostalCode: "4", - CountryIso3: "5", + Street: "1", + Locality: "2", + AdministrativeArea: "3", + AdministrativeAreaShort: "3.0", + AdministrativeAreaLong: "3.1", + PostalCode: "4", + CountryIso3: "5", }, { - Street: "6", - Locality: "7", - AdministrativeArea: "8", - PostalCode: "9", - CountryIso3: "10", + Street: "6", + Locality: "7", + AdministrativeArea: "8", + AdministrativeAreaShort: "8.0", + AdministrativeAreaLong: "8.1", + PostalCode: "9", + CountryIso3: "10", }, }}) }